iclient-openlayers-es6.js 3.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613906149061590616906179061890619906209062190622906239062490625906269062790628906299063090631906329063390634906359063690637906389063990640906419064290643906449064590646906479064890649906509065190652906539065490655906569065790658906599066090661906629066390664906659066690667906689066990670906719067290673906749067590676906779067890679906809068190682906839068490685906869068790688906899069090691906929069390694906959069690697906989069990700907019070290703907049070590706907079070890709907109071190712907139071490715907169071790718907199072090721907229072390724907259072690727907289072990730907319073290733907349073590736907379073890739907409074190742907439074490745907469074790748907499075090751907529075390754907559075690757907589075990760907619076290763907649076590766907679076890769907709077190772907739077490775907769077790778907799078090781907829078390784907859078690787907889078990790907919079290793907949079590796907979079890799908009080190802908039080490805908069080790808908099081090811908129081390814908159081690817908189081990820908219082290823908249082590826908279082890829908309083190832908339083490835908369083790838908399084090841908429084390844908459084690847908489084990850908519085290853908549085590856908579085890859908609086190862908639086490865908669086790868908699087090871908729087390874908759087690877908789087990880908819088290883908849088590886908879088890889908909089190892908939089490895908969089790898908999090090901909029090390904909059090690907909089090990910909119091290913909149091590916909179091890919909209092190922909239092490925909269092790928909299093090931909329093390934909359093690937909389093990940909419094290943909449094590946909479094890949909509095190952909539095490955909569095790958909599096090961909629096390964909659096690967909689096990970909719097290973909749097590976909779097890979909809098190982909839098490985909869098790988909899099090991909929099390994909959099690997909989099991000910019100291003910049100591006910079100891009910109101191012910139101491015910169101791018910199102091021910229102391024910259102691027910289102991030910319103291033910349103591036910379103891039910409104191042910439104491045910469104791048910499105091051910529105391054910559105691057910589105991060910619106291063910649106591066910679106891069910709107191072910739107491075910769107791078910799108091081910829108391084910859108691087910889108991090910919109291093910949109591096910979109891099911009110191102911039110491105911069110791108911099111091111911129111391114911159111691117911189111991120911219112291123911249112591126911279112891129911309113191132911339113491135911369113791138911399114091141911429114391144911459114691147911489114991150911519115291153911549115591156911579115891159911609116191162911639116491165911669116791168911699117091171911729117391174911759117691177911789117991180911819118291183911849118591186911879118891189911909119191192911939119491195911969119791198911999120091201912029120391204912059120691207912089120991210912119121291213912149121591216912179121891219912209122191222912239122491225912269122791228912299123091231912329123391234912359123691237912389123991240912419124291243912449124591246912479124891249912509125191252912539125491255912569125791258912599126091261912629126391264912659126691267912689126991270912719127291273912749127591276912779127891279912809128191282912839128491285912869128791288912899129091291912929129391294912959129691297912989129991300913019130291303913049130591306913079130891309913109131191312913139131491315913169131791318913199132091321913229132391324913259132691327913289132991330913319133291333913349133591336913379133891339913409134191342913439134491345913469134791348913499135091351913529135391354913559135691357913589135991360913619136291363913649136591366913679136891369913709137191372913739137491375913769137791378913799138091381913829138391384913859138691387913889138991390913919139291393913949139591396913979139891399914009140191402914039140491405914069140791408914099141091411914129141391414914159141691417914189141991420914219142291423914249142591426914279142891429914309143191432914339143491435914369143791438914399144091441914429144391444914459144691447914489144991450914519145291453914549145591456914579145891459914609146191462914639146491465914669146791468914699147091471914729147391474914759147691477914789147991480914819148291483914849148591486914879148891489914909149191492914939149491495914969149791498914999150091501915029150391504915059150691507915089150991510915119151291513915149151591516915179151891519915209152191522915239152491525915269152791528915299153091531915329153391534915359153691537915389153991540915419154291543915449154591546915479154891549915509155191552915539155491555915569155791558915599156091561915629156391564915659156691567915689156991570915719157291573915749157591576915779157891579915809158191582915839158491585915869158791588915899159091591915929159391594915959159691597915989159991600916019160291603916049160591606916079160891609916109161191612916139161491615916169161791618916199162091621916229162391624916259162691627916289162991630916319163291633916349163591636916379163891639916409164191642916439164491645916469164791648916499165091651916529165391654916559165691657916589165991660916619166291663916649166591666916679166891669916709167191672916739167491675916769167791678916799168091681916829168391684916859168691687916889168991690916919169291693916949169591696916979169891699917009170191702917039170491705917069170791708917099171091711917129171391714917159171691717917189171991720917219172291723917249172591726917279172891729917309173191732917339173491735917369173791738917399174091741917429174391744917459174691747917489174991750917519175291753917549175591756917579175891759917609176191762917639176491765917669176791768917699177091771917729177391774917759177691777917789177991780917819178291783917849178591786917879178891789917909179191792917939179491795917969179791798917999180091801918029180391804918059180691807918089180991810918119181291813918149181591816918179181891819918209182191822918239182491825918269182791828918299183091831918329183391834918359183691837918389183991840918419184291843918449184591846918479184891849918509185191852918539185491855918569185791858918599186091861918629186391864918659186691867918689186991870918719187291873918749187591876918779187891879918809188191882918839188491885918869188791888918899189091891918929189391894918959189691897918989189991900919019190291903919049190591906919079190891909919109191191912919139191491915919169191791918919199192091921919229192391924919259192691927919289192991930919319193291933919349193591936919379193891939919409194191942919439194491945919469194791948919499195091951919529195391954919559195691957919589195991960919619196291963919649196591966919679196891969919709197191972919739197491975919769197791978919799198091981919829198391984919859198691987919889198991990919919199291993919949199591996919979199891999920009200192002920039200492005920069200792008920099201092011920129201392014920159201692017920189201992020920219202292023920249202592026920279202892029920309203192032920339203492035920369203792038920399204092041920429204392044920459204692047920489204992050920519205292053920549205592056920579205892059920609206192062920639206492065920669206792068920699207092071920729207392074920759207692077920789207992080920819208292083920849208592086920879208892089920909209192092920939209492095920969209792098920999210092101921029210392104921059210692107921089210992110921119211292113921149211592116921179211892119921209212192122921239212492125921269212792128921299213092131921329213392134921359213692137921389213992140921419214292143921449214592146921479214892149921509215192152921539215492155921569215792158921599216092161921629216392164921659216692167921689216992170921719217292173921749217592176921779217892179921809218192182921839218492185921869218792188921899219092191921929219392194921959219692197921989219992200922019220292203922049220592206922079220892209922109221192212922139221492215922169221792218922199222092221922229222392224922259222692227922289222992230922319223292233922349223592236922379223892239922409224192242922439224492245922469224792248922499225092251922529225392254922559225692257922589225992260922619226292263922649226592266922679226892269922709227192272922739227492275922769227792278922799228092281922829228392284922859228692287922889228992290922919229292293922949229592296922979229892299923009230192302923039230492305923069230792308923099231092311923129231392314923159231692317923189231992320923219232292323923249232592326923279232892329923309233192332923339233492335923369233792338923399234092341923429234392344923459234692347923489234992350923519235292353923549235592356923579235892359923609236192362923639236492365923669236792368923699237092371923729237392374923759237692377923789237992380923819238292383923849238592386923879238892389923909239192392923939239492395923969239792398923999240092401924029240392404924059240692407924089240992410924119241292413924149241592416924179241892419924209242192422924239242492425924269242792428924299243092431924329243392434924359243692437924389243992440924419244292443924449244592446924479244892449924509245192452924539245492455924569245792458924599246092461924629246392464924659246692467924689246992470924719247292473924749247592476924779247892479924809248192482924839248492485924869248792488924899249092491924929249392494924959249692497924989249992500925019250292503925049250592506925079250892509925109251192512925139251492515925169251792518925199252092521925229252392524925259252692527925289252992530925319253292533925349253592536925379253892539925409254192542925439254492545925469254792548925499255092551925529255392554925559255692557925589255992560925619256292563925649256592566925679256892569925709257192572925739257492575925769257792578925799258092581925829258392584925859258692587925889258992590925919259292593925949259592596925979259892599926009260192602926039260492605926069260792608926099261092611926129261392614926159261692617926189261992620926219262292623926249262592626926279262892629926309263192632926339263492635926369263792638926399264092641926429264392644926459264692647926489264992650926519265292653926549265592656926579265892659926609266192662926639266492665926669266792668926699267092671926729267392674926759267692677926789267992680926819268292683926849268592686926879268892689926909269192692926939269492695926969269792698926999270092701927029270392704927059270692707927089270992710927119271292713927149271592716927179271892719927209272192722927239272492725927269272792728927299273092731927329273392734927359273692737927389273992740927419274292743927449274592746927479274892749927509275192752927539275492755927569275792758927599276092761927629276392764927659276692767927689276992770927719277292773927749277592776927779277892779927809278192782927839278492785927869278792788927899279092791927929279392794927959279692797927989279992800928019280292803928049280592806928079280892809928109281192812928139281492815928169281792818928199282092821928229282392824928259282692827928289282992830928319283292833928349283592836928379283892839928409284192842928439284492845928469284792848928499285092851928529285392854928559285692857928589285992860928619286292863928649286592866928679286892869928709287192872928739287492875928769287792878928799288092881928829288392884928859288692887928889288992890928919289292893928949289592896928979289892899929009290192902929039290492905929069290792908929099291092911929129291392914929159291692917929189291992920929219292292923929249292592926929279292892929929309293192932929339293492935929369293792938929399294092941929429294392944929459294692947929489294992950929519295292953929549295592956929579295892959929609296192962929639296492965929669296792968929699297092971929729297392974929759297692977929789297992980929819298292983929849298592986929879298892989929909299192992929939299492995929969299792998929999300093001930029300393004930059300693007930089300993010930119301293013930149301593016930179301893019930209302193022930239302493025930269302793028930299303093031930329303393034930359303693037930389303993040930419304293043930449304593046930479304893049930509305193052930539305493055930569305793058930599306093061930629306393064930659306693067930689306993070930719307293073930749307593076930779307893079930809308193082930839308493085930869308793088930899309093091930929309393094930959309693097930989309993100931019310293103931049310593106931079310893109931109311193112931139311493115931169311793118931199312093121931229312393124931259312693127931289312993130931319313293133931349313593136931379313893139931409314193142931439314493145931469314793148931499315093151931529315393154931559315693157931589315993160931619316293163931649316593166931679316893169931709317193172931739317493175931769317793178931799318093181931829318393184931859318693187931889318993190931919319293193931949319593196931979319893199932009320193202932039320493205932069320793208932099321093211932129321393214932159321693217932189321993220932219322293223932249322593226932279322893229932309323193232932339323493235932369323793238932399324093241932429324393244932459324693247932489324993250932519325293253932549325593256932579325893259932609326193262932639326493265932669326793268932699327093271932729327393274932759327693277932789327993280932819328293283932849328593286932879328893289932909329193292932939329493295932969329793298932999330093301933029330393304933059330693307933089330993310933119331293313933149331593316933179331893319933209332193322933239332493325933269332793328933299333093331933329333393334933359333693337933389333993340933419334293343933449334593346933479334893349933509335193352933539335493355933569335793358933599336093361933629336393364933659336693367933689336993370933719337293373933749337593376933779337893379933809338193382933839338493385933869338793388933899339093391933929339393394933959339693397933989339993400934019340293403934049340593406934079340893409934109341193412934139341493415934169341793418934199342093421934229342393424934259342693427934289342993430934319343293433934349343593436934379343893439934409344193442934439344493445934469344793448934499345093451934529345393454934559345693457934589345993460934619346293463934649346593466934679346893469934709347193472934739347493475934769347793478934799348093481934829348393484934859348693487934889348993490934919349293493934949349593496934979349893499935009350193502935039350493505935069350793508935099351093511935129351393514935159351693517935189351993520935219352293523935249352593526935279352893529935309353193532935339353493535935369353793538935399354093541935429354393544935459354693547935489354993550935519355293553935549355593556935579355893559935609356193562935639356493565935669356793568935699357093571935729357393574935759357693577935789357993580935819358293583935849358593586935879358893589935909359193592935939359493595935969359793598935999360093601936029360393604936059360693607936089360993610936119361293613936149361593616936179361893619936209362193622936239362493625936269362793628936299363093631936329363393634936359363693637936389363993640936419364293643936449364593646936479364893649936509365193652936539365493655936569365793658936599366093661936629366393664936659366693667936689366993670936719367293673936749367593676936779367893679936809368193682936839368493685936869368793688936899369093691936929369393694936959369693697936989369993700937019370293703937049370593706937079370893709937109371193712937139371493715937169371793718937199372093721937229372393724937259372693727937289372993730937319373293733937349373593736937379373893739937409374193742937439374493745937469374793748937499375093751937529375393754937559375693757937589375993760937619376293763937649376593766937679376893769937709377193772937739377493775937769377793778937799378093781937829378393784937859378693787937889378993790937919379293793937949379593796937979379893799938009380193802938039380493805938069380793808938099381093811938129381393814938159381693817938189381993820938219382293823938249382593826938279382893829938309383193832938339383493835938369383793838938399384093841938429384393844938459384693847938489384993850938519385293853938549385593856938579385893859938609386193862938639386493865938669386793868938699387093871938729387393874938759387693877938789387993880938819388293883938849388593886938879388893889938909389193892938939389493895938969389793898938999390093901939029390393904939059390693907939089390993910939119391293913939149391593916939179391893919939209392193922939239392493925939269392793928939299393093931939329393393934939359393693937939389393993940939419394293943939449394593946939479394893949939509395193952939539395493955939569395793958939599396093961939629396393964939659396693967939689396993970939719397293973939749397593976939779397893979939809398193982939839398493985939869398793988939899399093991939929399393994939959399693997939989399994000940019400294003940049400594006940079400894009940109401194012940139401494015940169401794018940199402094021940229402394024940259402694027940289402994030940319403294033940349403594036940379403894039940409404194042940439404494045940469404794048940499405094051940529405394054940559405694057940589405994060940619406294063940649406594066940679406894069940709407194072940739407494075940769407794078940799408094081940829408394084940859408694087940889408994090940919409294093940949409594096940979409894099941009410194102941039410494105941069410794108941099411094111941129411394114941159411694117941189411994120941219412294123941249412594126941279412894129941309413194132941339413494135941369413794138941399414094141941429414394144941459414694147941489414994150941519415294153941549415594156941579415894159941609416194162941639416494165941669416794168941699417094171941729417394174941759417694177941789417994180941819418294183941849418594186941879418894189941909419194192941939419494195941969419794198941999420094201942029420394204942059420694207942089420994210942119421294213942149421594216942179421894219942209422194222942239422494225942269422794228942299423094231942329423394234942359423694237942389423994240942419424294243942449424594246942479424894249942509425194252942539425494255942569425794258942599426094261942629426394264942659426694267942689426994270942719427294273942749427594276942779427894279942809428194282942839428494285942869428794288942899429094291942929429394294942959429694297942989429994300943019430294303943049430594306943079430894309943109431194312943139431494315943169431794318943199432094321943229432394324943259432694327943289432994330943319433294333943349433594336943379433894339943409434194342943439434494345943469434794348943499435094351943529435394354943559435694357943589435994360943619436294363943649436594366943679436894369943709437194372943739437494375943769437794378943799438094381943829438394384943859438694387943889438994390943919439294393943949439594396943979439894399944009440194402944039440494405944069440794408944099441094411944129441394414944159441694417944189441994420944219442294423944249442594426944279442894429944309443194432944339443494435944369443794438944399444094441944429444394444944459444694447944489444994450944519445294453944549445594456944579445894459944609446194462944639446494465944669446794468944699447094471944729447394474944759447694477944789447994480944819448294483944849448594486944879448894489944909449194492944939449494495944969449794498944999450094501945029450394504945059450694507945089450994510945119451294513945149451594516945179451894519945209452194522945239452494525945269452794528945299453094531945329453394534945359453694537945389453994540945419454294543945449454594546945479454894549945509455194552945539455494555945569455794558945599456094561945629456394564945659456694567945689456994570945719457294573945749457594576945779457894579945809458194582945839458494585945869458794588945899459094591945929459394594945959459694597945989459994600946019460294603946049460594606946079460894609946109461194612946139461494615946169461794618946199462094621946229462394624946259462694627946289462994630946319463294633946349463594636946379463894639946409464194642946439464494645946469464794648946499465094651946529465394654946559465694657946589465994660946619466294663946649466594666946679466894669946709467194672946739467494675946769467794678946799468094681946829468394684946859468694687946889468994690946919469294693946949469594696946979469894699947009470194702947039470494705947069470794708947099471094711947129471394714947159471694717947189471994720947219472294723947249472594726947279472894729947309473194732947339473494735947369473794738947399474094741947429474394744947459474694747947489474994750947519475294753947549475594756947579475894759947609476194762947639476494765947669476794768947699477094771947729477394774947759477694777947789477994780947819478294783947849478594786947879478894789947909479194792947939479494795947969479794798947999480094801948029480394804948059480694807948089480994810948119481294813948149481594816948179481894819948209482194822948239482494825948269482794828948299483094831948329483394834948359483694837948389483994840948419484294843948449484594846948479484894849948509485194852948539485494855948569485794858948599486094861948629486394864948659486694867948689486994870948719487294873948749487594876948779487894879948809488194882948839488494885948869488794888948899489094891948929489394894948959489694897948989489994900949019490294903949049490594906949079490894909949109491194912949139491494915949169491794918949199492094921949229492394924949259492694927949289492994930949319493294933949349493594936949379493894939949409494194942949439494494945949469494794948949499495094951949529495394954949559495694957949589495994960949619496294963949649496594966949679496894969949709497194972949739497494975949769497794978949799498094981949829498394984949859498694987949889498994990949919499294993949949499594996949979499894999950009500195002950039500495005950069500795008950099501095011950129501395014950159501695017950189501995020950219502295023950249502595026950279502895029950309503195032950339503495035950369503795038950399504095041950429504395044950459504695047950489504995050950519505295053950549505595056950579505895059950609506195062950639506495065950669506795068950699507095071950729507395074950759507695077950789507995080950819508295083950849508595086950879508895089950909509195092950939509495095950969509795098950999510095101951029510395104951059510695107951089510995110951119511295113951149511595116951179511895119951209512195122951239512495125951269512795128951299513095131951329513395134951359513695137951389513995140951419514295143951449514595146951479514895149951509515195152951539515495155951569515795158951599516095161951629516395164951659516695167951689516995170951719517295173951749517595176951779517895179951809518195182951839518495185951869518795188951899519095191951929519395194951959519695197951989519995200952019520295203952049520595206952079520895209952109521195212952139521495215952169521795218952199522095221952229522395224952259522695227952289522995230952319523295233952349523595236952379523895239952409524195242952439524495245952469524795248952499525095251952529525395254952559525695257952589525995260952619526295263952649526595266952679526895269952709527195272952739527495275952769527795278952799528095281952829528395284952859528695287952889528995290952919529295293952949529595296952979529895299953009530195302953039530495305953069530795308953099531095311953129531395314953159531695317953189531995320953219532295323953249532595326953279532895329953309533195332953339533495335953369533795338953399534095341953429534395344953459534695347953489534995350953519535295353953549535595356953579535895359953609536195362953639536495365953669536795368953699537095371953729537395374953759537695377953789537995380953819538295383953849538595386953879538895389953909539195392953939539495395953969539795398953999540095401954029540395404954059540695407954089540995410954119541295413954149541595416954179541895419954209542195422954239542495425954269542795428954299543095431954329543395434954359543695437954389543995440954419544295443954449544595446954479544895449954509545195452954539545495455954569545795458954599546095461954629546395464954659546695467954689546995470954719547295473954749547595476954779547895479954809548195482954839548495485954869548795488954899549095491954929549395494954959549695497954989549995500955019550295503955049550595506955079550895509955109551195512955139551495515955169551795518955199552095521955229552395524955259552695527955289552995530955319553295533955349553595536955379553895539955409554195542955439554495545955469554795548955499555095551955529555395554955559555695557955589555995560955619556295563955649556595566955679556895569955709557195572955739557495575955769557795578955799558095581955829558395584955859558695587955889558995590955919559295593955949559595596955979559895599956009560195602956039560495605956069560795608956099561095611956129561395614956159561695617956189561995620956219562295623956249562595626956279562895629956309563195632956339563495635956369563795638956399564095641956429564395644956459564695647956489564995650956519565295653956549565595656956579565895659956609566195662956639566495665956669566795668956699567095671956729567395674956759567695677956789567995680956819568295683956849568595686956879568895689956909569195692956939569495695956969569795698956999570095701957029570395704957059570695707957089570995710957119571295713957149571595716957179571895719957209572195722957239572495725957269572795728957299573095731957329573395734957359573695737957389573995740957419574295743957449574595746957479574895749957509575195752957539575495755957569575795758957599576095761957629576395764957659576695767957689576995770957719577295773957749577595776957779577895779957809578195782957839578495785957869578795788957899579095791957929579395794957959579695797957989579995800958019580295803958049580595806958079580895809958109581195812958139581495815958169581795818958199582095821958229582395824958259582695827958289582995830958319583295833958349583595836958379583895839958409584195842958439584495845958469584795848958499585095851958529585395854958559585695857958589585995860958619586295863958649586595866958679586895869958709587195872958739587495875958769587795878958799588095881958829588395884958859588695887958889588995890958919589295893958949589595896958979589895899959009590195902959039590495905959069590795908959099591095911959129591395914959159591695917959189591995920959219592295923959249592595926959279592895929959309593195932959339593495935959369593795938959399594095941959429594395944959459594695947959489594995950959519595295953959549595595956959579595895959959609596195962959639596495965959669596795968959699597095971959729597395974959759597695977959789597995980959819598295983959849598595986959879598895989959909599195992959939599495995959969599795998959999600096001960029600396004960059600696007960089600996010960119601296013960149601596016960179601896019960209602196022960239602496025960269602796028960299603096031960329603396034960359603696037960389603996040960419604296043960449604596046960479604896049960509605196052960539605496055960569605796058960599606096061960629606396064960659606696067960689606996070960719607296073960749607596076960779607896079960809608196082960839608496085960869608796088960899609096091960929609396094960959609696097960989609996100961019610296103961049610596106961079610896109961109611196112961139611496115961169611796118961199612096121961229612396124961259612696127961289612996130961319613296133961349613596136961379613896139961409614196142961439614496145961469614796148961499615096151961529615396154961559615696157961589615996160961619616296163961649616596166961679616896169961709617196172961739617496175961769617796178961799618096181961829618396184961859618696187961889618996190961919619296193961949619596196961979619896199962009620196202962039620496205962069620796208962099621096211962129621396214962159621696217962189621996220962219622296223962249622596226962279622896229962309623196232962339623496235962369623796238962399624096241962429624396244962459624696247962489624996250962519625296253962549625596256962579625896259962609626196262962639626496265962669626796268962699627096271962729627396274962759627696277962789627996280962819628296283962849628596286962879628896289962909629196292962939629496295962969629796298962999630096301963029630396304963059630696307963089630996310963119631296313963149631596316963179631896319963209632196322963239632496325963269632796328963299633096331963329633396334963359633696337963389633996340963419634296343963449634596346963479634896349963509635196352963539635496355963569635796358963599636096361963629636396364963659636696367963689636996370963719637296373963749637596376963779637896379963809638196382963839638496385963869638796388963899639096391963929639396394963959639696397963989639996400964019640296403964049640596406964079640896409964109641196412964139641496415964169641796418964199642096421964229642396424964259642696427964289642996430964319643296433964349643596436964379643896439964409644196442964439644496445964469644796448964499645096451964529645396454964559645696457964589645996460964619646296463964649646596466964679646896469964709647196472964739647496475964769647796478964799648096481964829648396484964859648696487964889648996490964919649296493964949649596496964979649896499965009650196502965039650496505965069650796508965099651096511965129651396514965159651696517965189651996520965219652296523965249652596526965279652896529965309653196532965339653496535965369653796538965399654096541965429654396544965459654696547965489654996550965519655296553965549655596556965579655896559965609656196562965639656496565965669656796568965699657096571965729657396574965759657696577965789657996580965819658296583965849658596586965879658896589965909659196592965939659496595965969659796598965999660096601966029660396604966059660696607966089660996610966119661296613966149661596616966179661896619966209662196622966239662496625966269662796628966299663096631966329663396634966359663696637966389663996640966419664296643966449664596646966479664896649966509665196652966539665496655966569665796658966599666096661966629666396664966659666696667966689666996670966719667296673966749667596676966779667896679966809668196682966839668496685966869668796688966899669096691966929669396694966959669696697966989669996700967019670296703967049670596706967079670896709967109671196712967139671496715967169671796718967199672096721967229672396724967259672696727967289672996730967319673296733967349673596736967379673896739967409674196742967439674496745967469674796748967499675096751967529675396754967559675696757967589675996760967619676296763967649676596766967679676896769967709677196772967739677496775967769677796778967799678096781967829678396784967859678696787967889678996790967919679296793967949679596796967979679896799968009680196802968039680496805968069680796808968099681096811968129681396814968159681696817968189681996820968219682296823968249682596826968279682896829968309683196832968339683496835968369683796838968399684096841968429684396844968459684696847968489684996850968519685296853968549685596856968579685896859968609686196862968639686496865968669686796868968699687096871968729687396874968759687696877968789687996880968819688296883968849688596886968879688896889968909689196892968939689496895968969689796898968999690096901969029690396904969059690696907969089690996910969119691296913969149691596916969179691896919969209692196922969239692496925969269692796928969299693096931969329693396934969359693696937969389693996940969419694296943969449694596946969479694896949969509695196952969539695496955969569695796958969599696096961969629696396964969659696696967969689696996970969719697296973969749697596976969779697896979969809698196982969839698496985969869698796988969899699096991969929699396994969959699696997969989699997000970019700297003970049700597006970079700897009970109701197012970139701497015970169701797018970199702097021970229702397024970259702697027970289702997030970319703297033970349703597036970379703897039970409704197042970439704497045970469704797048970499705097051970529705397054970559705697057970589705997060970619706297063970649706597066970679706897069970709707197072970739707497075970769707797078970799708097081970829708397084970859708697087970889708997090970919709297093970949709597096970979709897099971009710197102971039710497105971069710797108971099711097111971129711397114971159711697117971189711997120971219712297123971249712597126971279712897129971309713197132971339713497135971369713797138971399714097141971429714397144971459714697147971489714997150971519715297153971549715597156971579715897159971609716197162971639716497165971669716797168971699717097171971729717397174971759717697177971789717997180971819718297183971849718597186971879718897189971909719197192971939719497195971969719797198971999720097201972029720397204972059720697207972089720997210972119721297213972149721597216972179721897219972209722197222972239722497225972269722797228972299723097231972329723397234972359723697237972389723997240972419724297243972449724597246972479724897249972509725197252972539725497255972569725797258972599726097261972629726397264972659726697267972689726997270972719727297273
  1. /*!
  2. *
  3. * iclient-openlayers.(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. /***/ 693:
  12. /***/ (function(module) {
  13. (function(self) {
  14. 'use strict';
  15. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  16. // with Ajax.
  17. if (!self.__disableNativeFetch && self.fetch) {
  18. return
  19. }
  20. function normalizeName(name) {
  21. if (typeof name !== 'string') {
  22. name = String(name)
  23. }
  24. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  25. throw new TypeError('Invalid character in header field name')
  26. }
  27. return name.toLowerCase()
  28. }
  29. function normalizeValue(value) {
  30. if (typeof value !== 'string') {
  31. value = String(value)
  32. }
  33. return value
  34. }
  35. function Headers(headers) {
  36. this.map = {}
  37. if (headers instanceof Headers) {
  38. headers.forEach(function(value, name) {
  39. this.append(name, value)
  40. }, this)
  41. } else if (headers) {
  42. Object.getOwnPropertyNames(headers).forEach(function(name) {
  43. this.append(name, headers[name])
  44. }, this)
  45. }
  46. }
  47. Headers.prototype.append = function(name, value) {
  48. name = normalizeName(name)
  49. value = normalizeValue(value)
  50. var list = this.map[name]
  51. if (!list) {
  52. list = []
  53. this.map[name] = list
  54. }
  55. list.push(value)
  56. }
  57. Headers.prototype['delete'] = function(name) {
  58. delete this.map[normalizeName(name)]
  59. }
  60. Headers.prototype.get = function(name) {
  61. var values = this.map[normalizeName(name)]
  62. return values ? values[0] : null
  63. }
  64. Headers.prototype.getAll = function(name) {
  65. return this.map[normalizeName(name)] || []
  66. }
  67. Headers.prototype.has = function(name) {
  68. return this.map.hasOwnProperty(normalizeName(name))
  69. }
  70. Headers.prototype.set = function(name, value) {
  71. this.map[normalizeName(name)] = [normalizeValue(value)]
  72. }
  73. Headers.prototype.forEach = function(callback, thisArg) {
  74. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  75. this.map[name].forEach(function(value) {
  76. callback.call(thisArg, value, name, this)
  77. }, this)
  78. }, this)
  79. }
  80. function consumed(body) {
  81. if (body.bodyUsed) {
  82. return Promise.reject(new TypeError('Already read'))
  83. }
  84. body.bodyUsed = true
  85. }
  86. function fileReaderReady(reader) {
  87. return new Promise(function(resolve, reject) {
  88. reader.onload = function() {
  89. resolve(reader.result)
  90. }
  91. reader.onerror = function() {
  92. reject(reader.error)
  93. }
  94. })
  95. }
  96. function readBlobAsArrayBuffer(blob) {
  97. var reader = new FileReader()
  98. reader.readAsArrayBuffer(blob)
  99. return fileReaderReady(reader)
  100. }
  101. function readBlobAsText(blob, options) {
  102. var reader = new FileReader()
  103. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  104. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  105. var _charset = blob.type.match(regex) || contentType.match(regex)
  106. var args = [blob]
  107. if(_charset) {
  108. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  109. }
  110. reader.readAsText.apply(reader, args)
  111. return fileReaderReady(reader)
  112. }
  113. var support = {
  114. blob: 'FileReader' in self && 'Blob' in self && (function() {
  115. try {
  116. new Blob();
  117. return true
  118. } catch(e) {
  119. return false
  120. }
  121. })(),
  122. formData: 'FormData' in self,
  123. arrayBuffer: 'ArrayBuffer' in self
  124. }
  125. function Body() {
  126. this.bodyUsed = false
  127. this._initBody = function(body, options) {
  128. this._bodyInit = body
  129. if (typeof body === 'string') {
  130. this._bodyText = body
  131. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  132. this._bodyBlob = body
  133. this._options = options
  134. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  135. this._bodyFormData = body
  136. } else if (!body) {
  137. this._bodyText = ''
  138. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  139. // Only support ArrayBuffers for POST method.
  140. // Receiving ArrayBuffers happens via Blobs, instead.
  141. } else {
  142. throw new Error('unsupported BodyInit type')
  143. }
  144. }
  145. if (support.blob) {
  146. this.blob = function() {
  147. var rejected = consumed(this)
  148. if (rejected) {
  149. return rejected
  150. }
  151. if (this._bodyBlob) {
  152. return Promise.resolve(this._bodyBlob)
  153. } else if (this._bodyFormData) {
  154. throw new Error('could not read FormData body as blob')
  155. } else {
  156. return Promise.resolve(new Blob([this._bodyText]))
  157. }
  158. }
  159. this.arrayBuffer = function() {
  160. return this.blob().then(readBlobAsArrayBuffer)
  161. }
  162. this.text = function() {
  163. var rejected = consumed(this)
  164. if (rejected) {
  165. return rejected
  166. }
  167. if (this._bodyBlob) {
  168. return readBlobAsText(this._bodyBlob, this._options)
  169. } else if (this._bodyFormData) {
  170. throw new Error('could not read FormData body as text')
  171. } else {
  172. return Promise.resolve(this._bodyText)
  173. }
  174. }
  175. } else {
  176. this.text = function() {
  177. var rejected = consumed(this)
  178. return rejected ? rejected : Promise.resolve(this._bodyText)
  179. }
  180. }
  181. if (support.formData) {
  182. this.formData = function() {
  183. return this.text().then(decode)
  184. }
  185. }
  186. this.json = function() {
  187. return this.text().then(JSON.parse)
  188. }
  189. return this
  190. }
  191. // HTTP methods whose capitalization should be normalized
  192. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  193. function normalizeMethod(method) {
  194. var upcased = method.toUpperCase()
  195. return (methods.indexOf(upcased) > -1) ? upcased : method
  196. }
  197. function Request(input, options) {
  198. options = options || {}
  199. var body = options.body
  200. if (Request.prototype.isPrototypeOf(input)) {
  201. if (input.bodyUsed) {
  202. throw new TypeError('Already read')
  203. }
  204. this.url = input.url
  205. this.credentials = input.credentials
  206. if (!options.headers) {
  207. this.headers = new Headers(input.headers)
  208. }
  209. this.method = input.method
  210. this.mode = input.mode
  211. if (!body) {
  212. body = input._bodyInit
  213. input.bodyUsed = true
  214. }
  215. } else {
  216. this.url = input
  217. }
  218. this.credentials = options.credentials || this.credentials || 'omit'
  219. if (options.headers || !this.headers) {
  220. this.headers = new Headers(options.headers)
  221. }
  222. this.method = normalizeMethod(options.method || this.method || 'GET')
  223. this.mode = options.mode || this.mode || null
  224. this.referrer = null
  225. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  226. throw new TypeError('Body not allowed for GET or HEAD requests')
  227. }
  228. this._initBody(body, options)
  229. }
  230. Request.prototype.clone = function() {
  231. return new Request(this)
  232. }
  233. function decode(body) {
  234. var form = new FormData()
  235. body.trim().split('&').forEach(function(bytes) {
  236. if (bytes) {
  237. var split = bytes.split('=')
  238. var name = split.shift().replace(/\+/g, ' ')
  239. var value = split.join('=').replace(/\+/g, ' ')
  240. form.append(decodeURIComponent(name), decodeURIComponent(value))
  241. }
  242. })
  243. return form
  244. }
  245. function headers(xhr) {
  246. var head = new Headers()
  247. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  248. pairs.forEach(function(header) {
  249. var split = header.trim().split(':')
  250. var key = split.shift().trim()
  251. var value = split.join(':').trim()
  252. head.append(key, value)
  253. })
  254. return head
  255. }
  256. Body.call(Request.prototype)
  257. function Response(bodyInit, options) {
  258. if (!options) {
  259. options = {}
  260. }
  261. this._initBody(bodyInit, options)
  262. this.type = 'default'
  263. this.status = options.status
  264. this.ok = this.status >= 200 && this.status < 300
  265. this.statusText = options.statusText
  266. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  267. this.url = options.url || ''
  268. }
  269. Body.call(Response.prototype)
  270. Response.prototype.clone = function() {
  271. return new Response(this._bodyInit, {
  272. status: this.status,
  273. statusText: this.statusText,
  274. headers: new Headers(this.headers),
  275. url: this.url
  276. })
  277. }
  278. Response.error = function() {
  279. var response = new Response(null, {status: 0, statusText: ''})
  280. response.type = 'error'
  281. return response
  282. }
  283. var redirectStatuses = [301, 302, 303, 307, 308]
  284. Response.redirect = function(url, status) {
  285. if (redirectStatuses.indexOf(status) === -1) {
  286. throw new RangeError('Invalid status code')
  287. }
  288. return new Response(null, {status: status, headers: {location: url}})
  289. }
  290. self.Headers = Headers;
  291. self.Request = Request;
  292. self.Response = Response;
  293. self.fetch = function(input, init) {
  294. return new Promise(function(resolve, reject) {
  295. var request
  296. if (Request.prototype.isPrototypeOf(input) && !init) {
  297. request = input
  298. } else {
  299. request = new Request(input, init)
  300. }
  301. var xhr = new XMLHttpRequest()
  302. function responseURL() {
  303. if ('responseURL' in xhr) {
  304. return xhr.responseURL
  305. }
  306. // Avoid security warnings on getResponseHeader when not allowed by CORS
  307. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  308. return xhr.getResponseHeader('X-Request-URL')
  309. }
  310. return;
  311. }
  312. var __onLoadHandled = false;
  313. function onload() {
  314. if (xhr.readyState !== 4) {
  315. return
  316. }
  317. var status = (xhr.status === 1223) ? 204 : xhr.status
  318. if (status < 100 || status > 599) {
  319. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  320. reject(new TypeError('Network request failed'))
  321. return
  322. }
  323. var options = {
  324. status: status,
  325. statusText: xhr.statusText,
  326. headers: headers(xhr),
  327. url: responseURL()
  328. }
  329. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  330. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  331. resolve(new Response(body, options))
  332. }
  333. xhr.onreadystatechange = onload;
  334. xhr.onload = onload;
  335. xhr.onerror = function() {
  336. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  337. reject(new TypeError('Network request failed'))
  338. }
  339. xhr.open(request.method, request.url, true)
  340. // `withCredentials` should be setted after calling `.open` in IE10
  341. // http://stackoverflow.com/a/19667959/1219343
  342. try {
  343. if (request.credentials === 'include') {
  344. if ('withCredentials' in xhr) {
  345. xhr.withCredentials = true;
  346. } else {
  347. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  348. }
  349. }
  350. } catch (e) {
  351. console && console.warn && console.warn('set withCredentials error:' + e);
  352. }
  353. if ('responseType' in xhr && support.blob) {
  354. xhr.responseType = 'blob'
  355. }
  356. request.headers.forEach(function(value, name) {
  357. xhr.setRequestHeader(name, value)
  358. })
  359. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  360. })
  361. }
  362. self.fetch.polyfill = true
  363. // Support CommonJS
  364. if ( true && module.exports) {
  365. module.exports = self.fetch;
  366. }
  367. })(typeof self !== 'undefined' ? self : this);
  368. /***/ }),
  369. /***/ 144:
  370. /***/ (function(module, exports) {
  371. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  372. if (true) {
  373. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  374. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  375. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  376. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  377. } else { var mod; }
  378. })(this, function (exports, module) {
  379. 'use strict';
  380. var defaultOptions = {
  381. timeout: 5000,
  382. jsonpCallback: 'callback',
  383. jsonpCallbackFunction: null
  384. };
  385. function generateCallbackFunction() {
  386. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  387. }
  388. function clearFunction(functionName) {
  389. // IE8 throws an exception when you try to delete a property on window
  390. // http://stackoverflow.com/a/1824228/751089
  391. try {
  392. delete window[functionName];
  393. } catch (e) {
  394. window[functionName] = undefined;
  395. }
  396. }
  397. function removeScript(scriptId) {
  398. var script = document.getElementById(scriptId);
  399. if (script) {
  400. document.getElementsByTagName('head')[0].removeChild(script);
  401. }
  402. }
  403. function fetchJsonp(_url) {
  404. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  405. // to avoid param reassign
  406. var url = _url;
  407. var timeout = options.timeout || defaultOptions.timeout;
  408. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  409. var timeoutId = undefined;
  410. return new Promise(function (resolve, reject) {
  411. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  412. var scriptId = jsonpCallback + '_' + callbackFunction;
  413. window[callbackFunction] = function (response) {
  414. resolve({
  415. ok: true,
  416. // keep consistent with fetch API
  417. json: function json() {
  418. return Promise.resolve(response);
  419. }
  420. });
  421. if (timeoutId) clearTimeout(timeoutId);
  422. removeScript(scriptId);
  423. clearFunction(callbackFunction);
  424. };
  425. // Check if the user set their own params, and if not add a ? to start a list of params
  426. url += url.indexOf('?') === -1 ? '?' : '&';
  427. var jsonpScript = document.createElement('script');
  428. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  429. if (options.charset) {
  430. jsonpScript.setAttribute('charset', options.charset);
  431. }
  432. jsonpScript.id = scriptId;
  433. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  434. timeoutId = setTimeout(function () {
  435. reject(new Error('JSONP request to ' + _url + ' timed out'));
  436. clearFunction(callbackFunction);
  437. removeScript(scriptId);
  438. window[callbackFunction] = function () {
  439. clearFunction(callbackFunction);
  440. };
  441. }, timeout);
  442. // Caught if got 404/500
  443. jsonpScript.onerror = function () {
  444. reject(new Error('JSONP request to ' + _url + ' failed'));
  445. clearFunction(callbackFunction);
  446. removeScript(scriptId);
  447. if (timeoutId) clearTimeout(timeoutId);
  448. };
  449. });
  450. }
  451. // export as global function
  452. /*
  453. let local;
  454. if (typeof global !== 'undefined') {
  455. local = global;
  456. } else if (typeof self !== 'undefined') {
  457. local = self;
  458. } else {
  459. try {
  460. local = Function('return this')();
  461. } catch (e) {
  462. throw new Error('polyfill failed because global object is unavailable in this environment');
  463. }
  464. }
  465. local.fetchJsonp = fetchJsonp;
  466. */
  467. module.exports = fetchJsonp;
  468. });
  469. /***/ }),
  470. /***/ 794:
  471. /***/ ((module, exports, __webpack_require__) => {
  472. /* module decorator */ module = __webpack_require__.nmd(module);
  473. /**
  474. * lodash (Custom Build) <https://lodash.com/>
  475. * Build: `lodash modularize exports="npm" -o ./`
  476. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  477. * Released under MIT license <https://lodash.com/license>
  478. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  479. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  480. */
  481. /** Used as the size to enable large array optimizations. */
  482. var LARGE_ARRAY_SIZE = 200;
  483. /** Used as the `TypeError` message for "Functions" methods. */
  484. var FUNC_ERROR_TEXT = 'Expected a function';
  485. /** Used to stand-in for `undefined` hash values. */
  486. var HASH_UNDEFINED = '__lodash_hash_undefined__';
  487. /** Used to compose bitmasks for comparison styles. */
  488. var UNORDERED_COMPARE_FLAG = 1,
  489. PARTIAL_COMPARE_FLAG = 2;
  490. /** Used as references for various `Number` constants. */
  491. var INFINITY = 1 / 0,
  492. MAX_SAFE_INTEGER = 9007199254740991;
  493. /** `Object#toString` result references. */
  494. var argsTag = '[object Arguments]',
  495. arrayTag = '[object Array]',
  496. boolTag = '[object Boolean]',
  497. dateTag = '[object Date]',
  498. errorTag = '[object Error]',
  499. funcTag = '[object Function]',
  500. genTag = '[object GeneratorFunction]',
  501. mapTag = '[object Map]',
  502. numberTag = '[object Number]',
  503. objectTag = '[object Object]',
  504. promiseTag = '[object Promise]',
  505. regexpTag = '[object RegExp]',
  506. setTag = '[object Set]',
  507. stringTag = '[object String]',
  508. symbolTag = '[object Symbol]',
  509. weakMapTag = '[object WeakMap]';
  510. var arrayBufferTag = '[object ArrayBuffer]',
  511. dataViewTag = '[object DataView]',
  512. float32Tag = '[object Float32Array]',
  513. float64Tag = '[object Float64Array]',
  514. int8Tag = '[object Int8Array]',
  515. int16Tag = '[object Int16Array]',
  516. int32Tag = '[object Int32Array]',
  517. uint8Tag = '[object Uint8Array]',
  518. uint8ClampedTag = '[object Uint8ClampedArray]',
  519. uint16Tag = '[object Uint16Array]',
  520. uint32Tag = '[object Uint32Array]';
  521. /** Used to match property names within property paths. */
  522. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
  523. reIsPlainProp = /^\w*$/,
  524. reLeadingDot = /^\./,
  525. rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  526. /**
  527. * Used to match `RegExp`
  528. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  529. */
  530. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  531. /** Used to match backslashes in property paths. */
  532. var reEscapeChar = /\\(\\)?/g;
  533. /** Used to detect host constructors (Safari). */
  534. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  535. /** Used to detect unsigned integer values. */
  536. var reIsUint = /^(?:0|[1-9]\d*)$/;
  537. /** Used to identify `toStringTag` values of typed arrays. */
  538. var typedArrayTags = {};
  539. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
  540. typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
  541. typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
  542. typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
  543. typedArrayTags[uint32Tag] = true;
  544. typedArrayTags[argsTag] = typedArrayTags[arrayTag] =
  545. typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
  546. typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
  547. typedArrayTags[errorTag] = typedArrayTags[funcTag] =
  548. typedArrayTags[mapTag] = typedArrayTags[numberTag] =
  549. typedArrayTags[objectTag] = typedArrayTags[regexpTag] =
  550. typedArrayTags[setTag] = typedArrayTags[stringTag] =
  551. typedArrayTags[weakMapTag] = false;
  552. /** Detect free variable `global` from Node.js. */
  553. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  554. /** Detect free variable `self`. */
  555. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  556. /** Used as a reference to the global object. */
  557. var root = freeGlobal || freeSelf || Function('return this')();
  558. /** Detect free variable `exports`. */
  559. var freeExports = true && exports && !exports.nodeType && exports;
  560. /** Detect free variable `module`. */
  561. var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module;
  562. /** Detect the popular CommonJS extension `module.exports`. */
  563. var moduleExports = freeModule && freeModule.exports === freeExports;
  564. /** Detect free variable `process` from Node.js. */
  565. var freeProcess = moduleExports && freeGlobal.process;
  566. /** Used to access faster Node.js helpers. */
  567. var nodeUtil = (function() {
  568. try {
  569. return freeProcess && freeProcess.binding('util');
  570. } catch (e) {}
  571. }());
  572. /* Node.js helper references. */
  573. var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
  574. /**
  575. * A specialized version of `_.some` for arrays without support for iteratee
  576. * shorthands.
  577. *
  578. * @private
  579. * @param {Array} [array] The array to iterate over.
  580. * @param {Function} predicate The function invoked per iteration.
  581. * @returns {boolean} Returns `true` if any element passes the predicate check,
  582. * else `false`.
  583. */
  584. function arraySome(array, predicate) {
  585. var index = -1,
  586. length = array ? array.length : 0;
  587. while (++index < length) {
  588. if (predicate(array[index], index, array)) {
  589. return true;
  590. }
  591. }
  592. return false;
  593. }
  594. /**
  595. * The base implementation of `_.property` without support for deep paths.
  596. *
  597. * @private
  598. * @param {string} key The key of the property to get.
  599. * @returns {Function} Returns the new accessor function.
  600. */
  601. function baseProperty(key) {
  602. return function(object) {
  603. return object == null ? undefined : object[key];
  604. };
  605. }
  606. /**
  607. * The base implementation of `_.times` without support for iteratee shorthands
  608. * or max array length checks.
  609. *
  610. * @private
  611. * @param {number} n The number of times to invoke `iteratee`.
  612. * @param {Function} iteratee The function invoked per iteration.
  613. * @returns {Array} Returns the array of results.
  614. */
  615. function baseTimes(n, iteratee) {
  616. var index = -1,
  617. result = Array(n);
  618. while (++index < n) {
  619. result[index] = iteratee(index);
  620. }
  621. return result;
  622. }
  623. /**
  624. * The base implementation of `_.unary` without support for storing metadata.
  625. *
  626. * @private
  627. * @param {Function} func The function to cap arguments for.
  628. * @returns {Function} Returns the new capped function.
  629. */
  630. function baseUnary(func) {
  631. return function(value) {
  632. return func(value);
  633. };
  634. }
  635. /**
  636. * Gets the value at `key` of `object`.
  637. *
  638. * @private
  639. * @param {Object} [object] The object to query.
  640. * @param {string} key The key of the property to get.
  641. * @returns {*} Returns the property value.
  642. */
  643. function getValue(object, key) {
  644. return object == null ? undefined : object[key];
  645. }
  646. /**
  647. * Checks if `value` is a host object in IE < 9.
  648. *
  649. * @private
  650. * @param {*} value The value to check.
  651. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  652. */
  653. function isHostObject(value) {
  654. // Many host objects are `Object` objects that can coerce to strings
  655. // despite having improperly defined `toString` methods.
  656. var result = false;
  657. if (value != null && typeof value.toString != 'function') {
  658. try {
  659. result = !!(value + '');
  660. } catch (e) {}
  661. }
  662. return result;
  663. }
  664. /**
  665. * Converts `map` to its key-value pairs.
  666. *
  667. * @private
  668. * @param {Object} map The map to convert.
  669. * @returns {Array} Returns the key-value pairs.
  670. */
  671. function mapToArray(map) {
  672. var index = -1,
  673. result = Array(map.size);
  674. map.forEach(function(value, key) {
  675. result[++index] = [key, value];
  676. });
  677. return result;
  678. }
  679. /**
  680. * Creates a unary function that invokes `func` with its argument transformed.
  681. *
  682. * @private
  683. * @param {Function} func The function to wrap.
  684. * @param {Function} transform The argument transform.
  685. * @returns {Function} Returns the new function.
  686. */
  687. function overArg(func, transform) {
  688. return function(arg) {
  689. return func(transform(arg));
  690. };
  691. }
  692. /**
  693. * Converts `set` to an array of its values.
  694. *
  695. * @private
  696. * @param {Object} set The set to convert.
  697. * @returns {Array} Returns the values.
  698. */
  699. function setToArray(set) {
  700. var index = -1,
  701. result = Array(set.size);
  702. set.forEach(function(value) {
  703. result[++index] = value;
  704. });
  705. return result;
  706. }
  707. /** Used for built-in method references. */
  708. var arrayProto = Array.prototype,
  709. funcProto = Function.prototype,
  710. objectProto = Object.prototype;
  711. /** Used to detect overreaching core-js shims. */
  712. var coreJsData = root['__core-js_shared__'];
  713. /** Used to detect methods masquerading as native. */
  714. var maskSrcKey = (function() {
  715. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  716. return uid ? ('Symbol(src)_1.' + uid) : '';
  717. }());
  718. /** Used to resolve the decompiled source of functions. */
  719. var funcToString = funcProto.toString;
  720. /** Used to check objects for own properties. */
  721. var hasOwnProperty = objectProto.hasOwnProperty;
  722. /**
  723. * Used to resolve the
  724. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  725. * of values.
  726. */
  727. var objectToString = objectProto.toString;
  728. /** Used to detect if a method is native. */
  729. var reIsNative = RegExp('^' +
  730. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  731. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  732. );
  733. /** Built-in value references. */
  734. var Symbol = root.Symbol,
  735. Uint8Array = root.Uint8Array,
  736. propertyIsEnumerable = objectProto.propertyIsEnumerable,
  737. splice = arrayProto.splice;
  738. /* Built-in method references for those with the same name as other `lodash` methods. */
  739. var nativeKeys = overArg(Object.keys, Object);
  740. /* Built-in method references that are verified to be native. */
  741. var DataView = getNative(root, 'DataView'),
  742. Map = getNative(root, 'Map'),
  743. Promise = getNative(root, 'Promise'),
  744. Set = getNative(root, 'Set'),
  745. WeakMap = getNative(root, 'WeakMap'),
  746. nativeCreate = getNative(Object, 'create');
  747. /** Used to detect maps, sets, and weakmaps. */
  748. var dataViewCtorString = toSource(DataView),
  749. mapCtorString = toSource(Map),
  750. promiseCtorString = toSource(Promise),
  751. setCtorString = toSource(Set),
  752. weakMapCtorString = toSource(WeakMap);
  753. /** Used to convert symbols to primitives and strings. */
  754. var symbolProto = Symbol ? Symbol.prototype : undefined,
  755. symbolValueOf = symbolProto ? symbolProto.valueOf : undefined,
  756. symbolToString = symbolProto ? symbolProto.toString : undefined;
  757. /**
  758. * Creates a hash object.
  759. *
  760. * @private
  761. * @constructor
  762. * @param {Array} [entries] The key-value pairs to cache.
  763. */
  764. function Hash(entries) {
  765. var index = -1,
  766. length = entries ? entries.length : 0;
  767. this.clear();
  768. while (++index < length) {
  769. var entry = entries[index];
  770. this.set(entry[0], entry[1]);
  771. }
  772. }
  773. /**
  774. * Removes all key-value entries from the hash.
  775. *
  776. * @private
  777. * @name clear
  778. * @memberOf Hash
  779. */
  780. function hashClear() {
  781. this.__data__ = nativeCreate ? nativeCreate(null) : {};
  782. }
  783. /**
  784. * Removes `key` and its value from the hash.
  785. *
  786. * @private
  787. * @name delete
  788. * @memberOf Hash
  789. * @param {Object} hash The hash to modify.
  790. * @param {string} key The key of the value to remove.
  791. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  792. */
  793. function hashDelete(key) {
  794. return this.has(key) && delete this.__data__[key];
  795. }
  796. /**
  797. * Gets the hash value for `key`.
  798. *
  799. * @private
  800. * @name get
  801. * @memberOf Hash
  802. * @param {string} key The key of the value to get.
  803. * @returns {*} Returns the entry value.
  804. */
  805. function hashGet(key) {
  806. var data = this.__data__;
  807. if (nativeCreate) {
  808. var result = data[key];
  809. return result === HASH_UNDEFINED ? undefined : result;
  810. }
  811. return hasOwnProperty.call(data, key) ? data[key] : undefined;
  812. }
  813. /**
  814. * Checks if a hash value for `key` exists.
  815. *
  816. * @private
  817. * @name has
  818. * @memberOf Hash
  819. * @param {string} key The key of the entry to check.
  820. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  821. */
  822. function hashHas(key) {
  823. var data = this.__data__;
  824. return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key);
  825. }
  826. /**
  827. * Sets the hash `key` to `value`.
  828. *
  829. * @private
  830. * @name set
  831. * @memberOf Hash
  832. * @param {string} key The key of the value to set.
  833. * @param {*} value The value to set.
  834. * @returns {Object} Returns the hash instance.
  835. */
  836. function hashSet(key, value) {
  837. var data = this.__data__;
  838. data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;
  839. return this;
  840. }
  841. // Add methods to `Hash`.
  842. Hash.prototype.clear = hashClear;
  843. Hash.prototype['delete'] = hashDelete;
  844. Hash.prototype.get = hashGet;
  845. Hash.prototype.has = hashHas;
  846. Hash.prototype.set = hashSet;
  847. /**
  848. * Creates an list cache object.
  849. *
  850. * @private
  851. * @constructor
  852. * @param {Array} [entries] The key-value pairs to cache.
  853. */
  854. function ListCache(entries) {
  855. var index = -1,
  856. length = entries ? entries.length : 0;
  857. this.clear();
  858. while (++index < length) {
  859. var entry = entries[index];
  860. this.set(entry[0], entry[1]);
  861. }
  862. }
  863. /**
  864. * Removes all key-value entries from the list cache.
  865. *
  866. * @private
  867. * @name clear
  868. * @memberOf ListCache
  869. */
  870. function listCacheClear() {
  871. this.__data__ = [];
  872. }
  873. /**
  874. * Removes `key` and its value from the list cache.
  875. *
  876. * @private
  877. * @name delete
  878. * @memberOf ListCache
  879. * @param {string} key The key of the value to remove.
  880. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  881. */
  882. function listCacheDelete(key) {
  883. var data = this.__data__,
  884. index = assocIndexOf(data, key);
  885. if (index < 0) {
  886. return false;
  887. }
  888. var lastIndex = data.length - 1;
  889. if (index == lastIndex) {
  890. data.pop();
  891. } else {
  892. splice.call(data, index, 1);
  893. }
  894. return true;
  895. }
  896. /**
  897. * Gets the list cache value for `key`.
  898. *
  899. * @private
  900. * @name get
  901. * @memberOf ListCache
  902. * @param {string} key The key of the value to get.
  903. * @returns {*} Returns the entry value.
  904. */
  905. function listCacheGet(key) {
  906. var data = this.__data__,
  907. index = assocIndexOf(data, key);
  908. return index < 0 ? undefined : data[index][1];
  909. }
  910. /**
  911. * Checks if a list cache value for `key` exists.
  912. *
  913. * @private
  914. * @name has
  915. * @memberOf ListCache
  916. * @param {string} key The key of the entry to check.
  917. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  918. */
  919. function listCacheHas(key) {
  920. return assocIndexOf(this.__data__, key) > -1;
  921. }
  922. /**
  923. * Sets the list cache `key` to `value`.
  924. *
  925. * @private
  926. * @name set
  927. * @memberOf ListCache
  928. * @param {string} key The key of the value to set.
  929. * @param {*} value The value to set.
  930. * @returns {Object} Returns the list cache instance.
  931. */
  932. function listCacheSet(key, value) {
  933. var data = this.__data__,
  934. index = assocIndexOf(data, key);
  935. if (index < 0) {
  936. data.push([key, value]);
  937. } else {
  938. data[index][1] = value;
  939. }
  940. return this;
  941. }
  942. // Add methods to `ListCache`.
  943. ListCache.prototype.clear = listCacheClear;
  944. ListCache.prototype['delete'] = listCacheDelete;
  945. ListCache.prototype.get = listCacheGet;
  946. ListCache.prototype.has = listCacheHas;
  947. ListCache.prototype.set = listCacheSet;
  948. /**
  949. * Creates a map cache object to store key-value pairs.
  950. *
  951. * @private
  952. * @constructor
  953. * @param {Array} [entries] The key-value pairs to cache.
  954. */
  955. function MapCache(entries) {
  956. var index = -1,
  957. length = entries ? entries.length : 0;
  958. this.clear();
  959. while (++index < length) {
  960. var entry = entries[index];
  961. this.set(entry[0], entry[1]);
  962. }
  963. }
  964. /**
  965. * Removes all key-value entries from the map.
  966. *
  967. * @private
  968. * @name clear
  969. * @memberOf MapCache
  970. */
  971. function mapCacheClear() {
  972. this.__data__ = {
  973. 'hash': new Hash,
  974. 'map': new (Map || ListCache),
  975. 'string': new Hash
  976. };
  977. }
  978. /**
  979. * Removes `key` and its value from the map.
  980. *
  981. * @private
  982. * @name delete
  983. * @memberOf MapCache
  984. * @param {string} key The key of the value to remove.
  985. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  986. */
  987. function mapCacheDelete(key) {
  988. return getMapData(this, key)['delete'](key);
  989. }
  990. /**
  991. * Gets the map value for `key`.
  992. *
  993. * @private
  994. * @name get
  995. * @memberOf MapCache
  996. * @param {string} key The key of the value to get.
  997. * @returns {*} Returns the entry value.
  998. */
  999. function mapCacheGet(key) {
  1000. return getMapData(this, key).get(key);
  1001. }
  1002. /**
  1003. * Checks if a map value for `key` exists.
  1004. *
  1005. * @private
  1006. * @name has
  1007. * @memberOf MapCache
  1008. * @param {string} key The key of the entry to check.
  1009. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1010. */
  1011. function mapCacheHas(key) {
  1012. return getMapData(this, key).has(key);
  1013. }
  1014. /**
  1015. * Sets the map `key` to `value`.
  1016. *
  1017. * @private
  1018. * @name set
  1019. * @memberOf MapCache
  1020. * @param {string} key The key of the value to set.
  1021. * @param {*} value The value to set.
  1022. * @returns {Object} Returns the map cache instance.
  1023. */
  1024. function mapCacheSet(key, value) {
  1025. getMapData(this, key).set(key, value);
  1026. return this;
  1027. }
  1028. // Add methods to `MapCache`.
  1029. MapCache.prototype.clear = mapCacheClear;
  1030. MapCache.prototype['delete'] = mapCacheDelete;
  1031. MapCache.prototype.get = mapCacheGet;
  1032. MapCache.prototype.has = mapCacheHas;
  1033. MapCache.prototype.set = mapCacheSet;
  1034. /**
  1035. *
  1036. * Creates an array cache object to store unique values.
  1037. *
  1038. * @private
  1039. * @constructor
  1040. * @param {Array} [values] The values to cache.
  1041. */
  1042. function SetCache(values) {
  1043. var index = -1,
  1044. length = values ? values.length : 0;
  1045. this.__data__ = new MapCache;
  1046. while (++index < length) {
  1047. this.add(values[index]);
  1048. }
  1049. }
  1050. /**
  1051. * Adds `value` to the array cache.
  1052. *
  1053. * @private
  1054. * @name add
  1055. * @memberOf SetCache
  1056. * @alias push
  1057. * @param {*} value The value to cache.
  1058. * @returns {Object} Returns the cache instance.
  1059. */
  1060. function setCacheAdd(value) {
  1061. this.__data__.set(value, HASH_UNDEFINED);
  1062. return this;
  1063. }
  1064. /**
  1065. * Checks if `value` is in the array cache.
  1066. *
  1067. * @private
  1068. * @name has
  1069. * @memberOf SetCache
  1070. * @param {*} value The value to search for.
  1071. * @returns {number} Returns `true` if `value` is found, else `false`.
  1072. */
  1073. function setCacheHas(value) {
  1074. return this.__data__.has(value);
  1075. }
  1076. // Add methods to `SetCache`.
  1077. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  1078. SetCache.prototype.has = setCacheHas;
  1079. /**
  1080. * Creates a stack cache object to store key-value pairs.
  1081. *
  1082. * @private
  1083. * @constructor
  1084. * @param {Array} [entries] The key-value pairs to cache.
  1085. */
  1086. function Stack(entries) {
  1087. this.__data__ = new ListCache(entries);
  1088. }
  1089. /**
  1090. * Removes all key-value entries from the stack.
  1091. *
  1092. * @private
  1093. * @name clear
  1094. * @memberOf Stack
  1095. */
  1096. function stackClear() {
  1097. this.__data__ = new ListCache;
  1098. }
  1099. /**
  1100. * Removes `key` and its value from the stack.
  1101. *
  1102. * @private
  1103. * @name delete
  1104. * @memberOf Stack
  1105. * @param {string} key The key of the value to remove.
  1106. * @returns {boolean} Returns `true` if the entry was removed, else `false`.
  1107. */
  1108. function stackDelete(key) {
  1109. return this.__data__['delete'](key);
  1110. }
  1111. /**
  1112. * Gets the stack value for `key`.
  1113. *
  1114. * @private
  1115. * @name get
  1116. * @memberOf Stack
  1117. * @param {string} key The key of the value to get.
  1118. * @returns {*} Returns the entry value.
  1119. */
  1120. function stackGet(key) {
  1121. return this.__data__.get(key);
  1122. }
  1123. /**
  1124. * Checks if a stack value for `key` exists.
  1125. *
  1126. * @private
  1127. * @name has
  1128. * @memberOf Stack
  1129. * @param {string} key The key of the entry to check.
  1130. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
  1131. */
  1132. function stackHas(key) {
  1133. return this.__data__.has(key);
  1134. }
  1135. /**
  1136. * Sets the stack `key` to `value`.
  1137. *
  1138. * @private
  1139. * @name set
  1140. * @memberOf Stack
  1141. * @param {string} key The key of the value to set.
  1142. * @param {*} value The value to set.
  1143. * @returns {Object} Returns the stack cache instance.
  1144. */
  1145. function stackSet(key, value) {
  1146. var cache = this.__data__;
  1147. if (cache instanceof ListCache) {
  1148. var pairs = cache.__data__;
  1149. if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
  1150. pairs.push([key, value]);
  1151. return this;
  1152. }
  1153. cache = this.__data__ = new MapCache(pairs);
  1154. }
  1155. cache.set(key, value);
  1156. return this;
  1157. }
  1158. // Add methods to `Stack`.
  1159. Stack.prototype.clear = stackClear;
  1160. Stack.prototype['delete'] = stackDelete;
  1161. Stack.prototype.get = stackGet;
  1162. Stack.prototype.has = stackHas;
  1163. Stack.prototype.set = stackSet;
  1164. /**
  1165. * Creates an array of the enumerable property names of the array-like `value`.
  1166. *
  1167. * @private
  1168. * @param {*} value The value to query.
  1169. * @param {boolean} inherited Specify returning inherited property names.
  1170. * @returns {Array} Returns the array of property names.
  1171. */
  1172. function arrayLikeKeys(value, inherited) {
  1173. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  1174. // Safari 9 makes `arguments.length` enumerable in strict mode.
  1175. var result = (isArray(value) || isArguments(value))
  1176. ? baseTimes(value.length, String)
  1177. : [];
  1178. var length = result.length,
  1179. skipIndexes = !!length;
  1180. for (var key in value) {
  1181. if ((inherited || hasOwnProperty.call(value, key)) &&
  1182. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  1183. result.push(key);
  1184. }
  1185. }
  1186. return result;
  1187. }
  1188. /**
  1189. * Gets the index at which the `key` is found in `array` of key-value pairs.
  1190. *
  1191. * @private
  1192. * @param {Array} array The array to inspect.
  1193. * @param {*} key The key to search for.
  1194. * @returns {number} Returns the index of the matched value, else `-1`.
  1195. */
  1196. function assocIndexOf(array, key) {
  1197. var length = array.length;
  1198. while (length--) {
  1199. if (eq(array[length][0], key)) {
  1200. return length;
  1201. }
  1202. }
  1203. return -1;
  1204. }
  1205. /**
  1206. * The base implementation of `_.get` without support for default values.
  1207. *
  1208. * @private
  1209. * @param {Object} object The object to query.
  1210. * @param {Array|string} path The path of the property to get.
  1211. * @returns {*} Returns the resolved value.
  1212. */
  1213. function baseGet(object, path) {
  1214. path = isKey(path, object) ? [path] : castPath(path);
  1215. var index = 0,
  1216. length = path.length;
  1217. while (object != null && index < length) {
  1218. object = object[toKey(path[index++])];
  1219. }
  1220. return (index && index == length) ? object : undefined;
  1221. }
  1222. /**
  1223. * The base implementation of `getTag`.
  1224. *
  1225. * @private
  1226. * @param {*} value The value to query.
  1227. * @returns {string} Returns the `toStringTag`.
  1228. */
  1229. function baseGetTag(value) {
  1230. return objectToString.call(value);
  1231. }
  1232. /**
  1233. * The base implementation of `_.hasIn` without support for deep paths.
  1234. *
  1235. * @private
  1236. * @param {Object} [object] The object to query.
  1237. * @param {Array|string} key The key to check.
  1238. * @returns {boolean} Returns `true` if `key` exists, else `false`.
  1239. */
  1240. function baseHasIn(object, key) {
  1241. return object != null && key in Object(object);
  1242. }
  1243. /**
  1244. * The base implementation of `_.isEqual` which supports partial comparisons
  1245. * and tracks traversed objects.
  1246. *
  1247. * @private
  1248. * @param {*} value The value to compare.
  1249. * @param {*} other The other value to compare.
  1250. * @param {Function} [customizer] The function to customize comparisons.
  1251. * @param {boolean} [bitmask] The bitmask of comparison flags.
  1252. * The bitmask may be composed of the following flags:
  1253. * 1 - Unordered comparison
  1254. * 2 - Partial comparison
  1255. * @param {Object} [stack] Tracks traversed `value` and `other` objects.
  1256. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  1257. */
  1258. function baseIsEqual(value, other, customizer, bitmask, stack) {
  1259. if (value === other) {
  1260. return true;
  1261. }
  1262. if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) {
  1263. return value !== value && other !== other;
  1264. }
  1265. return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack);
  1266. }
  1267. /**
  1268. * A specialized version of `baseIsEqual` for arrays and objects which performs
  1269. * deep comparisons and tracks traversed objects enabling objects with circular
  1270. * references to be compared.
  1271. *
  1272. * @private
  1273. * @param {Object} object The object to compare.
  1274. * @param {Object} other The other object to compare.
  1275. * @param {Function} equalFunc The function to determine equivalents of values.
  1276. * @param {Function} [customizer] The function to customize comparisons.
  1277. * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual`
  1278. * for more details.
  1279. * @param {Object} [stack] Tracks traversed `object` and `other` objects.
  1280. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1281. */
  1282. function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) {
  1283. var objIsArr = isArray(object),
  1284. othIsArr = isArray(other),
  1285. objTag = arrayTag,
  1286. othTag = arrayTag;
  1287. if (!objIsArr) {
  1288. objTag = getTag(object);
  1289. objTag = objTag == argsTag ? objectTag : objTag;
  1290. }
  1291. if (!othIsArr) {
  1292. othTag = getTag(other);
  1293. othTag = othTag == argsTag ? objectTag : othTag;
  1294. }
  1295. var objIsObj = objTag == objectTag && !isHostObject(object),
  1296. othIsObj = othTag == objectTag && !isHostObject(other),
  1297. isSameTag = objTag == othTag;
  1298. if (isSameTag && !objIsObj) {
  1299. stack || (stack = new Stack);
  1300. return (objIsArr || isTypedArray(object))
  1301. ? equalArrays(object, other, equalFunc, customizer, bitmask, stack)
  1302. : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack);
  1303. }
  1304. if (!(bitmask & PARTIAL_COMPARE_FLAG)) {
  1305. var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
  1306. othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
  1307. if (objIsWrapped || othIsWrapped) {
  1308. var objUnwrapped = objIsWrapped ? object.value() : object,
  1309. othUnwrapped = othIsWrapped ? other.value() : other;
  1310. stack || (stack = new Stack);
  1311. return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack);
  1312. }
  1313. }
  1314. if (!isSameTag) {
  1315. return false;
  1316. }
  1317. stack || (stack = new Stack);
  1318. return equalObjects(object, other, equalFunc, customizer, bitmask, stack);
  1319. }
  1320. /**
  1321. * The base implementation of `_.isMatch` without support for iteratee shorthands.
  1322. *
  1323. * @private
  1324. * @param {Object} object The object to inspect.
  1325. * @param {Object} source The object of property values to match.
  1326. * @param {Array} matchData The property names, values, and compare flags to match.
  1327. * @param {Function} [customizer] The function to customize comparisons.
  1328. * @returns {boolean} Returns `true` if `object` is a match, else `false`.
  1329. */
  1330. function baseIsMatch(object, source, matchData, customizer) {
  1331. var index = matchData.length,
  1332. length = index,
  1333. noCustomizer = !customizer;
  1334. if (object == null) {
  1335. return !length;
  1336. }
  1337. object = Object(object);
  1338. while (index--) {
  1339. var data = matchData[index];
  1340. if ((noCustomizer && data[2])
  1341. ? data[1] !== object[data[0]]
  1342. : !(data[0] in object)
  1343. ) {
  1344. return false;
  1345. }
  1346. }
  1347. while (++index < length) {
  1348. data = matchData[index];
  1349. var key = data[0],
  1350. objValue = object[key],
  1351. srcValue = data[1];
  1352. if (noCustomizer && data[2]) {
  1353. if (objValue === undefined && !(key in object)) {
  1354. return false;
  1355. }
  1356. } else {
  1357. var stack = new Stack;
  1358. if (customizer) {
  1359. var result = customizer(objValue, srcValue, key, object, source, stack);
  1360. }
  1361. if (!(result === undefined
  1362. ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack)
  1363. : result
  1364. )) {
  1365. return false;
  1366. }
  1367. }
  1368. }
  1369. return true;
  1370. }
  1371. /**
  1372. * The base implementation of `_.isNative` without bad shim checks.
  1373. *
  1374. * @private
  1375. * @param {*} value The value to check.
  1376. * @returns {boolean} Returns `true` if `value` is a native function,
  1377. * else `false`.
  1378. */
  1379. function baseIsNative(value) {
  1380. if (!isObject(value) || isMasked(value)) {
  1381. return false;
  1382. }
  1383. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  1384. return pattern.test(toSource(value));
  1385. }
  1386. /**
  1387. * The base implementation of `_.isTypedArray` without Node.js optimizations.
  1388. *
  1389. * @private
  1390. * @param {*} value The value to check.
  1391. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  1392. */
  1393. function baseIsTypedArray(value) {
  1394. return isObjectLike(value) &&
  1395. isLength(value.length) && !!typedArrayTags[objectToString.call(value)];
  1396. }
  1397. /**
  1398. * The base implementation of `_.iteratee`.
  1399. *
  1400. * @private
  1401. * @param {*} [value=_.identity] The value to convert to an iteratee.
  1402. * @returns {Function} Returns the iteratee.
  1403. */
  1404. function baseIteratee(value) {
  1405. // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
  1406. // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
  1407. if (typeof value == 'function') {
  1408. return value;
  1409. }
  1410. if (value == null) {
  1411. return identity;
  1412. }
  1413. if (typeof value == 'object') {
  1414. return isArray(value)
  1415. ? baseMatchesProperty(value[0], value[1])
  1416. : baseMatches(value);
  1417. }
  1418. return property(value);
  1419. }
  1420. /**
  1421. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  1422. *
  1423. * @private
  1424. * @param {Object} object The object to query.
  1425. * @returns {Array} Returns the array of property names.
  1426. */
  1427. function baseKeys(object) {
  1428. if (!isPrototype(object)) {
  1429. return nativeKeys(object);
  1430. }
  1431. var result = [];
  1432. for (var key in Object(object)) {
  1433. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  1434. result.push(key);
  1435. }
  1436. }
  1437. return result;
  1438. }
  1439. /**
  1440. * The base implementation of `_.matches` which doesn't clone `source`.
  1441. *
  1442. * @private
  1443. * @param {Object} source The object of property values to match.
  1444. * @returns {Function} Returns the new spec function.
  1445. */
  1446. function baseMatches(source) {
  1447. var matchData = getMatchData(source);
  1448. if (matchData.length == 1 && matchData[0][2]) {
  1449. return matchesStrictComparable(matchData[0][0], matchData[0][1]);
  1450. }
  1451. return function(object) {
  1452. return object === source || baseIsMatch(object, source, matchData);
  1453. };
  1454. }
  1455. /**
  1456. * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
  1457. *
  1458. * @private
  1459. * @param {string} path The path of the property to get.
  1460. * @param {*} srcValue The value to match.
  1461. * @returns {Function} Returns the new spec function.
  1462. */
  1463. function baseMatchesProperty(path, srcValue) {
  1464. if (isKey(path) && isStrictComparable(srcValue)) {
  1465. return matchesStrictComparable(toKey(path), srcValue);
  1466. }
  1467. return function(object) {
  1468. var objValue = get(object, path);
  1469. return (objValue === undefined && objValue === srcValue)
  1470. ? hasIn(object, path)
  1471. : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG);
  1472. };
  1473. }
  1474. /**
  1475. * A specialized version of `baseProperty` which supports deep paths.
  1476. *
  1477. * @private
  1478. * @param {Array|string} path The path of the property to get.
  1479. * @returns {Function} Returns the new accessor function.
  1480. */
  1481. function basePropertyDeep(path) {
  1482. return function(object) {
  1483. return baseGet(object, path);
  1484. };
  1485. }
  1486. /**
  1487. * The base implementation of `_.pullAt` without support for individual
  1488. * indexes or capturing the removed elements.
  1489. *
  1490. * @private
  1491. * @param {Array} array The array to modify.
  1492. * @param {number[]} indexes The indexes of elements to remove.
  1493. * @returns {Array} Returns `array`.
  1494. */
  1495. function basePullAt(array, indexes) {
  1496. var length = array ? indexes.length : 0,
  1497. lastIndex = length - 1;
  1498. while (length--) {
  1499. var index = indexes[length];
  1500. if (length == lastIndex || index !== previous) {
  1501. var previous = index;
  1502. if (isIndex(index)) {
  1503. splice.call(array, index, 1);
  1504. }
  1505. else if (!isKey(index, array)) {
  1506. var path = castPath(index),
  1507. object = parent(array, path);
  1508. if (object != null) {
  1509. delete object[toKey(last(path))];
  1510. }
  1511. }
  1512. else {
  1513. delete array[toKey(index)];
  1514. }
  1515. }
  1516. }
  1517. return array;
  1518. }
  1519. /**
  1520. * The base implementation of `_.slice` without an iteratee call guard.
  1521. *
  1522. * @private
  1523. * @param {Array} array The array to slice.
  1524. * @param {number} [start=0] The start position.
  1525. * @param {number} [end=array.length] The end position.
  1526. * @returns {Array} Returns the slice of `array`.
  1527. */
  1528. function baseSlice(array, start, end) {
  1529. var index = -1,
  1530. length = array.length;
  1531. if (start < 0) {
  1532. start = -start > length ? 0 : (length + start);
  1533. }
  1534. end = end > length ? length : end;
  1535. if (end < 0) {
  1536. end += length;
  1537. }
  1538. length = start > end ? 0 : ((end - start) >>> 0);
  1539. start >>>= 0;
  1540. var result = Array(length);
  1541. while (++index < length) {
  1542. result[index] = array[index + start];
  1543. }
  1544. return result;
  1545. }
  1546. /**
  1547. * The base implementation of `_.toString` which doesn't convert nullish
  1548. * values to empty strings.
  1549. *
  1550. * @private
  1551. * @param {*} value The value to process.
  1552. * @returns {string} Returns the string.
  1553. */
  1554. function baseToString(value) {
  1555. // Exit early for strings to avoid a performance hit in some environments.
  1556. if (typeof value == 'string') {
  1557. return value;
  1558. }
  1559. if (isSymbol(value)) {
  1560. return symbolToString ? symbolToString.call(value) : '';
  1561. }
  1562. var result = (value + '');
  1563. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  1564. }
  1565. /**
  1566. * Casts `value` to a path array if it's not one.
  1567. *
  1568. * @private
  1569. * @param {*} value The value to inspect.
  1570. * @returns {Array} Returns the cast property path array.
  1571. */
  1572. function castPath(value) {
  1573. return isArray(value) ? value : stringToPath(value);
  1574. }
  1575. /**
  1576. * A specialized version of `baseIsEqualDeep` for arrays with support for
  1577. * partial deep comparisons.
  1578. *
  1579. * @private
  1580. * @param {Array} array The array to compare.
  1581. * @param {Array} other The other array to compare.
  1582. * @param {Function} equalFunc The function to determine equivalents of values.
  1583. * @param {Function} customizer The function to customize comparisons.
  1584. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  1585. * for more details.
  1586. * @param {Object} stack Tracks traversed `array` and `other` objects.
  1587. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
  1588. */
  1589. function equalArrays(array, other, equalFunc, customizer, bitmask, stack) {
  1590. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  1591. arrLength = array.length,
  1592. othLength = other.length;
  1593. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  1594. return false;
  1595. }
  1596. // Assume cyclic values are equal.
  1597. var stacked = stack.get(array);
  1598. if (stacked && stack.get(other)) {
  1599. return stacked == other;
  1600. }
  1601. var index = -1,
  1602. result = true,
  1603. seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined;
  1604. stack.set(array, other);
  1605. stack.set(other, array);
  1606. // Ignore non-index properties.
  1607. while (++index < arrLength) {
  1608. var arrValue = array[index],
  1609. othValue = other[index];
  1610. if (customizer) {
  1611. var compared = isPartial
  1612. ? customizer(othValue, arrValue, index, other, array, stack)
  1613. : customizer(arrValue, othValue, index, array, other, stack);
  1614. }
  1615. if (compared !== undefined) {
  1616. if (compared) {
  1617. continue;
  1618. }
  1619. result = false;
  1620. break;
  1621. }
  1622. // Recursively compare arrays (susceptible to call stack limits).
  1623. if (seen) {
  1624. if (!arraySome(other, function(othValue, othIndex) {
  1625. if (!seen.has(othIndex) &&
  1626. (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) {
  1627. return seen.add(othIndex);
  1628. }
  1629. })) {
  1630. result = false;
  1631. break;
  1632. }
  1633. } else if (!(
  1634. arrValue === othValue ||
  1635. equalFunc(arrValue, othValue, customizer, bitmask, stack)
  1636. )) {
  1637. result = false;
  1638. break;
  1639. }
  1640. }
  1641. stack['delete'](array);
  1642. stack['delete'](other);
  1643. return result;
  1644. }
  1645. /**
  1646. * A specialized version of `baseIsEqualDeep` for comparing objects of
  1647. * the same `toStringTag`.
  1648. *
  1649. * **Note:** This function only supports comparing values with tags of
  1650. * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
  1651. *
  1652. * @private
  1653. * @param {Object} object The object to compare.
  1654. * @param {Object} other The other object to compare.
  1655. * @param {string} tag The `toStringTag` of the objects to compare.
  1656. * @param {Function} equalFunc The function to determine equivalents of values.
  1657. * @param {Function} customizer The function to customize comparisons.
  1658. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  1659. * for more details.
  1660. * @param {Object} stack Tracks traversed `object` and `other` objects.
  1661. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1662. */
  1663. function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) {
  1664. switch (tag) {
  1665. case dataViewTag:
  1666. if ((object.byteLength != other.byteLength) ||
  1667. (object.byteOffset != other.byteOffset)) {
  1668. return false;
  1669. }
  1670. object = object.buffer;
  1671. other = other.buffer;
  1672. case arrayBufferTag:
  1673. if ((object.byteLength != other.byteLength) ||
  1674. !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
  1675. return false;
  1676. }
  1677. return true;
  1678. case boolTag:
  1679. case dateTag:
  1680. case numberTag:
  1681. // Coerce booleans to `1` or `0` and dates to milliseconds.
  1682. // Invalid dates are coerced to `NaN`.
  1683. return eq(+object, +other);
  1684. case errorTag:
  1685. return object.name == other.name && object.message == other.message;
  1686. case regexpTag:
  1687. case stringTag:
  1688. // Coerce regexes to strings and treat strings, primitives and objects,
  1689. // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
  1690. // for more details.
  1691. return object == (other + '');
  1692. case mapTag:
  1693. var convert = mapToArray;
  1694. case setTag:
  1695. var isPartial = bitmask & PARTIAL_COMPARE_FLAG;
  1696. convert || (convert = setToArray);
  1697. if (object.size != other.size && !isPartial) {
  1698. return false;
  1699. }
  1700. // Assume cyclic values are equal.
  1701. var stacked = stack.get(object);
  1702. if (stacked) {
  1703. return stacked == other;
  1704. }
  1705. bitmask |= UNORDERED_COMPARE_FLAG;
  1706. // Recursively compare objects (susceptible to call stack limits).
  1707. stack.set(object, other);
  1708. var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack);
  1709. stack['delete'](object);
  1710. return result;
  1711. case symbolTag:
  1712. if (symbolValueOf) {
  1713. return symbolValueOf.call(object) == symbolValueOf.call(other);
  1714. }
  1715. }
  1716. return false;
  1717. }
  1718. /**
  1719. * A specialized version of `baseIsEqualDeep` for objects with support for
  1720. * partial deep comparisons.
  1721. *
  1722. * @private
  1723. * @param {Object} object The object to compare.
  1724. * @param {Object} other The other object to compare.
  1725. * @param {Function} equalFunc The function to determine equivalents of values.
  1726. * @param {Function} customizer The function to customize comparisons.
  1727. * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual`
  1728. * for more details.
  1729. * @param {Object} stack Tracks traversed `object` and `other` objects.
  1730. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
  1731. */
  1732. function equalObjects(object, other, equalFunc, customizer, bitmask, stack) {
  1733. var isPartial = bitmask & PARTIAL_COMPARE_FLAG,
  1734. objProps = keys(object),
  1735. objLength = objProps.length,
  1736. othProps = keys(other),
  1737. othLength = othProps.length;
  1738. if (objLength != othLength && !isPartial) {
  1739. return false;
  1740. }
  1741. var index = objLength;
  1742. while (index--) {
  1743. var key = objProps[index];
  1744. if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
  1745. return false;
  1746. }
  1747. }
  1748. // Assume cyclic values are equal.
  1749. var stacked = stack.get(object);
  1750. if (stacked && stack.get(other)) {
  1751. return stacked == other;
  1752. }
  1753. var result = true;
  1754. stack.set(object, other);
  1755. stack.set(other, object);
  1756. var skipCtor = isPartial;
  1757. while (++index < objLength) {
  1758. key = objProps[index];
  1759. var objValue = object[key],
  1760. othValue = other[key];
  1761. if (customizer) {
  1762. var compared = isPartial
  1763. ? customizer(othValue, objValue, key, other, object, stack)
  1764. : customizer(objValue, othValue, key, object, other, stack);
  1765. }
  1766. // Recursively compare objects (susceptible to call stack limits).
  1767. if (!(compared === undefined
  1768. ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack))
  1769. : compared
  1770. )) {
  1771. result = false;
  1772. break;
  1773. }
  1774. skipCtor || (skipCtor = key == 'constructor');
  1775. }
  1776. if (result && !skipCtor) {
  1777. var objCtor = object.constructor,
  1778. othCtor = other.constructor;
  1779. // Non `Object` object instances with different constructors are not equal.
  1780. if (objCtor != othCtor &&
  1781. ('constructor' in object && 'constructor' in other) &&
  1782. !(typeof objCtor == 'function' && objCtor instanceof objCtor &&
  1783. typeof othCtor == 'function' && othCtor instanceof othCtor)) {
  1784. result = false;
  1785. }
  1786. }
  1787. stack['delete'](object);
  1788. stack['delete'](other);
  1789. return result;
  1790. }
  1791. /**
  1792. * Gets the data for `map`.
  1793. *
  1794. * @private
  1795. * @param {Object} map The map to query.
  1796. * @param {string} key The reference key.
  1797. * @returns {*} Returns the map data.
  1798. */
  1799. function getMapData(map, key) {
  1800. var data = map.__data__;
  1801. return isKeyable(key)
  1802. ? data[typeof key == 'string' ? 'string' : 'hash']
  1803. : data.map;
  1804. }
  1805. /**
  1806. * Gets the property names, values, and compare flags of `object`.
  1807. *
  1808. * @private
  1809. * @param {Object} object The object to query.
  1810. * @returns {Array} Returns the match data of `object`.
  1811. */
  1812. function getMatchData(object) {
  1813. var result = keys(object),
  1814. length = result.length;
  1815. while (length--) {
  1816. var key = result[length],
  1817. value = object[key];
  1818. result[length] = [key, value, isStrictComparable(value)];
  1819. }
  1820. return result;
  1821. }
  1822. /**
  1823. * Gets the native function at `key` of `object`.
  1824. *
  1825. * @private
  1826. * @param {Object} object The object to query.
  1827. * @param {string} key The key of the method to get.
  1828. * @returns {*} Returns the function if it's native, else `undefined`.
  1829. */
  1830. function getNative(object, key) {
  1831. var value = getValue(object, key);
  1832. return baseIsNative(value) ? value : undefined;
  1833. }
  1834. /**
  1835. * Gets the `toStringTag` of `value`.
  1836. *
  1837. * @private
  1838. * @param {*} value The value to query.
  1839. * @returns {string} Returns the `toStringTag`.
  1840. */
  1841. var getTag = baseGetTag;
  1842. // Fallback for data views, maps, sets, and weak maps in IE 11,
  1843. // for data views in Edge < 14, and promises in Node.js.
  1844. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  1845. (Map && getTag(new Map) != mapTag) ||
  1846. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  1847. (Set && getTag(new Set) != setTag) ||
  1848. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  1849. getTag = function(value) {
  1850. var result = objectToString.call(value),
  1851. Ctor = result == objectTag ? value.constructor : undefined,
  1852. ctorString = Ctor ? toSource(Ctor) : undefined;
  1853. if (ctorString) {
  1854. switch (ctorString) {
  1855. case dataViewCtorString: return dataViewTag;
  1856. case mapCtorString: return mapTag;
  1857. case promiseCtorString: return promiseTag;
  1858. case setCtorString: return setTag;
  1859. case weakMapCtorString: return weakMapTag;
  1860. }
  1861. }
  1862. return result;
  1863. };
  1864. }
  1865. /**
  1866. * Checks if `path` exists on `object`.
  1867. *
  1868. * @private
  1869. * @param {Object} object The object to query.
  1870. * @param {Array|string} path The path to check.
  1871. * @param {Function} hasFunc The function to check properties.
  1872. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  1873. */
  1874. function hasPath(object, path, hasFunc) {
  1875. path = isKey(path, object) ? [path] : castPath(path);
  1876. var result,
  1877. index = -1,
  1878. length = path.length;
  1879. while (++index < length) {
  1880. var key = toKey(path[index]);
  1881. if (!(result = object != null && hasFunc(object, key))) {
  1882. break;
  1883. }
  1884. object = object[key];
  1885. }
  1886. if (result) {
  1887. return result;
  1888. }
  1889. var length = object ? object.length : 0;
  1890. return !!length && isLength(length) && isIndex(key, length) &&
  1891. (isArray(object) || isArguments(object));
  1892. }
  1893. /**
  1894. * Checks if `value` is a valid array-like index.
  1895. *
  1896. * @private
  1897. * @param {*} value The value to check.
  1898. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  1899. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  1900. */
  1901. function isIndex(value, length) {
  1902. length = length == null ? MAX_SAFE_INTEGER : length;
  1903. return !!length &&
  1904. (typeof value == 'number' || reIsUint.test(value)) &&
  1905. (value > -1 && value % 1 == 0 && value < length);
  1906. }
  1907. /**
  1908. * Checks if `value` is a property name and not a property path.
  1909. *
  1910. * @private
  1911. * @param {*} value The value to check.
  1912. * @param {Object} [object] The object to query keys on.
  1913. * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
  1914. */
  1915. function isKey(value, object) {
  1916. if (isArray(value)) {
  1917. return false;
  1918. }
  1919. var type = typeof value;
  1920. if (type == 'number' || type == 'symbol' || type == 'boolean' ||
  1921. value == null || isSymbol(value)) {
  1922. return true;
  1923. }
  1924. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
  1925. (object != null && value in Object(object));
  1926. }
  1927. /**
  1928. * Checks if `value` is suitable for use as unique object key.
  1929. *
  1930. * @private
  1931. * @param {*} value The value to check.
  1932. * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
  1933. */
  1934. function isKeyable(value) {
  1935. var type = typeof value;
  1936. return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
  1937. ? (value !== '__proto__')
  1938. : (value === null);
  1939. }
  1940. /**
  1941. * Checks if `func` has its source masked.
  1942. *
  1943. * @private
  1944. * @param {Function} func The function to check.
  1945. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  1946. */
  1947. function isMasked(func) {
  1948. return !!maskSrcKey && (maskSrcKey in func);
  1949. }
  1950. /**
  1951. * Checks if `value` is likely a prototype object.
  1952. *
  1953. * @private
  1954. * @param {*} value The value to check.
  1955. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  1956. */
  1957. function isPrototype(value) {
  1958. var Ctor = value && value.constructor,
  1959. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  1960. return value === proto;
  1961. }
  1962. /**
  1963. * Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
  1964. *
  1965. * @private
  1966. * @param {*} value The value to check.
  1967. * @returns {boolean} Returns `true` if `value` if suitable for strict
  1968. * equality comparisons, else `false`.
  1969. */
  1970. function isStrictComparable(value) {
  1971. return value === value && !isObject(value);
  1972. }
  1973. /**
  1974. * A specialized version of `matchesProperty` for source values suitable
  1975. * for strict equality comparisons, i.e. `===`.
  1976. *
  1977. * @private
  1978. * @param {string} key The key of the property to get.
  1979. * @param {*} srcValue The value to match.
  1980. * @returns {Function} Returns the new spec function.
  1981. */
  1982. function matchesStrictComparable(key, srcValue) {
  1983. return function(object) {
  1984. if (object == null) {
  1985. return false;
  1986. }
  1987. return object[key] === srcValue &&
  1988. (srcValue !== undefined || (key in Object(object)));
  1989. };
  1990. }
  1991. /**
  1992. * Gets the parent value at `path` of `object`.
  1993. *
  1994. * @private
  1995. * @param {Object} object The object to query.
  1996. * @param {Array} path The path to get the parent value of.
  1997. * @returns {*} Returns the parent value.
  1998. */
  1999. function parent(object, path) {
  2000. return path.length == 1 ? object : baseGet(object, baseSlice(path, 0, -1));
  2001. }
  2002. /**
  2003. * Converts `string` to a property path array.
  2004. *
  2005. * @private
  2006. * @param {string} string The string to convert.
  2007. * @returns {Array} Returns the property path array.
  2008. */
  2009. var stringToPath = memoize(function(string) {
  2010. string = toString(string);
  2011. var result = [];
  2012. if (reLeadingDot.test(string)) {
  2013. result.push('');
  2014. }
  2015. string.replace(rePropName, function(match, number, quote, string) {
  2016. result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
  2017. });
  2018. return result;
  2019. });
  2020. /**
  2021. * Converts `value` to a string key if it's not a string or symbol.
  2022. *
  2023. * @private
  2024. * @param {*} value The value to inspect.
  2025. * @returns {string|symbol} Returns the key.
  2026. */
  2027. function toKey(value) {
  2028. if (typeof value == 'string' || isSymbol(value)) {
  2029. return value;
  2030. }
  2031. var result = (value + '');
  2032. return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
  2033. }
  2034. /**
  2035. * Converts `func` to its source code.
  2036. *
  2037. * @private
  2038. * @param {Function} func The function to process.
  2039. * @returns {string} Returns the source code.
  2040. */
  2041. function toSource(func) {
  2042. if (func != null) {
  2043. try {
  2044. return funcToString.call(func);
  2045. } catch (e) {}
  2046. try {
  2047. return (func + '');
  2048. } catch (e) {}
  2049. }
  2050. return '';
  2051. }
  2052. /**
  2053. * Gets the last element of `array`.
  2054. *
  2055. * @static
  2056. * @memberOf _
  2057. * @since 0.1.0
  2058. * @category Array
  2059. * @param {Array} array The array to query.
  2060. * @returns {*} Returns the last element of `array`.
  2061. * @example
  2062. *
  2063. * _.last([1, 2, 3]);
  2064. * // => 3
  2065. */
  2066. function last(array) {
  2067. var length = array ? array.length : 0;
  2068. return length ? array[length - 1] : undefined;
  2069. }
  2070. /**
  2071. * Removes all elements from `array` that `predicate` returns truthy for
  2072. * and returns an array of the removed elements. The predicate is invoked
  2073. * with three arguments: (value, index, array).
  2074. *
  2075. * **Note:** Unlike `_.filter`, this method mutates `array`. Use `_.pull`
  2076. * to pull elements from an array by value.
  2077. *
  2078. * @static
  2079. * @memberOf _
  2080. * @since 2.0.0
  2081. * @category Array
  2082. * @param {Array} array The array to modify.
  2083. * @param {Function} [predicate=_.identity]
  2084. * The function invoked per iteration.
  2085. * @returns {Array} Returns the new array of removed elements.
  2086. * @example
  2087. *
  2088. * var array = [1, 2, 3, 4];
  2089. * var evens = _.remove(array, function(n) {
  2090. * return n % 2 == 0;
  2091. * });
  2092. *
  2093. * console.log(array);
  2094. * // => [1, 3]
  2095. *
  2096. * console.log(evens);
  2097. * // => [2, 4]
  2098. */
  2099. function remove(array, predicate) {
  2100. var result = [];
  2101. if (!(array && array.length)) {
  2102. return result;
  2103. }
  2104. var index = -1,
  2105. indexes = [],
  2106. length = array.length;
  2107. predicate = baseIteratee(predicate, 3);
  2108. while (++index < length) {
  2109. var value = array[index];
  2110. if (predicate(value, index, array)) {
  2111. result.push(value);
  2112. indexes.push(index);
  2113. }
  2114. }
  2115. basePullAt(array, indexes);
  2116. return result;
  2117. }
  2118. /**
  2119. * Creates a function that memoizes the result of `func`. If `resolver` is
  2120. * provided, it determines the cache key for storing the result based on the
  2121. * arguments provided to the memoized function. By default, the first argument
  2122. * provided to the memoized function is used as the map cache key. The `func`
  2123. * is invoked with the `this` binding of the memoized function.
  2124. *
  2125. * **Note:** The cache is exposed as the `cache` property on the memoized
  2126. * function. Its creation may be customized by replacing the `_.memoize.Cache`
  2127. * constructor with one whose instances implement the
  2128. * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
  2129. * method interface of `delete`, `get`, `has`, and `set`.
  2130. *
  2131. * @static
  2132. * @memberOf _
  2133. * @since 0.1.0
  2134. * @category Function
  2135. * @param {Function} func The function to have its output memoized.
  2136. * @param {Function} [resolver] The function to resolve the cache key.
  2137. * @returns {Function} Returns the new memoized function.
  2138. * @example
  2139. *
  2140. * var object = { 'a': 1, 'b': 2 };
  2141. * var other = { 'c': 3, 'd': 4 };
  2142. *
  2143. * var values = _.memoize(_.values);
  2144. * values(object);
  2145. * // => [1, 2]
  2146. *
  2147. * values(other);
  2148. * // => [3, 4]
  2149. *
  2150. * object.a = 2;
  2151. * values(object);
  2152. * // => [1, 2]
  2153. *
  2154. * // Modify the result cache.
  2155. * values.cache.set(object, ['a', 'b']);
  2156. * values(object);
  2157. * // => ['a', 'b']
  2158. *
  2159. * // Replace `_.memoize.Cache`.
  2160. * _.memoize.Cache = WeakMap;
  2161. */
  2162. function memoize(func, resolver) {
  2163. if (typeof func != 'function' || (resolver && typeof resolver != 'function')) {
  2164. throw new TypeError(FUNC_ERROR_TEXT);
  2165. }
  2166. var memoized = function() {
  2167. var args = arguments,
  2168. key = resolver ? resolver.apply(this, args) : args[0],
  2169. cache = memoized.cache;
  2170. if (cache.has(key)) {
  2171. return cache.get(key);
  2172. }
  2173. var result = func.apply(this, args);
  2174. memoized.cache = cache.set(key, result);
  2175. return result;
  2176. };
  2177. memoized.cache = new (memoize.Cache || MapCache);
  2178. return memoized;
  2179. }
  2180. // Assign cache to `_.memoize`.
  2181. memoize.Cache = MapCache;
  2182. /**
  2183. * Performs a
  2184. * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
  2185. * comparison between two values to determine if they are equivalent.
  2186. *
  2187. * @static
  2188. * @memberOf _
  2189. * @since 4.0.0
  2190. * @category Lang
  2191. * @param {*} value The value to compare.
  2192. * @param {*} other The other value to compare.
  2193. * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
  2194. * @example
  2195. *
  2196. * var object = { 'a': 1 };
  2197. * var other = { 'a': 1 };
  2198. *
  2199. * _.eq(object, object);
  2200. * // => true
  2201. *
  2202. * _.eq(object, other);
  2203. * // => false
  2204. *
  2205. * _.eq('a', 'a');
  2206. * // => true
  2207. *
  2208. * _.eq('a', Object('a'));
  2209. * // => false
  2210. *
  2211. * _.eq(NaN, NaN);
  2212. * // => true
  2213. */
  2214. function eq(value, other) {
  2215. return value === other || (value !== value && other !== other);
  2216. }
  2217. /**
  2218. * Checks if `value` is likely an `arguments` object.
  2219. *
  2220. * @static
  2221. * @memberOf _
  2222. * @since 0.1.0
  2223. * @category Lang
  2224. * @param {*} value The value to check.
  2225. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  2226. * else `false`.
  2227. * @example
  2228. *
  2229. * _.isArguments(function() { return arguments; }());
  2230. * // => true
  2231. *
  2232. * _.isArguments([1, 2, 3]);
  2233. * // => false
  2234. */
  2235. function isArguments(value) {
  2236. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2237. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  2238. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  2239. }
  2240. /**
  2241. * Checks if `value` is classified as an `Array` object.
  2242. *
  2243. * @static
  2244. * @memberOf _
  2245. * @since 0.1.0
  2246. * @category Lang
  2247. * @param {*} value The value to check.
  2248. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  2249. * @example
  2250. *
  2251. * _.isArray([1, 2, 3]);
  2252. * // => true
  2253. *
  2254. * _.isArray(document.body.children);
  2255. * // => false
  2256. *
  2257. * _.isArray('abc');
  2258. * // => false
  2259. *
  2260. * _.isArray(_.noop);
  2261. * // => false
  2262. */
  2263. var isArray = Array.isArray;
  2264. /**
  2265. * Checks if `value` is array-like. A value is considered array-like if it's
  2266. * not a function and has a `value.length` that's an integer greater than or
  2267. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  2268. *
  2269. * @static
  2270. * @memberOf _
  2271. * @since 4.0.0
  2272. * @category Lang
  2273. * @param {*} value The value to check.
  2274. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  2275. * @example
  2276. *
  2277. * _.isArrayLike([1, 2, 3]);
  2278. * // => true
  2279. *
  2280. * _.isArrayLike(document.body.children);
  2281. * // => true
  2282. *
  2283. * _.isArrayLike('abc');
  2284. * // => true
  2285. *
  2286. * _.isArrayLike(_.noop);
  2287. * // => false
  2288. */
  2289. function isArrayLike(value) {
  2290. return value != null && isLength(value.length) && !isFunction(value);
  2291. }
  2292. /**
  2293. * This method is like `_.isArrayLike` except that it also checks if `value`
  2294. * is an object.
  2295. *
  2296. * @static
  2297. * @memberOf _
  2298. * @since 4.0.0
  2299. * @category Lang
  2300. * @param {*} value The value to check.
  2301. * @returns {boolean} Returns `true` if `value` is an array-like object,
  2302. * else `false`.
  2303. * @example
  2304. *
  2305. * _.isArrayLikeObject([1, 2, 3]);
  2306. * // => true
  2307. *
  2308. * _.isArrayLikeObject(document.body.children);
  2309. * // => true
  2310. *
  2311. * _.isArrayLikeObject('abc');
  2312. * // => false
  2313. *
  2314. * _.isArrayLikeObject(_.noop);
  2315. * // => false
  2316. */
  2317. function isArrayLikeObject(value) {
  2318. return isObjectLike(value) && isArrayLike(value);
  2319. }
  2320. /**
  2321. * Checks if `value` is classified as a `Function` object.
  2322. *
  2323. * @static
  2324. * @memberOf _
  2325. * @since 0.1.0
  2326. * @category Lang
  2327. * @param {*} value The value to check.
  2328. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  2329. * @example
  2330. *
  2331. * _.isFunction(_);
  2332. * // => true
  2333. *
  2334. * _.isFunction(/abc/);
  2335. * // => false
  2336. */
  2337. function isFunction(value) {
  2338. // The use of `Object#toString` avoids issues with the `typeof` operator
  2339. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  2340. var tag = isObject(value) ? objectToString.call(value) : '';
  2341. return tag == funcTag || tag == genTag;
  2342. }
  2343. /**
  2344. * Checks if `value` is a valid array-like length.
  2345. *
  2346. * **Note:** This method is loosely based on
  2347. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  2348. *
  2349. * @static
  2350. * @memberOf _
  2351. * @since 4.0.0
  2352. * @category Lang
  2353. * @param {*} value The value to check.
  2354. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  2355. * @example
  2356. *
  2357. * _.isLength(3);
  2358. * // => true
  2359. *
  2360. * _.isLength(Number.MIN_VALUE);
  2361. * // => false
  2362. *
  2363. * _.isLength(Infinity);
  2364. * // => false
  2365. *
  2366. * _.isLength('3');
  2367. * // => false
  2368. */
  2369. function isLength(value) {
  2370. return typeof value == 'number' &&
  2371. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  2372. }
  2373. /**
  2374. * Checks if `value` is the
  2375. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  2376. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  2377. *
  2378. * @static
  2379. * @memberOf _
  2380. * @since 0.1.0
  2381. * @category Lang
  2382. * @param {*} value The value to check.
  2383. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  2384. * @example
  2385. *
  2386. * _.isObject({});
  2387. * // => true
  2388. *
  2389. * _.isObject([1, 2, 3]);
  2390. * // => true
  2391. *
  2392. * _.isObject(_.noop);
  2393. * // => true
  2394. *
  2395. * _.isObject(null);
  2396. * // => false
  2397. */
  2398. function isObject(value) {
  2399. var type = typeof value;
  2400. return !!value && (type == 'object' || type == 'function');
  2401. }
  2402. /**
  2403. * Checks if `value` is object-like. A value is object-like if it's not `null`
  2404. * and has a `typeof` result of "object".
  2405. *
  2406. * @static
  2407. * @memberOf _
  2408. * @since 4.0.0
  2409. * @category Lang
  2410. * @param {*} value The value to check.
  2411. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  2412. * @example
  2413. *
  2414. * _.isObjectLike({});
  2415. * // => true
  2416. *
  2417. * _.isObjectLike([1, 2, 3]);
  2418. * // => true
  2419. *
  2420. * _.isObjectLike(_.noop);
  2421. * // => false
  2422. *
  2423. * _.isObjectLike(null);
  2424. * // => false
  2425. */
  2426. function isObjectLike(value) {
  2427. return !!value && typeof value == 'object';
  2428. }
  2429. /**
  2430. * Checks if `value` is classified as a `Symbol` primitive or object.
  2431. *
  2432. * @static
  2433. * @memberOf _
  2434. * @since 4.0.0
  2435. * @category Lang
  2436. * @param {*} value The value to check.
  2437. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  2438. * @example
  2439. *
  2440. * _.isSymbol(Symbol.iterator);
  2441. * // => true
  2442. *
  2443. * _.isSymbol('abc');
  2444. * // => false
  2445. */
  2446. function isSymbol(value) {
  2447. return typeof value == 'symbol' ||
  2448. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  2449. }
  2450. /**
  2451. * Checks if `value` is classified as a typed array.
  2452. *
  2453. * @static
  2454. * @memberOf _
  2455. * @since 3.0.0
  2456. * @category Lang
  2457. * @param {*} value The value to check.
  2458. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
  2459. * @example
  2460. *
  2461. * _.isTypedArray(new Uint8Array);
  2462. * // => true
  2463. *
  2464. * _.isTypedArray([]);
  2465. * // => false
  2466. */
  2467. var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  2468. /**
  2469. * Converts `value` to a string. An empty string is returned for `null`
  2470. * and `undefined` values. The sign of `-0` is preserved.
  2471. *
  2472. * @static
  2473. * @memberOf _
  2474. * @since 4.0.0
  2475. * @category Lang
  2476. * @param {*} value The value to process.
  2477. * @returns {string} Returns the string.
  2478. * @example
  2479. *
  2480. * _.toString(null);
  2481. * // => ''
  2482. *
  2483. * _.toString(-0);
  2484. * // => '-0'
  2485. *
  2486. * _.toString([1, 2, 3]);
  2487. * // => '1,2,3'
  2488. */
  2489. function toString(value) {
  2490. return value == null ? '' : baseToString(value);
  2491. }
  2492. /**
  2493. * Gets the value at `path` of `object`. If the resolved value is
  2494. * `undefined`, the `defaultValue` is returned in its place.
  2495. *
  2496. * @static
  2497. * @memberOf _
  2498. * @since 3.7.0
  2499. * @category Object
  2500. * @param {Object} object The object to query.
  2501. * @param {Array|string} path The path of the property to get.
  2502. * @param {*} [defaultValue] The value returned for `undefined` resolved values.
  2503. * @returns {*} Returns the resolved value.
  2504. * @example
  2505. *
  2506. * var object = { 'a': [{ 'b': { 'c': 3 } }] };
  2507. *
  2508. * _.get(object, 'a[0].b.c');
  2509. * // => 3
  2510. *
  2511. * _.get(object, ['a', '0', 'b', 'c']);
  2512. * // => 3
  2513. *
  2514. * _.get(object, 'a.b.c', 'default');
  2515. * // => 'default'
  2516. */
  2517. function get(object, path, defaultValue) {
  2518. var result = object == null ? undefined : baseGet(object, path);
  2519. return result === undefined ? defaultValue : result;
  2520. }
  2521. /**
  2522. * Checks if `path` is a direct or inherited property of `object`.
  2523. *
  2524. * @static
  2525. * @memberOf _
  2526. * @since 4.0.0
  2527. * @category Object
  2528. * @param {Object} object The object to query.
  2529. * @param {Array|string} path The path to check.
  2530. * @returns {boolean} Returns `true` if `path` exists, else `false`.
  2531. * @example
  2532. *
  2533. * var object = _.create({ 'a': _.create({ 'b': 2 }) });
  2534. *
  2535. * _.hasIn(object, 'a');
  2536. * // => true
  2537. *
  2538. * _.hasIn(object, 'a.b');
  2539. * // => true
  2540. *
  2541. * _.hasIn(object, ['a', 'b']);
  2542. * // => true
  2543. *
  2544. * _.hasIn(object, 'b');
  2545. * // => false
  2546. */
  2547. function hasIn(object, path) {
  2548. return object != null && hasPath(object, path, baseHasIn);
  2549. }
  2550. /**
  2551. * Creates an array of the own enumerable property names of `object`.
  2552. *
  2553. * **Note:** Non-object values are coerced to objects. See the
  2554. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  2555. * for more details.
  2556. *
  2557. * @static
  2558. * @since 0.1.0
  2559. * @memberOf _
  2560. * @category Object
  2561. * @param {Object} object The object to query.
  2562. * @returns {Array} Returns the array of property names.
  2563. * @example
  2564. *
  2565. * function Foo() {
  2566. * this.a = 1;
  2567. * this.b = 2;
  2568. * }
  2569. *
  2570. * Foo.prototype.c = 3;
  2571. *
  2572. * _.keys(new Foo);
  2573. * // => ['a', 'b'] (iteration order is not guaranteed)
  2574. *
  2575. * _.keys('hi');
  2576. * // => ['0', '1']
  2577. */
  2578. function keys(object) {
  2579. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  2580. }
  2581. /**
  2582. * This method returns the first argument it receives.
  2583. *
  2584. * @static
  2585. * @since 0.1.0
  2586. * @memberOf _
  2587. * @category Util
  2588. * @param {*} value Any value.
  2589. * @returns {*} Returns `value`.
  2590. * @example
  2591. *
  2592. * var object = { 'a': 1 };
  2593. *
  2594. * console.log(_.identity(object) === object);
  2595. * // => true
  2596. */
  2597. function identity(value) {
  2598. return value;
  2599. }
  2600. /**
  2601. * Creates a function that returns the value at `path` of a given object.
  2602. *
  2603. * @static
  2604. * @memberOf _
  2605. * @since 2.4.0
  2606. * @category Util
  2607. * @param {Array|string} path The path of the property to get.
  2608. * @returns {Function} Returns the new accessor function.
  2609. * @example
  2610. *
  2611. * var objects = [
  2612. * { 'a': { 'b': 2 } },
  2613. * { 'a': { 'b': 1 } }
  2614. * ];
  2615. *
  2616. * _.map(objects, _.property('a.b'));
  2617. * // => [2, 1]
  2618. *
  2619. * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
  2620. * // => [1, 2]
  2621. */
  2622. function property(path) {
  2623. return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
  2624. }
  2625. module.exports = remove;
  2626. /***/ }),
  2627. /***/ 52:
  2628. /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
  2629. /**
  2630. * lodash (Custom Build) <https://lodash.com/>
  2631. * Build: `lodash modularize exports="npm" -o ./`
  2632. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  2633. * Released under MIT license <https://lodash.com/license>
  2634. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  2635. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  2636. */
  2637. /** Used as references for various `Number` constants. */
  2638. var MAX_SAFE_INTEGER = 9007199254740991;
  2639. /** `Object#toString` result references. */
  2640. var argsTag = '[object Arguments]',
  2641. funcTag = '[object Function]',
  2642. genTag = '[object GeneratorFunction]',
  2643. mapTag = '[object Map]',
  2644. objectTag = '[object Object]',
  2645. promiseTag = '[object Promise]',
  2646. setTag = '[object Set]',
  2647. weakMapTag = '[object WeakMap]';
  2648. var dataViewTag = '[object DataView]';
  2649. /**
  2650. * Used to match `RegExp`
  2651. * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
  2652. */
  2653. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  2654. /** Used to detect host constructors (Safari). */
  2655. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  2656. /** Used to detect unsigned integer values. */
  2657. var reIsUint = /^(?:0|[1-9]\d*)$/;
  2658. /** Detect free variable `global` from Node.js. */
  2659. var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g;
  2660. /** Detect free variable `self`. */
  2661. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  2662. /** Used as a reference to the global object. */
  2663. var root = freeGlobal || freeSelf || Function('return this')();
  2664. /**
  2665. * A specialized version of `_.map` for arrays without support for iteratee
  2666. * shorthands.
  2667. *
  2668. * @private
  2669. * @param {Array} [array] The array to iterate over.
  2670. * @param {Function} iteratee The function invoked per iteration.
  2671. * @returns {Array} Returns the new mapped array.
  2672. */
  2673. function arrayMap(array, iteratee) {
  2674. var index = -1,
  2675. length = array ? array.length : 0,
  2676. result = Array(length);
  2677. while (++index < length) {
  2678. result[index] = iteratee(array[index], index, array);
  2679. }
  2680. return result;
  2681. }
  2682. /**
  2683. * The base implementation of `_.times` without support for iteratee shorthands
  2684. * or max array length checks.
  2685. *
  2686. * @private
  2687. * @param {number} n The number of times to invoke `iteratee`.
  2688. * @param {Function} iteratee The function invoked per iteration.
  2689. * @returns {Array} Returns the array of results.
  2690. */
  2691. function baseTimes(n, iteratee) {
  2692. var index = -1,
  2693. result = Array(n);
  2694. while (++index < n) {
  2695. result[index] = iteratee(index);
  2696. }
  2697. return result;
  2698. }
  2699. /**
  2700. * The base implementation of `_.toPairs` and `_.toPairsIn` which creates an array
  2701. * of key-value pairs for `object` corresponding to the property names of `props`.
  2702. *
  2703. * @private
  2704. * @param {Object} object The object to query.
  2705. * @param {Array} props The property names to get values for.
  2706. * @returns {Object} Returns the key-value pairs.
  2707. */
  2708. function baseToPairs(object, props) {
  2709. return arrayMap(props, function(key) {
  2710. return [key, object[key]];
  2711. });
  2712. }
  2713. /**
  2714. * Gets the value at `key` of `object`.
  2715. *
  2716. * @private
  2717. * @param {Object} [object] The object to query.
  2718. * @param {string} key The key of the property to get.
  2719. * @returns {*} Returns the property value.
  2720. */
  2721. function getValue(object, key) {
  2722. return object == null ? undefined : object[key];
  2723. }
  2724. /**
  2725. * Checks if `value` is a host object in IE < 9.
  2726. *
  2727. * @private
  2728. * @param {*} value The value to check.
  2729. * @returns {boolean} Returns `true` if `value` is a host object, else `false`.
  2730. */
  2731. function isHostObject(value) {
  2732. // Many host objects are `Object` objects that can coerce to strings
  2733. // despite having improperly defined `toString` methods.
  2734. var result = false;
  2735. if (value != null && typeof value.toString != 'function') {
  2736. try {
  2737. result = !!(value + '');
  2738. } catch (e) {}
  2739. }
  2740. return result;
  2741. }
  2742. /**
  2743. * Converts `map` to its key-value pairs.
  2744. *
  2745. * @private
  2746. * @param {Object} map The map to convert.
  2747. * @returns {Array} Returns the key-value pairs.
  2748. */
  2749. function mapToArray(map) {
  2750. var index = -1,
  2751. result = Array(map.size);
  2752. map.forEach(function(value, key) {
  2753. result[++index] = [key, value];
  2754. });
  2755. return result;
  2756. }
  2757. /**
  2758. * Creates a unary function that invokes `func` with its argument transformed.
  2759. *
  2760. * @private
  2761. * @param {Function} func The function to wrap.
  2762. * @param {Function} transform The argument transform.
  2763. * @returns {Function} Returns the new function.
  2764. */
  2765. function overArg(func, transform) {
  2766. return function(arg) {
  2767. return func(transform(arg));
  2768. };
  2769. }
  2770. /**
  2771. * Converts `set` to its value-value pairs.
  2772. *
  2773. * @private
  2774. * @param {Object} set The set to convert.
  2775. * @returns {Array} Returns the value-value pairs.
  2776. */
  2777. function setToPairs(set) {
  2778. var index = -1,
  2779. result = Array(set.size);
  2780. set.forEach(function(value) {
  2781. result[++index] = [value, value];
  2782. });
  2783. return result;
  2784. }
  2785. /** Used for built-in method references. */
  2786. var funcProto = Function.prototype,
  2787. objectProto = Object.prototype;
  2788. /** Used to detect overreaching core-js shims. */
  2789. var coreJsData = root['__core-js_shared__'];
  2790. /** Used to detect methods masquerading as native. */
  2791. var maskSrcKey = (function() {
  2792. var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
  2793. return uid ? ('Symbol(src)_1.' + uid) : '';
  2794. }());
  2795. /** Used to resolve the decompiled source of functions. */
  2796. var funcToString = funcProto.toString;
  2797. /** Used to check objects for own properties. */
  2798. var hasOwnProperty = objectProto.hasOwnProperty;
  2799. /**
  2800. * Used to resolve the
  2801. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  2802. * of values.
  2803. */
  2804. var objectToString = objectProto.toString;
  2805. /** Used to detect if a method is native. */
  2806. var reIsNative = RegExp('^' +
  2807. funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&')
  2808. .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
  2809. );
  2810. /** Built-in value references. */
  2811. var propertyIsEnumerable = objectProto.propertyIsEnumerable;
  2812. /* Built-in method references for those with the same name as other `lodash` methods. */
  2813. var nativeKeys = overArg(Object.keys, Object);
  2814. /* Built-in method references that are verified to be native. */
  2815. var DataView = getNative(root, 'DataView'),
  2816. Map = getNative(root, 'Map'),
  2817. Promise = getNative(root, 'Promise'),
  2818. Set = getNative(root, 'Set'),
  2819. WeakMap = getNative(root, 'WeakMap');
  2820. /** Used to detect maps, sets, and weakmaps. */
  2821. var dataViewCtorString = toSource(DataView),
  2822. mapCtorString = toSource(Map),
  2823. promiseCtorString = toSource(Promise),
  2824. setCtorString = toSource(Set),
  2825. weakMapCtorString = toSource(WeakMap);
  2826. /**
  2827. * Creates an array of the enumerable property names of the array-like `value`.
  2828. *
  2829. * @private
  2830. * @param {*} value The value to query.
  2831. * @param {boolean} inherited Specify returning inherited property names.
  2832. * @returns {Array} Returns the array of property names.
  2833. */
  2834. function arrayLikeKeys(value, inherited) {
  2835. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  2836. // Safari 9 makes `arguments.length` enumerable in strict mode.
  2837. var result = (isArray(value) || isArguments(value))
  2838. ? baseTimes(value.length, String)
  2839. : [];
  2840. var length = result.length,
  2841. skipIndexes = !!length;
  2842. for (var key in value) {
  2843. if ((inherited || hasOwnProperty.call(value, key)) &&
  2844. !(skipIndexes && (key == 'length' || isIndex(key, length)))) {
  2845. result.push(key);
  2846. }
  2847. }
  2848. return result;
  2849. }
  2850. /**
  2851. * The base implementation of `getTag`.
  2852. *
  2853. * @private
  2854. * @param {*} value The value to query.
  2855. * @returns {string} Returns the `toStringTag`.
  2856. */
  2857. function baseGetTag(value) {
  2858. return objectToString.call(value);
  2859. }
  2860. /**
  2861. * The base implementation of `_.isNative` without bad shim checks.
  2862. *
  2863. * @private
  2864. * @param {*} value The value to check.
  2865. * @returns {boolean} Returns `true` if `value` is a native function,
  2866. * else `false`.
  2867. */
  2868. function baseIsNative(value) {
  2869. if (!isObject(value) || isMasked(value)) {
  2870. return false;
  2871. }
  2872. var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor;
  2873. return pattern.test(toSource(value));
  2874. }
  2875. /**
  2876. * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
  2877. *
  2878. * @private
  2879. * @param {Object} object The object to query.
  2880. * @returns {Array} Returns the array of property names.
  2881. */
  2882. function baseKeys(object) {
  2883. if (!isPrototype(object)) {
  2884. return nativeKeys(object);
  2885. }
  2886. var result = [];
  2887. for (var key in Object(object)) {
  2888. if (hasOwnProperty.call(object, key) && key != 'constructor') {
  2889. result.push(key);
  2890. }
  2891. }
  2892. return result;
  2893. }
  2894. /**
  2895. * Creates a `_.toPairs` or `_.toPairsIn` function.
  2896. *
  2897. * @private
  2898. * @param {Function} keysFunc The function to get the keys of a given object.
  2899. * @returns {Function} Returns the new pairs function.
  2900. */
  2901. function createToPairs(keysFunc) {
  2902. return function(object) {
  2903. var tag = getTag(object);
  2904. if (tag == mapTag) {
  2905. return mapToArray(object);
  2906. }
  2907. if (tag == setTag) {
  2908. return setToPairs(object);
  2909. }
  2910. return baseToPairs(object, keysFunc(object));
  2911. };
  2912. }
  2913. /**
  2914. * Gets the native function at `key` of `object`.
  2915. *
  2916. * @private
  2917. * @param {Object} object The object to query.
  2918. * @param {string} key The key of the method to get.
  2919. * @returns {*} Returns the function if it's native, else `undefined`.
  2920. */
  2921. function getNative(object, key) {
  2922. var value = getValue(object, key);
  2923. return baseIsNative(value) ? value : undefined;
  2924. }
  2925. /**
  2926. * Gets the `toStringTag` of `value`.
  2927. *
  2928. * @private
  2929. * @param {*} value The value to query.
  2930. * @returns {string} Returns the `toStringTag`.
  2931. */
  2932. var getTag = baseGetTag;
  2933. // Fallback for data views, maps, sets, and weak maps in IE 11,
  2934. // for data views in Edge < 14, and promises in Node.js.
  2935. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
  2936. (Map && getTag(new Map) != mapTag) ||
  2937. (Promise && getTag(Promise.resolve()) != promiseTag) ||
  2938. (Set && getTag(new Set) != setTag) ||
  2939. (WeakMap && getTag(new WeakMap) != weakMapTag)) {
  2940. getTag = function(value) {
  2941. var result = objectToString.call(value),
  2942. Ctor = result == objectTag ? value.constructor : undefined,
  2943. ctorString = Ctor ? toSource(Ctor) : undefined;
  2944. if (ctorString) {
  2945. switch (ctorString) {
  2946. case dataViewCtorString: return dataViewTag;
  2947. case mapCtorString: return mapTag;
  2948. case promiseCtorString: return promiseTag;
  2949. case setCtorString: return setTag;
  2950. case weakMapCtorString: return weakMapTag;
  2951. }
  2952. }
  2953. return result;
  2954. };
  2955. }
  2956. /**
  2957. * Checks if `value` is a valid array-like index.
  2958. *
  2959. * @private
  2960. * @param {*} value The value to check.
  2961. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
  2962. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
  2963. */
  2964. function isIndex(value, length) {
  2965. length = length == null ? MAX_SAFE_INTEGER : length;
  2966. return !!length &&
  2967. (typeof value == 'number' || reIsUint.test(value)) &&
  2968. (value > -1 && value % 1 == 0 && value < length);
  2969. }
  2970. /**
  2971. * Checks if `func` has its source masked.
  2972. *
  2973. * @private
  2974. * @param {Function} func The function to check.
  2975. * @returns {boolean} Returns `true` if `func` is masked, else `false`.
  2976. */
  2977. function isMasked(func) {
  2978. return !!maskSrcKey && (maskSrcKey in func);
  2979. }
  2980. /**
  2981. * Checks if `value` is likely a prototype object.
  2982. *
  2983. * @private
  2984. * @param {*} value The value to check.
  2985. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
  2986. */
  2987. function isPrototype(value) {
  2988. var Ctor = value && value.constructor,
  2989. proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;
  2990. return value === proto;
  2991. }
  2992. /**
  2993. * Converts `func` to its source code.
  2994. *
  2995. * @private
  2996. * @param {Function} func The function to process.
  2997. * @returns {string} Returns the source code.
  2998. */
  2999. function toSource(func) {
  3000. if (func != null) {
  3001. try {
  3002. return funcToString.call(func);
  3003. } catch (e) {}
  3004. try {
  3005. return (func + '');
  3006. } catch (e) {}
  3007. }
  3008. return '';
  3009. }
  3010. /**
  3011. * Checks if `value` is likely an `arguments` object.
  3012. *
  3013. * @static
  3014. * @memberOf _
  3015. * @since 0.1.0
  3016. * @category Lang
  3017. * @param {*} value The value to check.
  3018. * @returns {boolean} Returns `true` if `value` is an `arguments` object,
  3019. * else `false`.
  3020. * @example
  3021. *
  3022. * _.isArguments(function() { return arguments; }());
  3023. * // => true
  3024. *
  3025. * _.isArguments([1, 2, 3]);
  3026. * // => false
  3027. */
  3028. function isArguments(value) {
  3029. // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
  3030. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
  3031. (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
  3032. }
  3033. /**
  3034. * Checks if `value` is classified as an `Array` object.
  3035. *
  3036. * @static
  3037. * @memberOf _
  3038. * @since 0.1.0
  3039. * @category Lang
  3040. * @param {*} value The value to check.
  3041. * @returns {boolean} Returns `true` if `value` is an array, else `false`.
  3042. * @example
  3043. *
  3044. * _.isArray([1, 2, 3]);
  3045. * // => true
  3046. *
  3047. * _.isArray(document.body.children);
  3048. * // => false
  3049. *
  3050. * _.isArray('abc');
  3051. * // => false
  3052. *
  3053. * _.isArray(_.noop);
  3054. * // => false
  3055. */
  3056. var isArray = Array.isArray;
  3057. /**
  3058. * Checks if `value` is array-like. A value is considered array-like if it's
  3059. * not a function and has a `value.length` that's an integer greater than or
  3060. * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
  3061. *
  3062. * @static
  3063. * @memberOf _
  3064. * @since 4.0.0
  3065. * @category Lang
  3066. * @param {*} value The value to check.
  3067. * @returns {boolean} Returns `true` if `value` is array-like, else `false`.
  3068. * @example
  3069. *
  3070. * _.isArrayLike([1, 2, 3]);
  3071. * // => true
  3072. *
  3073. * _.isArrayLike(document.body.children);
  3074. * // => true
  3075. *
  3076. * _.isArrayLike('abc');
  3077. * // => true
  3078. *
  3079. * _.isArrayLike(_.noop);
  3080. * // => false
  3081. */
  3082. function isArrayLike(value) {
  3083. return value != null && isLength(value.length) && !isFunction(value);
  3084. }
  3085. /**
  3086. * This method is like `_.isArrayLike` except that it also checks if `value`
  3087. * is an object.
  3088. *
  3089. * @static
  3090. * @memberOf _
  3091. * @since 4.0.0
  3092. * @category Lang
  3093. * @param {*} value The value to check.
  3094. * @returns {boolean} Returns `true` if `value` is an array-like object,
  3095. * else `false`.
  3096. * @example
  3097. *
  3098. * _.isArrayLikeObject([1, 2, 3]);
  3099. * // => true
  3100. *
  3101. * _.isArrayLikeObject(document.body.children);
  3102. * // => true
  3103. *
  3104. * _.isArrayLikeObject('abc');
  3105. * // => false
  3106. *
  3107. * _.isArrayLikeObject(_.noop);
  3108. * // => false
  3109. */
  3110. function isArrayLikeObject(value) {
  3111. return isObjectLike(value) && isArrayLike(value);
  3112. }
  3113. /**
  3114. * Checks if `value` is classified as a `Function` object.
  3115. *
  3116. * @static
  3117. * @memberOf _
  3118. * @since 0.1.0
  3119. * @category Lang
  3120. * @param {*} value The value to check.
  3121. * @returns {boolean} Returns `true` if `value` is a function, else `false`.
  3122. * @example
  3123. *
  3124. * _.isFunction(_);
  3125. * // => true
  3126. *
  3127. * _.isFunction(/abc/);
  3128. * // => false
  3129. */
  3130. function isFunction(value) {
  3131. // The use of `Object#toString` avoids issues with the `typeof` operator
  3132. // in Safari 8-9 which returns 'object' for typed array and other constructors.
  3133. var tag = isObject(value) ? objectToString.call(value) : '';
  3134. return tag == funcTag || tag == genTag;
  3135. }
  3136. /**
  3137. * Checks if `value` is a valid array-like length.
  3138. *
  3139. * **Note:** This method is loosely based on
  3140. * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
  3141. *
  3142. * @static
  3143. * @memberOf _
  3144. * @since 4.0.0
  3145. * @category Lang
  3146. * @param {*} value The value to check.
  3147. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
  3148. * @example
  3149. *
  3150. * _.isLength(3);
  3151. * // => true
  3152. *
  3153. * _.isLength(Number.MIN_VALUE);
  3154. * // => false
  3155. *
  3156. * _.isLength(Infinity);
  3157. * // => false
  3158. *
  3159. * _.isLength('3');
  3160. * // => false
  3161. */
  3162. function isLength(value) {
  3163. return typeof value == 'number' &&
  3164. value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  3165. }
  3166. /**
  3167. * Checks if `value` is the
  3168. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  3169. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  3170. *
  3171. * @static
  3172. * @memberOf _
  3173. * @since 0.1.0
  3174. * @category Lang
  3175. * @param {*} value The value to check.
  3176. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  3177. * @example
  3178. *
  3179. * _.isObject({});
  3180. * // => true
  3181. *
  3182. * _.isObject([1, 2, 3]);
  3183. * // => true
  3184. *
  3185. * _.isObject(_.noop);
  3186. * // => true
  3187. *
  3188. * _.isObject(null);
  3189. * // => false
  3190. */
  3191. function isObject(value) {
  3192. var type = typeof value;
  3193. return !!value && (type == 'object' || type == 'function');
  3194. }
  3195. /**
  3196. * Checks if `value` is object-like. A value is object-like if it's not `null`
  3197. * and has a `typeof` result of "object".
  3198. *
  3199. * @static
  3200. * @memberOf _
  3201. * @since 4.0.0
  3202. * @category Lang
  3203. * @param {*} value The value to check.
  3204. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  3205. * @example
  3206. *
  3207. * _.isObjectLike({});
  3208. * // => true
  3209. *
  3210. * _.isObjectLike([1, 2, 3]);
  3211. * // => true
  3212. *
  3213. * _.isObjectLike(_.noop);
  3214. * // => false
  3215. *
  3216. * _.isObjectLike(null);
  3217. * // => false
  3218. */
  3219. function isObjectLike(value) {
  3220. return !!value && typeof value == 'object';
  3221. }
  3222. /**
  3223. * Creates an array of the own enumerable property names of `object`.
  3224. *
  3225. * **Note:** Non-object values are coerced to objects. See the
  3226. * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
  3227. * for more details.
  3228. *
  3229. * @static
  3230. * @since 0.1.0
  3231. * @memberOf _
  3232. * @category Object
  3233. * @param {Object} object The object to query.
  3234. * @returns {Array} Returns the array of property names.
  3235. * @example
  3236. *
  3237. * function Foo() {
  3238. * this.a = 1;
  3239. * this.b = 2;
  3240. * }
  3241. *
  3242. * Foo.prototype.c = 3;
  3243. *
  3244. * _.keys(new Foo);
  3245. * // => ['a', 'b'] (iteration order is not guaranteed)
  3246. *
  3247. * _.keys('hi');
  3248. * // => ['0', '1']
  3249. */
  3250. function keys(object) {
  3251. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  3252. }
  3253. /**
  3254. * Creates an array of own enumerable string keyed-value pairs for `object`
  3255. * which can be consumed by `_.fromPairs`. If `object` is a map or set, its
  3256. * entries are returned.
  3257. *
  3258. * @static
  3259. * @memberOf _
  3260. * @since 4.0.0
  3261. * @alias entries
  3262. * @category Object
  3263. * @param {Object} object The object to query.
  3264. * @returns {Array} Returns the key-value pairs.
  3265. * @example
  3266. *
  3267. * function Foo() {
  3268. * this.a = 1;
  3269. * this.b = 2;
  3270. * }
  3271. *
  3272. * Foo.prototype.c = 3;
  3273. *
  3274. * _.toPairs(new Foo);
  3275. * // => [['a', 1], ['b', 2]] (iteration order is not guaranteed)
  3276. */
  3277. var toPairs = createToPairs(keys);
  3278. module.exports = toPairs;
  3279. /***/ }),
  3280. /***/ 107:
  3281. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  3282. (function (global, factory) {
  3283. true ? factory() :
  3284. 0;
  3285. }(this, (function () { 'use strict';
  3286. /**
  3287. * @this {Promise}
  3288. */
  3289. function finallyConstructor(callback) {
  3290. var constructor = this.constructor;
  3291. return this.then(
  3292. function(value) {
  3293. // @ts-ignore
  3294. return constructor.resolve(callback()).then(function() {
  3295. return value;
  3296. });
  3297. },
  3298. function(reason) {
  3299. // @ts-ignore
  3300. return constructor.resolve(callback()).then(function() {
  3301. // @ts-ignore
  3302. return constructor.reject(reason);
  3303. });
  3304. }
  3305. );
  3306. }
  3307. // Store setTimeout reference so promise-polyfill will be unaffected by
  3308. // other code modifying setTimeout (like sinon.useFakeTimers())
  3309. var setTimeoutFunc = setTimeout;
  3310. function isArray(x) {
  3311. return Boolean(x && typeof x.length !== 'undefined');
  3312. }
  3313. function noop() {}
  3314. // Polyfill for Function.prototype.bind
  3315. function bind(fn, thisArg) {
  3316. return function() {
  3317. fn.apply(thisArg, arguments);
  3318. };
  3319. }
  3320. /**
  3321. * @constructor
  3322. * @param {Function} fn
  3323. */
  3324. function Promise(fn) {
  3325. if (!(this instanceof Promise))
  3326. throw new TypeError('Promises must be constructed via new');
  3327. if (typeof fn !== 'function') throw new TypeError('not a function');
  3328. /** @type {!number} */
  3329. this._state = 0;
  3330. /** @type {!boolean} */
  3331. this._handled = false;
  3332. /** @type {Promise|undefined} */
  3333. this._value = undefined;
  3334. /** @type {!Array<!Function>} */
  3335. this._deferreds = [];
  3336. doResolve(fn, this);
  3337. }
  3338. function handle(self, deferred) {
  3339. while (self._state === 3) {
  3340. self = self._value;
  3341. }
  3342. if (self._state === 0) {
  3343. self._deferreds.push(deferred);
  3344. return;
  3345. }
  3346. self._handled = true;
  3347. Promise._immediateFn(function() {
  3348. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  3349. if (cb === null) {
  3350. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  3351. return;
  3352. }
  3353. var ret;
  3354. try {
  3355. ret = cb(self._value);
  3356. } catch (e) {
  3357. reject(deferred.promise, e);
  3358. return;
  3359. }
  3360. resolve(deferred.promise, ret);
  3361. });
  3362. }
  3363. function resolve(self, newValue) {
  3364. try {
  3365. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  3366. if (newValue === self)
  3367. throw new TypeError('A promise cannot be resolved with itself.');
  3368. if (
  3369. newValue &&
  3370. (typeof newValue === 'object' || typeof newValue === 'function')
  3371. ) {
  3372. var then = newValue.then;
  3373. if (newValue instanceof Promise) {
  3374. self._state = 3;
  3375. self._value = newValue;
  3376. finale(self);
  3377. return;
  3378. } else if (typeof then === 'function') {
  3379. doResolve(bind(then, newValue), self);
  3380. return;
  3381. }
  3382. }
  3383. self._state = 1;
  3384. self._value = newValue;
  3385. finale(self);
  3386. } catch (e) {
  3387. reject(self, e);
  3388. }
  3389. }
  3390. function reject(self, newValue) {
  3391. self._state = 2;
  3392. self._value = newValue;
  3393. finale(self);
  3394. }
  3395. function finale(self) {
  3396. if (self._state === 2 && self._deferreds.length === 0) {
  3397. Promise._immediateFn(function() {
  3398. if (!self._handled) {
  3399. Promise._unhandledRejectionFn(self._value);
  3400. }
  3401. });
  3402. }
  3403. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  3404. handle(self, self._deferreds[i]);
  3405. }
  3406. self._deferreds = null;
  3407. }
  3408. /**
  3409. * @constructor
  3410. */
  3411. function Handler(onFulfilled, onRejected, promise) {
  3412. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  3413. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  3414. this.promise = promise;
  3415. }
  3416. /**
  3417. * Take a potentially misbehaving resolver function and make sure
  3418. * onFulfilled and onRejected are only called once.
  3419. *
  3420. * Makes no guarantees about asynchrony.
  3421. */
  3422. function doResolve(fn, self) {
  3423. var done = false;
  3424. try {
  3425. fn(
  3426. function(value) {
  3427. if (done) return;
  3428. done = true;
  3429. resolve(self, value);
  3430. },
  3431. function(reason) {
  3432. if (done) return;
  3433. done = true;
  3434. reject(self, reason);
  3435. }
  3436. );
  3437. } catch (ex) {
  3438. if (done) return;
  3439. done = true;
  3440. reject(self, ex);
  3441. }
  3442. }
  3443. Promise.prototype['catch'] = function(onRejected) {
  3444. return this.then(null, onRejected);
  3445. };
  3446. Promise.prototype.then = function(onFulfilled, onRejected) {
  3447. // @ts-ignore
  3448. var prom = new this.constructor(noop);
  3449. handle(this, new Handler(onFulfilled, onRejected, prom));
  3450. return prom;
  3451. };
  3452. Promise.prototype['finally'] = finallyConstructor;
  3453. Promise.all = function(arr) {
  3454. return new Promise(function(resolve, reject) {
  3455. if (!isArray(arr)) {
  3456. return reject(new TypeError('Promise.all accepts an array'));
  3457. }
  3458. var args = Array.prototype.slice.call(arr);
  3459. if (args.length === 0) return resolve([]);
  3460. var remaining = args.length;
  3461. function res(i, val) {
  3462. try {
  3463. if (val && (typeof val === 'object' || typeof val === 'function')) {
  3464. var then = val.then;
  3465. if (typeof then === 'function') {
  3466. then.call(
  3467. val,
  3468. function(val) {
  3469. res(i, val);
  3470. },
  3471. reject
  3472. );
  3473. return;
  3474. }
  3475. }
  3476. args[i] = val;
  3477. if (--remaining === 0) {
  3478. resolve(args);
  3479. }
  3480. } catch (ex) {
  3481. reject(ex);
  3482. }
  3483. }
  3484. for (var i = 0; i < args.length; i++) {
  3485. res(i, args[i]);
  3486. }
  3487. });
  3488. };
  3489. Promise.resolve = function(value) {
  3490. if (value && typeof value === 'object' && value.constructor === Promise) {
  3491. return value;
  3492. }
  3493. return new Promise(function(resolve) {
  3494. resolve(value);
  3495. });
  3496. };
  3497. Promise.reject = function(value) {
  3498. return new Promise(function(resolve, reject) {
  3499. reject(value);
  3500. });
  3501. };
  3502. Promise.race = function(arr) {
  3503. return new Promise(function(resolve, reject) {
  3504. if (!isArray(arr)) {
  3505. return reject(new TypeError('Promise.race accepts an array'));
  3506. }
  3507. for (var i = 0, len = arr.length; i < len; i++) {
  3508. Promise.resolve(arr[i]).then(resolve, reject);
  3509. }
  3510. });
  3511. };
  3512. // Use polyfill for setImmediate for performance gains
  3513. Promise._immediateFn =
  3514. // @ts-ignore
  3515. (typeof setImmediate === 'function' &&
  3516. function(fn) {
  3517. // @ts-ignore
  3518. setImmediate(fn);
  3519. }) ||
  3520. function(fn) {
  3521. setTimeoutFunc(fn, 0);
  3522. };
  3523. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  3524. if (typeof console !== 'undefined' && console) {
  3525. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  3526. }
  3527. };
  3528. /** @suppress {undefinedVars} */
  3529. var globalNS = (function() {
  3530. // the only reliable means to get the global object is
  3531. // `Function('return this')()`
  3532. // However, this causes CSP violations in Chrome apps.
  3533. if (typeof self !== 'undefined') {
  3534. return self;
  3535. }
  3536. if (typeof window !== 'undefined') {
  3537. return window;
  3538. }
  3539. if (typeof __webpack_require__.g !== 'undefined') {
  3540. return __webpack_require__.g;
  3541. }
  3542. throw new Error('unable to locate global object');
  3543. })();
  3544. if (!('Promise' in globalNS)) {
  3545. globalNS['Promise'] = Promise;
  3546. } else if (!globalNS.Promise.prototype['finally']) {
  3547. globalNS.Promise.prototype['finally'] = finallyConstructor;
  3548. }
  3549. })));
  3550. /***/ })
  3551. /******/ });
  3552. /************************************************************************/
  3553. /******/ // The module cache
  3554. /******/ var __webpack_module_cache__ = {};
  3555. /******/
  3556. /******/ // The require function
  3557. /******/ function __webpack_require__(moduleId) {
  3558. /******/ // Check if module is in cache
  3559. /******/ if(__webpack_module_cache__[moduleId]) {
  3560. /******/ return __webpack_module_cache__[moduleId].exports;
  3561. /******/ }
  3562. /******/ // Create a new module (and put it into the cache)
  3563. /******/ var module = __webpack_module_cache__[moduleId] = {
  3564. /******/ id: moduleId,
  3565. /******/ loaded: false,
  3566. /******/ exports: {}
  3567. /******/ };
  3568. /******/
  3569. /******/ // Execute the module function
  3570. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  3571. /******/
  3572. /******/ // Flag the module as loaded
  3573. /******/ module.loaded = true;
  3574. /******/
  3575. /******/ // Return the exports of the module
  3576. /******/ return module.exports;
  3577. /******/ }
  3578. /******/
  3579. /************************************************************************/
  3580. /******/ /* webpack/runtime/compat get default export */
  3581. /******/ (() => {
  3582. /******/ // getDefaultExport function for compatibility with non-harmony modules
  3583. /******/ __webpack_require__.n = (module) => {
  3584. /******/ var getter = module && module.__esModule ?
  3585. /******/ () => module['default'] :
  3586. /******/ () => module;
  3587. /******/ __webpack_require__.d(getter, { a: getter });
  3588. /******/ return getter;
  3589. /******/ };
  3590. /******/ })();
  3591. /******/
  3592. /******/ /* webpack/runtime/define property getters */
  3593. /******/ (() => {
  3594. /******/ // define getter functions for harmony exports
  3595. /******/ __webpack_require__.d = (exports, definition) => {
  3596. /******/ for(var key in definition) {
  3597. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  3598. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  3599. /******/ }
  3600. /******/ }
  3601. /******/ };
  3602. /******/ })();
  3603. /******/
  3604. /******/ /* webpack/runtime/global */
  3605. /******/ (() => {
  3606. /******/ __webpack_require__.g = (function() {
  3607. /******/ if (typeof globalThis === 'object') return globalThis;
  3608. /******/ try {
  3609. /******/ return this || new Function('return this')();
  3610. /******/ } catch (e) {
  3611. /******/ if (typeof window === 'object') return window;
  3612. /******/ }
  3613. /******/ })();
  3614. /******/ })();
  3615. /******/
  3616. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  3617. /******/ (() => {
  3618. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
  3619. /******/ })();
  3620. /******/
  3621. /******/ /* webpack/runtime/node module decorator */
  3622. /******/ (() => {
  3623. /******/ __webpack_require__.nmd = (module) => {
  3624. /******/ module.paths = [];
  3625. /******/ if (!module.children) module.children = [];
  3626. /******/ return module;
  3627. /******/ };
  3628. /******/ })();
  3629. /******/
  3630. /************************************************************************/
  3631. (() => {
  3632. "use strict";
  3633. // UNUSED EXPORTS: AddressMatchService, AggQueryBuilderParameter, AggregationParameter, AggregationQueryBuilderType, AggregationType, AlongLineDirection, AnalystAreaUnit, AnalystSizeUnit, AreaSolarRadiationParameters, ArrayStatistic, AttributesPopContainer, BaiduMap, BufferAnalystParameters, BufferDistance, BufferEndType, BufferRadiusUnit, BufferSetting, BuffersAnalystJobsParameter, BurstPipelineAnalystParameters, ChangeTileVersion, ChartQueryFilterParameter, ChartQueryParameters, ChartService, ChartType, CityTabsPage, ClientType, ClipAnalystMode, ClipParameter, CloverShape, ColorDictionary, ColorGradientType, ColorSpaceType, ColorsPickerUtil, CommonContainer, CommonTheme, ComponentsUtil, ComputeWeightMatrixParameters, DataFlow, DataFlowService, DataFormat, DataItemOrderBy, DataItemType, DataReturnMode, DataReturnOption, DatasetBufferAnalystParameters, DatasetInfo, DatasetOverlayAnalystParameters, DatasetSurfaceAnalystParameters, DatasetThiessenAnalystParameters, DatasourceConnectionInfo, DeafultCanvasStyle, DensityKernelAnalystParameters, DirectionType, DropDownBox, 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, GeoFeature, GeoHashGridAggParameter, GeoRelationAnalystParameters, GeometryBufferAnalystParameters, GeometryOverlayAnalystParameters, GeometrySurfaceAnalystParameters, GeometryThiessenAnalystParameters, GeometryType, GeoprocessingService, GetFeatureMode, GetFeaturesByBoundsParameters, GetFeaturesByBufferParameters, GetFeaturesByGeometryParameters, GetFeaturesByIDsParameters, GetFeaturesBySQLParameters, GetGridCellInfosParameters, GraduatedMode, Graph, GraphAxesTextDisplayMode, Graphic, GraphicCanvasRenderer, GraphicWebGLRenderer, Grid, GridCellInfosService, GridType, HeatMap, HitCloverShape, IManager, IManagerCreateNodeParam, IManagerServiceBase, IPortal, IPortalAddDataParam, IPortalAddResourceParam, IPortalDataConnectionInfoParam, IPortalDataMetaInfoParam, IPortalDataStoreInfoParam, IPortalQueryParam, IPortalQueryResult, IPortalRegisterServiceParam, IPortalResource, IPortalServiceBase, IPortalShareEntity, IPortalShareParam, IPortalUser, Image, ImageSuperMapRest, IndexTabsPageContainer, InterpolationAlgorithmType, InterpolationAnalystParameters, InterpolationIDWAnalystParameters, InterpolationKrigingAnalystParameters, InterpolationRBFAnalystParameters, JoinItem, JoinType, KernelDensityJobParameter, KeyServiceParameter, Label, LabelBackShape, LabelImageCell, LabelMatrixCell, LabelMixedTextStyle, LabelOverLengthMode, LabelSymbolCell, LabelThemeCell, LayerInfoService, LayerStatus, LayerType, LinkItem, Logo, MapExtend, MapService, MapboxStyles, MappingParameters, Mapv, MapvCanvasLayer, MapvLayer, MathExpressionAnalysisParameters, MeasureMode, MeasureParameters, MeasureService, MessageBox, NavTabsPage, NetworkAnalyst3DService, NetworkAnalystService, Online, OnlineData, OnlineQueryDatasParameter, OnlineServiceBase, OutputSetting, OutputType, OverlapDisplayedOptions, OverlayAnalystParameters, OverlayGeoJobParameter, OverlayGraphic, OverlayOperationType, PaginationContainer, PixelFormat, PointWithMeasure, PopContainer, ProcessingService, QueryByBoundsParameters, QueryByDistanceParameters, QueryByGeometryParameters, QueryBySQLParameters, QueryOption, QueryParameters, QueryService, Range, RangeMode, RankSymbol, Route, RouteCalculateMeasureParameters, RouteLocatorParameters, ScaleLine, SearchMode, SecurityManager, Select, ServerColor, ServerFeature, ServerGeometry, ServerInfo, ServerStyle, ServerTextStyle, ServerTheme, ServerType, ServiceBase, ServiceStatus, SetLayerInfoParameters, SetLayerStatusParameters, SetLayersInfoParameters, SideType, SingleObjectQueryJobsParameter, SmoothMethod, SpatialAnalystService, SpatialQueryMode, SpatialRelationType, StatisticAnalystMode, StatisticMode, StopQueryParameters, StyleMap, StyleUtils, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SummaryType, SuperMap, SuperMapCloud, SupplyCenter, SupplyCenterType, SurfaceAnalystMethod, SurfaceAnalystParameters, SurfaceAnalystParametersSetting, TerrainCurvatureCalculationParameters, TextAlignment, Theme, ThemeDotDensity, ThemeFeature, ThemeFlow, ThemeGraduatedSymbol, ThemeGraduatedSymbolStyle, ThemeGraph, ThemeGraphAxes, ThemeGraphItem, ThemeGraphSize, ThemeGraphText, ThemeGraphTextFormat, ThemeGraphType, ThemeGridRange, ThemeGridRangeItem, ThemeGridUnique, ThemeGridUniqueItem, ThemeLabel, ThemeLabelAlongLine, ThemeLabelBackground, ThemeLabelItem, ThemeLabelText, ThemeLabelUniqueItem, ThemeMemoryData, ThemeOffset, ThemeParameters, ThemeRange, ThemeRangeItem, ThemeService, ThemeType, ThemeUnique, ThemeUniqueItem, ThiessenAnalystParameters, Tianditu, TileSuperMapRest, TimeFlowControl, TokenServiceParameter, TopologyValidatorJobsParameter, TopologyValidatorRule, TrafficTransferAnalystService, TransferLine, TransferPathParameters, TransferPreference, TransferSolutionParameters, TransferTactic, TransportationAnalystParameter, TransportationAnalystResultSetting, Turf, TurnType, UGCLayer, UGCLayerType, UGCMapLayer, UGCSubLayer, Unique, Unit, UpdateEdgeWeightParameters, UpdateTurnNodeWeightParameters, Util, VariogramMode, Vector, VectorClipJobsParameter, VectorTileStyles, VectorTileSuperMapRest, WebMap, WebPrintingJobService, lineMap, lineStyle, pointMap, pointStyle, polygonMap, polygonStyle
  3634. ;// CONCATENATED MODULE: external "ol.Observable"
  3635. const external_ol_Observable_namespaceObject = ol.Observable;
  3636. var external_ol_Observable_default = /*#__PURE__*/__webpack_require__.n(external_ol_Observable_namespaceObject);
  3637. ;// CONCATENATED MODULE: ./src/openlayers/services/ServiceBase.js
  3638. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3639. * This program are made available under the terms of the Apache License, Version 2.0
  3640. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3641. /**
  3642. * @class ol.supermap.ServiceBase
  3643. * @category iServer
  3644. * @classdesc ol.supermap 的服务基类。
  3645. * @param {string} url - 与客户端交互的服务地址。
  3646. * @param {Object} options - 参数。
  3647. * @param {string} [options.proxy] - 服务代理地址。
  3648. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  3649. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  3650. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  3651. * @param {Object} [options.headers] - 请求头。
  3652. * @extends {ol/Observable}
  3653. */
  3654. class ServiceBase extends (external_ol_Observable_default()) {
  3655. constructor(url, options) {
  3656. super(url, options);
  3657. this.options = options || {};
  3658. this.url = url;
  3659. this.dispatchEvent({type: 'initialized', value: this});
  3660. }
  3661. }
  3662. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  3663. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3664. * This program are made available under the terms of the Apache License, Version 2.0
  3665. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3666. var SuperMap = window.SuperMap = window.SuperMap || {};
  3667. SuperMap.Components = window.SuperMap.Components || {};
  3668. ;// CONCATENATED MODULE: ./src/common/REST.js
  3669. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3670. * This program are made available under the terms of the Apache License, Version 2.0
  3671. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3672. /**
  3673. * @enum DataFormat
  3674. * @memberOf SuperMap
  3675. * @description 服务请求返回结果数据类型
  3676. * @type {string}
  3677. */
  3678. var DataFormat = SuperMap.DataFormat = {
  3679. /** GEOJSON */
  3680. GEOJSON: "GEOJSON",
  3681. /** ISERVER */
  3682. ISERVER: "ISERVER"
  3683. };
  3684. /**
  3685. * @enum ServerType
  3686. * @memberOf SuperMap
  3687. * @description 服务器类型
  3688. * @type {string}
  3689. */
  3690. var ServerType = SuperMap.ServerType = {
  3691. /** ISERVER */
  3692. ISERVER: "ISERVER",
  3693. /** IPORTAL */
  3694. IPORTAL: "IPORTAL",
  3695. /** ONLINE */
  3696. ONLINE: "ONLINE"
  3697. };
  3698. /**
  3699. * @enum GeometryType
  3700. * @memberOf SuperMap
  3701. * @description 几何对象枚举,定义了一系列几何对象类型。
  3702. * @type {string}
  3703. */
  3704. var GeometryType = SuperMap.GeometryType = {
  3705. /** LINE */
  3706. LINE: "LINE",
  3707. /** LINEM */
  3708. LINEM: "LINEM",
  3709. /** POINT */
  3710. POINT: "POINT",
  3711. /** REGION */
  3712. REGION: "REGION",
  3713. /** POINTEPS */
  3714. POINTEPS: "POINTEPS",
  3715. /** LINEEPS */
  3716. LINEEPS: "LINEEPS",
  3717. /** REGIONEPS */
  3718. REGIONEPS: "REGIONEPS",
  3719. /** ELLIPSE */
  3720. ELLIPSE: "ELLIPSE",
  3721. /** CIRCLE */
  3722. CIRCLE: "CIRCLE",
  3723. /** TEXT */
  3724. TEXT: "TEXT",
  3725. /** RECTANGLE */
  3726. RECTANGLE: "RECTANGLE",
  3727. /** UNKNOWN */
  3728. UNKNOWN: "UNKNOWN",
  3729. /** GEOCOMPOUND */
  3730. GEOCOMPOUND:"GEOCOMPOUND"
  3731. };
  3732. /**
  3733. * @enum QueryOption
  3734. * @memberOf SuperMap
  3735. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  3736. * @type {string}
  3737. */
  3738. var QueryOption = SuperMap.QueryOption = {
  3739. /** 属性 */
  3740. ATTRIBUTE: "ATTRIBUTE",
  3741. /** 属性和几何对象 */
  3742. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  3743. /** 几何对象 */
  3744. GEOMETRY: "GEOMETRY"
  3745. };
  3746. /**
  3747. * @enum JoinType
  3748. * @memberOf SuperMap
  3749. * @description 关联查询时的关联类型常量。
  3750. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  3751. * @type {string}
  3752. */
  3753. var JoinType = SuperMap.JoinType = {
  3754. /** INNERJOIN */
  3755. INNERJOIN: "INNERJOIN",
  3756. /** LEFTJOIN */
  3757. LEFTJOIN: "LEFTJOIN"
  3758. };
  3759. /**
  3760. * @enum SpatialQueryMode
  3761. * @memberOf SuperMap
  3762. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  3763. * @type {string}
  3764. */
  3765. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  3766. /** 包含空间查询模式 */
  3767. CONTAIN: "CONTAIN",
  3768. /** 交叉空间查询模式 */
  3769. CROSS: "CROSS",
  3770. /** 分离空间查询模式 */
  3771. DISJOINT: "DISJOINT",
  3772. /** 重合空间查询模式 */
  3773. IDENTITY: "IDENTITY",
  3774. /** 相交空间查询模式 */
  3775. INTERSECT: "INTERSECT",
  3776. /** 无空间查询 */
  3777. NONE: "NONE",
  3778. /** 叠加空间查询模式 */
  3779. OVERLAP: "OVERLAP",
  3780. /** 邻接空间查询模式 */
  3781. TOUCH: "TOUCH",
  3782. /** 被包含空间查询模式 */
  3783. WITHIN: "WITHIN"
  3784. };
  3785. /**
  3786. * @enum SpatialRelationType
  3787. * @memberOf SuperMap
  3788. * @description 数据集对象间的空间关系枚举。
  3789. * 该类定义了数据集对象间的空间关系类型常量。
  3790. * @type {string}
  3791. */
  3792. var SpatialRelationType = SuperMap.SpatialRelationType = {
  3793. /** 包含关系 */
  3794. CONTAIN: "CONTAIN",
  3795. /** 相交关系 */
  3796. INTERSECT: "INTERSECT",
  3797. /** 被包含关系 */
  3798. WITHIN: "WITHIN"
  3799. };
  3800. /**
  3801. * @enum MeasureMode
  3802. * @memberOf SuperMap
  3803. * @type {string}
  3804. * @description 量算模式枚举。
  3805. * 该类定义了两种测量模式:距离测量和面积测量。
  3806. */
  3807. var MeasureMode = SuperMap.MeasureMode = {
  3808. /** 距离测量 */
  3809. DISTANCE: "DISTANCE",
  3810. /** 面积测量 */
  3811. AREA: "AREA"
  3812. };
  3813. /**
  3814. * @enum Unit
  3815. * @memberOf SuperMap
  3816. * @description 距离单位枚举。
  3817. * 该类定义了一系列距离单位类型。
  3818. * @type {string}
  3819. */
  3820. var REST_Unit = SuperMap.Unit = {
  3821. /** 米 */
  3822. METER: "METER",
  3823. /** 千米 */
  3824. KILOMETER: "KILOMETER",
  3825. /** 英里 */
  3826. MILE: "MILE",
  3827. /** 码 */
  3828. YARD: "YARD",
  3829. /** 度 */
  3830. DEGREE: "DEGREE",
  3831. /** 毫米 */
  3832. MILLIMETER: "MILLIMETER",
  3833. /** 厘米 */
  3834. CENTIMETER: "CENTIMETER",
  3835. /** 英寸 */
  3836. INCH: "INCH",
  3837. /** 分米 */
  3838. DECIMETER: "DECIMETER",
  3839. /** 英尺 */
  3840. FOOT: "FOOT",
  3841. /** 秒 */
  3842. SECOND: "SECOND",
  3843. /** 分 */
  3844. MINUTE: "MINUTE",
  3845. /** 弧度 */
  3846. RADIAN: "RADIAN"
  3847. };
  3848. /**
  3849. * @enum BufferRadiusUnit
  3850. * @memberOf SuperMap
  3851. * @description 缓冲区距离单位枚举。
  3852. * 该类定义了一系列缓冲距离单位类型。
  3853. * @type {string}
  3854. */
  3855. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  3856. /** 厘米 */
  3857. CENTIMETER: "CENTIMETER",
  3858. /** 分米 */
  3859. DECIMETER: "DECIMETER",
  3860. /** 英尺 */
  3861. FOOT: "FOOT",
  3862. /** 英寸 */
  3863. INCH: "INCH",
  3864. /** 千米 */
  3865. KILOMETER: "KILOMETER",
  3866. /** 米 */
  3867. METER: "METER",
  3868. /** 英里 */
  3869. MILE: "MILE",
  3870. /** 毫米 */
  3871. MILLIMETER: "MILLIMETER",
  3872. /** 码 */
  3873. YARD: "YARD"
  3874. }
  3875. /**
  3876. * @enum EngineType
  3877. * @memberOf SuperMap
  3878. * @description 数据源引擎类型枚举。
  3879. * @type {string}
  3880. */
  3881. var EngineType = SuperMap.EngineType = {
  3882. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  3883. IMAGEPLUGINS: "IMAGEPLUGINS",
  3884. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  3885. OGC: "OGC",
  3886. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  3887. ORACLEPLUS: "ORACLEPLUS",
  3888. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  3889. SDBPLUS: "SDBPLUS",
  3890. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  3891. SQLPLUS: "SQLPLUS",
  3892. /** UDB 引擎类型,文件引擎。 */
  3893. UDB: "UDB"
  3894. };
  3895. /**
  3896. * @enum ThemeGraphTextFormat
  3897. * @memberOf SuperMap
  3898. * @description 统计专题图文本显示格式枚举。
  3899. * @type {string}
  3900. */
  3901. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  3902. /** 标题。以各子项的标题来进行标注。 */
  3903. CAPTION: "CAPTION",
  3904. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  3905. CAPTION_PERCENT: "CAPTION_PERCENT",
  3906. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  3907. CAPTION_VALUE: "CAPTION_VALUE",
  3908. /** 百分数。以各子项所占的百分比来进行标注。 */
  3909. PERCENT: "PERCENT",
  3910. /** 实际数值。以各子项的真实数值来进行标注。 */
  3911. VALUE: "VALUE"
  3912. };
  3913. /**
  3914. * @enum ThemeGraphType
  3915. * @memberOf SuperMap
  3916. * @description 统计专题图类型枚举。
  3917. * @type {string}
  3918. */
  3919. var ThemeGraphType = SuperMap.ThemeGraphType = {
  3920. /** 面积图。 */
  3921. AREA: "AREA",
  3922. /** 柱状图。 */
  3923. BAR: "BAR",
  3924. /** 三维柱状图。 */
  3925. BAR3D: "BAR3D",
  3926. /** 折线图。 */
  3927. LINE: "LINE",
  3928. /** 饼图。 */
  3929. PIE: "PIE",
  3930. /** 三维饼图。 */
  3931. PIE3D: "PIE3D",
  3932. /** 点状图。 */
  3933. POINT: "POINT",
  3934. /** 环状图。 */
  3935. RING: "RING",
  3936. /** 玫瑰图。 */
  3937. ROSE: "ROSE",
  3938. /** 三维玫瑰图。 */
  3939. ROSE3D: "ROSE3D",
  3940. /** 堆叠柱状图。 */
  3941. STACK_BAR: "STACK_BAR",
  3942. /** 三维堆叠柱状图。 */
  3943. STACK_BAR3D: "STACK_BAR3D",
  3944. /** 阶梯图。 */
  3945. STEP: "STEP"
  3946. };
  3947. /**
  3948. * @enum GraphAxesTextDisplayMode
  3949. * @memberOf SuperMap
  3950. * @description 统计专题图坐标轴文本显示模式。
  3951. * @type {string}
  3952. */
  3953. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  3954. /** 显示全部文本。 */
  3955. ALL: "ALL",
  3956. /** 不显示。 */
  3957. NONE: "NONE",
  3958. /** 显示Y轴的文本。 */
  3959. YAXES: "YAXES"
  3960. };
  3961. /**
  3962. * @enum GraduatedMode
  3963. * @memberOf SuperMap
  3964. * @description 专题图分级模式枚举。
  3965. *
  3966. * @type {string}
  3967. */
  3968. var GraduatedMode = SuperMap.GraduatedMode = {
  3969. /** 常量分级模式。 */
  3970. CONSTANT: "CONSTANT",
  3971. /** 对数分级模式。 */
  3972. LOGARITHM: "LOGARITHM",
  3973. /** 平方根分级模式。 */
  3974. SQUAREROOT: "SQUAREROOT"
  3975. };
  3976. /**
  3977. * @enum RangeMode
  3978. * @memberOf SuperMap
  3979. * @description 范围分段专题图分段方式枚举。
  3980. * @type {string}
  3981. */
  3982. var RangeMode = SuperMap.RangeMode = {
  3983. /** 自定义分段法。 */
  3984. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  3985. /** 等距离分段法。 */
  3986. EQUALINTERVAL: "EQUALINTERVAL",
  3987. /** 对数分段法。 */
  3988. LOGARITHM: "LOGARITHM",
  3989. /** 等计数分段法。 */
  3990. QUANTILE: "QUANTILE",
  3991. /** 平方根分段法。 */
  3992. SQUAREROOT: "SQUAREROOT",
  3993. /** 标准差分段法。 */
  3994. STDDEVIATION: "STDDEVIATION"
  3995. };
  3996. /**
  3997. * @enum ThemeType
  3998. * @memberOf SuperMap
  3999. * @description 专题图类型枚举。
  4000. * @type {string}
  4001. */
  4002. var ThemeType = SuperMap.ThemeType = {
  4003. /** 点密度专题图。 */
  4004. DOTDENSITY: "DOTDENSITY",
  4005. /** 等级符号专题图。 */
  4006. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  4007. /** 统计专题图。 */
  4008. GRAPH: "GRAPH",
  4009. /** 标签专题图。 */
  4010. LABEL: "LABEL",
  4011. /** 分段专题图。 */
  4012. RANGE: "RANGE",
  4013. /** 単值专题图。 */
  4014. UNIQUE: "UNIQUE"
  4015. };
  4016. /**
  4017. * @enum ColorGradientType
  4018. * @memberOf SuperMap
  4019. * @description 渐变颜色枚举。
  4020. * @type {string}
  4021. */
  4022. var ColorGradientType = SuperMap.ColorGradientType = {
  4023. /** 黑白渐变色。 */
  4024. BLACK_WHITE: "BLACKWHITE",
  4025. /** 蓝黑渐变色。 */
  4026. BLUE_BLACK: "BLUEBLACK",
  4027. /** 蓝红渐变色。 */
  4028. BLUE_RED: "BLUERED",
  4029. /** 蓝白渐变色。 */
  4030. BLUE_WHITE: "BLUEWHITE",
  4031. /** 青黑渐变色。 */
  4032. CYAN_BLACK: "CYANBLACK",
  4033. /** 青蓝渐变色。 */
  4034. CYAN_BLUE: "CYANBLUE",
  4035. /** 青绿渐变色。 */
  4036. CYAN_GREEN: "CYANGREEN",
  4037. /** 青白渐变色。 */
  4038. CYAN_WHITE: "CYANWHITE",
  4039. /** 绿黑渐变色。 */
  4040. GREEN_BLACK: "GREENBLACK",
  4041. /** 绿蓝渐变色。 */
  4042. GREEN_BLUE: "GREENBLUE",
  4043. /** 绿橙紫渐变色。 */
  4044. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  4045. /** 绿红渐变色。 */
  4046. GREEN_RED: "GREENRED",
  4047. /** 蓝红渐变色。 */
  4048. GREEN_WHITE: "GREENWHITE",
  4049. /** 粉黑渐变色。 */
  4050. PINK_BLACK: "PINKBLACK",
  4051. /** 粉蓝渐变色。 */
  4052. PINK_BLUE: "PINKBLUE",
  4053. /** 粉红渐变色。 */
  4054. PINK_RED: "PINKRED",
  4055. /** 粉白渐变色。 */
  4056. PINK_WHITE: "PINKWHITE",
  4057. /** 彩虹色。 */
  4058. RAIN_BOW: "RAINBOW",
  4059. /** 红黑渐变色。 */
  4060. RED_BLACK: "REDBLACK",
  4061. /** 红白渐变色。 */
  4062. RED_WHITE: "REDWHITE",
  4063. /** 光谱渐变。 */
  4064. SPECTRUM: "SPECTRUM",
  4065. /** 地形渐变,用于三维显示效果较好。 */
  4066. TERRAIN: "TERRAIN",
  4067. /** 黄黑渐变色。 */
  4068. YELLOW_BLACK: "YELLOWBLACK",
  4069. /** 黄蓝渐变色。 */
  4070. YELLOW_BLUE: "YELLOWBLUE",
  4071. /** 黄绿渐变色。 */
  4072. YELLOW_GREEN: "YELLOWGREEN",
  4073. /** 黄红渐变色。 */
  4074. YELLOW_RED: "YELLOWRED",
  4075. /** 黄白渐变色。 */
  4076. YELLOW_WHITE: "YELLOWWHITE"
  4077. };
  4078. /**
  4079. * @enum TextAlignment
  4080. * @memberOf SuperMap
  4081. * @description 文本对齐枚举。
  4082. * @type {string}
  4083. */
  4084. var TextAlignment = SuperMap.TextAlignment = {
  4085. /** 左上角对齐。 */
  4086. TOPLEFT: "TOPLEFT",
  4087. /** 顶部居中对齐。 */
  4088. TOPCENTER: "TOPCENTER",
  4089. /** 右上角对齐。 */
  4090. TOPRIGHT: "TOPRIGHT",
  4091. /** 基准线左对齐。 */
  4092. BASELINELEFT: "BASELINELEFT",
  4093. /** 基准线居中对齐。 */
  4094. BASELINECENTER: "BASELINECENTER",
  4095. /** 基准线右对齐。 */
  4096. BASELINERIGHT: "BASELINERIGHT",
  4097. /** 左下角对齐。 */
  4098. BOTTOMLEFT: "BOTTOMLEFT",
  4099. /** 底部居中对齐。 */
  4100. BOTTOMCENTER: "BOTTOMCENTER",
  4101. /** 右下角对齐。 */
  4102. BOTTOMRIGHT: "BOTTOMRIGHT",
  4103. /** 左中对齐。 */
  4104. MIDDLELEFT: "MIDDLELEFT",
  4105. /** 中心对齐。 */
  4106. MIDDLECENTER: "MIDDLECENTER",
  4107. /** 右中对齐。 */
  4108. MIDDLERIGHT: "MIDDLERIGHT"
  4109. };
  4110. /**
  4111. * @enum FillGradientMode
  4112. * @memberOf SuperMap
  4113. * @description 渐变填充风格的渐变类型枚举。
  4114. * @type {string}
  4115. */
  4116. var FillGradientMode = SuperMap.FillGradientMode = {
  4117. /** 无渐变。 */
  4118. NONE: "NONE",
  4119. /** 线性渐变填充。 */
  4120. LINEAR: "LINEAR",
  4121. /** 辐射渐变填充。 */
  4122. RADIAL: "RADIAL",
  4123. /** 圆锥渐变填充。 */
  4124. CONICAL: "CONICAL",
  4125. /** 四角渐变填充。 */
  4126. SQUARE: "SQUARE"
  4127. };
  4128. /**
  4129. * @enum AlongLineDirection
  4130. * @memberOf SuperMap
  4131. * @description 标签沿线标注方向枚举。
  4132. * @type {string}
  4133. */
  4134. var AlongLineDirection = SuperMap.AlongLineDirection = {
  4135. /** 沿线的法线方向放置标签。 */
  4136. NORMAL: "ALONG_LINE_NORMAL",
  4137. /** 从下到上,从左到右放置。 */
  4138. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  4139. /** 从上到下,从左到右放置。 */
  4140. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  4141. /** 从下到上,从右到左放置。 */
  4142. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  4143. /** 从上到下,从右到左放置。 */
  4144. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  4145. };
  4146. /**
  4147. * @enum LabelBackShape
  4148. * @memberOf SuperMap
  4149. * @description 标签专题图中标签背景的形状枚举。
  4150. * @type {string}
  4151. */
  4152. var LabelBackShape = SuperMap.LabelBackShape = {
  4153. /** 菱形背景,即标签背景的形状为菱形。 */
  4154. DIAMOND: "DIAMOND",
  4155. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  4156. ELLIPSE: "ELLIPSE",
  4157. /** 符号背景,即标签背景的形状为设定的符号。 */
  4158. MARKER: "MARKER",
  4159. /** 空背景,即不使用任何形状作为标签的背景。 */
  4160. NONE: "NONE",
  4161. /** 矩形背景,即标签背景的形状为矩形。 */
  4162. RECT: "RECT",
  4163. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  4164. ROUNDRECT: "ROUNDRECT",
  4165. /** 三角形背景,即标签背景的形状为三角形。 */
  4166. TRIANGLE: "TRIANGLE"
  4167. };
  4168. /**
  4169. * @enum LabelOverLengthMode
  4170. * @memberOf SuperMap
  4171. * @description 标签专题图中超长标签的处理模式枚举。
  4172. * @type {string}
  4173. */
  4174. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  4175. /** 换行显示。 */
  4176. NEWLINE: "NEWLINE",
  4177. /** 对超长标签不进行处理。 */
  4178. NONE: "NONE",
  4179. /** 省略超出部分。 */
  4180. OMIT: "OMIT"
  4181. };
  4182. /**
  4183. * @enum DirectionType
  4184. * @memberOf SuperMap
  4185. * @description 网络分析中方向枚举。
  4186. * 在行驶引导子项中使用。
  4187. * @type {string}
  4188. */
  4189. var DirectionType = SuperMap.DirectionType = {
  4190. /** 东。 */
  4191. EAST: "EAST",
  4192. /** 无方向。 */
  4193. NONE: "NONE",
  4194. /** 北。 */
  4195. NORTH: "NORTH",
  4196. /** 南。 */
  4197. SOURTH: "SOURTH",
  4198. /** 西。 */
  4199. WEST: "WEST"
  4200. };
  4201. /**
  4202. * @enum SideType
  4203. * @memberOf SuperMap
  4204. * @description 行驶位置枚举。
  4205. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  4206. * @type {string}
  4207. */
  4208. var SideType = SuperMap.SideType = {
  4209. /** 路的左侧。 */
  4210. LEFT: "LEFT",
  4211. /** 在路上(即路的中间)。 */
  4212. MIDDLE: "MIDDLE",
  4213. /** 无效值。 */
  4214. NONE: "NONE",
  4215. /** 路的右侧。 */
  4216. RIGHT: "RIGHT"
  4217. };
  4218. /**
  4219. * @enum SupplyCenterType
  4220. * @memberOf SuperMap
  4221. * @description 资源供给中心类型枚举。
  4222. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  4223. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  4224. * @type {string}
  4225. */
  4226. var SupplyCenterType = SuperMap.SupplyCenterType = {
  4227. /** 固定中心点。 */
  4228. FIXEDCENTER: "FIXEDCENTER",
  4229. /** 非中心点。 */
  4230. NULL: "NULL",
  4231. /** 可选中心点。 */
  4232. OPTIONALCENTER: "OPTIONALCENTER"
  4233. };
  4234. /**
  4235. * @enum TurnType
  4236. * @memberOf SuperMap
  4237. * @description 转弯方向枚举。
  4238. * 用在行驶引导子项类中,表示转弯的方向。
  4239. * @type {string}
  4240. */
  4241. var TurnType = SuperMap.TurnType = {
  4242. /** 向前直行。 */
  4243. AHEAD: "AHEAD",
  4244. /** 掉头。 */
  4245. BACK: "BACK",
  4246. /** 终点,不拐弯。 */
  4247. END: "END",
  4248. /** 左转弯。 */
  4249. LEFT: "LEFT",
  4250. /** 无效值。 */
  4251. NONE: "NONE",
  4252. /** 右转弯。 */
  4253. RIGHT: "RIGHT"
  4254. };
  4255. /**
  4256. * @enum BufferEndType
  4257. * @memberOf SuperMap
  4258. * @description 缓冲区分析BufferEnd类型。
  4259. * @type {string}
  4260. */
  4261. var BufferEndType = SuperMap.BufferEndType = {
  4262. /** FLAT */
  4263. FLAT: "FLAT",
  4264. /** ROUND */
  4265. ROUND: "ROUND"
  4266. };
  4267. /**
  4268. * @enum OverlayOperationType
  4269. * @memberOf SuperMap
  4270. * @description 叠加分析类型枚举。
  4271. * @type {string}
  4272. */
  4273. var OverlayOperationType = SuperMap.OverlayOperationType = {
  4274. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  4275. CLIP: "CLIP",
  4276. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  4277. ERASE: "ERASE",
  4278. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  4279. IDENTITY: "IDENTITY",
  4280. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  4281. INTERSECT: "INTERSECT",
  4282. /** 对两个面数据集(几何对象)进行合并操作。 */
  4283. UNION: "UNION",
  4284. /** 对两个面数据集(几何对象)进行更新操作。 */
  4285. UPDATE: "UPDATE",
  4286. /** 对两个面数据集(几何对象)进行对称差操作。 */
  4287. XOR: "XOR"
  4288. };
  4289. /**
  4290. * @enum OutputType
  4291. * @memberOf SuperMap
  4292. * @description 分布式分析输出类型枚举。
  4293. * @type {string}
  4294. */
  4295. var OutputType = SuperMap.OutputType = {
  4296. /** INDEXEDHDFS */
  4297. INDEXEDHDFS: "INDEXEDHDFS",
  4298. /** UDB */
  4299. UDB: "UDB",
  4300. /** MONGODB */
  4301. MONGODB: "MONGODB",
  4302. /** PG */
  4303. PG: "PG"
  4304. };
  4305. /**
  4306. * @enum SmoothMethod
  4307. * @memberOf SuperMap
  4308. * @description 光滑方法枚举。
  4309. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  4310. * @type {string}
  4311. */
  4312. var SmoothMethod = SuperMap.SmoothMethod = {
  4313. /** B 样条法。 */
  4314. BSPLINE: "BSPLINE",
  4315. /** 磨角法。 */
  4316. POLISH: "POLISH"
  4317. };
  4318. /**
  4319. * @enum SurfaceAnalystMethod
  4320. * @memberOf SuperMap
  4321. * @description 表面分析方法枚举。
  4322. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  4323. * @type {string}
  4324. */
  4325. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  4326. /** 等值线提取。 */
  4327. ISOLINE: "ISOLINE",
  4328. /** 等值面提取。 */
  4329. ISOREGION: "ISOREGION"
  4330. };
  4331. /**
  4332. * @enum DataReturnMode
  4333. * @memberOf SuperMap
  4334. * @description 数据返回模式枚举。
  4335. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  4336. * @type {string}
  4337. */
  4338. var DataReturnMode = SuperMap.DataReturnMode = {
  4339. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  4340. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  4341. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  4342. DATASET_ONLY: "DATASET_ONLY",
  4343. /** 只返回记录集(RecordSet)。 */
  4344. RECORDSET_ONLY: "RECORDSET_ONLY"
  4345. };
  4346. /**
  4347. * @enum EditType
  4348. * @memberOf SuperMap
  4349. * @description 要素集更新模式枚举。
  4350. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  4351. * @type {string}
  4352. */
  4353. var EditType = SuperMap.EditType = {
  4354. /** 增加操作。 */
  4355. ADD: "add",
  4356. /** 修改操作。 */
  4357. UPDATE: "update",
  4358. /** 删除操作。 */
  4359. DELETE: "delete"
  4360. };
  4361. /**
  4362. * @enum TransferTactic
  4363. * @memberOf SuperMap
  4364. * @description 公交换乘策略枚举。
  4365. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  4366. * @type {string}
  4367. */
  4368. var TransferTactic = SuperMap.TransferTactic = {
  4369. /** 时间短。 */
  4370. LESS_TIME: "LESS_TIME",
  4371. /** 少换乘。 */
  4372. LESS_TRANSFER: "LESS_TRANSFER",
  4373. /** 少步行。 */
  4374. LESS_WALK: "LESS_WALK",
  4375. /** 距离最短。 */
  4376. MIN_DISTANCE: "MIN_DISTANCE"
  4377. };
  4378. /**
  4379. * @enum TransferPreference
  4380. * @memberOf SuperMap
  4381. * @description 公交换乘策略枚举。
  4382. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  4383. * @type {string}
  4384. */
  4385. var TransferPreference = SuperMap.TransferPreference = {
  4386. /** 公交汽车优先。 */
  4387. BUS: "BUS",
  4388. /** 地铁优先。 */
  4389. SUBWAY: "SUBWAY",
  4390. /** 不乘坐地铁。 */
  4391. NO_SUBWAY: "NO_SUBWAY",
  4392. /** 无乘车偏好。 */
  4393. NONE: "NONE"
  4394. };
  4395. /**
  4396. * @enum GridType
  4397. * @memberOf SuperMap
  4398. * @description 地图背景格网类型枚举。
  4399. * @type {string}
  4400. */
  4401. var GridType = SuperMap.GridType = {
  4402. /** 十字叉丝。 */
  4403. CROSS: "CROSS",
  4404. /** 网格线。 */
  4405. GRID: "GRID",
  4406. /** 点。 */
  4407. POINT: "POINT"
  4408. };
  4409. /**
  4410. * @enum ColorSpaceType
  4411. * @memberOf SuperMap
  4412. * @description 色彩空间枚举。
  4413. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  4414. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  4415. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  4416. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  4417. * @type {string}
  4418. */
  4419. var ColorSpaceType = SuperMap.ColorSpaceType = {
  4420. /** 该类型主要在印刷系统使用。 */
  4421. CMYK: "CMYK",
  4422. /** 该类型主要在显示系统中使用。 */
  4423. RGB: "RGB"
  4424. };
  4425. /**
  4426. * @enum LayerType
  4427. * @memberOf SuperMap
  4428. * @description 图层类型。
  4429. * @type {string}
  4430. */
  4431. var LayerType = SuperMap.LayerType = {
  4432. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  4433. UGC: "UGC",
  4434. /** WMS 图层。 */
  4435. WMS: "WMS",
  4436. /** WFS 图层。 */
  4437. WFS: "WFS",
  4438. /** 自定义图层。 */
  4439. CUSTOM: "CUSTOM"
  4440. };
  4441. /**
  4442. * @enum UGCLayerType
  4443. * @memberOf SuperMap
  4444. * @description UGC图层类型。
  4445. * @type {string}
  4446. */
  4447. var UGCLayerType = SuperMap.UGCLayerType = {
  4448. /** 专题图层。 */
  4449. THEME: "THEME",
  4450. /** 矢量图层。 */
  4451. VECTOR: "VECTOR",
  4452. /** 栅格图层。。 */
  4453. GRID: "GRID",
  4454. /** 影像图层。 */
  4455. IMAGE: "IMAGE"
  4456. };
  4457. /**
  4458. * @enum StatisticMode
  4459. * @memberOf SuperMap
  4460. * @description 字段统计方法类型。
  4461. * @type {string}
  4462. */
  4463. var StatisticMode = SuperMap.StatisticMode = {
  4464. /** 统计所选字段的平均值。 */
  4465. AVERAGE: "AVERAGE",
  4466. /** 统计所选字段的最大值。 */
  4467. MAX: "MAX",
  4468. /** 统计所选字段的最小值。 */
  4469. MIN: "MIN",
  4470. /** 统计所选字段的标准差 */
  4471. STDDEVIATION: "STDDEVIATION",
  4472. /** 统计所选字段的总和。 */
  4473. SUM: "SUM",
  4474. /** 统计所选字段的方差。 */
  4475. VARIANCE: "VARIANCE"
  4476. };
  4477. /**
  4478. * @enum PixelFormat
  4479. * @memberOf SuperMap
  4480. * @description 栅格与影像数据存储的像素格式枚举。
  4481. * @type {string}
  4482. */
  4483. var PixelFormat = SuperMap.PixelFormat = {
  4484. /** 每个像元用16个比特(即2个字节)表示。 */
  4485. BIT16: "BIT16",
  4486. /** 每个像元用32个比特(即4个字节)表示。 */
  4487. BIT32: "BIT32",
  4488. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  4489. BIT64: "BIT64",
  4490. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  4491. SINGLE: "SINGLE",
  4492. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  4493. DOUBLE: "DOUBLE",
  4494. /** 每个像元用1个比特表示。 */
  4495. UBIT1: "UBIT1",
  4496. /** 每个像元用4个比特来表示。 */
  4497. UBIT4: "UBIT4",
  4498. /** 每个像元用8个比特(即1个字节)来表示。 */
  4499. UBIT8: "UBIT8",
  4500. /** 每个像元用24个比特(即3个字节)来表示。 */
  4501. UBIT24: "UBIT24",
  4502. /** 每个像元用32个比特(即4个字节)来表示。 */
  4503. UBIT32: "UBIT32"
  4504. };
  4505. /**
  4506. * @enum SearchMode
  4507. * @memberOf SuperMap
  4508. * @description 内插时使用的样本点的查找方式枚举
  4509. * @type {string}
  4510. */
  4511. var SearchMode = SuperMap.SearchMode = {
  4512. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  4513. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  4514. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  4515. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  4516. /** 不进行查找,使用所有的输入点进行内插分析。 */
  4517. NONE: "NONE",
  4518. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  4519. QUADTREE: "QUADTREE"
  4520. };
  4521. /**
  4522. * @enum InterpolationAlgorithmType
  4523. * @memberOf SuperMap
  4524. * @description 插值分析的算法的类型
  4525. * @type {string}
  4526. */
  4527. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  4528. /** 普通克吕金插值法。 */
  4529. KRIGING: "KRIGING",
  4530. /** 简单克吕金插值法。 */
  4531. SimpleKriging: "SimpleKriging",
  4532. /** 泛克吕金插值法。 */
  4533. UniversalKriging: "UniversalKriging"
  4534. };
  4535. /**
  4536. * @enum VariogramMode
  4537. * @memberOf SuperMap
  4538. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  4539. * @type {string}
  4540. */
  4541. var VariogramMode = SuperMap.VariogramMode = {
  4542. /** 指数函数。 */
  4543. EXPONENTIAL: "EXPONENTIAL",
  4544. /** 高斯函数。 */
  4545. GAUSSIAN: "GAUSSIAN",
  4546. /** 球型函数。 */
  4547. SPHERICAL: "SPHERICAL"
  4548. };
  4549. /**
  4550. * @enum Exponent
  4551. * @memberOf SuperMap
  4552. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  4553. * @type {string}
  4554. */
  4555. var Exponent = SuperMap.Exponent = {
  4556. /** 阶数为1。 */
  4557. EXP1: "EXP1",
  4558. /** 阶数为2。 */
  4559. EXP2: "EXP2"
  4560. };
  4561. /**
  4562. * @enum ClientType
  4563. * @memberOf SuperMap
  4564. * @description token申请的客户端标识类型
  4565. * @type {string}
  4566. */
  4567. var ClientType = SuperMap.ClientType = {
  4568. /** 指定的 IP 地址。 */
  4569. IP: "IP",
  4570. /** 指定的 URL。 */
  4571. REFERER: "Referer",
  4572. /** 发送申请令牌请求的客户端 IP。 */
  4573. REQUESTIP: "RequestIP",
  4574. /** 不做任何验证。 */
  4575. NONE: "NONE",
  4576. /** SERVER。 */
  4577. SERVER: "SERVER",
  4578. /** WEB。 */
  4579. WEB: "WEB"
  4580. };
  4581. /**
  4582. * @enum ChartType
  4583. * @memberOf SuperMap
  4584. * @description 客户端专题图图表类型
  4585. * @type {string}
  4586. */
  4587. var ChartType = SuperMap.ChartType = {
  4588. /** 柱状图。 */
  4589. BAR: "Bar",
  4590. /** 三维柱状图。 */
  4591. BAR3D: "Bar3D",
  4592. /** 圆形图。 */
  4593. CIRCLE: "Circle",
  4594. /** 饼图。 */
  4595. PIE: "Pie",
  4596. /** 散点图。 */
  4597. POINT: "Point",
  4598. /** 折线图。 */
  4599. LINE: "Line",
  4600. /** 环状图。 */
  4601. RING: "Ring"
  4602. };
  4603. /**
  4604. * @enum ClipAnalystMode
  4605. * @memberOf SuperMap
  4606. * @description 裁剪分析模式
  4607. * @type {string}
  4608. */
  4609. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  4610. /** CLIP。 */
  4611. CLIP: "clip",
  4612. /** INTERSECT。 */
  4613. INTERSECT: "intersect"
  4614. };
  4615. /**
  4616. * @enum AnalystAreaUnit
  4617. * @memberOf SuperMap
  4618. * @description 分布式分析面积单位
  4619. * @type {string}
  4620. */
  4621. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  4622. /** 平方米。 */
  4623. "SQUAREMETER": "SquareMeter",
  4624. /** 平方千米。 */
  4625. "SQUAREKILOMETER": "SquareKiloMeter",
  4626. /** 公顷。 */
  4627. "HECTARE": "Hectare",
  4628. /** 公亩。 */
  4629. "ARE": "Are",
  4630. /** 英亩。 */
  4631. "ACRE": "Acre",
  4632. /** 平方英尺。 */
  4633. "SQUAREFOOT": "SquareFoot",
  4634. /** 平方码。 */
  4635. "SQUAREYARD": "SquareYard",
  4636. /** 平方英里。 */
  4637. "SQUAREMILE": "SquareMile"
  4638. };
  4639. /**
  4640. * @enum AnalystSizeUnit
  4641. * @memberOf SuperMap
  4642. * @description 分布式分析单位
  4643. * @type {string}
  4644. */
  4645. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  4646. /** 米。 */
  4647. "METER": "Meter",
  4648. /** 千米。 */
  4649. "KILOMETER": "Kilometer",
  4650. /** 码。 */
  4651. "YARD": "Yard",
  4652. /** 英尺。 */
  4653. "FOOT": "Foot",
  4654. /** 英里。 */
  4655. "MILE": "Mile"
  4656. };
  4657. /**
  4658. * @enum StatisticAnalystMode
  4659. * @memberOf SuperMap
  4660. * @description 分布式分析统计模式
  4661. * @type {string}
  4662. */
  4663. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  4664. /** 统计所选字段的最大值。 */
  4665. "MAX": "max",
  4666. /** 统计所选字段的最小值。 */
  4667. "MIN": "min",
  4668. /** 统计所选字段的平均值。 */
  4669. "AVERAGE": "average",
  4670. /** 统计所选字段的总和。 */
  4671. "SUM": "sum",
  4672. /** 统计所选字段的方差。 */
  4673. "VARIANCE": "variance",
  4674. /** 统计所选字段的标准差 */
  4675. "STDDEVIATION": "stdDeviation"
  4676. };
  4677. /**
  4678. * @enum SummaryType
  4679. * @memberOf SuperMap
  4680. * @description 分布式分析聚合类型
  4681. * @type {string}
  4682. */
  4683. var SummaryType = SuperMap.SummaryType = {
  4684. /** 格网聚合。 */
  4685. "SUMMARYMESH": "SUMMARYMESH",
  4686. /** 多边形聚合。 */
  4687. "SUMMARYREGION": "SUMMARYREGION"
  4688. };
  4689. /**
  4690. * @enum TopologyValidatorRule
  4691. * @memberOf SuperMap
  4692. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  4693. * @type {string}
  4694. */
  4695. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  4696. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  4697. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  4698. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  4699. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  4700. /** 面被面包含,用于对面数据进行拓扑检查。 */
  4701. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  4702. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  4703. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  4704. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  4705. LINENOOVERLAP: "LINENOOVERLAP",
  4706. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  4707. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  4708. /** 点不相同,用于对点数据进行拓扑检查。 */
  4709. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  4710. };
  4711. /**
  4712. * @enum AggregationType
  4713. * @memberOf SuperMap
  4714. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  4715. * @type {string}
  4716. */
  4717. var AggregationType = SuperMap.AggregationType = {
  4718. /** 格网聚合类型。 */
  4719. GEOHASH_GRID: "geohash_grid",
  4720. /** 过滤聚合类型。 */
  4721. FILTER: "filter"
  4722. };
  4723. /**
  4724. * @enum AggregationType
  4725. * @memberOf SuperMap
  4726. * @description 聚合查询中filter查询枚举类
  4727. * @type {string}
  4728. */
  4729. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  4730. /** 范围查询。 */
  4731. GEO_BOUNDING_BOX: "geo_bounding_box"
  4732. }
  4733. /**
  4734. * @enum GetFeatureMode
  4735. * @memberOf SuperMap
  4736. * @description feature 查询方式。
  4737. * @type {string}
  4738. */
  4739. var GetFeatureMode = SuperMap.GetFeatureMode = {
  4740. /** 通过范围查询来获取要素。 */
  4741. BOUNDS: "BOUNDS",
  4742. /** 通过几何对象的缓冲区来获取要素。 */
  4743. BUFFER: "BUFFER",
  4744. /** 通过 ID 来获取要素。 */
  4745. ID: "ID",
  4746. /** 通过空间查询模式来获取要素。 */
  4747. SPATIAL: "SPATIAL",
  4748. /** 通过 SQL 查询来获取要素。 */
  4749. SQL: 'SQL'
  4750. }
  4751. /**
  4752. * @enum RasterFunctionType
  4753. * @memberOf SuperMap
  4754. * @description 栅格分析方法。
  4755. * @type {string}
  4756. */
  4757. var RasterFunctionType = SuperMap.RasterFunctionType = {
  4758. /** 归一化植被指数。 */
  4759. NDVI: "NDVI",
  4760. /** 阴影面分析。 */
  4761. HILLSHADE: "HILLSHADE"
  4762. }
  4763. /**
  4764. * @enum ResourceType
  4765. * @memberOf SuperMap
  4766. * @description iportal资源类型。
  4767. * @version 10.0.1
  4768. * @type {string}
  4769. */
  4770. var ResourceType = SuperMap.ResourceType = {
  4771. /** 地图。 */
  4772. MAP: "MAP",
  4773. /** 服务。 */
  4774. SERVICE: "SERVICE",
  4775. /** 场景。 */
  4776. SCENE: "SCENE",
  4777. /** 数据。 */
  4778. DATA: "DATA",
  4779. /** 洞察。 */
  4780. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  4781. /** 大屏。 */
  4782. MAP_DASHBOARD: "MAP_DASHBOARD"
  4783. }
  4784. /**
  4785. * @enum OrderBy
  4786. * @memberOf SuperMap
  4787. * @description iportal资源排序字段。
  4788. * @version 10.0.1
  4789. * @type {string}
  4790. */
  4791. var OrderBy = SuperMap.OrderBy = {
  4792. /** 按更新时间排序 */
  4793. UPDATETIME: "UPDATETIME",
  4794. /** 按热度(可能是访问量、下载量)排序 */
  4795. HEATLEVEL: "HEATLEVEL",
  4796. /** 按相关性排序 */
  4797. RELEVANCE: "RELEVANCE"
  4798. }
  4799. /**
  4800. * @enum OrderType
  4801. * @memberOf SuperMap
  4802. * @description iportal资源升序还是降序过滤
  4803. * @version 10.0.1
  4804. * @type {string}
  4805. */
  4806. var OrderType = SuperMap.OrderType = {
  4807. /** 升序 */
  4808. ASC: "ASC",
  4809. /** 降序 */
  4810. DESC: "DESC"
  4811. }
  4812. /**
  4813. * @enum SearchType
  4814. * @memberOf SuperMap
  4815. * @description iportal资源查询的范围进行过滤
  4816. * @version 10.0.1
  4817. * @type {string}
  4818. */
  4819. var SearchType = SuperMap.SearchType = {
  4820. /** 公开资源。 */
  4821. PUBLIC: "PUBLIC",
  4822. /** 我的资源。 */
  4823. MY_RES: "MY_RES",
  4824. /** 我的群组资源。 */
  4825. MYGROUP_RES: "MYGROUP_RES",
  4826. /** 我的部门资源。 */
  4827. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  4828. /** 分享给我的资源。 */
  4829. SHARETOME_RES: "SHARETOME_RES"
  4830. }
  4831. /**
  4832. * @enum AggregationTypes
  4833. * @memberOf SuperMap
  4834. * @description iportal资源聚合查询的类型
  4835. * @version 10.0.1
  4836. * @type {string}
  4837. */
  4838. var AggregationTypes = SuperMap.AggregationTypes = {
  4839. /** 标签 */
  4840. TAG: "TAG",
  4841. /** 资源类型 */
  4842. TYPE: "TYPE"
  4843. }
  4844. /**
  4845. * @enum PermissionType
  4846. * @memberOf SuperMap
  4847. * @description iportal资源权限类型。
  4848. * @version 10.0.1
  4849. * @type {string}
  4850. */
  4851. var PermissionType = SuperMap.PermissionType = {
  4852. /** 可检索 */
  4853. SEARCH:"SEARCH",
  4854. /** 可查看 */
  4855. READ: "READ",
  4856. /** 可编辑 */
  4857. READWRITE: "READWRITE",
  4858. /** 可删除 */
  4859. DELETE: "DELETE",
  4860. /** 可下载,包括可读、可检索 */
  4861. DOWNLOAD:"DOWNLOAD"
  4862. }
  4863. /**
  4864. * @enum EntityType
  4865. * @memberOf SuperMap
  4866. * @description iportal资源实体类型。
  4867. * @version 10.0.1
  4868. * @type {string}
  4869. */
  4870. var EntityType = SuperMap.EntityType = {
  4871. /** 部门 */
  4872. DEPARTMENT: "DEPARTMENT",
  4873. /** 用户组 */
  4874. GROUP: "GROUP",
  4875. /** 群组 */
  4876. IPORTALGROUP: "IPORTALGROUP",
  4877. /** 角色 */
  4878. ROLE: "ROLE",
  4879. /** 用户 */
  4880. USER: "USER"
  4881. }
  4882. /**
  4883. * @enum DataItemType
  4884. * @memberOf SuperMap
  4885. * @description iportal数据类型。
  4886. * @version 10.0.1
  4887. * @type {string}
  4888. */
  4889. var DataItemType = SuperMap.DataItemType = {
  4890. /** 工作空间 sxwu, smwu, sxw, smw */
  4891. WORKSPACE: "WORKSPACE",
  4892. /** udb 数据源 */
  4893. UDB: "UDB",
  4894. /** shp空间数据 */
  4895. SHP: "SHP",
  4896. /** excel数据 */
  4897. EXCEL: "EXCEL",
  4898. /** csv数据 */
  4899. CSV: "CSV",
  4900. /** geojson数据。 */
  4901. GEOJSON: "GEOJSON",
  4902. /** smtiles */
  4903. SMTILES: "SMTILES",
  4904. /** svtiles */
  4905. SVTILES: "SVTILES",
  4906. /** mbtiles */
  4907. MBTILES: "MBTILES",
  4908. /** tpk */
  4909. TPK: "TPK",
  4910. /** ugc v5 */
  4911. UGCV5: "UGCV5",
  4912. /** UGCV5_MVT */
  4913. UGCV5_MVT: "UGCV5_MVT",
  4914. /** json数据 */
  4915. JSON: "JSON"
  4916. }
  4917. /**
  4918. * @enum WebExportFormatType
  4919. * @memberOf SuperMap
  4920. * @description Web 打印输出的格式。
  4921. * @version 10.0.1
  4922. * @type {string}
  4923. */
  4924. var WebExportFormatType = SuperMap.WebExportFormatType = {
  4925. /** png */
  4926. PNG: "PNG",
  4927. /** pdf */
  4928. PDF: "PDF"
  4929. }
  4930. /**
  4931. * @enum WebScaleOrientationType
  4932. * @memberOf SuperMap
  4933. * @description Web 比例尺的方位样式。
  4934. * @version 10.0.1
  4935. * @type {string}
  4936. */
  4937. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  4938. /** horizontal labels below */
  4939. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  4940. /** horizontal labels above */
  4941. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  4942. /** vertical labels left */
  4943. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  4944. /** vertical labels right */
  4945. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  4946. }
  4947. /**
  4948. * @enum WebScaleType
  4949. * @memberOf SuperMap
  4950. * @description Web 比例尺的样式。
  4951. * @version 10.0.1
  4952. * @type {string}
  4953. */
  4954. var WebScaleType = SuperMap.WebScaleType = {
  4955. /** line */
  4956. LINE: "LINE",
  4957. /** bar */
  4958. BAR: "BAR",
  4959. /** bar sub */
  4960. BAR_SUB: "BAR_SUB"
  4961. }
  4962. /**
  4963. * @enum WebScaleUnit
  4964. * @memberOf SuperMap
  4965. * @description Web 比例尺的单位制。
  4966. * @version 10.0.1
  4967. * @type {string}
  4968. */
  4969. var WebScaleUnit = SuperMap.WebScaleUnit = {
  4970. /** meter */
  4971. METER: "METER",
  4972. /** foot */
  4973. FOOT: "FOOT",
  4974. /** degrees */
  4975. DEGREES: "DEGREES"
  4976. }
  4977. ;// CONCATENATED MODULE: ./src/common/commontypes/Size.js
  4978. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4979. * This program are made available under the terms of the Apache License, Version 2.0
  4980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4981. /**
  4982. * @class SuperMap.Size
  4983. * @category BaseTypes Style
  4984. * @classdesc 此类描绘一对高宽值的实例。
  4985. * @param {number} [w=0.0] - 宽度。
  4986. * @param {number} [h=0.0] - 高度。
  4987. *
  4988. * @example
  4989. * var size = new SuperMap.Size(31,46);
  4990. */
  4991. class Size {
  4992. constructor(w, h) {
  4993. /**
  4994. * @member {number} [SuperMap.Size.prototype.w=0.0]
  4995. * @description 宽度。
  4996. */
  4997. this.w = w ? parseFloat(w) : 0.0;
  4998. /**
  4999. * @member {number} [SuperMap.Size.prototype.h=0.0]
  5000. * @description 高度。
  5001. */
  5002. this.h = w ? parseFloat(h) : 0.0;
  5003. this.CLASS_NAME = "SuperMap.Size";
  5004. }
  5005. /**
  5006. * @function SuperMap.Size.prototype.toString
  5007. * @description 返回此对象的字符串形式。
  5008. * @example
  5009. * var size = new SuperMap.Size(10,5);
  5010. * var str = size.toString();
  5011. * @returns {string} 例如:"w=10,h=5"。
  5012. */
  5013. toString() {
  5014. return ("w=" + this.w + ",h=" + this.h);
  5015. }
  5016. /**
  5017. * @function SuperMap.Size.prototype.clone
  5018. * @description 克隆当前size对象。
  5019. * @example
  5020. * var size = new SuperMap.Size(31,46);
  5021. * var size2 = size.clone();
  5022. * @returns {SuperMap.Size} 返回一个新的与当前 size 对象有相同宽、高的 Size 对象。
  5023. */
  5024. clone() {
  5025. return new Size(this.w, this.h);
  5026. }
  5027. /**
  5028. *
  5029. * @function SuperMap.Size.prototype.equals
  5030. * @description 比较两个 size 对象是否相等。
  5031. * @example
  5032. * var size = new SuperMap.Size(31,46);
  5033. * var size2 = new SuperMap.Size(31,46);
  5034. * var isEquals = size.equals(size2);
  5035. *
  5036. * @param {SuperMap.Size} sz - 用于比较相等的 Size 对象。
  5037. * @returns {boolean} 传入的 size 和当前 size 高宽相等,注意:如果传入的 size 为空则返回 false。
  5038. *
  5039. */
  5040. equals(sz) {
  5041. var equals = false;
  5042. if (sz != null) {
  5043. equals = ((this.w === sz.w && this.h === sz.h) ||
  5044. (isNaN(this.w) && isNaN(this.h) && isNaN(sz.w) && isNaN(sz.h)));
  5045. }
  5046. return equals;
  5047. }
  5048. /**
  5049. *
  5050. * @function SuperMap.Size.prototype.destroy
  5051. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  5052. * @example
  5053. * var size = new SuperMap.Size(31,46);
  5054. * size.destroy();
  5055. */
  5056. destroy() {
  5057. this.w = null;
  5058. this.h = null;
  5059. }
  5060. }
  5061. SuperMap.Size = Size;
  5062. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  5063. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5064. * This program are made available under the terms of the Apache License, Version 2.0
  5065. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5066. /**
  5067. * @class SuperMap.Pixel
  5068. * @category BaseTypes Geometry
  5069. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  5070. * @param {number} [x=0.0] - x 坐标。
  5071. * @param {number} [y=0.0] - y 坐标。
  5072. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  5073. *
  5074. * @example
  5075. * //单独创建一个对象
  5076. * var pixcel = new SuperMap.Pixel(100,50);
  5077. *
  5078. * //依据 size 创建
  5079. * var size = new SuperMap.Size(21,25);
  5080. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  5081. */
  5082. class Pixel {
  5083. constructor(x, y, mode) {
  5084. /**
  5085. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  5086. * @description x 坐标。
  5087. */
  5088. this.x = x ? parseFloat(x) : 0.0;
  5089. /**
  5090. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  5091. * @description y 坐标。
  5092. */
  5093. this.y = y ? parseFloat(y) : 0.0;
  5094. /**
  5095. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  5096. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  5097. */
  5098. this.mode = mode;
  5099. this.CLASS_NAME = "SuperMap.Pixel";
  5100. /**
  5101. * @enum SuperMap.Pixel.Mode
  5102. * @readonly
  5103. * @description 模式。
  5104. * @type {string}
  5105. */
  5106. SuperMap.Pixel.Mode = {
  5107. /** 左上模式。*/
  5108. LeftTop: "lefttop",
  5109. /** 右上模式。 */
  5110. RightTop: "righttop",
  5111. /** 右下模式。 */
  5112. RightBottom: "rightbottom",
  5113. /** 左下模式。 */
  5114. LeftBottom: "leftbottom"
  5115. };
  5116. }
  5117. /**
  5118. * @function SuperMap.Pixel.prototype.toString
  5119. * @description 返回此对象的字符串形式。
  5120. * @example
  5121. *
  5122. * var pixcel = new SuperMap.Pixel(100,50);
  5123. * var str = pixcel.toString();
  5124. *
  5125. * @returns {string} 例如: "x=200.4,y=242.2"
  5126. */
  5127. toString() {
  5128. return ("x=" + this.x + ",y=" + this.y);
  5129. }
  5130. /**
  5131. * @function SuperMap.Pixel.prototype.clone
  5132. * @description 克隆当前的 pixel 对象。
  5133. * @example
  5134. * var pixcel = new SuperMap.Pixel(100,50);
  5135. * var pixcel2 = pixcel.clone();
  5136. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  5137. */
  5138. clone() {
  5139. return new Pixel(this.x, this.y, this.mode);
  5140. }
  5141. /**
  5142. * @function SuperMap.Pixel.prototype.equals
  5143. * @description 比较两 pixel 是否相等。
  5144. * @example
  5145. * var pixcel = new SuperMap.Pixel(100,50);
  5146. * var pixcel2 = new SuperMap.Pixel(100,50);
  5147. * var isEquals = pixcel.equals(pixcel2);
  5148. *
  5149. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  5150. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  5151. */
  5152. equals(px) {
  5153. var equals = false;
  5154. if (px != null) {
  5155. equals = ((this.x == px.x && this.y == px.y) ||
  5156. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  5157. }
  5158. return equals;
  5159. }
  5160. /**
  5161. * @function SuperMap.Pixel.prototype.distanceTo
  5162. * @description 返回两个 pixel 的距离。
  5163. * @example
  5164. * var pixcel = new SuperMap.Pixel(100,50);
  5165. * var pixcel2 = new SuperMap.Pixel(110,30);
  5166. * var distance = pixcel.distanceTo(pixcel2);
  5167. *
  5168. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  5169. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  5170. */
  5171. distanceTo(px) {
  5172. return Math.sqrt(
  5173. Math.pow(this.x - px.x, 2) +
  5174. Math.pow(this.y - px.y, 2)
  5175. );
  5176. }
  5177. /**
  5178. * @function SuperMap.Pixel.prototype.add
  5179. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  5180. * @example
  5181. * var pixcel = new SuperMap.Pixel(100,50);
  5182. * //pixcel2是新的对象
  5183. * var pixcel2 = pixcel.add(20,30);
  5184. *
  5185. * @param {number} x - 传入的 x 值。
  5186. * @param {number} y - 传入的 y 值。
  5187. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  5188. */
  5189. add(x, y) {
  5190. if ((x == null) || (y == null)) {
  5191. throw new TypeError('Pixel.add cannot receive null values');
  5192. }
  5193. return new Pixel(this.x + x, this.y + y);
  5194. }
  5195. /**
  5196. * @function SuperMap.Pixel.prototype.offset
  5197. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  5198. * @example
  5199. * var pixcel = new SuperMap.Pixel(100,50);
  5200. * var pixcel2 = new SuperMap.Pixel(130,20);
  5201. * //pixcel3 是新的对象
  5202. * var pixcel3 = pixcel.offset(pixcel2);
  5203. *
  5204. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  5205. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  5206. */
  5207. offset(px) {
  5208. var newPx = this.clone();
  5209. if (px) {
  5210. newPx = this.add(px.x, px.y);
  5211. }
  5212. return newPx;
  5213. }
  5214. /**
  5215. *
  5216. * @function SuperMap.Pixel.prototype.destroy
  5217. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  5218. * @example
  5219. * var pixcel = new SuperMap.Pixel(100,50);
  5220. * pixcel.destroy();
  5221. */
  5222. destroy() {
  5223. this.x = null;
  5224. this.y = null;
  5225. this.mode = null;
  5226. }
  5227. }
  5228. SuperMap.Pixel = Pixel;
  5229. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  5230. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5231. * This program are made available under the terms of the Apache License, Version 2.0
  5232. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5233. /**
  5234. *@namespace SuperMap
  5235. *@category BaseTypes Namespace
  5236. */
  5237. /**
  5238. * @function SuperMap.inherit
  5239. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  5240. * @memberOf SuperMap
  5241. * @param {Object} C - 继承的类。
  5242. * @param {Object} P - 被继承的父类。
  5243. */
  5244. SuperMap.inherit = function (C, P) {
  5245. var F = function () {
  5246. };
  5247. F.prototype = P.prototype;
  5248. C.prototype = new F;
  5249. var i, l, o;
  5250. for (i = 2, l = arguments.length; i < l; i++) {
  5251. o = arguments[i];
  5252. if (typeof o === "function") {
  5253. o = o.prototype;
  5254. }
  5255. SuperMap.Util.extend(C.prototype, o);
  5256. }
  5257. };
  5258. /**
  5259. * @function SuperMap.mixin
  5260. * @description 实现多重继承。
  5261. * @memberOf SuperMap
  5262. * @param {Class|Object} ...mixins - 继承的类。
  5263. */
  5264. SuperMap.mixin = function (...mixins) {
  5265. class Mix {
  5266. constructor(options) {
  5267. for (var index = 0; index < mixins.length; index++) {
  5268. copyProperties(this, new mixins[index](options));
  5269. }
  5270. }
  5271. }
  5272. for (var index = 0; index < mixins.length; index++) {
  5273. var mixin = mixins[index];
  5274. copyProperties(Mix, mixin);
  5275. copyProperties(Mix.prototype, mixin.prototype);
  5276. copyProperties(Mix.prototype, new mixin());
  5277. }
  5278. return Mix;
  5279. function copyProperties(target, source) {
  5280. var ownKeys = Object.getOwnPropertyNames(source);
  5281. if (Object.getOwnPropertySymbols) {
  5282. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  5283. }
  5284. for (var index = 0; index < ownKeys.length; index++) {
  5285. var key = ownKeys[index];
  5286. if (key !== "constructor"
  5287. && key !== "prototype"
  5288. && key !== "name" && key !== "length") {
  5289. let desc = Object.getOwnPropertyDescriptor(source, key);
  5290. if (window["ActiveXObject"]) {
  5291. Object.defineProperty(target, key, desc || {});
  5292. } else {
  5293. Object.defineProperty(target, key, desc);
  5294. }
  5295. }
  5296. }
  5297. }
  5298. };
  5299. /**
  5300. * @name String
  5301. * @namespace
  5302. * @memberOf SuperMap
  5303. * @category BaseTypes Util
  5304. * @description 字符串操作的一系列常用扩展函数。
  5305. */
  5306. var StringExt = SuperMap.String = {
  5307. /**
  5308. * @function SuperMap.String.startsWith
  5309. * @description 判断目标字符串是否以指定的子字符串开头。
  5310. * @param {string} str - 目标字符串。
  5311. * @param {string} sub - 查找的子字符串。
  5312. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  5313. */
  5314. startsWith: function (str, sub) {
  5315. return (str.indexOf(sub) == 0);
  5316. },
  5317. /**
  5318. * @function SuperMap.String.contains
  5319. * @description 判断目标字符串是否包含指定的子字符串。
  5320. * @param {string} str - 目标字符串。
  5321. * @param {string} sub - 查找的子字符串。
  5322. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  5323. */
  5324. contains: function (str, sub) {
  5325. return (str.indexOf(sub) != -1);
  5326. },
  5327. /**
  5328. * @function SuperMap.String.trim
  5329. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  5330. * @param {string} str - (可能)存在空白字符填塞的字符串。
  5331. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  5332. */
  5333. trim: function (str) {
  5334. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  5335. },
  5336. /**
  5337. * @function SuperMap.String.camelize
  5338. * @description 骆驼式("-")连字符的字符串处理。
  5339. * 例如:"chicken-head" becomes "chickenHead",
  5340. * "-chicken-head" becomes "ChickenHead"。
  5341. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  5342. * @returns {string}
  5343. */
  5344. camelize: function (str) {
  5345. var oStringList = str.split('-');
  5346. var camelizedString = oStringList[0];
  5347. for (var i = 1, len = oStringList.length; i < len; i++) {
  5348. var s = oStringList[i];
  5349. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  5350. }
  5351. return camelizedString;
  5352. },
  5353. /**
  5354. * @function SuperMap.String.format
  5355. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  5356. * @example
  5357. * 示例:
  5358. * (code)
  5359. * 1、template = "${value,getValue}";
  5360. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  5361. * args = [2,23,12,36,21];
  5362. * 返回值:36
  5363. * (end)
  5364. * 示例:
  5365. * (code)
  5366. * 2、template = "$${{value,getValue}}";
  5367. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  5368. * args = [2,23,12,36,21];
  5369. * 返回值:"${36}"
  5370. * (end)
  5371. * 示例:
  5372. * (code)
  5373. * 3、template = "${a,b}";
  5374. * context = {a: {b:"format"}};
  5375. * args = null;
  5376. * 返回值:"format"
  5377. * (end)
  5378. * 示例:
  5379. * (code)
  5380. * 3、template = "${a,b}";
  5381. * context = null;
  5382. * args = null;
  5383. * 返回值:"${a.b}"
  5384. * (end)
  5385. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  5386. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  5387. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  5388. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  5389. */
  5390. format: function (template, context, args) {
  5391. if (!context) {
  5392. context = window;
  5393. }
  5394. // Example matching:
  5395. // str = ${foo.bar}
  5396. // match = foo.bar
  5397. var replacer = function (str, match) {
  5398. var replacement;
  5399. // Loop through all subs. Example: ${a.b.c}
  5400. // 0 -> replacement = context[a];
  5401. // 1 -> replacement = context[a][b];
  5402. // 2 -> replacement = context[a][b][c];
  5403. var subs = match.split(/\.+/);
  5404. for (var i = 0; i < subs.length; i++) {
  5405. if (i == 0) {
  5406. replacement = context;
  5407. }
  5408. replacement = replacement[subs[i]];
  5409. }
  5410. if (typeof replacement === "function") {
  5411. replacement = args ?
  5412. replacement.apply(null, args) :
  5413. replacement();
  5414. }
  5415. // If replacement is undefined, return the string 'undefined'.
  5416. // This is a workaround for a bugs in browsers not properly
  5417. // dealing with non-participating groups in regular expressions:
  5418. // http://blog.stevenlevithan.com/archives/npcg-javascript
  5419. if (typeof replacement == 'undefined') {
  5420. return 'undefined';
  5421. } else {
  5422. return replacement;
  5423. }
  5424. };
  5425. return template.replace(SuperMap.String.tokenRegEx, replacer);
  5426. },
  5427. /**
  5428. * @member {RegExp} [SuperMap.String.tokenRegEx]
  5429. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  5430. * @example
  5431. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  5432. */
  5433. tokenRegEx: /\$\{([\w.]+?)\}/g,
  5434. /**
  5435. * @member {RegExp} [SuperMap.String.numberRegEx]
  5436. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  5437. */
  5438. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  5439. /**
  5440. * @function SuperMap.String.isNumeric
  5441. * @description 判断一个字符串是否只包含一个数值。
  5442. * @example
  5443. * (code)
  5444. * SuperMap.String.isNumeric("6.02e23") // true
  5445. * SuperMap.String.isNumeric("12 dozen") // false
  5446. * SuperMap.String.isNumeric("4") // true
  5447. * SuperMap.String.isNumeric(" 4 ") // false
  5448. * (end)
  5449. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  5450. */
  5451. isNumeric: function (value) {
  5452. return SuperMap.String.numberRegEx.test(value);
  5453. },
  5454. /**
  5455. * @function SuperMap.String.numericIf
  5456. * @description 把一个看似数值型的字符串转化为一个数值。
  5457. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  5458. */
  5459. numericIf: function (value) {
  5460. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  5461. }
  5462. };
  5463. /**
  5464. * @name Number
  5465. * @memberOf SuperMap
  5466. * @namespace
  5467. * @category BaseTypes Util
  5468. * @description 数值操作的一系列常用扩展函数。
  5469. */
  5470. var NumberExt = SuperMap.Number = {
  5471. /**
  5472. * @member {string} [SuperMap.Number.decimalSeparator='.']
  5473. * @description 格式化数字时默认的小数点分隔符。
  5474. * @constant
  5475. */
  5476. decimalSeparator: ".",
  5477. /**
  5478. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  5479. * @description 格式化数字时默认的千位分隔符。
  5480. * @constant
  5481. */
  5482. thousandsSeparator: ",",
  5483. /**
  5484. * @function SuperMap.Number.limitSigDigs
  5485. * @description 限制浮点数的有效数字位数。
  5486. * @param {number} num - 浮点数。
  5487. * @param {integer} sig - 有效位数。
  5488. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  5489. */
  5490. limitSigDigs: function (num, sig) {
  5491. var fig = 0;
  5492. if (sig > 0) {
  5493. fig = parseFloat(num.toPrecision(sig));
  5494. }
  5495. return fig;
  5496. },
  5497. /**
  5498. * @function SuperMap.Number.format
  5499. * @description 数字格式化输出。
  5500. * @param {number} num - 数字。
  5501. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  5502. * @param {string} [tsep=','] - 千位分隔符。
  5503. * @param {string} [dsep='.'] - 小数点分隔符。
  5504. * @returns {string} 数字格式化后的字符串。
  5505. */
  5506. format: function (num, dec, tsep, dsep) {
  5507. dec = (typeof dec != "undefined") ? dec : 0;
  5508. tsep = (typeof tsep != "undefined") ? tsep :
  5509. SuperMap.Number.thousandsSeparator;
  5510. dsep = (typeof dsep != "undefined") ? dsep :
  5511. SuperMap.Number.decimalSeparator;
  5512. if (dec != null) {
  5513. num = parseFloat(num.toFixed(dec));
  5514. }
  5515. var parts = num.toString().split(".");
  5516. if (parts.length === 1 && dec == null) {
  5517. // integer where we do not want to touch the decimals
  5518. dec = 0;
  5519. }
  5520. var integer = parts[0];
  5521. if (tsep) {
  5522. var thousands = /(-?[0-9]+)([0-9]{3})/;
  5523. while (thousands.test(integer)) {
  5524. integer = integer.replace(thousands, "$1" + tsep + "$2");
  5525. }
  5526. }
  5527. var str;
  5528. if (dec == 0) {
  5529. str = integer;
  5530. } else {
  5531. var rem = parts.length > 1 ? parts[1] : "0";
  5532. if (dec != null) {
  5533. rem = rem + new Array(dec - rem.length + 1).join("0");
  5534. }
  5535. str = integer + dsep + rem;
  5536. }
  5537. return str;
  5538. }
  5539. };
  5540. if (!Number.prototype.limitSigDigs) {
  5541. /**
  5542. * APIMethod: Number.limitSigDigs
  5543. * 限制浮点数的有效数字位数.
  5544. * @param {integer} sig -有效位数。
  5545. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  5546. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  5547. */
  5548. Number.prototype.limitSigDigs = function (sig) {
  5549. return NumberExt.limitSigDigs(this, sig);
  5550. };
  5551. }
  5552. /**
  5553. * @name Function
  5554. * @memberOf SuperMap
  5555. * @namespace
  5556. * @category BaseTypes Util
  5557. * @description 函数操作的一系列常用扩展函数。
  5558. */
  5559. var FunctionExt = SuperMap.Function = {
  5560. /**
  5561. * @function SuperMap.Function.bind
  5562. * @description 绑定函数到对象。方便创建 this 的作用域。
  5563. * @param {function} func - 输入函数。
  5564. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  5565. * @returns {function} object 参数作为 func 函数的 this 对象。
  5566. */
  5567. bind: function (func, object) {
  5568. // create a reference to all arguments past the second one
  5569. var args = Array.prototype.slice.apply(arguments, [2]);
  5570. return function () {
  5571. // Push on any additional arguments from the actual function call.
  5572. // These will come after those sent to the bind call.
  5573. var newArgs = args.concat(
  5574. Array.prototype.slice.apply(arguments, [0])
  5575. );
  5576. return func.apply(object, newArgs);
  5577. };
  5578. },
  5579. /**
  5580. * @function SuperMap.Function.bindAsEventListener
  5581. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  5582. * @param {function} func - 用于监听事件的函数。
  5583. * @param {Object} object - this 对象的引用。
  5584. * @returns {function}
  5585. */
  5586. bindAsEventListener: function (func, object) {
  5587. return function (event) {
  5588. return func.call(object, event || window.event);
  5589. };
  5590. },
  5591. /**
  5592. * @function SuperMap.Function.False
  5593. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  5594. * @example
  5595. * document.onclick = SuperMap.Function.False;
  5596. * @returns {boolean}
  5597. */
  5598. False: function () {
  5599. return false;
  5600. },
  5601. /**
  5602. * @function SuperMap.Function.True
  5603. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  5604. * @example
  5605. * document.onclick = SuperMap.Function.True;
  5606. * @returns {boolean}
  5607. */
  5608. True: function () {
  5609. return true;
  5610. },
  5611. /**
  5612. * @function SuperMap.Function.Void
  5613. * @description 可重用函数,仅仅返回 "undefined"。
  5614. * @returns {undefined}
  5615. */
  5616. Void: function () {
  5617. }
  5618. };
  5619. /**
  5620. * @name Array
  5621. * @memberOf SuperMap
  5622. * @namespace
  5623. * @category BaseTypes Util
  5624. * @description 数组操作的一系列常用扩展函数。
  5625. */
  5626. var ArrayExt = SuperMap.Array = {
  5627. /**
  5628. * @function SuperMap.Array.filter
  5629. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  5630. * @param {Array} array - 要过滤的数组。
  5631. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  5632. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  5633. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  5634. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  5635. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  5636. */
  5637. filter: function (array, callback, caller) {
  5638. var selected = [];
  5639. if (Array.prototype.filter) {
  5640. selected = array.filter(callback, caller);
  5641. } else {
  5642. var len = array.length;
  5643. if (typeof callback != "function") {
  5644. throw new TypeError();
  5645. }
  5646. for (var i = 0; i < len; i++) {
  5647. if (i in array) {
  5648. var val = array[i];
  5649. if (callback.call(caller, val, i, array)) {
  5650. selected.push(val);
  5651. }
  5652. }
  5653. }
  5654. }
  5655. return selected;
  5656. }
  5657. };
  5658. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  5659. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5660. * This program are made available under the terms of the Apache License, Version 2.0
  5661. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5662. var Util = SuperMap.Util = SuperMap.Util || {};
  5663. /**
  5664. * @name Util
  5665. * @memberOf SuperMap
  5666. * @namespace
  5667. * @category BaseTypes Util
  5668. * @description common 工具类。
  5669. */
  5670. /**
  5671. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  5672. * @example
  5673. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  5674. * var size = new SuperMap.Size(100, 100);
  5675. * var obj = {};
  5676. * SuperMap.Util.extend(obj, size);
  5677. * @param {Object} [destination] - 目标对象。
  5678. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  5679. * @returns {Object} 目标对象。
  5680. */
  5681. SuperMap.Util.extend = function (destination, source) {
  5682. destination = destination || {};
  5683. if (source) {
  5684. for (var property in source) {
  5685. var value = source[property];
  5686. if (value !== undefined) {
  5687. destination[property] = value;
  5688. }
  5689. }
  5690. /**
  5691. * IE doesn't include the toString property when iterating over an object's
  5692. * properties with the for(property in object) syntax. Explicitly check if
  5693. * the source has its own toString property.
  5694. */
  5695. /*
  5696. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  5697. * prototype object" when calling hawOwnProperty if the source object
  5698. * is an instance of window.Event.
  5699. */
  5700. var sourceIsEvt = typeof window.Event === "function"
  5701. && source instanceof window.Event;
  5702. if (!sourceIsEvt
  5703. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  5704. destination.toString = source.toString;
  5705. }
  5706. }
  5707. return destination;
  5708. };
  5709. /**
  5710. * @description 对象拷贝。
  5711. * @param {Object} [des] - 目标对象。
  5712. * @param {Object} soc - 源对象。
  5713. */
  5714. SuperMap.Util.copy = function (des, soc) {
  5715. des = des || {};
  5716. var v;
  5717. if (soc) {
  5718. for (var p in des) {
  5719. v = soc[p];
  5720. if (typeof v !== 'undefined') {
  5721. des[p] = v;
  5722. }
  5723. }
  5724. }
  5725. };
  5726. /**
  5727. * @description 销毁对象,将其属性置空。
  5728. * @param {Object} [obj] - 目标对象。
  5729. */
  5730. SuperMap.Util.reset = function (obj) {
  5731. obj = obj || {};
  5732. for (var p in obj) {
  5733. if (obj.hasOwnProperty(p)) {
  5734. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  5735. for (var i in obj[p]) {
  5736. if (obj[p][i].destroy) {
  5737. obj[p][i].destroy();
  5738. }
  5739. }
  5740. obj[p].length = 0;
  5741. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  5742. if (obj[p].destroy) {
  5743. obj[p].destroy();
  5744. }
  5745. }
  5746. obj[p] = null;
  5747. }
  5748. }
  5749. };
  5750. /**
  5751. * @description 获取 HTML 元素数组。
  5752. * @returns {Array.<HTMLElement>} HTML 元素数组。
  5753. */
  5754. SuperMap.Util.getElement = function () {
  5755. var elements = [];
  5756. for (var i = 0, len = arguments.length; i < len; i++) {
  5757. var element = arguments[i];
  5758. if (typeof element === 'string') {
  5759. element = document.getElementById(element);
  5760. }
  5761. if (arguments.length === 1) {
  5762. return element;
  5763. }
  5764. elements.push(element);
  5765. }
  5766. return elements;
  5767. };
  5768. /**
  5769. * @description instance of 的跨浏览器实现。
  5770. * @param {Object} o - 对象。
  5771. * @returns {boolean} 是否是页面元素。
  5772. */
  5773. SuperMap.Util.isElement = function (o) {
  5774. return !!(o && o.nodeType === 1);
  5775. };
  5776. /**
  5777. * @description 判断一个对象是否是数组。
  5778. * @param {Object} a - 对象。
  5779. * @returns {boolean} 是否是数组。
  5780. */
  5781. SuperMap.Util.isArray = function (a) {
  5782. return (Object.prototype.toString.call(a) === '[object Array]');
  5783. };
  5784. /**
  5785. * @description 从数组中删除某一项。
  5786. * @param {Array} array - 数组。
  5787. * @param {Object} item - 数组中要删除的一项。
  5788. * @returns {Array} 执行删除操作后的数组。
  5789. */
  5790. SuperMap.Util.removeItem = function (array, item) {
  5791. for (var i = array.length - 1; i >= 0; i--) {
  5792. if (array[i] === item) {
  5793. array.splice(i, 1);
  5794. //break;more than once??
  5795. }
  5796. }
  5797. return array;
  5798. };
  5799. /**
  5800. * @description 获取某对象再数组中的索引值。
  5801. * @param {Array} array - 数组。
  5802. * @param {Object} obj - 对象。
  5803. * @returns {number} 某对象再数组中的索引值。
  5804. */
  5805. SuperMap.Util.indexOf = function (array, obj) {
  5806. if (array == null) {
  5807. return -1;
  5808. } else {
  5809. // use the build-in function if available.
  5810. if (typeof array.indexOf === "function") {
  5811. return array.indexOf(obj);
  5812. } else {
  5813. for (var i = 0, len = array.length; i < len; i++) {
  5814. if (array[i] === obj) {
  5815. return i;
  5816. }
  5817. }
  5818. return -1;
  5819. }
  5820. }
  5821. };
  5822. /**
  5823. * @description 修改某 DOM 元素的许多属性。
  5824. * @param {HTMLElement} element - 待修改的 DOM 元素。
  5825. * @param {string} [id] - DOM 元素的 ID。
  5826. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  5827. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  5828. * @param {string} [position] - DOM 元素的 position 属性。
  5829. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  5830. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  5831. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  5832. */
  5833. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  5834. border, overflow, opacity) {
  5835. if (id) {
  5836. element.id = id;
  5837. }
  5838. if (px) {
  5839. element.style.left = px.x + "px";
  5840. element.style.top = px.y + "px";
  5841. }
  5842. if (sz) {
  5843. element.style.width = sz.w + "px";
  5844. element.style.height = sz.h + "px";
  5845. }
  5846. if (position) {
  5847. element.style.position = position;
  5848. }
  5849. if (border) {
  5850. element.style.border = border;
  5851. }
  5852. if (overflow) {
  5853. element.style.overflow = overflow;
  5854. }
  5855. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  5856. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  5857. element.style.opacity = opacity;
  5858. } else if (parseFloat(opacity) === 1.0) {
  5859. element.style.filter = '';
  5860. element.style.opacity = '';
  5861. }
  5862. };
  5863. /**
  5864. * @description Takes an object and copies any properties that don't exist from
  5865. * another properties, by analogy with SuperMap.Util.extend() from
  5866. * Prototype.js.
  5867. *
  5868. * @param {Object} [to] - 目标对象。
  5869. * @param {Object} from - 源对象。Any properties of this object that
  5870. * are undefined in the to object will be set on the to object.
  5871. *
  5872. * @returns {Object} A reference to the to object. Note that the to argument is modified
  5873. * in place and returned by this function.
  5874. */
  5875. SuperMap.Util.applyDefaults = function (to, from) {
  5876. to = to || {};
  5877. /*
  5878. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  5879. * prototype object" when calling hawOwnProperty if the source object is an
  5880. * instance of window.Event.
  5881. */
  5882. var fromIsEvt = typeof window.Event === "function"
  5883. && from instanceof window.Event;
  5884. for (var key in from) {
  5885. if (to[key] === undefined ||
  5886. (!fromIsEvt && from.hasOwnProperty
  5887. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  5888. to[key] = from[key];
  5889. }
  5890. }
  5891. /**
  5892. * IE doesn't include the toString property when iterating over an object's
  5893. * properties with the for(property in object) syntax. Explicitly check if
  5894. * the source has its own toString property.
  5895. */
  5896. if (!fromIsEvt && from && from.hasOwnProperty
  5897. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  5898. to.toString = from.toString;
  5899. }
  5900. return to;
  5901. };
  5902. /**
  5903. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  5904. * @param {Object} params - 参数对象。
  5905. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  5906. */
  5907. SuperMap.Util.getParameterString = function (params) {
  5908. var paramsArray = [];
  5909. for (var key in params) {
  5910. var value = params[key];
  5911. if ((value != null) && (typeof value !== 'function')) {
  5912. var encodedValue;
  5913. if (Array.isArray(value) || value.toString() === '[object Object]') {
  5914. encodedValue = encodeURIComponent(JSON.stringify(value));
  5915. } else {
  5916. /* value is a string; simply encode */
  5917. encodedValue = encodeURIComponent(value);
  5918. }
  5919. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  5920. }
  5921. }
  5922. return paramsArray.join("&");
  5923. };
  5924. /**
  5925. * @description 给 URL 追加查询参数。
  5926. * @param {string} url - 待追加参数的 URL 字符串。
  5927. * @param {string} paramStr - 待追加的查询参数。
  5928. * @returns {string} 新的 URL。
  5929. */
  5930. SuperMap.Util.urlAppend = function (url, paramStr) {
  5931. var newUrl = url;
  5932. if (paramStr) {
  5933. if(paramStr.indexOf('?') === 0){
  5934. paramStr = paramStr.substring(1);
  5935. }
  5936. var parts = (url + " ").split(/[?&]/);
  5937. newUrl += (parts.pop() === " " ?
  5938. paramStr :
  5939. parts.length ? "&" + paramStr : "?" + paramStr);
  5940. }
  5941. return newUrl;
  5942. };
  5943. /**
  5944. * @description 给 URL 追加 path 参数。
  5945. * @param {string} url - 待追加参数的 URL 字符串。
  5946. * @param {string} paramStr - 待追加的path参数。
  5947. * @returns {string} 新的 URL。
  5948. */
  5949. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  5950. let newUrl = url;
  5951. if (!pathStr) {
  5952. return newUrl;
  5953. }
  5954. if (pathStr.indexOf('/') === 0) {
  5955. pathStr = pathStr.substring(1);
  5956. }
  5957. const parts = url.split('?');
  5958. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  5959. parts[0] += '/'
  5960. }
  5961. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  5962. return newUrl;
  5963. };
  5964. /**
  5965. * @description 为了避免浮点精度错误而保留的有效位数。
  5966. * @type {number}
  5967. * @default 14
  5968. */
  5969. SuperMap.Util.DEFAULT_PRECISION = 14;
  5970. /**
  5971. * @description 将字符串以接近的精度转换为数字。
  5972. * @param {string} number - 字符串。
  5973. * @param {number} [precision=14] - 精度。
  5974. * @returns {number} 数字。
  5975. */
  5976. SuperMap.Util.toFloat = function (number, precision) {
  5977. if (precision == null) {
  5978. precision = SuperMap.Util.DEFAULT_PRECISION;
  5979. }
  5980. if (typeof number !== "number") {
  5981. number = parseFloat(number);
  5982. }
  5983. return precision === 0 ? number :
  5984. parseFloat(number.toPrecision(precision));
  5985. };
  5986. /**
  5987. * @description 角度转弧度。
  5988. * @param {number} x - 角度。
  5989. * @returns {number} 弧度。
  5990. */
  5991. SuperMap.Util.rad = function (x) {
  5992. return x * Math.PI / 180;
  5993. };
  5994. /**
  5995. * @description 从 URL 字符串中解析出参数对象。
  5996. * @param {string} url - URL。
  5997. * @returns {Object} 解析出的参数对象。
  5998. */
  5999. SuperMap.Util.getParameters = function (url) {
  6000. // if no url specified, take it from the location bar
  6001. url = (url === null || url === undefined) ? window.location.href : url;
  6002. //parse out parameters portion of url string
  6003. var paramsString = "";
  6004. if (SuperMap.String.contains(url, '?')) {
  6005. var start = url.indexOf('?') + 1;
  6006. var end = SuperMap.String.contains(url, "#") ?
  6007. url.indexOf('#') : url.length;
  6008. paramsString = url.substring(start, end);
  6009. }
  6010. var parameters = {};
  6011. var pairs = paramsString.split(/[&;]/);
  6012. for (var i = 0, len = pairs.length; i < len; ++i) {
  6013. var keyValue = pairs[i].split('=');
  6014. if (keyValue[0]) {
  6015. var key = keyValue[0];
  6016. try {
  6017. key = decodeURIComponent(key);
  6018. } catch (err) {
  6019. key = unescape(key);
  6020. }
  6021. // being liberal by replacing "+" with " "
  6022. var value = (keyValue[1] || '').replace(/\+/g, " ");
  6023. try {
  6024. value = decodeURIComponent(value);
  6025. } catch (err) {
  6026. value = unescape(value);
  6027. }
  6028. // follow OGC convention of comma delimited values
  6029. value = value.split(",");
  6030. //if there's only one value, do not return as array
  6031. if (value.length == 1) {
  6032. value = value[0];
  6033. }
  6034. parameters[key] = value;
  6035. }
  6036. }
  6037. return parameters;
  6038. };
  6039. /**
  6040. * @description 不断递增计数变量,用于生成唯一 ID。
  6041. * @type {number}
  6042. * @default 0
  6043. */
  6044. SuperMap.Util.lastSeqID = 0;
  6045. /**
  6046. * @description 创建唯一 ID 值。
  6047. * @param {string} [prefix] - 前缀。
  6048. * @returns {string} 唯一的 ID 值。
  6049. */
  6050. SuperMap.Util.createUniqueID = function (prefix) {
  6051. if (prefix == null) {
  6052. prefix = "id_";
  6053. }
  6054. SuperMap.Util.lastSeqID += 1;
  6055. return prefix + SuperMap.Util.lastSeqID;
  6056. };
  6057. /**
  6058. * @memberOf SuperMap
  6059. * @description 每单位的英尺数。
  6060. * @type {Object}
  6061. * @constant
  6062. */
  6063. SuperMap.INCHES_PER_UNIT = {
  6064. 'inches': 1.0,
  6065. 'ft': 12.0,
  6066. 'mi': 63360.0,
  6067. 'm': 39.3701,
  6068. 'km': 39370.1,
  6069. 'dd': 4374754,
  6070. 'yd': 36
  6071. };
  6072. SuperMap.INCHES_PER_UNIT.in = SuperMap.INCHES_PER_UNIT.inches;
  6073. SuperMap.INCHES_PER_UNIT.degrees = SuperMap.INCHES_PER_UNIT.dd;
  6074. SuperMap.INCHES_PER_UNIT.nmi = 1852 * SuperMap.INCHES_PER_UNIT.m;
  6075. // Units from CS-Map
  6076. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  6077. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  6078. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  6079. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  6080. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  6081. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  6082. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  6083. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  6084. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  6085. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  6086. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  6087. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  6088. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  6089. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  6090. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  6091. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  6092. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  6093. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  6094. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  6095. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  6096. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  6097. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  6098. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  6099. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  6100. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  6101. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  6102. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  6103. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  6104. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  6105. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  6106. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  6107. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  6108. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  6109. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  6110. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  6111. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  6112. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  6113. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  6114. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  6115. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  6116. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  6117. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  6118. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  6119. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  6120. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  6121. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  6122. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  6123. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  6124. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  6125. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  6126. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  6127. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  6128. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  6129. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  6130. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  6131. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  6132. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  6133. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  6134. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  6135. });
  6136. //unit abbreviations supported by PROJ.4
  6137. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  6138. "mm": SuperMap.INCHES_PER_UNIT.Meter / 1000.0,
  6139. "cm": SuperMap.INCHES_PER_UNIT.Meter / 100.0,
  6140. "dm": SuperMap.INCHES_PER_UNIT.Meter * 100.0,
  6141. "km": SuperMap.INCHES_PER_UNIT.Meter * 1000.0,
  6142. "kmi": SuperMap.INCHES_PER_UNIT.nmi, //International Nautical Mile
  6143. "fath": SuperMap.INCHES_PER_UNIT.Fathom, //International Fathom
  6144. "ch": SuperMap.INCHES_PER_UNIT.IntnlChain, //International Chain
  6145. "link": SuperMap.INCHES_PER_UNIT.IntnlLink, //International Link
  6146. "us-in": SuperMap.INCHES_PER_UNIT.inches, //U.S. Surveyor's Inch
  6147. "us-ft": SuperMap.INCHES_PER_UNIT.Foot, //U.S. Surveyor's Foot
  6148. "us-yd": SuperMap.INCHES_PER_UNIT.Yard, //U.S. Surveyor's Yard
  6149. "us-ch": SuperMap.INCHES_PER_UNIT.GunterChain, //U.S. Surveyor's Chain
  6150. "us-mi": SuperMap.INCHES_PER_UNIT.Mile, //U.S. Surveyor's Statute Mile
  6151. "ind-yd": SuperMap.INCHES_PER_UNIT.IndianYd37, //Indian Yard
  6152. "ind-ft": SuperMap.INCHES_PER_UNIT.IndianFt37, //Indian Foot
  6153. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  6154. });
  6155. /**
  6156. * @memberOf SuperMap
  6157. * @member [SuperMap.DOTS_PER_INCH=96]
  6158. * @description 分辨率与比例尺之间转换的常量。
  6159. * @type {Object}
  6160. */
  6161. SuperMap.DOTS_PER_INCH = 96;
  6162. /**
  6163. * @param {number} scale - 比例尺。
  6164. * @returns {number} 返回正常的 scale 值。
  6165. */
  6166. SuperMap.Util.normalizeScale = function (scale) {
  6167. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  6168. return normScale;
  6169. };
  6170. /**
  6171. * @description 比例尺转分辨率。
  6172. * @param {number} scale - 比例尺。
  6173. * @param {string} [units='degrees'] - 比例尺单位。
  6174. * @returns {number} 分辨率。
  6175. */
  6176. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  6177. var resolution;
  6178. if (scale) {
  6179. if (units == null) {
  6180. units = "degrees";
  6181. }
  6182. var normScale = SuperMap.Util.normalizeScale(scale);
  6183. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  6184. * SuperMap.DOTS_PER_INCH);
  6185. }
  6186. return resolution;
  6187. };
  6188. /**
  6189. * @description 分辨率转比例尺。
  6190. * @param {number} resolution - 分辨率。
  6191. * @param {string} [units='degrees'] - 分辨率单位。
  6192. * @returns {number} 比例尺。
  6193. */
  6194. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  6195. if (units == null) {
  6196. units = "degrees";
  6197. }
  6198. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  6199. SuperMap.DOTS_PER_INCH;
  6200. return scale;
  6201. };
  6202. /**
  6203. * @memberOf SuperMap
  6204. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  6205. * @constant
  6206. */
  6207. SuperMap.IS_GECKO = (function () {
  6208. var ua = navigator.userAgent.toLowerCase();
  6209. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  6210. })();
  6211. /**
  6212. * @memberOf SuperMap
  6213. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  6214. * * "opera" -- Opera
  6215. * * "msie" -- Internet Explorer
  6216. * * "safari" -- Safari
  6217. * * "firefox" -- Firefox
  6218. * * "mozilla" -- Mozilla
  6219. * @constant
  6220. */
  6221. SuperMap.Browser = (function () {
  6222. var name = '', version = '', device = 'pc', uaMatch;
  6223. //以下进行测试
  6224. var ua = navigator.userAgent.toLowerCase();
  6225. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  6226. name = 'msie';
  6227. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  6228. } else if (ua.indexOf("chrome") > -1) {
  6229. name = 'chrome';
  6230. uaMatch = ua.match(/chrome\/([\d.]+)/);
  6231. } else if (ua.indexOf("firefox") > -1) {
  6232. name = 'firefox';
  6233. uaMatch = ua.match(/firefox\/([\d.]+)/);
  6234. } else if (ua.indexOf("opera") > -1) {
  6235. name = 'opera';
  6236. uaMatch = ua.match(/version\/([\d.]+)/);
  6237. } else if (ua.indexOf("safari") > -1) {
  6238. name = 'safari';
  6239. uaMatch = ua.match(/version\/([\d.]+)/);
  6240. }
  6241. version = uaMatch ? uaMatch[1] : '';
  6242. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  6243. device = 'apple';
  6244. } else if (ua.indexOf("android") > -1) {
  6245. uaMatch = ua.match(/version\/([\d.]+)/);
  6246. version = uaMatch ? uaMatch[1] : '';
  6247. device = 'android';
  6248. }
  6249. return {name: name, version: version, device: device};
  6250. })();
  6251. /**
  6252. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  6253. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  6254. */
  6255. SuperMap.Util.getBrowser = function () {
  6256. return SuperMap.Browser;
  6257. };
  6258. /**
  6259. * @description 浏览器是否支持 Canvas。
  6260. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  6261. */
  6262. SuperMap.Util.isSupportCanvas = (function () {
  6263. var checkRes = true, broz = SuperMap.Util.getBrowser();
  6264. if (document.createElement("canvas").getContext) {
  6265. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  6266. checkRes = false;
  6267. }
  6268. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  6269. checkRes = false;
  6270. }
  6271. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  6272. checkRes = false;
  6273. }
  6274. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  6275. checkRes = false;
  6276. }
  6277. } else {
  6278. checkRes = false;
  6279. }
  6280. return checkRes;
  6281. })();
  6282. /**
  6283. * @description 判断;浏览器是否支持 Canvas。
  6284. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  6285. */
  6286. SuperMap.Util.supportCanvas = function () {
  6287. return SuperMap.Util.isSupportCanvas;
  6288. };
  6289. //将服务端的地图单位转成SuperMap的地图单位
  6290. SuperMap.INCHES_PER_UNIT.degree = SuperMap.INCHES_PER_UNIT.dd;
  6291. SuperMap.INCHES_PER_UNIT.meter = SuperMap.INCHES_PER_UNIT.m;
  6292. SuperMap.INCHES_PER_UNIT.foot = SuperMap.INCHES_PER_UNIT.ft;
  6293. SuperMap.INCHES_PER_UNIT.inch = SuperMap.INCHES_PER_UNIT.inches;
  6294. SuperMap.INCHES_PER_UNIT.mile = SuperMap.INCHES_PER_UNIT.mi;
  6295. SuperMap.INCHES_PER_UNIT.kilometer = SuperMap.INCHES_PER_UNIT.km;
  6296. SuperMap.INCHES_PER_UNIT.yard = SuperMap.INCHES_PER_UNIT.yd;
  6297. /**
  6298. * @description 判断一个 URL 请求是否在当前域中。
  6299. * @param {string} url - URL 请求字符串。
  6300. * @returns {boolean} URL 请求是否在当前域中。
  6301. */
  6302. SuperMap.Util.isInTheSameDomain = function (url) {
  6303. if (!url) {
  6304. return true;
  6305. }
  6306. var index = url.indexOf("//");
  6307. var documentUrl = document.location.toString();
  6308. var documentIndex = documentUrl.indexOf("//");
  6309. if (index === -1) {
  6310. return true;
  6311. } else {
  6312. var protocol;
  6313. var substring = protocol = url.substring(0, index);
  6314. var documentSubString = documentUrl.substring(documentIndex + 2);
  6315. documentIndex = documentSubString.indexOf("/");
  6316. var documentPortIndex = documentSubString.indexOf(":");
  6317. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  6318. //var documentPort;
  6319. var documentprotocol = document.location.protocol;
  6320. if (documentPortIndex !== -1) {
  6321. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  6322. } else {
  6323. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  6324. }
  6325. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  6326. return false;
  6327. }
  6328. substring = url.substring(index + 2);
  6329. var portIndex = substring.indexOf(":");
  6330. index = substring.indexOf("/");
  6331. var domainWithPort = substring.substring(0, index);
  6332. var domain;
  6333. if (portIndex !== -1) {
  6334. domain = substring.substring(0, portIndex);
  6335. } else {
  6336. domain = substring.substring(0, index);
  6337. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  6338. }
  6339. var documentDomain = document.domain;
  6340. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  6341. return true;
  6342. }
  6343. }
  6344. return false;
  6345. };
  6346. /**
  6347. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  6348. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  6349. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  6350. * @param {number} scale - 地图初始化时默认的显示比例尺。
  6351. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  6352. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  6353. * @returns {number} 返回图层显示分辨率。
  6354. */
  6355. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  6356. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  6357. if (!viewBounds || !viewer || !scale) {
  6358. return;
  6359. }
  6360. var ratio = 10000,
  6361. rvbWidth = viewBounds.getWidth(),
  6362. rvbHeight = viewBounds.getHeight(),
  6363. rvWidth = viewer.w,
  6364. rvHeight = viewer.h;
  6365. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  6366. datumAxis = datumAxis || 6378137;
  6367. coordUnit = coordUnit || "degrees";
  6368. var dpi;
  6369. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  6370. let num1 = rvbWidth / rvWidth,
  6371. num2 = rvbHeight / rvHeight,
  6372. resolution = num1 > num2 ? num1 : num2;
  6373. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  6374. } else {
  6375. let resolution = rvbWidth / rvWidth;
  6376. dpi = 0.0254 * ratio / resolution / scale / ratio;
  6377. }
  6378. return dpi;
  6379. };
  6380. /**
  6381. * @description 将对象转换成 JSON 字符串。
  6382. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  6383. * @returns {string} 返回转换后的 JSON 对象。
  6384. */
  6385. SuperMap.Util.toJSON = function (obj) {
  6386. var objInn = obj;
  6387. if (objInn == null) {
  6388. return null;
  6389. }
  6390. switch (objInn.constructor) {
  6391. case String:
  6392. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  6393. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  6394. objInn = objInn.replace(/\n/g, "\\n");
  6395. objInn = objInn.replace(/\r/g, "\\r");
  6396. objInn = objInn.replace("<", "&lt;");
  6397. objInn = objInn.replace(">", "&gt;");
  6398. objInn = objInn.replace(/%/g, "%25");
  6399. objInn = objInn.replace(/&/g, "%26");
  6400. return objInn;
  6401. case Array:
  6402. var arr = [];
  6403. for (var i = 0, len = objInn.length; i < len; i++) {
  6404. arr.push(SuperMap.Util.toJSON(objInn[i]));
  6405. }
  6406. return "[" + arr.join(",") + "]";
  6407. case Number:
  6408. return isFinite(objInn) ? String(objInn) : null;
  6409. case Boolean:
  6410. return String(objInn);
  6411. case Date:
  6412. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  6413. "'Year':" + objInn.getFullYear() + "," +
  6414. "'Month':" + (objInn.getMonth() + 1) + "," +
  6415. "'Day':" + objInn.getDate() + "," +
  6416. "'Hour':" + objInn.getHours() + "," +
  6417. "'Minute':" + objInn.getMinutes() + "," +
  6418. "'Second':" + objInn.getSeconds() + "," +
  6419. "'Millisecond':" + objInn.getMilliseconds() + "," +
  6420. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  6421. return dateStr;
  6422. default:
  6423. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  6424. return objInn.toJSON();
  6425. }
  6426. if (typeof objInn === "object") {
  6427. if (objInn.length) {
  6428. let arr = [];
  6429. for (let i = 0, len = objInn.length; i < len; i++) {
  6430. arr.push(SuperMap.Util.toJSON(objInn[i]));
  6431. }
  6432. return "[" + arr.join(",") + "]";
  6433. }
  6434. let arr = [];
  6435. for (let attr in objInn) {
  6436. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  6437. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  6438. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  6439. }
  6440. }
  6441. if (arr.length > 0) {
  6442. return "{" + arr.join(",") + "}";
  6443. } else {
  6444. return "{}";
  6445. }
  6446. }
  6447. return objInn.toString();
  6448. }
  6449. };
  6450. /**
  6451. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  6452. * @param {number} scale - 比例尺。
  6453. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  6454. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  6455. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  6456. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  6457. */
  6458. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  6459. var resolution = null,
  6460. ratio = 10000;
  6461. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  6462. datumAxis = datumAxis || 6378137;
  6463. coordUnit = coordUnit || "";
  6464. if (scale > 0 && dpi > 0) {
  6465. scale = SuperMap.Util.normalizeScale(scale);
  6466. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  6467. //scale = SuperMap.Util.normalizeScale(scale);
  6468. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  6469. return resolution;
  6470. } else {
  6471. resolution = 0.0254 * ratio / dpi / scale / ratio;
  6472. return resolution;
  6473. }
  6474. }
  6475. return -1;
  6476. };
  6477. /**
  6478. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  6479. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  6480. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  6481. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  6482. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  6483. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  6484. */
  6485. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  6486. var scale = null,
  6487. ratio = 10000;
  6488. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  6489. datumAxis = datumAxis || 6378137;
  6490. coordUnit = coordUnit || "";
  6491. if (resolution > 0 && dpi > 0) {
  6492. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  6493. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  6494. return scale;
  6495. } else {
  6496. scale = 0.0254 * ratio / dpi / resolution / ratio;
  6497. return scale;
  6498. }
  6499. }
  6500. return -1;
  6501. };
  6502. /**
  6503. * @description 转换查询结果。
  6504. * @param {Object} result - 查询结果。
  6505. * @returns {Object} 转换后的查询结果。
  6506. */
  6507. SuperMap.Util.transformResult = function (result) {
  6508. if (result.responseText && typeof result.responseText === "string") {
  6509. result = JSON.parse(result.responseText);
  6510. }
  6511. return result;
  6512. };
  6513. /**
  6514. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  6515. * @param {Object} [destination] - 拷贝目标。
  6516. * @param {Object} source - 源对象。
  6517. *
  6518. */
  6519. SuperMap.Util.copyAttributes = function (destination, source) {
  6520. destination = destination || {};
  6521. if (source) {
  6522. for (var property in source) {
  6523. var value = source[property];
  6524. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  6525. destination[property] = value;
  6526. }
  6527. }
  6528. }
  6529. return destination;
  6530. };
  6531. /**
  6532. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  6533. * @param {Object} [destination] - 目标对象。
  6534. * @param {Object} source - 源对象。
  6535. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  6536. *
  6537. */
  6538. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  6539. destination = destination || {};
  6540. if (source) {
  6541. for (var property in source) {
  6542. //去掉禁止拷贝的属性
  6543. var isInClip = false;
  6544. if (clip && clip.length) {
  6545. for (var i = 0, len = clip.length; i < len; i++) {
  6546. if (property === clip[i]) {
  6547. isInClip = true;
  6548. break;
  6549. }
  6550. }
  6551. }
  6552. if (isInClip === true) {
  6553. continue;
  6554. }
  6555. var value = source[property];
  6556. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  6557. destination[property] = value;
  6558. }
  6559. }
  6560. }
  6561. return destination;
  6562. };
  6563. /**
  6564. * @description 克隆一个 Object 对象
  6565. * @param {Object} obj - 需要克隆的对象。
  6566. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  6567. */
  6568. SuperMap.Util.cloneObject = function (obj) {
  6569. // Handle the 3 simple types, and null or undefined
  6570. if (null === obj || "object" !== typeof obj) {
  6571. return obj;
  6572. }
  6573. // Handle Date
  6574. if (obj instanceof Date) {
  6575. let copy = new Date();
  6576. copy.setTime(obj.getTime());
  6577. return copy;
  6578. }
  6579. // Handle Array
  6580. if (obj instanceof Array) {
  6581. let copy = obj.slice(0);
  6582. return copy;
  6583. }
  6584. // Handle Object
  6585. if (obj instanceof Object) {
  6586. let copy = {};
  6587. for (var attr in obj) {
  6588. if (obj.hasOwnProperty(attr)) {
  6589. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  6590. }
  6591. }
  6592. return copy;
  6593. }
  6594. throw new Error("Unable to copy obj! Its type isn't supported.");
  6595. };
  6596. /**
  6597. * @description 判断两条线段是不是有交点。
  6598. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  6599. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  6600. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  6601. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  6602. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  6603. */
  6604. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  6605. var intersectValue = null;
  6606. var k1;
  6607. var k2;
  6608. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  6609. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  6610. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  6611. //ab==0代表两条线断的斜率一样
  6612. if (ab != 0) {
  6613. k1 = b / ab;
  6614. k2 = a / ab;
  6615. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  6616. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  6617. } else {
  6618. intersectValue = "No Intersection";
  6619. }
  6620. } else {
  6621. if (b == 0 && a == 0) {
  6622. var maxy = Math.max(a1.y, a2.y);
  6623. var miny = Math.min(a1.y, a2.y);
  6624. var maxx = Math.max(a1.x, a2.x);
  6625. var minx = Math.min(a1.x, a2.x);
  6626. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  6627. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  6628. intersectValue = "Coincident";//重合
  6629. } else {
  6630. intersectValue = "Parallel";//平行
  6631. }
  6632. } else {
  6633. intersectValue = "Parallel";//平行
  6634. }
  6635. }
  6636. return intersectValue;
  6637. };
  6638. /**
  6639. * @description 获取文本外接矩形宽度与高度。
  6640. * @param {SuperMap.ThemeStyle} style - 文本样式。
  6641. * @param {string} text - 文本内容。
  6642. * @param {Object} element - DOM 元素。
  6643. * @returns {Object} 返回裁剪后的宽度,高度信息。
  6644. */
  6645. SuperMap.Util.getTextBounds = function (style, text, element) {
  6646. document.body.appendChild(element);
  6647. element.style.width = 'auto';
  6648. element.style.height = 'auto';
  6649. if (style.fontSize) {
  6650. element.style.fontSize = style.fontSize;
  6651. }
  6652. if (style.fontFamily) {
  6653. element.style.fontFamily = style.fontFamily;
  6654. }
  6655. if (style.fontWeight) {
  6656. element.style.fontWeight = style.fontWeight;
  6657. }
  6658. element.style.position = 'relative';
  6659. element.style.visibility = 'hidden';
  6660. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  6661. element.style.display = 'inline-block';
  6662. element.innerHTML = text;
  6663. var textWidth = element.clientWidth;
  6664. var textHeight = element.clientHeight;
  6665. document.body.removeChild(element);
  6666. return {
  6667. textWidth: textWidth,
  6668. textHeight: textHeight
  6669. };
  6670. };
  6671. ;// CONCATENATED MODULE: ./src/common/commontypes/LonLat.js
  6672. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6673. * This program are made available under the terms of the Apache License, Version 2.0
  6674. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6675. /**
  6676. * @class SuperMap.LonLat
  6677. * @category BaseTypes Geometry
  6678. * @classdesc 这个类用来表示经度和纬度对。
  6679. * @param {number} [lon=0.0] - 地图单位上的 X 轴坐标,如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。
  6680. * @param {number} [lat=0.0] - 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。
  6681. * @param {Array.<float>} [location] - 如果要同时设置,则使用传入横纵坐标组成的数组。
  6682. * @example
  6683. * var lonLat = new SuperMap.LonLat(30,45);
  6684. */
  6685. class LonLat {
  6686. constructor(lon, lat) {
  6687. if (Util.isArray(lon)) {
  6688. lat = lon[1];
  6689. lon = lon[0];
  6690. }
  6691. /**
  6692. * @member {float} [SuperMap.LonLat.prototype.lon=0.0]
  6693. * @description 地图的单位的 X 轴(横轴)坐标。
  6694. */
  6695. this.lon = lon ? Util.toFloat(lon) : 0.0;
  6696. /**
  6697. * @member {float} [SuperMap.LonLat.prototype.lat=0.0]
  6698. * @description 地图的单位的 Y 轴(纵轴)坐标。
  6699. */
  6700. this.lat = lat ? Util.toFloat(lat) : 0.0;
  6701. this.CLASS_NAME = "SuperMap.LonLat";
  6702. }
  6703. /**
  6704. * @function SuperMap.LonLat.prototype.toString
  6705. * @description 返回此对象的字符串形式
  6706. * @example
  6707. * var lonLat = new SuperMap.LonLat(100,50);
  6708. * var str = lonLat.toString();
  6709. * @returns {string} 例如: "lon=100,lat=50"
  6710. */
  6711. toString() {
  6712. return ("lon=" + this.lon + ",lat=" + this.lat);
  6713. }
  6714. /**
  6715. * @function SuperMap.LonLat.prototype.toShortString
  6716. * @description 将经度纬度转换成简单字符串。
  6717. * @example
  6718. * var lonLat = new SuperMap.LonLat(100,50);
  6719. * var str = lonLat.toShortString();
  6720. * @returns {string} 返回处理后的经纬度字符串。例如:"100,50"
  6721. */
  6722. toShortString() {
  6723. return (this.lon + "," + this.lat);
  6724. }
  6725. /**
  6726. * @function SuperMap.LonLat.prototype.clone
  6727. * @description 复制坐标对象,并返回复制后的新对象。
  6728. * @example
  6729. * var lonLat1 = new SuperMap.LonLat(100,50);
  6730. * var lonLat2 = lonLat1.clone();
  6731. * @returns {SuperMap.LonLat} 返回相同坐标值的新的坐标对象。
  6732. */
  6733. clone() {
  6734. return new LonLat(this.lon, this.lat);
  6735. }
  6736. /**
  6737. * @function SuperMap.LonLat.prototype.add
  6738. * @description 在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。
  6739. * @example
  6740. * var lonLat1 = new SuperMap.LonLat(100,50);
  6741. * //lonLat2 是新的对象
  6742. * var lonLat2 = lonLat1.add(100,50);
  6743. * @param {float} lon - 传入的经度参数。
  6744. * @param {float} lat - 传入的纬度参数。
  6745. * @returns {SuperMap.LonLat} 返回一个新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。
  6746. */
  6747. add(lon, lat) {
  6748. if ((lon == null) || (lat == null)) {
  6749. throw new TypeError('LonLat.add cannot receive null values');
  6750. }
  6751. return new LonLat(this.lon + Util.toFloat(lon),
  6752. this.lat + Util.toFloat(lat));
  6753. }
  6754. /**
  6755. * @function SuperMap.LonLat.prototype.equals
  6756. * @description 判断两个坐标对象是否相等。
  6757. * @example
  6758. * var lonLat1 = new SuperMap.LonLat(100,50);
  6759. * var lonLat2 = new SuperMap.LonLat(100,50);
  6760. * var isEquals = lonLat1.equals(lonLat2);
  6761. * @param {SuperMap.LonLat} ll - 需要进行比较的坐标对象。
  6762. * @returns {boolean} 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一
  6763. * 致或传入的ll参数为NULL则返回false。
  6764. */
  6765. equals(ll) {
  6766. var equals = false;
  6767. if (ll != null) {
  6768. equals = ((this.lon === ll.lon && this.lat === ll.lat) ||
  6769. (isNaN(this.lon) && isNaN(this.lat) && isNaN(ll.lon) && isNaN(ll.lat)));
  6770. }
  6771. return equals;
  6772. }
  6773. /**
  6774. * @function SuperMap.LonLat.prototype.wrapDateLine
  6775. * @description 通过传入的范围对象对坐标对象转换到该范围内。
  6776. * 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。
  6777. * 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。
  6778. * @example
  6779. * var lonLat1 = new SuperMap.LonLat(420,50);
  6780. * var lonLat2 = lonLat1.wrapDateLine(
  6781. * new SuperMap.Bounds(-180,-90,180,90)
  6782. * );
  6783. * @param {SuperMap.Bounds} maxExtent - 最大边界的范围。
  6784. * @returns {SuperMap.LonLat} 将坐标转换到范围对象以内,并返回新的坐标。
  6785. */
  6786. wrapDateLine(maxExtent) {
  6787. var newLonLat = this.clone();
  6788. if (maxExtent) {
  6789. //shift right?
  6790. while (newLonLat.lon < maxExtent.left) {
  6791. newLonLat.lon += maxExtent.getWidth();
  6792. }
  6793. //shift left?
  6794. while (newLonLat.lon > maxExtent.right) {
  6795. newLonLat.lon -= maxExtent.getWidth();
  6796. }
  6797. }
  6798. return newLonLat;
  6799. }
  6800. /**
  6801. *
  6802. * @function SuperMap.LonLat.prototype.destroy
  6803. * @description 销毁此对象。
  6804. * 销毁后此对象的所有属性为 null,而不是初始值。
  6805. * @example
  6806. * var lonLat = new SuperMap.LonLat(100,50);
  6807. * lonLat.destroy();
  6808. */
  6809. destroy() {
  6810. this.lon = null;
  6811. this.lat = null;
  6812. }
  6813. /**
  6814. * @function SuperMap.LonLat.fromString
  6815. * @description 通过字符串生成一个 {@link SuperMap.LonLat} 对象。
  6816. * @example
  6817. * var str = "100,50";
  6818. * var lonLat = SuperMap.LonLat.fromString(str);
  6819. * @param {string} str - 字符串的格式:Lon+","+Lat。如:"100,50"。
  6820. * @returns {SuperMap.LonLat} 返回一个 {@link SuperMap.LonLat} 对象。
  6821. */
  6822. static fromString(str) {
  6823. var pair = str.split(",");
  6824. return new LonLat(pair[0], pair[1]);
  6825. }
  6826. /**
  6827. * @function SuperMap.LonLat.fromArray
  6828. * @description 通过数组生成一个 <SuperMap.LonLat> 对象。
  6829. * @param {Array.<float>} arr - 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。
  6830. * @returns {SuperMap.LonLat} 返回一个 <SuperMap.LonLat> 对象。
  6831. */
  6832. static fromArray(arr) {
  6833. var gotArr = Util.isArray(arr),
  6834. lon = gotArr && arr[0],
  6835. lat = gotArr && arr[1];
  6836. return new LonLat(lon, lat);
  6837. }
  6838. }
  6839. ;// CONCATENATED MODULE: ./src/common/commontypes/Bounds.js
  6840. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6841. * This program are made available under the terms of the Apache License, Version 2.0
  6842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6843. /**
  6844. * @class SuperMap.Bounds
  6845. * @category BaseTypes Geometry
  6846. * @classdesc 表示边界类实例。使用 bounds 之前需要设置 left,bottom,right,top 四个属性,这些属性的初始值为 null。
  6847. * @param {number} [left] - 左边界,注意考虑宽度,理论上小于 right 值。
  6848. * @param {number} [bottom] - 下边界。考虑高度,理论上小于 top 值。
  6849. * @param {number} [right] - 右边界。
  6850. * @param {number} [top] - 上边界。
  6851. * @param {Array.<number>} [array] - [left, bottom, right, top],如果同时传多个参数,则使用左下右上组成的数组。
  6852. * @example
  6853. * var bounds = new SuperMap.Bounds();
  6854. * bounds.extend(new SuperMap.LonLat(4,5));
  6855. * bounds.extend(new SuperMap.LonLat(5,6));
  6856. * bounds.toBBOX(); // returns 4,5,5,6
  6857. */
  6858. class Bounds {
  6859. constructor(left, bottom, right, top) {
  6860. if (Util.isArray(left)) {
  6861. top = left[3];
  6862. right = left[2];
  6863. bottom = left[1];
  6864. left = left[0];
  6865. }
  6866. /**
  6867. * @member {number} SuperMap.Bounds.prototype.left
  6868. * @description 最小的水平坐标系。
  6869. */
  6870. this.left = left != null ? Util.toFloat(left) : this.left;
  6871. /**
  6872. * @member {number} SuperMap.Bounds.prototype.bottom
  6873. * @description 最小的垂直坐标系。
  6874. */
  6875. this.bottom = bottom != null ? Util.toFloat(bottom) : this.bottom;
  6876. /**
  6877. * @member {number} SuperMap.Bounds.prototype.right
  6878. * @description 最大的水平坐标系。
  6879. */
  6880. this.right = right != null ? Util.toFloat(right) : this.right;
  6881. /**
  6882. * @member {number} SuperMap.Bounds.prototype.top
  6883. * @description 最大的垂直坐标系。
  6884. */
  6885. this.top = top != null ? Util.toFloat(top) : this.top;
  6886. /**
  6887. * @member {SuperMap.LonLat} SuperMap.Bounds.prototype.centerLonLat
  6888. * @description bounds 的地图空间的中心点。用 getCenterLonLat() 获得。
  6889. */
  6890. this.centerLonLat = null;
  6891. this.CLASS_NAME = "SuperMap.Bounds";
  6892. }
  6893. /**
  6894. * @function SuperMap.Bounds.prototype.clone
  6895. * @description 复制当前 bounds 对象。
  6896. * @example
  6897. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  6898. * var bounds2 = bounds1.clone();
  6899. * @returns {SuperMap.Bounds} 返回一个克隆的 bounds。
  6900. */
  6901. clone() {
  6902. return new Bounds(this.left, this.bottom,
  6903. this.right, this.top);
  6904. }
  6905. /**
  6906. * @function SuperMap.Bounds.prototype.equals
  6907. * @description 判断两个 bounds 对象是否相等。
  6908. * @example
  6909. * var bounds1 = new SuperMap.Bounds(-180,-90,180,90);
  6910. * var bounds2 = new SuperMap.Bounds(-180,-90,180,90);
  6911. * var isEquals = bounds1.equals(bounds2);
  6912. * @param {SuperMap.Bounds} bounds - 需要进行计较的 bounds。
  6913. * @returns {boolean} 如果 bounds 对象的边和传入的 bounds 一致则返回 true,不一致或传入的 bounds 参数为 NULL 则返回 false。
  6914. */
  6915. equals(bounds) {
  6916. var equals = false;
  6917. if (bounds != null) {
  6918. equals = ((this.left === bounds.left) &&
  6919. (this.right === bounds.right) &&
  6920. (this.top === bounds.top) &&
  6921. (this.bottom === bounds.bottom));
  6922. }
  6923. return equals;
  6924. }
  6925. /**
  6926. * @function SuperMap.Bounds.prototype.toString
  6927. * @description 返回此对象的字符串形式。
  6928. * @example
  6929. * var bounds = new SuperMap.Bounds(-180,-90,180,90);
  6930. * var str = bounds.toString();
  6931. * @returns {string} 边界对象的字符串表示形式(left,bottom,right,top),例如: "-180,-90,180,90"。
  6932. */
  6933. toString() {
  6934. return [this.left, this.bottom, this.right, this.top].join(",");
  6935. }
  6936. /**
  6937. * @function SuperMap.Bounds.prototype.toArray
  6938. * @description 边界对象的数组表示形式。
  6939. * @example
  6940. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6941. * //array1 = [-180,-90,100,80];
  6942. * var array1 = bounds.toArray();
  6943. * //array1 = [-90,-180,80,100];
  6944. * var array2 = bounds.toArray(true);
  6945. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  6946. * 如果设为 true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6947. * @returns {Array.<number>} left, bottom, right, top 数组。
  6948. */
  6949. toArray(reverseAxisOrder) {
  6950. if (reverseAxisOrder === true) {
  6951. return [this.bottom, this.left, this.top, this.right];
  6952. } else {
  6953. return [this.left, this.bottom, this.right, this.top];
  6954. }
  6955. }
  6956. /**
  6957. * @function SuperMap.Bounds.prototype.toBBOX
  6958. * @description 取小数点后 decimal 位数字进行四舍五入再转换为 BBOX 字符串。
  6959. * @example
  6960. * var bounds = new SuperMap.Bounds(-1.1234567,-1.7654321,1.4444444,1.5555555);
  6961. * //str1 = "-1.123457,-1.765432,1.444444,1.555556";
  6962. * var str1 = bounds.toBBOX();
  6963. * //str2 = "-1.1,-1.8,1.4,1.6";
  6964. * var str2 = bounds.toBBOX(1);
  6965. * //str2 = "-1.8,-1.1,1.6,1.4";
  6966. * var str2 = bounds.toBBOX(1,true);
  6967. * @param {integer} [decimal=6] - 边界方位坐标的有效数字个数。
  6968. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。
  6969. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  6970. * @returns {string} 边界对象的字符串表示形式,如:"5,42,10,45"。
  6971. */
  6972. toBBOX(decimal, reverseAxisOrder) {
  6973. if (decimal == null) {
  6974. decimal = 6;
  6975. }
  6976. var mult = Math.pow(10, decimal);
  6977. var xmin = Math.round(this.left * mult) / mult;
  6978. var ymin = Math.round(this.bottom * mult) / mult;
  6979. var xmax = Math.round(this.right * mult) / mult;
  6980. var ymax = Math.round(this.top * mult) / mult;
  6981. if (reverseAxisOrder === true) {
  6982. return ymin + "," + xmin + "," + ymax + "," + xmax;
  6983. } else {
  6984. return xmin + "," + ymin + "," + xmax + "," + ymax;
  6985. }
  6986. }
  6987. /**
  6988. * @function SuperMap.Bounds.prototype.toGeometry
  6989. * @description 基于当前边界范围创建一个新的多边形对象。
  6990. * @example
  6991. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  6992. * //SuperMap.Geometry.Polygon对象
  6993. * var geo = bounds.toGeometry();
  6994. * @returns {SuperMap.Geometry.Polygon} 基于当前 bounds 坐标创建的新的多边形。
  6995. */
  6996. // toGeometry() {
  6997. // return new Polygon([
  6998. // new LinearRing([
  6999. // new Point(this.left, this.bottom),
  7000. // new Point(this.right, this.bottom),
  7001. // new Point(this.right, this.top),
  7002. // new Point(this.left, this.top)
  7003. // ])
  7004. // ]);
  7005. // }
  7006. /**
  7007. * @function SuperMap.Bounds.prototype.getWidth
  7008. * @description 获取 bounds 的宽度。
  7009. * @example
  7010. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7011. * //width = 280;
  7012. * var width = bounds.getWidth();
  7013. * @returns {float} 获取当前 bounds 的宽度(right 减去 left)。
  7014. */
  7015. getWidth() {
  7016. return (this.right - this.left);
  7017. }
  7018. /**
  7019. * @function SuperMap.Bounds.prototype.getHeight
  7020. * @description 获取 bounds 的高度。
  7021. * @example
  7022. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7023. * //height = 170;
  7024. * var height = bounds.getHeight();
  7025. * @returns {float} 返回边界高度(top 减去 bottom)。
  7026. */
  7027. getHeight() {
  7028. return (this.top - this.bottom);
  7029. }
  7030. /**
  7031. * @function SuperMap.Bounds.prototype.getSize
  7032. * @description 获取边框大小。
  7033. * @example
  7034. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7035. * var size = bounds.getSize();
  7036. * @returns {SuperMap.Size} 返回边框大小。
  7037. */
  7038. getSize() {
  7039. return new Size(this.getWidth(), this.getHeight());
  7040. }
  7041. /**
  7042. * @function SuperMap.Bounds.prototype.getCenterPixel
  7043. * @description 获取像素格式的范围中心点。
  7044. * @example
  7045. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7046. * var pixel = bounds.getCenterPixel();
  7047. * @returns {SuperMap.Pixel} 返回像素格式的当前范围的中心点。
  7048. */
  7049. getCenterPixel() {
  7050. return new Pixel((this.left + this.right) / 2,
  7051. (this.bottom + this.top) / 2);
  7052. }
  7053. /**
  7054. * @function SuperMap.Bounds.prototype.getCenterLonLat
  7055. * @description 获取地理格式的范围中心点。
  7056. * @example
  7057. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7058. * var lonlat = bounds.getCenterLonLat();
  7059. * @returns {SuperMap.LonLat} 返回当前地理范围的中心点。
  7060. */
  7061. getCenterLonLat() {
  7062. if (!this.centerLonLat) {
  7063. this.centerLonLat = new LonLat(
  7064. (this.left + this.right) / 2, (this.bottom + this.top) / 2
  7065. );
  7066. }
  7067. return this.centerLonLat;
  7068. }
  7069. /**
  7070. * @function SuperMap.Bounds.prototype.scale
  7071. * @description 按照比例扩大/缩小出一个新的 bounds。
  7072. * @example
  7073. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  7074. * var bounds2 = bounds.scale(2);
  7075. * @param {float} [ratio=1] - 需要扩大的比例。
  7076. * @param {(SuperMap.Pixel|SuperMap.LonLat)} [origin] - 扩大时的基准点,默认为当前 bounds 的中心点。
  7077. * @returns {SuperMap.Bounds} 返回通过 ratio、origin 计算得到的新的边界范围。
  7078. */
  7079. scale(ratio, origin) {
  7080. ratio = ratio ? ratio : 1;
  7081. if (origin == null) {
  7082. origin = this.getCenterLonLat();
  7083. }
  7084. var origx, origy;
  7085. // get origin coordinates
  7086. if (origin.CLASS_NAME === "SuperMap.LonLat") {
  7087. origx = origin.lon;
  7088. origy = origin.lat;
  7089. } else {
  7090. origx = origin.x;
  7091. origy = origin.y;
  7092. }
  7093. var left = (this.left - origx) * ratio + origx;
  7094. var bottom = (this.bottom - origy) * ratio + origy;
  7095. var right = (this.right - origx) * ratio + origx;
  7096. var top = (this.top - origy) * ratio + origy;
  7097. return new Bounds(left, bottom, right, top);
  7098. }
  7099. /**
  7100. * @function SuperMap.Bounds.prototype.add
  7101. * @description 在当前的 Bounds 上按照传入的坐标点进行平移,返回新的范围。
  7102. * @example
  7103. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  7104. * //bounds2 是新的 bounds
  7105. * var bounds2 = bounds.add(20,10);
  7106. * @param {float} x - 传入坐标点的 x 坐标。
  7107. * @param {float} y - 传入坐标点的 y 坐标。
  7108. * @returns {SuperMap.Bounds} 返回一个新的 bounds,此 bounds 的坐标是由传入的 x,y 参数与当前 bounds 坐标计算所得。
  7109. */
  7110. add(x, y) {
  7111. if ((x == null) || (y == null)) {
  7112. throw new TypeError('Bounds.add cannot receive null values');
  7113. }
  7114. return new Bounds(this.left + x, this.bottom + y,
  7115. this.right + x, this.top + y);
  7116. }
  7117. /**
  7118. * @function SuperMap.Bounds.prototype.extend
  7119. * @description 在当前 bounds 上扩展 bounds,支持 point,lanlat 和 bounds。扩展后的 bounds 的范围是两者的结合。
  7120. * @example
  7121. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  7122. * //bounds 改变
  7123. * bounds.extend(new SuperMap.LonLat(50,60));
  7124. * @param {(SuperMap.Geometry.Point|SuperMap.LonLat|SuperMap.Bounds)} object - 可以是 point、lonlat 和 bounds。
  7125. */
  7126. extend(object) {
  7127. var bounds = null;
  7128. if (object) {
  7129. // clear cached center location
  7130. switch (object.CLASS_NAME) {
  7131. case "SuperMap.LonLat":
  7132. bounds = new Bounds(object.lon, object.lat,
  7133. object.lon, object.lat);
  7134. break;
  7135. case "SuperMap.Geometry.Point":
  7136. bounds = new Bounds(object.x, object.y,
  7137. object.x, object.y);
  7138. break;
  7139. case "SuperMap.Bounds":
  7140. bounds = object;
  7141. break;
  7142. }
  7143. if (bounds) {
  7144. this.centerLonLat = null;
  7145. if ((this.left == null) || (bounds.left < this.left)) {
  7146. this.left = bounds.left;
  7147. }
  7148. if ((this.bottom == null) || (bounds.bottom < this.bottom)) {
  7149. this.bottom = bounds.bottom;
  7150. }
  7151. if ((this.right == null) || (bounds.right > this.right)) {
  7152. this.right = bounds.right;
  7153. }
  7154. if ((this.top == null) || (bounds.top > this.top)) {
  7155. this.top = bounds.top;
  7156. }
  7157. }
  7158. }
  7159. }
  7160. /**
  7161. * @function SuperMap.Bounds.prototype.containsLonLat
  7162. * @description 判断传入的坐标是否在范围内。
  7163. * @example
  7164. * var bounds1 = new SuperMap.Bounds(-50,-50,40,40);
  7165. * //isContains1 = true
  7166. * //这里的第二个参数可以直接为 boolean 类型,也就是inclusive
  7167. * var isContains1 = bounds.containsLonLat(new SuperMap.LonLat(40,40),true);
  7168. *
  7169. * //(40,40)在范围内,同样(40+360,40)也在范围内
  7170. * var bounds2 = new SuperMap.Bounds(-50,-50,40,40);
  7171. * //isContains2 = true;
  7172. * var isContains2 = bounds2.containsLonLat(
  7173. * new SuperMap.LonLat(400,40),
  7174. * {
  7175. * inclusive:true,
  7176. * //全球的范围
  7177. * worldBounds: new SuperMap.Bounds(-180,-90,180,90)
  7178. * }
  7179. * );
  7180. * @param {(SuperMap.LonLat|Object)} ll - <SuperMap.LonLat> 对象或者是一个包含 'lon' 与 'lat' 属性的对象。
  7181. * @param {Object} options - 可选参数。
  7182. * @param {boolean} [options.inclusive=true] - 是否包含边界。
  7183. * @param {SuperMap.Bounds} [options.worldBounds] - 如果提供 worldBounds 参数, 如果 ll 参数提供的坐标超出了世界边界(worldBounds),
  7184. * 但是通过日界线的转化可以被包含, 它将被认为是包含在该范围内的。
  7185. * @returns {boolean} 传入坐标是否包含在范围内。
  7186. */
  7187. containsLonLat(ll, options) {
  7188. if (typeof options === "boolean") {
  7189. options = {inclusive: options};
  7190. }
  7191. options = options || {};
  7192. var contains = this.contains(ll.lon, ll.lat, options.inclusive),
  7193. worldBounds = options.worldBounds;
  7194. //日界线以外的也有可能算包含,
  7195. if (worldBounds && !contains) {
  7196. var worldWidth = worldBounds.getWidth();
  7197. var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
  7198. //这一步很关键
  7199. var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
  7200. contains = this.containsLonLat({
  7201. lon: ll.lon - worldsAway * worldWidth,
  7202. lat: ll.lat
  7203. }, {inclusive: options.inclusive});
  7204. }
  7205. return contains;
  7206. }
  7207. /**
  7208. * @function SuperMap.Bounds.prototype.containsPixel
  7209. * @description 判断传入的像素是否在范围内。直接匹配大小,不涉及像素和地理转换。
  7210. * @example
  7211. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  7212. * //isContains = true
  7213. * var isContains = bounds.containsPixel(new SuperMap.Pixel(40,40),true);
  7214. * @param {SuperMap.Pixel} px - 提供的像素参数。
  7215. * @param {boolean} [inclusive=true] - 是否包含边界。
  7216. * @returns {boolean} 传入的 pixel 在当前边界范围之内。
  7217. */
  7218. containsPixel(px, inclusive) {
  7219. return this.contains(px.x, px.y, inclusive);
  7220. }
  7221. /**
  7222. * @function SuperMap.Bounds.prototype.contains
  7223. * @description 判断传入的 x,y 坐标值是否在范围内。
  7224. * @example
  7225. * var bounds = new SuperMap.Bounds(-50,-50,40,40);
  7226. * //isContains = true
  7227. * var isContains = bounds.contains(40,40,true);
  7228. * @param {float} x - 传入的 x 坐标值。
  7229. * @param {float} y - 传入的 y 坐标值。
  7230. * @param {boolean} [inclusive=true] - 是否包含边界。
  7231. * @returns {boolean} 传入的 x,y 坐标是否在当前范围内。
  7232. */
  7233. contains(x, y, inclusive) {
  7234. //set default
  7235. if (inclusive == null) {
  7236. inclusive = true;
  7237. }
  7238. if (x == null || y == null) {
  7239. return false;
  7240. }
  7241. //x = Util.toFloat(x);
  7242. //y = Util.toFloat(y);
  7243. var contains = false;
  7244. if (inclusive) {
  7245. contains = ((x >= this.left) && (x <= this.right) &&
  7246. (y >= this.bottom) && (y <= this.top));
  7247. } else {
  7248. contains = ((x > this.left) && (x < this.right) &&
  7249. (y > this.bottom) && (y < this.top));
  7250. }
  7251. return contains;
  7252. }
  7253. /**
  7254. * @function SuperMap.Bounds.prototype.intersectsBounds
  7255. * @description 判断目标边界范围是否与当前边界范围相交。如果两个边界范围中的任意
  7256. * 边缘相交或者一个边界包含了另外一个就认为这两个边界相交。
  7257. * @example
  7258. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7259. * var isIntersects = bounds.intersectsBounds(
  7260. * new SuperMap.Bounds(-170,-90,120,80)
  7261. * );
  7262. * @param {SuperMap.Bounds} bounds - 目标边界。
  7263. * @param {Object} options - 参数。
  7264. * @param {boolean} [options.inclusive=true] - 边缘重合也看成相交。如果是false,
  7265. * 两个边界范围没有重叠部分仅仅是在边缘相接(重合),
  7266. * 这种情况被认为没有相交。
  7267. * @param {SuperMap.Bounds} [options.worldBounds] - 提供了 worldBounds 参数, 如果他们相交时
  7268. * 是在全球范围内, 两个边界将被视为相交。这仅适用于交叉或完全不在世界范围的边界。
  7269. * @returns {boolean} 传入的 bounds 对象与当前 bounds 相交。
  7270. */
  7271. intersectsBounds(bounds, options) {
  7272. if (typeof options === "boolean") {
  7273. options = {inclusive: options};
  7274. }
  7275. options = options || {};
  7276. if (options.worldBounds) {
  7277. var self = this.wrapDateLine(options.worldBounds);
  7278. bounds = bounds.wrapDateLine(options.worldBounds);
  7279. } else {
  7280. self = this;
  7281. }
  7282. if (options.inclusive == null) {
  7283. options.inclusive = true;
  7284. }
  7285. var intersects = false;
  7286. var mightTouch = (
  7287. self.left === bounds.right ||
  7288. self.right === bounds.left ||
  7289. self.top === bounds.bottom ||
  7290. self.bottom === bounds.top
  7291. );
  7292. // if the two bounds only touch at an edge, and inclusive is false,
  7293. // then the bounds don't *really* intersect.
  7294. if (options.inclusive || !mightTouch) {
  7295. // otherwise, if one of the boundaries even partially contains another,
  7296. // inclusive of the edges, then they do intersect.
  7297. var inBottom = (
  7298. ((bounds.bottom >= self.bottom) && (bounds.bottom <= self.top)) ||
  7299. ((self.bottom >= bounds.bottom) && (self.bottom <= bounds.top))
  7300. );
  7301. var inTop = (
  7302. ((bounds.top >= self.bottom) && (bounds.top <= self.top)) ||
  7303. ((self.top > bounds.bottom) && (self.top < bounds.top))
  7304. );
  7305. var inLeft = (
  7306. ((bounds.left >= self.left) && (bounds.left <= self.right)) ||
  7307. ((self.left >= bounds.left) && (self.left <= bounds.right))
  7308. );
  7309. var inRight = (
  7310. ((bounds.right >= self.left) && (bounds.right <= self.right)) ||
  7311. ((self.right >= bounds.left) && (self.right <= bounds.right))
  7312. );
  7313. intersects = ((inBottom || inTop) && (inLeft || inRight));
  7314. }
  7315. // document me
  7316. if (options.worldBounds && !intersects) {
  7317. var world = options.worldBounds;
  7318. var width = world.getWidth();
  7319. var selfCrosses = !world.containsBounds(self);
  7320. var boundsCrosses = !world.containsBounds(bounds);
  7321. if (selfCrosses && !boundsCrosses) {
  7322. bounds = bounds.add(-width, 0);
  7323. intersects = self.intersectsBounds(bounds, {inclusive: options.inclusive});
  7324. } else if (boundsCrosses && !selfCrosses) {
  7325. self = self.add(-width, 0);
  7326. intersects = bounds.intersectsBounds(self, {inclusive: options.inclusive});
  7327. }
  7328. }
  7329. return intersects;
  7330. }
  7331. /**
  7332. * @function SuperMap.Bounds.prototype.containsBounds
  7333. * @description 判断目标边界是否被当前边界包含在内。
  7334. * @example
  7335. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7336. * var isContains = bounds.containsBounds(
  7337. * new SuperMap.Bounds(-170,-90,100,80),true,true
  7338. * );
  7339. * @param {SuperMap.Bounds} bounds - 目标边界。
  7340. * @param {boolean} [partial=false] - 目标边界的任意部分都包含在当前边界中则被认为是包含关系。
  7341. * 如果设为 false,整个目标边界全部被包含在当前边界范围内。
  7342. * @param {boolean} [inclusive=true] - 边缘共享被视为包含。
  7343. * @returns {boolean} 传入的边界被当前边界包含。
  7344. */
  7345. containsBounds(bounds, partial, inclusive) {
  7346. if (partial == null) {
  7347. partial = false;
  7348. }
  7349. if (inclusive == null) {
  7350. inclusive = true;
  7351. }
  7352. var bottomLeft = this.contains(bounds.left, bounds.bottom, inclusive);
  7353. var bottomRight = this.contains(bounds.right, bounds.bottom, inclusive);
  7354. var topLeft = this.contains(bounds.left, bounds.top, inclusive);
  7355. var topRight = this.contains(bounds.right, bounds.top, inclusive);
  7356. return (partial) ? (bottomLeft || bottomRight || topLeft || topRight)
  7357. : (bottomLeft && bottomRight && topLeft && topRight);
  7358. }
  7359. /**
  7360. * @function SuperMap.Bounds.prototype.determineQuadrant
  7361. * @description 判断传入坐标是否在 bounds 范围内的象限。以 bounds 中心点为坐标原点。
  7362. * @example
  7363. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7364. * //str = "tr";
  7365. * var str = bounds.determineQuadrant(
  7366. * new SuperMap.LonLat(20,20)
  7367. * );
  7368. * @param {SuperMap.LonLat} lonlat - 传入的坐标对象。
  7369. * @returns {string} 传入坐标所在的象限("br" "tr" "tl" "bl" 分别对应"右下","右上","左上" "左下")。
  7370. */
  7371. determineQuadrant(lonlat) {
  7372. var quadrant = "";
  7373. var center = this.getCenterLonLat();
  7374. quadrant += (lonlat.lat < center.lat) ? "b" : "t";
  7375. quadrant += (lonlat.lon < center.lon) ? "l" : "r";
  7376. return quadrant;
  7377. }
  7378. /**
  7379. * @function SuperMap.Bounds.prototype.wrapDateLine
  7380. * @description 将当前 bounds 移动到最大边界范围内部(所谓的内部是相交或者内部)。
  7381. * @example
  7382. * var bounds = new SuperMap.Bounds(380,-40,400,-20);
  7383. * var maxExtent = new SuperMap.Bounds(-180,-90,100,80);
  7384. * //新的bounds
  7385. * var newBounds = bounds.wrapDateLine(maxExtent);
  7386. * @param {SuperMap.Bounds} maxExtent - 最大的边界范围(一般是全球范围)。
  7387. * @param {Object} options - 可选选项参数。
  7388. * @param {float} [options.leftTolerance=0] - left 允许的误差。
  7389. * @param {float} [options.rightTolerance=0] - right 允许的误差。
  7390. * @returns {SuperMap.Bounds} 克隆当前边界。如果当前边界完全在最大范围之外此函数则返回一个不同值的边界,
  7391. * 若落在最大边界的左边,则给当前的bounds值加上最大范围的宽度,即向右移动,
  7392. * 若落在右边,则向左移动,即给当前的bounds值加上负的最大范围的宽度。
  7393. */
  7394. wrapDateLine(maxExtent, options) {
  7395. options = options || {};
  7396. var leftTolerance = options.leftTolerance || 0;
  7397. var rightTolerance = options.rightTolerance || 0;
  7398. var newBounds = this.clone();
  7399. if (maxExtent) {
  7400. var width = maxExtent.getWidth();
  7401. //如果 newBounds 在 maxExtent 的左边,那么一直向右移动,直到相交或者包含为止,每次移动width
  7402. //shift right?
  7403. while (newBounds.left < maxExtent.left &&
  7404. newBounds.right - rightTolerance <= maxExtent.left) {
  7405. newBounds = newBounds.add(width, 0);
  7406. }
  7407. //如果 newBounds 在 maxExtent 的右边,那么一直向左移动,直到相交或者包含为止,每次移动width
  7408. //shift left?
  7409. while (newBounds.left + leftTolerance >= maxExtent.right &&
  7410. newBounds.right > maxExtent.right) {
  7411. newBounds = newBounds.add(-width, 0);
  7412. }
  7413. //如果和右边相交,左边又在内部,那么再次向左边移动一次
  7414. // crosses right only? force left
  7415. var newLeft = newBounds.left + leftTolerance;
  7416. if (newLeft < maxExtent.right && newLeft > maxExtent.left &&
  7417. newBounds.right - rightTolerance > maxExtent.right) {
  7418. newBounds = newBounds.add(-width, 0);
  7419. }
  7420. }
  7421. return newBounds;
  7422. }
  7423. /**
  7424. * @function SuperMap.Bounds.prototype.toServerJSONObject
  7425. * @description 转换成对应的 JSON 格式对象。
  7426. * @example
  7427. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7428. * var obj = bounds.toServerJSONObject();
  7429. * @returns {Object} 返回 JSON 格式的 Object 对象。
  7430. */
  7431. toServerJSONObject() {
  7432. var jsonObject = {
  7433. rightTop: {x: this.right, y: this.top},
  7434. leftBottom: {x: this.left, y: this.bottom},
  7435. left: this.left,
  7436. right: this.right,
  7437. top: this.top,
  7438. bottom: this.bottom
  7439. }
  7440. return jsonObject;
  7441. }
  7442. /**
  7443. *
  7444. * @function SuperMap.Bounds.prototype.destroy
  7445. * @description 销毁此对象。
  7446. * 销毁后此对象的所有属性为 null,而不是初始值。
  7447. * @example
  7448. * var bounds = new SuperMap.Bounds(-180,-90,100,80);
  7449. * bounds.destroy();
  7450. */
  7451. destroy() {
  7452. this.left = null;
  7453. this.right = null;
  7454. this.top = null;
  7455. this.bottom = null;
  7456. this.centerLonLat = null;
  7457. }
  7458. /**
  7459. * @function SuperMap.Bounds.fromString
  7460. * @description 通过字符串参数创建新的 bounds 的构造函数。
  7461. * @example
  7462. * var bounds = SuperMap.Bounds.fromString("-180,-90,100,80");
  7463. * @param {string} str - 边界字符串,用逗号隔开(e.g. <i>"5,42,10,45"</i>)。
  7464. * @param {boolean} [reverseAxisOrder=false] - 是否反转轴顺序。
  7465. * 如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  7466. * @returns {SuperMap.Bounds} 返回给定的字符串创建的新的边界对象。
  7467. */
  7468. static fromString(str, reverseAxisOrder) {
  7469. var bounds = str.split(",");
  7470. return Bounds.fromArray(bounds, reverseAxisOrder);
  7471. }
  7472. /**
  7473. * @function SuperMap.Bounds.fromArray
  7474. * @description 通过边界框数组创建 Bounds。
  7475. * @example
  7476. * var bounds = SuperMap.Bounds.fromArray([-180,-90,100,80]);
  7477. * @param {Array.<float>} bbox - 边界值数组。(e.g. <i>[5,42,10,45]</i>)。
  7478. * @param {boolean} [reverseAxisOrder=false] - 是否是反转轴顺序。如果设为true,则倒转顺序(bottom,left,top,right),否则按正常轴顺序(left,bottom,right,top)。
  7479. * @returns {SuperMap.Bounds} 返回根据传入的数组创建的新的边界对象。
  7480. */
  7481. static fromArray(bbox, reverseAxisOrder) {
  7482. return reverseAxisOrder === true ?
  7483. new Bounds(bbox[1], bbox[0], bbox[3], bbox[2]) :
  7484. new Bounds(bbox[0], bbox[1], bbox[2], bbox[3]);
  7485. }
  7486. /**
  7487. * @function SuperMap.Bounds.fromSize
  7488. * @description 通过传入的边界大小来创建新的边界。
  7489. * @example
  7490. * var bounds = SuperMap.Bounds.fromSize(new SuperMap.Size(20,10));
  7491. * @param {SuperMap.Size} size - 传入的边界大小。
  7492. * @returns {SuperMap.Bounds} 返回根据传入的边界大小的创建新的边界。
  7493. */
  7494. static fromSize(size) {
  7495. return new Bounds(0,
  7496. size.h,
  7497. size.w,
  7498. 0);
  7499. }
  7500. /**
  7501. * @function SuperMap.Bounds.oppositeQuadrant
  7502. * @description 反转象限。"t"和"b" 交换,"r"和"l"交换, 如:"tl"变为"br"。
  7503. * @param {string} quadrant - 代表象限的字符串,如:"tl"。
  7504. * @returns {string} 反转后的象限。
  7505. */
  7506. static oppositeQuadrant(quadrant) {
  7507. var opp = "";
  7508. opp += (quadrant.charAt(0) === 't') ? 'b' : 't';
  7509. opp += (quadrant.charAt(1) === 'l') ? 'r' : 'l';
  7510. return opp;
  7511. }
  7512. }
  7513. SuperMap.Bounds = Bounds;
  7514. ;// CONCATENATED MODULE: ./src/common/commontypes/Geometry.js
  7515. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7516. * This program are made available under the terms of the Apache License, Version 2.0
  7517. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7518. // import {WKT} from '../format/WKT';
  7519. // import {Vector} from './Vector';
  7520. /**
  7521. * @class SuperMap.Geometry
  7522. * @category BaseTypes Geometry
  7523. * @classdesc 几何对象类,描述地理对象的几何图形。
  7524. */
  7525. class Geometry {
  7526. constructor() {
  7527. this.CLASS_NAME = "SuperMap.Geometry";
  7528. /**
  7529. * @member {string} SuperMap.Geometry.prototype.id
  7530. * @description 此几何对象的唯一标示符。
  7531. *
  7532. */
  7533. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  7534. /**
  7535. * @member {SuperMap.Geometry} SuperMap.Geometry.prototype.parent
  7536. * @description This is set when a Geometry is added as component
  7537. * of another geometry
  7538. */
  7539. this.parent = null;
  7540. /**
  7541. * @member {SuperMap.Bounds} SuperMap.Geometry.prototype.bounds
  7542. * @description 几何对象的范围。
  7543. *
  7544. */
  7545. this.bounds = null;
  7546. /**
  7547. * @member {interger} SuperMap.Geometry.prototype.SRID
  7548. * @description 投影坐标参数。通过该参数,服务器判断 Geometry 对象的坐标参考系是否与数据集相同,如果不同,则在数据入库前进行投影变换。
  7549. * @example
  7550. * var geometry= new SuperMap.Geometry();
  7551. * geometry. SRID=4326;
  7552. *
  7553. */
  7554. this.SRID = null;
  7555. }
  7556. /**
  7557. * @function SuperMap.Geometry.prototype.destroy
  7558. * @description 解构 Geometry 类,释放资源。
  7559. */
  7560. destroy() {
  7561. this.id = null;
  7562. this.bounds = null;
  7563. this.SRID = null;
  7564. }
  7565. /**
  7566. * @function SuperMap.Geometry.prototype.clone
  7567. * @description 创建克隆的几何图形。克隆的几何图形不设置非标准的属性。
  7568. * @returns {SuperMap.Geometry} 克隆的几何图形。
  7569. */
  7570. clone() {
  7571. return new Geometry();
  7572. }
  7573. /**
  7574. * @function SuperMap.Geometry.prototype.setBounds
  7575. * @description 设置此几何对象的 bounds。
  7576. * @param {SuperMap.Bounds} bounds - 范围。
  7577. */
  7578. setBounds(bounds) {
  7579. if (bounds) {
  7580. this.bounds = bounds.clone();
  7581. }
  7582. }
  7583. /**
  7584. * @function SuperMap.Geometry.prototype.clearBounds
  7585. * @description 清除几何对象的 bounds。
  7586. * 如果该对象有父类,也会清除父类几何对象的 bounds。
  7587. */
  7588. clearBounds() {
  7589. this.bounds = null;
  7590. if (this.parent) {
  7591. this.parent.clearBounds();
  7592. }
  7593. }
  7594. /**
  7595. * @function SuperMap.Geometry.prototype.extendBounds
  7596. * @description Extend the existing bounds to include the new bounds.
  7597. * If geometry's bounds is not yet set, then set a new Bounds.
  7598. *
  7599. * @param {SuperMap.Bounds} newBounds - 范围。
  7600. */
  7601. extendBounds(newBounds) {
  7602. var bounds = this.getBounds();
  7603. if (!bounds) {
  7604. this.setBounds(newBounds);
  7605. } else {
  7606. this.bounds.extend(newBounds);
  7607. }
  7608. }
  7609. /**
  7610. * @function SuperMap.Geometry.prototype.getBounds
  7611. * @description 获得几何图形的边界。如果没有设置边界,可通过计算获得。
  7612. * @returns {SuperMap.Bounds} 返回的几何对象的边界。
  7613. */
  7614. getBounds() {
  7615. if (this.bounds == null) {
  7616. this.calculateBounds();
  7617. }
  7618. return this.bounds;
  7619. }
  7620. /**
  7621. * @function SuperMap.Geometry.prototype.calculateBounds
  7622. * @description 重新计算几何图形的边界(需要在子类中实现此方法)。
  7623. */
  7624. calculateBounds() {
  7625. //
  7626. // This should be overridden by subclasses.
  7627. //
  7628. }
  7629. /**
  7630. * @function SuperMap.Geometry.prototype.getVertices
  7631. * @description 返回几何图形的所有顶点的列表(需要在子类中实现此方法)。
  7632. * @param {boolean} [nodes] - 如果是 true,线则只返回线的末端点,如果 false,仅仅返回顶点,如果没有设置,则返回顶点。
  7633. * @returns {Array} 几何图形的顶点列表。
  7634. */
  7635. getVertices(nodes) { // eslint-disable-line no-unused-vars
  7636. }
  7637. /**
  7638. * @function SuperMap.Geometry.prototype.getArea
  7639. * @description 计算几何对象的面积 ,此方法需要在子类中定义。
  7640. * @returns {float} The area of the collection by summing its parts
  7641. */
  7642. getArea() {
  7643. //to be overridden by geometries that actually have an area
  7644. //
  7645. return 0.0;
  7646. }
  7647. // /**
  7648. // * @function SuperMap.Geometry.prototype.toString
  7649. // * @description 返回geometry对象的字符串表述,需要引入{@link SuperMap.Format.WKT}。此方法只能在子类实现,在父类使用会报错。
  7650. // * @returns {string} geometry对象的字符串表述(Well-Known Text)
  7651. // */
  7652. // toString() {
  7653. // var string;
  7654. // if (WKT) {
  7655. // var wkt = new WKT();
  7656. // string = wkt.write(new Vector(this));
  7657. // } else {
  7658. // string = Object.prototype.toString.call(this);
  7659. // }
  7660. // return string;
  7661. // }
  7662. }
  7663. SuperMap.Geometry = Geometry;
  7664. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Collection.js
  7665. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7666. * This program are made available under the terms of the Apache License, Version 2.0
  7667. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7668. /**
  7669. * @class SuperMap.Geometry.Collection
  7670. * @classdesc 几何对象集合类,存储在本地的 components 属性中(可作为参数传递给构造函数)。<br>
  7671. * 随着新的几何图形添加到集合中,将不能被克隆,当移动几何图形时,需要指定参照物。<br>
  7672. * getArea 和 getLength 函数只能通过遍历存储几何对象的 components 数组,总计所有几何图形的面积和长度。
  7673. * @category BaseTypes Geometry
  7674. * @extends {SuperMap.Geometry}
  7675. * @param {Array.<SuperMap.Geometry>} components - 几何对象数组。
  7676. * @example
  7677. * var point1 = new SuperMap.Geometry.Point(10,20);
  7678. * var point2 = new SuperMap.Geometry.Point(30,40);
  7679. * var col = new SuperMap.Geometry.Collection([point1,point2]);
  7680. */
  7681. class Collection extends Geometry {
  7682. constructor(components) {
  7683. super();
  7684. /**
  7685. * @description 存储几何对象的数组。
  7686. * @member {Array.<SuperMap.Geometry>} SuperMap.Geometry.Collection.prototype.components
  7687. */
  7688. this.components = [];
  7689. /**
  7690. * @member {Array.<string>} SuperMap.Geometry.Collection.prototype.componentTypes
  7691. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  7692. */
  7693. this.componentTypes = null;
  7694. if (components != null) {
  7695. this.addComponents(components);
  7696. }
  7697. this.CLASS_NAME = "SuperMap.Geometry.Collection";
  7698. this.geometryType = "Collection";
  7699. }
  7700. /**
  7701. * @function SuperMap.Geometry.Collection.prototype.destroy
  7702. * @description 销毁几何图形。
  7703. */
  7704. destroy() {
  7705. this.components.length = 0;
  7706. this.components = null;
  7707. super.destroy();
  7708. }
  7709. /**
  7710. * @function SuperMap.Geometry.Collection.prototype.clone
  7711. * @description 克隆当前几何对象。
  7712. * @returns {SuperMap.Geometry.Collection} 克隆的几何对象集合。
  7713. */
  7714. clone() {
  7715. var geometry = new Collection();
  7716. for (var i = 0, len = this.components.length; i < len; i++) {
  7717. geometry.addComponent(this.components[i].clone());
  7718. }
  7719. // catch any randomly tagged-on properties
  7720. Util.applyDefaults(geometry, this);
  7721. return geometry;
  7722. }
  7723. /**
  7724. * @function SuperMap.Geometry.Collection.prototype.getComponentsString
  7725. * @description 获取 components 字符串。
  7726. * @returns {string} components 字符串。
  7727. */
  7728. getComponentsString() {
  7729. var strings = [];
  7730. for (var i = 0, len = this.components.length; i < len; i++) {
  7731. strings.push(this.components[i].toShortString());
  7732. }
  7733. return strings.join(",");
  7734. }
  7735. /**
  7736. * @function SuperMap.Geometry.Collection.prototype.calculateBounds
  7737. * @description 通过遍历数组重新计算边界,在遍历每一子项中时调用 extend 方法。
  7738. */
  7739. calculateBounds() {
  7740. this.bounds = null;
  7741. var bounds = new Bounds();
  7742. var components = this.components;
  7743. if (components) {
  7744. for (var i = 0, len = components.length; i < len; i++) {
  7745. bounds.extend(components[i].getBounds());
  7746. }
  7747. }
  7748. // to preserve old behavior, we only set bounds if non-null
  7749. // in the future, we could add bounds.isEmpty()
  7750. if (bounds.left != null && bounds.bottom != null &&
  7751. bounds.right != null && bounds.top != null) {
  7752. this.setBounds(bounds);
  7753. }
  7754. }
  7755. /**
  7756. * @function SuperMap.Geometry.Collection.prototype.addComponents
  7757. * @description 给几何图形对象添加元素。
  7758. * @param {Array.<SuperMap.Geometry>} components - 几何对象组件。
  7759. * @example
  7760. * var collection = new SuperMap.Geometry.Collection();
  7761. * collection.addComponents(new SuerpMap.Geometry.Point(10,10));
  7762. */
  7763. addComponents(components) {
  7764. if (!(Util.isArray(components))) {
  7765. components = [components];
  7766. }
  7767. for (var i = 0, len = components.length; i < len; i++) {
  7768. this.addComponent(components[i]);
  7769. }
  7770. }
  7771. /**
  7772. * @function SuperMap.Geometry.Collection.prototype.addComponent
  7773. * @description 添加一个几何对象到集合中。如果设置了 componentTypes 类型,则添加的几何对象必须是 componentTypes 中的类型。
  7774. * @param {SuperMap.Geometry} component - 待添加的几何对象。
  7775. * @param {int} [index] - 几何对象插入的位置。
  7776. * @returns {boolean} 是否添加成功。
  7777. */
  7778. addComponent(component, index) {
  7779. var added = false;
  7780. if (component) {
  7781. if (this.componentTypes == null ||
  7782. (Util.indexOf(this.componentTypes,
  7783. component.CLASS_NAME) > -1)) {
  7784. if (index != null && (index < this.components.length)) {
  7785. var components1 = this.components.slice(0, index);
  7786. var components2 = this.components.slice(index,
  7787. this.components.length);
  7788. components1.push(component);
  7789. this.components = components1.concat(components2);
  7790. } else {
  7791. this.components.push(component);
  7792. }
  7793. component.parent = this;
  7794. this.clearBounds();
  7795. added = true;
  7796. }
  7797. }
  7798. return added;
  7799. }
  7800. /**
  7801. * @function SuperMap.Geometry.Collection.prototype.removeComponents
  7802. * @description 清除几何对象。
  7803. * @param {Array.<SuperMap.Geometry>} components - 需要清除的几何对象。
  7804. * @returns {boolean} 元素是否被删除。
  7805. */
  7806. removeComponents(components) {
  7807. var removed = false;
  7808. if (!(Util.isArray(components))) {
  7809. components = [components];
  7810. }
  7811. for (var i = components.length - 1; i >= 0; --i) {
  7812. removed = this.removeComponent(components[i]) || removed;
  7813. }
  7814. return removed;
  7815. }
  7816. /**
  7817. * @function SuperMap.Geometry.Collection.prototype.removeComponent
  7818. * @description 从集合中移除一个几何对象。
  7819. * @param {SuperMap.Geometry} component - 要移除的几何对象。
  7820. * @returns {boolean} 几何对象是否移除成功。
  7821. */
  7822. removeComponent(component) {
  7823. Util.removeItem(this.components, component);
  7824. // clearBounds() so that it gets recalculated on the next call
  7825. // to this.getBounds();
  7826. this.clearBounds();
  7827. return true;
  7828. }
  7829. /**
  7830. * @function SuperMap.Geometry.Collection.prototype.getArea
  7831. * @description 计算几何对象的面积。注意,这个方法在 {@link SuperMap.Geometry.Polygon} 类中需要重写。
  7832. * @returns {number} 几何图形的面积,是几何对象中所有组成部分的面积之和。
  7833. */
  7834. getArea() {
  7835. var area = 0.0;
  7836. for (var i = 0, len = this.components.length; i < len; i++) {
  7837. area += this.components[i].getArea();
  7838. }
  7839. return area;
  7840. }
  7841. /**
  7842. * @function SuperMap.Geometry.Collection.prototype.equals
  7843. * @description 判断两个几何图形是否相等。如果所有的 components 具有相同的坐标,则认为是相等的。
  7844. * @param {SuperMap.Geometry} geometry - 需要判断的几何图形。
  7845. * @returns {boolean} 输入的几何图形与当前几何图形是否相等。
  7846. */
  7847. equals(geometry) {
  7848. var equivalent = true;
  7849. if (!geometry || !geometry.CLASS_NAME ||
  7850. (this.CLASS_NAME !== geometry.CLASS_NAME)) {
  7851. equivalent = false;
  7852. } else if (!(Util.isArray(geometry.components)) ||
  7853. (geometry.components.length !== this.components.length)) {
  7854. equivalent = false;
  7855. } else {
  7856. for (var i = 0, len = this.components.length; i < len; ++i) {
  7857. if (!this.components[i].equals(geometry.components[i])) {
  7858. equivalent = false;
  7859. break;
  7860. }
  7861. }
  7862. }
  7863. return equivalent;
  7864. }
  7865. /**
  7866. * @function SuperMap.Geometry.Collection.prototype.getVertices
  7867. * @description 返回几何对象的所有结点的列表。
  7868. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点如果没有设置此参数,则返回所有顶点。
  7869. * @returns {Array} 几何对象的顶点列表。
  7870. */
  7871. getVertices(nodes) {
  7872. var vertices = [];
  7873. for (var i = 0, len = this.components.length; i < len; ++i) {
  7874. Array.prototype.push.apply(
  7875. vertices, this.components[i].getVertices(nodes)
  7876. );
  7877. }
  7878. return vertices;
  7879. }
  7880. }
  7881. SuperMap.Geometry.Collection = Collection;
  7882. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPoint.js
  7883. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7884. * This program are made available under the terms of the Apache License, Version 2.0
  7885. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7886. /**
  7887. * @class SuperMap.Geometry.MultiPoint
  7888. * @classdesc 几何对象多点类。
  7889. * @category BaseTypes Geometry
  7890. * @extends {SuperMap.Geometry.Collection}
  7891. * @param {Array.<SuperMap.Geometry.Point>} components - 点对象数组。
  7892. * @example
  7893. * var point1 = new SuperMap.Geometry.Point(5,6);
  7894. * var poine2 = new SuperMap.Geometry.Point(7,8);
  7895. * var multiPoint = new SuperMap.Geometry.MultiPoint([point1,point2]);
  7896. */
  7897. class MultiPoint extends Collection {
  7898. constructor(components) {
  7899. super(components);
  7900. /**
  7901. * @member {Array.<string>} [SuperMap.Geometry.MultiPoint.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  7902. * @description components 存储的的几何对象所支持的几何类型数组。
  7903. * @readonly
  7904. */
  7905. this.componentTypes = ["SuperMap.Geometry.Point"];
  7906. this.CLASS_NAME = "SuperMap.Geometry.MultiPoint";
  7907. this.geometryType = "MultiPoint";
  7908. }
  7909. /**
  7910. * @function SuperMap.Geometry.MultiPoint.prototype.addPoint
  7911. * @description 添加点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.addComponent} 方法。
  7912. * @param {SuperMap.Geometry.Point} point - 添加的点。
  7913. * @param {integer} [index] - 下标。
  7914. */
  7915. addPoint(point, index) {
  7916. this.addComponent(point, index);
  7917. }
  7918. /**
  7919. * @function SuperMap.Geometry.MultiPoint.prototype.removePoint
  7920. * @description 移除点,封装了 {@link SuperMap.Geometry.Collection|SuperMap.Geometry.Collection.removeComponent} 方法。
  7921. * @param {SuperMap.Geometry.Point} point - 移除的点对象。
  7922. */
  7923. removePoint(point) {
  7924. this.removeComponent(point);
  7925. }
  7926. }
  7927. SuperMap.Geometry.MultiPoint = MultiPoint;
  7928. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Curve.js
  7929. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7930. * This program are made available under the terms of the Apache License, Version 2.0
  7931. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7932. /**
  7933. * @class SuperMap.Geometry.Curve
  7934. * @classdesc 几何对象曲线类。
  7935. * @category BaseTypes Geometry
  7936. * @extends {SuperMap.Geometry.MultiPoint}
  7937. * @param {Array.<SuperMap.Geometry.Point>} components - 几何对象数组。
  7938. * @example
  7939. * var point1 = new SuperMap.Geometry.Point(10,20);
  7940. * var point2 = new SuperMap.Geometry.Point(30,40);
  7941. * var curve = new SuperMap.Geometry.Curve([point1,point2]);
  7942. */
  7943. class Curve extends MultiPoint {
  7944. constructor(components) {
  7945. super(components);
  7946. /**
  7947. * @member {Array.<string>} [SuperMap.Geometry.Curve.prototype.componentType=["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"]]
  7948. * @description components 存储的的几何对象所支持的几何类型数组。
  7949. * @readonly
  7950. */
  7951. this.componentTypes = ["SuperMap.Geometry.Point", "SuperMap.PointWithMeasure"];
  7952. this.CLASS_NAME = "SuperMap.Geometry.Curve";
  7953. this.geometryType = "Curve";
  7954. }
  7955. }
  7956. SuperMap.Geometry.Curve = Curve;
  7957. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Point.js
  7958. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7959. * This program are made available under the terms of the Apache License, Version 2.0
  7960. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7961. /**
  7962. * @class SuperMap.Geometry.Point
  7963. * @classdesc 点几何对象类。
  7964. * @category BaseTypes Geometry
  7965. * @extends {SuperMap.Geometry}
  7966. * @param {float} x - x 坐标。
  7967. * @param {float} y - y 坐标。
  7968. * @param {string} [type = 'Point'] - 用来存储点的类型。
  7969. * @param {float} [tag] - 用来存储额外的属性,比如差值分析中的 Z 值。
  7970. * @example
  7971. * var point = new SuperMap.Geometry.Point(-111.04, 45.68);
  7972. */
  7973. class Point extends Geometry {
  7974. constructor(x, y, type, tag) {
  7975. super(x, y, type, tag);
  7976. /**
  7977. * @member {float} SuperMap.Geometry.Point.prototype.x
  7978. * @description 横坐标。
  7979. */
  7980. this.x = parseFloat(x);
  7981. /**
  7982. * @member {float} SuperMap.Geometry.Point.prototype.y
  7983. * @description 纵坐标。
  7984. */
  7985. this.y = parseFloat(y);
  7986. /**
  7987. * @member {string} SuperMap.Geometry.Point.prototype.tag
  7988. * @description 用来存储额外的属性,比如差值分析中的 Z 值。
  7989. */
  7990. this.tag = (tag || tag == 0) ? parseFloat(tag) : null;
  7991. /**
  7992. * @member {string} SuperMap.Geometry.Point.prototype.tag
  7993. * @description 用来存储点的类型
  7994. */
  7995. this.type = type || "Point";
  7996. this.CLASS_NAME = "SuperMap.Geometry.Point";
  7997. this.geometryType = "Point";
  7998. }
  7999. /**
  8000. * @function SuperMap.Geometry.Point.prototype.clone
  8001. * @description 克隆点对象。
  8002. * @returns {SuperMap.Geometry.Point} 克隆后的点对象。
  8003. */
  8004. clone(obj) {
  8005. if (obj == null) {
  8006. obj = new Point(this.x, this.y);
  8007. }
  8008. // catch any randomly tagged-on properties
  8009. Util.applyDefaults(obj, this);
  8010. return obj;
  8011. }
  8012. /**
  8013. * @function SuperMap.Geometry.Point.prototype.calculateBounds
  8014. * @description 计算点对象的范围。
  8015. */
  8016. calculateBounds() {
  8017. this.bounds = new Bounds(this.x, this.y,
  8018. this.x, this.y);
  8019. }
  8020. /**
  8021. * @function SuperMap.Geometry.Point.prototype.equals
  8022. * @description 判断两个点对象是否相等。如果两个点对象具有相同的坐标,则认为是相等的。
  8023. * @example
  8024. * var point= new SuperMap.Geometry.Point(0,0);
  8025. * var point1={x:0,y:0};
  8026. * var result= point.equals(point1);
  8027. * @param {SuperMap.Geometry.Point} geom - 需要判断的点对象。
  8028. * @returns {boolean} 两个点对象是否相等(true 为相等,false 为不等)。
  8029. */
  8030. equals(geom) {
  8031. var equals = false;
  8032. if (geom != null) {
  8033. equals = ((this.x === geom.x && this.y === geom.y) ||
  8034. (isNaN(this.x) && isNaN(this.y) && isNaN(geom.x) && isNaN(geom.y)));
  8035. }
  8036. return equals;
  8037. }
  8038. /**
  8039. * @function SuperMap.Geometry.Point.prototype.move
  8040. * @description 沿着 x、y 轴的正方向上按照给定的位移移动点对象,move 不仅改变了几何对象的位置并且清理了边界缓存。
  8041. * @param {float} x - x 轴正方向上的偏移量。
  8042. * @param {float} y - y 轴正方向上偏移量。
  8043. */
  8044. move(x, y) {
  8045. this.x = this.x + x;
  8046. this.y = this.y + y;
  8047. this.clearBounds();
  8048. }
  8049. /**
  8050. * @function SuperMap.Geometry.Point.prototype.toShortString
  8051. * @returns {string} 字符串代表点对象。(ex. <i>"5, 42"</i>)
  8052. */
  8053. toShortString() {
  8054. return (this.x + ", " + this.y);
  8055. }
  8056. /**
  8057. * @function SuperMap.Geometry.Point.prototype.destroy
  8058. * @description 释放点对象的资源。
  8059. */
  8060. destroy() {
  8061. this.x = null;
  8062. this.y = null;
  8063. this.tag = null;
  8064. super.destroy();
  8065. }
  8066. /**
  8067. * @function SuperMap.Geometry.Point.prototype.getVertices
  8068. * @description 返回点对象的所有顶点的列表。
  8069. * @param {boolean} [nodes] - 对于点对象此参数不起作用,直接返回点。
  8070. * @returns {Array} 几何图形的顶点列表。
  8071. */
  8072. getVertices(nodes) { // eslint-disable-line no-unused-vars
  8073. return [this];
  8074. }
  8075. }
  8076. SuperMap.Geometry.Point = Point;
  8077. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LineString.js
  8078. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8079. * This program are made available under the terms of the Apache License, Version 2.0
  8080. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8081. /**
  8082. * @class SuperMap.Geometry.LineString
  8083. * @classdesc 几何对象线串类。
  8084. * @category BaseTypes Geometry
  8085. * @param {Array.<SuperMap.Geometry.Point>} points - 用来生成线串的点数组。
  8086. * @extends {SuperMap.Geometry.Curve}
  8087. * @example
  8088. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  8089. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  8090. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  8091. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  8092. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  8093. * var roadLine = new SuperMap.Geometry.LineString(points);
  8094. */
  8095. class LineString extends Curve {
  8096. constructor(points) {
  8097. super(points);
  8098. this.CLASS_NAME = "SuperMap.Geometry.LineString";
  8099. this.geometryType = "LineString";
  8100. }
  8101. /**
  8102. * @function SuperMap.Geometry.LineString.prototype.removeComponent
  8103. * @description 只有在线串上有三个或更多的点的时候,才会允许移除点(否则结果将会是单一的点)。
  8104. * @param {SuperMap.Geometry.Point} point - 将被删除的点。
  8105. * @returns {boolean} 删除的点。
  8106. */
  8107. removeComponent(point) { // eslint-disable-line no-unused-vars
  8108. var removed = this.components && (this.components.length > 2);
  8109. if (removed) {
  8110. super.removeComponent.apply(this, arguments);
  8111. }
  8112. return removed;
  8113. }
  8114. /**
  8115. * @function SuperMap.Geometry.LineString.prototype.getSortedSegments
  8116. * @returns {Array} An array of segment objects. Segment objects have properties
  8117. * x1, y1, x2, and y2. The start point is represented by x1 and y1.
  8118. * The end point is represented by x2 and y2. Start and end are
  8119. * ordered so that x1 < x2.
  8120. */
  8121. getSortedSegments() {
  8122. var numSeg = this.components.length - 1;
  8123. var segments = new Array(numSeg), point1, point2;
  8124. for (var i = 0; i < numSeg; ++i) {
  8125. point1 = this.components[i];
  8126. point2 = this.components[i + 1];
  8127. if (point1.x < point2.x) {
  8128. segments[i] = {
  8129. x1: point1.x,
  8130. y1: point1.y,
  8131. x2: point2.x,
  8132. y2: point2.y
  8133. };
  8134. } else {
  8135. segments[i] = {
  8136. x1: point2.x,
  8137. y1: point2.y,
  8138. x2: point1.x,
  8139. y2: point1.y
  8140. };
  8141. }
  8142. }
  8143. // more efficient to define this somewhere static
  8144. function byX1(seg1, seg2) {
  8145. return seg1.x1 - seg2.x1;
  8146. }
  8147. return segments.sort(byX1);
  8148. }
  8149. /**
  8150. * @function SuperMap.Geometry.LineString.prototype.getVertices
  8151. * @description 返回几何图形的所有顶点的列表。
  8152. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false,则返回非端点的顶点。如果没有设置此参数,则返回所有顶点。
  8153. * @returns {Array} 几何图形的顶点列表。
  8154. */
  8155. getVertices(nodes) {
  8156. var vertices;
  8157. if (nodes === true) {
  8158. vertices = [
  8159. this.components[0],
  8160. this.components[this.components.length - 1]
  8161. ];
  8162. } else if (nodes === false) {
  8163. vertices = this.components.slice(1, this.components.length - 1);
  8164. } else {
  8165. vertices = this.components.slice();
  8166. }
  8167. return vertices;
  8168. }
  8169. /**
  8170. * @function SuperMap.Geometry.LineString.calculateCircle
  8171. * @description 三点画圆弧。
  8172. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  8173. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的圆弧控制点。
  8174. * @example
  8175. * var points = [];
  8176. * points.push(new SuperMap.Geometry.Point(-50,30));
  8177. * points.push(new SuperMap.Geometry.Point(-30,50));
  8178. * points.push(new SuperMap.Geometry.Point(2,60));
  8179. * var circle = SuperMap.Geometry.LineString.calculateCircle(points);
  8180. */
  8181. static calculateCircle(points) {
  8182. if (points.length < 3) {
  8183. return points
  8184. }
  8185. var centerPoint = {},
  8186. p1 = points[0],
  8187. p2 = points[1],
  8188. p3 = points[2];
  8189. var R = 0,
  8190. dStep = 0,
  8191. direc = true,
  8192. dRotation = 0,
  8193. dRotationBegin = 0,
  8194. dRotationAngle = 0,
  8195. nSegmentCount = 72,
  8196. circlePoints = [];
  8197. var KTan13 = (p3.y - p1.y) / (p3.x - p1.x);
  8198. var B13 = p3.y - KTan13 * p3.x;
  8199. if ((((p3.x != p1.x) && (p3.y != p1.y)) && (p2.y == KTan13 * p2.x + B13)) ||
  8200. ((p3.x == p1.x) && (p2.x == p1.x)) || ((p3.y == p1.y) && (p2.y == p1.y)) ||
  8201. ((p3.x == p1.x) && (p3.y == p1.y)) || ((p3.x == p2.x) && (p3.y == p2.y)) || ((p1.x == p2.x) && (p1.y == p2.y))) {
  8202. circlePoints.push(p1);
  8203. circlePoints.push(p2);
  8204. circlePoints.push(p3);
  8205. } else {
  8206. 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) -
  8207. (p1.x * p1.x + p1.y * p1.y)) * (2 * (p2.y - p1.y));
  8208. var E = (2 * (p2.x - p1.x)) * ((p3.x * p3.x + p3.y * p3.y) - (p1.x * p1.x + p1.y * p1.y)) -
  8209. (2 * (p3.x - p1.x)) * ((p2.x * p2.x + p2.y * p2.y) - (p1.x * p1.x + p1.y * p1.y));
  8210. var F = 4 * ((p2.x - p1.x) * (p3.y - p1.y) - (p3.x - p1.x) * (p2.y - p1.y));
  8211. centerPoint.x = D / F;
  8212. centerPoint.y = E / F;
  8213. R = Math.sqrt((p1.x - centerPoint.x) * (p1.x - centerPoint.x) + (p1.y - centerPoint.y) * (p1.y - centerPoint.y));
  8214. var dis = (p1.x - p3.x) * (p1.x - p3.x) + (p1.y - p3.y) * (p1.y - p3.y);
  8215. var cons = (2 * R * R - dis) / (2 * R * R);
  8216. cons = cons >= 1 ? 1 : cons;
  8217. cons = cons <= -1 ? -1 : cons;
  8218. dRotationAngle = Math.acos(cons) * 180 / Math.PI;
  8219. if (p3.x == p1.x) {
  8220. dRotationAngle = ((centerPoint.x > p1.x && p2.x > p1.x) || (centerPoint.x < p1.x && p2.x < p1.x)) ? (360 - dRotationAngle) : dRotationAngle;
  8221. } else {
  8222. dRotationAngle = ((centerPoint.y > (KTan13 * centerPoint.x + B13) && p2.y > (KTan13 * p2.x + B13)) ||
  8223. (centerPoint.y < (KTan13 * centerPoint.x + B13) && p2.y < (KTan13 * p2.x + B13))) ? (360 - dRotationAngle) : dRotationAngle;
  8224. }
  8225. dStep = dRotationAngle / 72;
  8226. if (p3.y != p1.y) {
  8227. if (p3.x == p1.x) {
  8228. if (p3.y > p1.y) {
  8229. if (p2.x < p1.x) {
  8230. direc = false;
  8231. }
  8232. } else {
  8233. if (p2.x > p1.x) {
  8234. direc = false;
  8235. }
  8236. }
  8237. } else if (p3.x < p1.x) {
  8238. if (p2.y < KTan13 * p2.x + B13) {
  8239. direc = false;
  8240. }
  8241. } else {
  8242. if (p2.y > KTan13 * p2.x + B13) {
  8243. direc = false;
  8244. }
  8245. }
  8246. } else {
  8247. if (p3.x > p1.x) {
  8248. if (p2.y > p1.y) {
  8249. direc = false;
  8250. }
  8251. } else {
  8252. if (p2.y < p1.y) {
  8253. direc = false;
  8254. }
  8255. }
  8256. }
  8257. var K10 = (p1.y - centerPoint.y) / (p1.x - centerPoint.x);
  8258. var atan10 = K10 >= 0 ? Math.atan(K10) * 180 / Math.PI : Math.abs(Math.atan(K10) * 180 / Math.PI) + 90;
  8259. var CY = Math.abs(centerPoint.y);
  8260. if ((p1.y == CY) && (CY == p3.y)) {
  8261. if (p1.x < p3.x) {
  8262. atan10 = atan10 + 180;
  8263. }
  8264. }
  8265. var newPY = p1.y - centerPoint.y;
  8266. circlePoints.push(p1);
  8267. for (var i = 1; i < nSegmentCount; i++) {
  8268. dRotation = dStep * i;
  8269. dRotationBegin = atan10;
  8270. if (direc) {
  8271. if (newPY >= 0) {
  8272. if (K10 >= 0) {
  8273. dRotationBegin = dRotationBegin + dRotation;
  8274. } else {
  8275. dRotationBegin = (180 - (dRotationBegin - 90)) + dRotation;
  8276. }
  8277. } else {
  8278. if (K10 > 0) {
  8279. dRotationBegin = (dRotationBegin - 180) + dRotation;
  8280. } else {
  8281. dRotationBegin = (90 - dRotationBegin) + dRotation;
  8282. }
  8283. }
  8284. } else {
  8285. if (newPY >= 0) {
  8286. if (K10 >= 0) {
  8287. dRotationBegin = dRotationBegin - dRotation;
  8288. } else {
  8289. dRotationBegin = (180 - (dRotationBegin - 90)) - dRotation;
  8290. }
  8291. } else {
  8292. if (K10 >= 0) {
  8293. dRotationBegin = (dRotationBegin - 180) - dRotation;
  8294. } else {
  8295. dRotationBegin = (90 - dRotationBegin) - dRotation;
  8296. }
  8297. }
  8298. }
  8299. dRotationBegin = dRotationBegin * Math.PI / 180;
  8300. var x = centerPoint.x + R * Math.cos(dRotationBegin);
  8301. var y = centerPoint.y + R * Math.sin(dRotationBegin);
  8302. circlePoints.push(new Point(x, y));
  8303. }
  8304. circlePoints.push(p3);
  8305. }
  8306. return circlePoints;
  8307. }
  8308. /**
  8309. * @function SuperMap.Geometry.LineString.createLineEPS
  8310. * @description 根据点的类型画出不同类型的曲线。
  8311. * 点的类型有三种:LTypeArc,LTypeCurve,NONE。
  8312. * @param {Array.<SuperMap.Geometry.Point>} points - 传入的待计算的初始点串。
  8313. * @returns {Array.<SuperMap.Geometry.Point>} 计算出相应的 lineEPS 控制点。
  8314. * @example
  8315. * var points = [];
  8316. * points.push(new SuperMap.Geometry.Point(-50,30));
  8317. * points.push(new SuperMap.Geometry.Point(-30,50,"LTypeArc"));
  8318. * points.push(new SuperMap.Geometry.Point(2,60));
  8319. * points.push(new SuperMap.Geometry.Point(8,20));
  8320. * var lineEPS = SuperMap.Geometry.LineString.createLineEPS(points);
  8321. */
  8322. static createLineEPS(points) {
  8323. var list = [],
  8324. len = points.length;
  8325. if (len < 2) {
  8326. return points;
  8327. }
  8328. for (var i = 0; i < len;) {
  8329. var type = points[i].type;
  8330. if (type == 'LTypeArc') {
  8331. var listObj = LineString.createLineArc(list, i, len, points);
  8332. list = listObj[0];
  8333. i = listObj[1];
  8334. } else {
  8335. list.push(points[i]);
  8336. i++;
  8337. }
  8338. }
  8339. return list;
  8340. }
  8341. static createLineArc(list, i, len, points) {
  8342. if (i == 0) {
  8343. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  8344. Array.prototype.push.apply(list, bezierPtsObj[0]);
  8345. i = bezierPtsObj[1] + 1;
  8346. } else if (i == len - 1) {
  8347. var bezierP = [points[i - 1], points[i]],
  8348. bezierPts = LineString.calculateCircle(bezierP);
  8349. Array.prototype.push.apply(list, bezierPts);
  8350. i++;
  8351. } else {
  8352. let bezierPtsObj = LineString.addPointEPS(points, i, len, 'LTypeArc');
  8353. list.pop();
  8354. Array.prototype.push.apply(list, bezierPtsObj[0]);
  8355. i = bezierPtsObj[1] + 1;
  8356. }
  8357. return [list, i];
  8358. }
  8359. static addPointEPS(points, i, len, type) {
  8360. var bezierP = [], j = i + 1;
  8361. if (i == 0) {
  8362. Array.prototype.push.apply(bezierP, [points[i], points[i + 1]]);
  8363. } else if (i == len - 1) {
  8364. Array.prototype.push.apply(bezierP, [points[i - 1], points[i]]);
  8365. } else {
  8366. Array.prototype.push.apply(bezierP, [points[i - 1], points[i], points[i + 1]]);
  8367. }
  8368. var bezierPts;
  8369. if (type == 'LTypeCurve') {
  8370. bezierPts = LineString.calculatePointsFBZN(bezierP);
  8371. } else if (type == 'LTypeArc') {
  8372. bezierPts = LineString.calculateCircle(bezierP);
  8373. }
  8374. return [bezierPts, j];
  8375. }
  8376. }
  8377. SuperMap.Geometry.LineString = LineString;
  8378. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/GeoText.js
  8379. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8380. * This program are made available under the terms of the Apache License, Version 2.0
  8381. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8382. /**
  8383. * @class SuperMap.Geometry.GeoText
  8384. * @classdesc 文本标签类。
  8385. * @category BaseTypes Geometry
  8386. * @extends {SuperMap.Geometry}
  8387. * @param {float} x - x 坐标。
  8388. * @param {float} y - y 坐标。
  8389. * @param {string} text - 标签中的文本内容。
  8390. */
  8391. class GeoText extends Geometry {
  8392. constructor(x, y, text) {
  8393. super(x, y, text);
  8394. /**
  8395. * @member {float} SuperMap.Geometry.GeoText.prototype.x
  8396. * @description 横坐标。
  8397. */
  8398. this.x = parseFloat(x);
  8399. /**
  8400. * @member {float} SuperMap.Geometry.GeoText.prototype.y
  8401. * @description 纵坐标。
  8402. */
  8403. this.y = parseFloat(y);
  8404. /**
  8405. * @member {string} SuperMap.Geometry.GeoText.prototype.text
  8406. * @description 标签中的文本内容。
  8407. */
  8408. this.text = text.toString();
  8409. /**
  8410. * @member {Object} SuperMap.Geometry.GeoText.prototype.bsInfo
  8411. * @description 标签范围的基础信息。
  8412. * @property {number} w - bounds 的宽。
  8413. * @property {number} h - bounds 的高度。
  8414. */
  8415. this.bsInfo = {
  8416. "h": null,
  8417. "w": null
  8418. };
  8419. this.element = document.createElement('span');
  8420. this.CLASS_NAME = "SuperMap.Geometry.GeoText";
  8421. this.geometryType = "GeoText";
  8422. }
  8423. /**
  8424. * @function SuperMap.Geometry.GeoText.prototype.destroy
  8425. * @description 销毁文本标签类。
  8426. */
  8427. destroy() {
  8428. super.destroy();
  8429. this.x = null;
  8430. this.y = null;
  8431. this.text = null;
  8432. }
  8433. /**
  8434. * @function SuperMap.Geometry.GeoText.prototype.getCentroid
  8435. * @description 获取标签对象的质心。
  8436. * @returns {SuperMap.Geometry.Point} 标签对象的质心。
  8437. */
  8438. getCentroid() {
  8439. return new Point(this.x, this.y);
  8440. }
  8441. /**
  8442. * @function SuperMap.Geometry.GeoText.prototype.clone
  8443. * @description 克隆标签对象。
  8444. * @returns {SuperMap.Geometry.GeoText} 克隆后的标签对象。
  8445. */
  8446. clone(obj) {
  8447. if (obj == null) {
  8448. obj = new GeoText(this.x, this.y, this.text);
  8449. }
  8450. Util.applyDefaults(obj, this);
  8451. return obj;
  8452. }
  8453. /**
  8454. * @function SuperMap.Geometry.GeoText.prototype.calculateBounds
  8455. * @description 计算标签对象的范围。
  8456. */
  8457. calculateBounds() {
  8458. this.bounds = new Bounds(this.x, this.y,
  8459. this.x, this.y);
  8460. }
  8461. /**
  8462. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByLabel
  8463. * @description 根据绘制好的标签获取文字标签的像素范围,参数的单位是像素;此方法相对于 getLabelPxBoundsByText 效率较低,但支持所有格式的文本。
  8464. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  8465. * @param {string} labelWidth - 标签的宽度,如:“90px”。
  8466. * @param {string} labelHeight - 标签的高度。
  8467. * @param {Object} style - 标签的 style。
  8468. * @returns {SuperMap.Bounds} 标签的像素范围。
  8469. */
  8470. getLabelPxBoundsByLabel(locationPixel, labelWidth, labelHeight, style) {
  8471. var labelPxBounds, left, bottom, top, right;
  8472. var locationPx = Util.cloneObject(locationPixel);
  8473. //计算文本行数
  8474. var theText = style.label || this.text;
  8475. var textRows = theText.split('\n');
  8476. var laberRows = textRows.length;
  8477. //处理文字对齐
  8478. labelWidth = parseFloat(labelWidth);
  8479. labelHeight = parseFloat(labelHeight);
  8480. if (laberRows > 1) {
  8481. labelHeight = parseFloat(labelHeight) * laberRows;
  8482. }
  8483. if (style.labelAlign && style.labelAlign !== "cm") {
  8484. switch (style.labelAlign) {
  8485. case "lt":
  8486. locationPx.x += labelWidth / 2;
  8487. locationPx.y += labelHeight / 2;
  8488. break;
  8489. case "lm":
  8490. locationPx.x += labelWidth / 2;
  8491. break;
  8492. case "lb":
  8493. locationPx.x += labelWidth / 2;
  8494. locationPx.y -= labelHeight / 2;
  8495. break;
  8496. case "ct":
  8497. locationPx.y += labelHeight / 2;
  8498. break;
  8499. case "cb":
  8500. locationPx.y -= labelHeight / 2;
  8501. break;
  8502. case "rt":
  8503. locationPx.x -= labelWidth / 2;
  8504. locationPx.y += labelHeight / 2;
  8505. break;
  8506. case "rm":
  8507. locationPx.x -= labelWidth / 2;
  8508. break;
  8509. case "rb":
  8510. locationPx.x -= labelWidth / 2;
  8511. locationPx.y -= labelHeight / 2;
  8512. break;
  8513. default:
  8514. break;
  8515. }
  8516. }
  8517. this.bsInfo.h = labelHeight;
  8518. this.bsInfo.w = labelWidth;
  8519. //bounds的四边
  8520. left = locationPx.x - parseFloat(labelWidth) / 2;
  8521. bottom = locationPx.y + parseFloat(labelHeight) / 2;
  8522. right = locationPx.x + parseFloat(labelWidth) / 2;
  8523. top = locationPx.y - parseFloat(labelHeight) / 2;
  8524. labelPxBounds = new Bounds(left, bottom, right, top);
  8525. return labelPxBounds;
  8526. }
  8527. /**
  8528. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxBoundsByText
  8529. * @description 根据文本内容获取文字标签的像素范围。
  8530. * @param {Object} locationPixel - 标签的位置点,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  8531. * @param {Object} style - 标签的样式。
  8532. * @returns {SuperMap.Bounds} 标签的像素范围。
  8533. */
  8534. getLabelPxBoundsByText(locationPixel, style) {
  8535. var labelPxBounds, left, bottom, top, right;
  8536. var labelSize = this.getLabelPxSize(style);
  8537. var locationPx = Util.cloneObject(locationPixel);
  8538. //处理文字对齐
  8539. if (style.labelAlign && style.labelAlign !== "cm") {
  8540. switch (style.labelAlign) {
  8541. case "lt":
  8542. locationPx.x += labelSize.w / 2;
  8543. locationPx.y += labelSize.h / 2;
  8544. break;
  8545. case "lm":
  8546. locationPx.x += labelSize.w / 2;
  8547. break;
  8548. case "lb":
  8549. locationPx.x += labelSize.w / 2;
  8550. locationPx.y -= labelSize.h / 2;
  8551. break;
  8552. case "ct":
  8553. locationPx.y += labelSize.h / 2;
  8554. break;
  8555. case "cb":
  8556. locationPx.y -= labelSize.h / 2;
  8557. break;
  8558. case "rt":
  8559. locationPx.x -= labelSize.w / 2;
  8560. locationPx.y += labelSize.h / 2;
  8561. break;
  8562. case "rm":
  8563. locationPx.x -= labelSize.w / 2;
  8564. break;
  8565. case "rb":
  8566. locationPx.x -= labelSize.w / 2;
  8567. locationPx.y -= labelSize.h / 2;
  8568. break;
  8569. default:
  8570. break;
  8571. }
  8572. }
  8573. this.bsInfo.h = labelSize.h;
  8574. this.bsInfo.w = labelSize.w;
  8575. left = locationPx.x - labelSize.w / 2;
  8576. bottom = locationPx.y + labelSize.h / 2;
  8577. //处理斜体字
  8578. if (style.fontStyle && style.fontStyle === "italic") {
  8579. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  8580. } else {
  8581. right = locationPx.x + labelSize.w / 2;
  8582. }
  8583. top = locationPx.y - labelSize.h / 2;
  8584. labelPxBounds = new Bounds(left, bottom, right, top);
  8585. return labelPxBounds;
  8586. }
  8587. /**
  8588. * @function SuperMap.Geometry.GeoText.prototype.getLabelPxSize
  8589. * @description 获取 label 的像素大小。
  8590. * @param {Object} style - 标签样式。
  8591. * @returns {Object} 标签大小对象,属性 w 表示标签的宽度,属性 h 表示标签的高度。
  8592. */
  8593. getLabelPxSize(style) {
  8594. var text,//文本内容
  8595. fontSize,//字体大小
  8596. spacing = 1,//两个字符间的间距(单位:px)
  8597. lineSpacing = 0.2,
  8598. bgstrokeWidth = parseFloat(style.strokeWidth);//标签背景框边框的宽度
  8599. text = style.label || this.text;
  8600. if (style.fontSize) {
  8601. fontSize = parseFloat(style.fontSize);
  8602. } else {
  8603. fontSize = parseFloat("12px");
  8604. }
  8605. //标签宽高
  8606. var labelW, labelH;
  8607. var textRows = text.split('\n');
  8608. var numRows = textRows.length;
  8609. if (numRows > 1) {
  8610. labelH = fontSize * numRows + numRows + bgstrokeWidth + lineSpacing * fontSize;
  8611. } else {
  8612. labelH = fontSize + bgstrokeWidth + lineSpacing * fontSize + 1;
  8613. }
  8614. //取最大宽度
  8615. labelW = 0;
  8616. if (this.labelWTmp && labelW < this.labelWTmp) {
  8617. labelW = this.labelWTmp;
  8618. }
  8619. for (var i = 0; i < numRows; i++) {
  8620. var textCharC = this.getTextCount(textRows[i]);
  8621. var labelWTmp = this.labelWTmp = Util.getTextBounds(style, textRows[i], this.element).textWidth + textCharC.textC * spacing + bgstrokeWidth;
  8622. if (labelW < labelWTmp) {
  8623. labelW = labelWTmp;
  8624. }
  8625. }
  8626. var labelSize = new Object(); //标签大小
  8627. labelSize.h = labelH;
  8628. labelSize.w = labelW;
  8629. return labelSize;
  8630. }
  8631. /**
  8632. * @function SuperMap.Geometry.GeoText.prototype.getTextCount
  8633. * @description 获取 text 中的字符个数。
  8634. * @param {string} text - 字符串。
  8635. * @returns {Object} 字符个数统计结果,属性 cnC 表示中文字符个数,属性 enC 表示英文字符个数,属性 textC 表示字符总个数。
  8636. */
  8637. getTextCount(text) {
  8638. var textCharCount = {};
  8639. var cnCount = 0;
  8640. var enCount = 0;
  8641. for (var i = 0; i < text.length; i++) {
  8642. if (text.charCodeAt(i) > 255) { //遍历判断字符串中每个字符的Unicode码,大于255则为中文
  8643. cnCount++;
  8644. } else {
  8645. enCount++;
  8646. }
  8647. }
  8648. //中午字符个数
  8649. textCharCount.cnC = cnCount;
  8650. //英文字符个数
  8651. textCharCount.enC = enCount;
  8652. //字符总个数
  8653. textCharCount.textC = text.length;
  8654. return textCharCount;
  8655. }
  8656. }
  8657. SuperMap.Geometry.GeoText = GeoText;
  8658. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/LinearRing.js
  8659. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8660. * This program are made available under the terms of the Apache License, Version 2.0
  8661. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8662. /**
  8663. * @class SuperMap.Geometry.LinearRing
  8664. * @classdesc 几何对象线环类,是一个特殊的封闭的线串,在每次 addPoint/removePoint 之后会通过添加一个点(此点是复制的第一个点得到的)
  8665. * 作为最后的一个点来自动关闭线环。
  8666. * @category BaseTypes Geometry
  8667. * @extends {SuperMap.Geometry.LineString}
  8668. * @param {Array.<SuperMap.Geometry.Point>} points - 组成线性环的点。
  8669. * @example
  8670. * var points = [new SuperMap.Geometry.Point(4933.319287022352, -3337.3849141502124),
  8671. * new SuperMap.Geometry.Point(4960.9674060199022, -3349.3316322355736),
  8672. * new SuperMap.Geometry.Point(5006.0235999418364, -3358.8890067038628),
  8673. * new SuperMap.Geometry.Point(5075.3145648369318, -3378.0037556404409),
  8674. * new SuperMap.Geometry.Point(5305.19551436013, -3376.9669111768926)],
  8675. * var linearRing = new SuperMap.Geometry.LinearRing(points);
  8676. */
  8677. class LinearRing extends LineString {
  8678. constructor(points) {
  8679. super(points);
  8680. /**
  8681. * @member {Array.<string>} [SuperMap.Geometry.LinearRing.prototype.componentTypes=["SuperMap.Geometry.Point"]]
  8682. * @description components 存储的的几何对象所支持的几何类型数组,为空表示类型不受限制。
  8683. * @readonly
  8684. */
  8685. this.componentTypes = ["SuperMap.Geometry.Point"];
  8686. this.CLASS_NAME = "SuperMap.Geometry.LinearRing";
  8687. this.geometryType = "LinearRing";
  8688. }
  8689. /**
  8690. * @function SuperMap.Geometry.LinearRing.prototype.addComponent
  8691. * @description 添加一个点到几何图形数组中,如果这个点将要被添加到组件数组的末端,并且与数组中已经存在的最后一个点相同,
  8692. * 重复的点是不能被添加的。这将影响未关闭环的关闭。
  8693. * 这个方法可以通过将非空索引(组件数组的下标)作为第二个参数重写。
  8694. * @param {SuperMap.Geometry.Point} point - 点对象。
  8695. * @param {integer} [index] - 插入组件数组的下标。
  8696. * @returns {boolean} 点对象是否添加成功。
  8697. */
  8698. addComponent(point, index) {
  8699. var added = false;
  8700. //remove last point
  8701. var lastPoint = this.components.pop();
  8702. // given an index, add the point
  8703. // without an index only add non-duplicate points
  8704. if (index != null || !point.equals(lastPoint)) {
  8705. added = super.addComponent.apply(this, arguments);
  8706. }
  8707. //append copy of first point
  8708. var firstPoint = this.components[0];
  8709. super.addComponent.apply(this, [firstPoint]);
  8710. return added;
  8711. }
  8712. /**
  8713. * @function SuperMap.Geometry.LinearRing.prototype.removeComponent
  8714. * @description 从几何组件中删除一个点。
  8715. * @param {SuperMap.Geometry.Point} point - 点对象。
  8716. * @returns {boolean} 点对象是否删除。
  8717. */
  8718. removeComponent(point) { // eslint-disable-line no-unused-vars
  8719. var removed = this.components && (this.components.length > 3);
  8720. if (removed) {
  8721. //remove last point
  8722. this.components.pop();
  8723. //remove our point
  8724. super.removeComponent.apply(this, arguments);
  8725. //append copy of first point
  8726. var firstPoint = this.components[0];
  8727. super.addComponent.apply(this, [firstPoint]);
  8728. }
  8729. return removed;
  8730. }
  8731. /**
  8732. * @function SuperMap.Geometry.LinearRing.prototype.getArea
  8733. * @description 获得当前几何对象区域大小,如果是沿顺时针方向的环则是正值,否则为负值。
  8734. * @returns {float} 环的面积。
  8735. */
  8736. getArea() {
  8737. var area = 0.0;
  8738. if (this.components && (this.components.length > 2)) {
  8739. var sum = 0.0;
  8740. for (var i = 0, len = this.components.length; i < len - 1; i++) {
  8741. var b = this.components[i];
  8742. var c = this.components[i + 1];
  8743. sum += (b.x + c.x) * (c.y - b.y);
  8744. }
  8745. area = -sum / 2.0;
  8746. }
  8747. return area;
  8748. }
  8749. /**
  8750. * @function SuperMap.Geometry.LinearRing.prototype.getVertices
  8751. * @description 返回几何图形的所有点的列表。
  8752. * @param {boolean} [nodes] - 对于线来说,仅仅返回作为端点的顶点,如果设为 false ,则返回非端点的顶点,如果没有设置此参数,则返回所有顶点。
  8753. * @returns {Array} 几何对象所有点的列表。
  8754. */
  8755. getVertices(nodes) {
  8756. return (nodes === true) ? [] : this.components.slice(0, this.components.length - 1);
  8757. }
  8758. }
  8759. SuperMap.Geometry.LinearRing = LinearRing;
  8760. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiLineString.js
  8761. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8762. * This program are made available under the terms of the Apache License, Version 2.0
  8763. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8764. /**
  8765. * @class SuperMap.Geometry.MultiLineString
  8766. * @classdesc 几何对象多线类。
  8767. * @category BaseTypes Geometry
  8768. * @extends {SuperMap.Geometry.Collection}
  8769. * @param {Array.<SuperMap.Geometry.LineString>} components - LineString 数组。
  8770. * @example
  8771. * var multi = new SuperMap.Geometry.MultiLineString([
  8772. * new SuperMap.Geometry.LineString([
  8773. * new SuperMap.Geometry.Point(1, 0),
  8774. * new SuperMap.Geometry.Point(0, 1)
  8775. * ])
  8776. * ]);
  8777. */
  8778. class MultiLineString extends Collection {
  8779. constructor(components) {
  8780. super(components);
  8781. /**
  8782. * @member {Array.<string>} [SuperMap.Geometry.MultiLineString.prototype.componentTypes=["SuperMap.Geometry.LineString"]]
  8783. * @description components 存储的的几何对象所支持的几何类型数组。
  8784. * @readonly
  8785. */
  8786. this.componentTypes = ["SuperMap.Geometry.LineString"];
  8787. this.CLASS_NAME = "SuperMap.Geometry.MultiLineString";
  8788. this.geometryType = "MultiLineString";
  8789. }
  8790. }
  8791. SuperMap.Geometry.MultiLineString = MultiLineString;
  8792. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/MultiPolygon.js
  8793. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8794. * This program are made available under the terms of the Apache License, Version 2.0
  8795. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8796. /**
  8797. * @class SuperMap.Geometry.MultiPolygon
  8798. * @classdesc 几何对象多多边形类。
  8799. * @category BaseTypes Geometry
  8800. * @extends {SuperMap.Geometry.Collection}
  8801. * @param {Array.<SuperMap.Geometry.Polygon>} components - 形成 MultiPolygon 的多边形数组。
  8802. * @example
  8803. * var points1 = [new SuperMap.Geometry.Point(10,10),new SuperMap.Geometry.Point(0,0)];
  8804. * 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)];
  8805. *
  8806. * var linearRing1 = new SuperMap.Geometry.LinearRing(points1);
  8807. * var linearRing2 = new SuperMap.Geometry.LinearRing(points2);
  8808. *
  8809. * var polygon1 = new SuperMap.Geometry.Polygon([linearRing1]);
  8810. * var polygon2 = new SuperMap.Geometry.Polygon([linearRing2]);
  8811. *
  8812. * var multiPolygon1 = new SuperMap.Geometry.MultiPolygon([polygon1,polygon2]);
  8813. */
  8814. class MultiPolygon extends Collection {
  8815. constructor(components) {
  8816. super(components);
  8817. /**
  8818. * @member {Array.<string>} [SuperMap.Geometry.MultiPolygon.prototype.componentTypes=["SuperMap.Geometry.Polygon"]]
  8819. * @description components 存储的的几何对象所支持的几何类型数组。
  8820. * @readonly
  8821. */
  8822. this.componentTypes = ["SuperMap.Geometry.Polygon"];
  8823. this.CLASS_NAME = "SuperMap.Geometry.MultiPolygon";
  8824. this.geometryType = "MultiPolygon";
  8825. }
  8826. }
  8827. SuperMap.Geometry.MultiPolygon = MultiPolygon;
  8828. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Polygon.js
  8829. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8830. * This program are made available under the terms of the Apache License, Version 2.0
  8831. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8832. /**
  8833. * @class SuperMap.Geometry.Polygon
  8834. * @classdesc 多边形几何对象类。
  8835. * @category BaseTypes Geometry
  8836. * @extends {SuperMap.Geometry.Collection}
  8837. * @param {Array.<SuperMap.Geometry.LinearRing>} components - 用来生成多边形的线环数组。
  8838. * @example
  8839. * var points =[new SuperMap.Geometry.Point(0,4010338),
  8840. * new SuperMap.Geometry.Point(1063524,4010338),
  8841. * new SuperMap.Geometry.Point(1063524,3150322),
  8842. * new SuperMap.Geometry.Point(0,3150322)
  8843. * ],
  8844. * var linearRings = new SuperMap.Geometry.LinearRing(points),
  8845. * var region = new SuperMap.Geometry.Polygon([linearRings]);
  8846. */
  8847. class Polygon extends Collection {
  8848. constructor(components) {
  8849. super(components);
  8850. /**
  8851. * @member {Array.<string>} [SuperMap.Geometry.Polygon.prototype.componentTypes=["SuperMap.Geometry.LinearRing"]]
  8852. * @description components 存储的的几何对象所支持的几何类型数组。
  8853. * @readonly
  8854. */
  8855. this.componentTypes = ["SuperMap.Geometry.LinearRing"];
  8856. this.CLASS_NAME = "SuperMap.Geometry.Polygon";
  8857. this.geometryType = "Polygon";
  8858. }
  8859. /**
  8860. * @function SuperMap.Geometry.Polygon.prototype.getArea
  8861. * @description 获得区域面积,从区域的外部口径减去计此区域内部口径算所得的面积。
  8862. * @returns {float} 几何对象的面积。
  8863. */
  8864. getArea() {
  8865. var area = 0.0;
  8866. if (this.components && (this.components.length > 0)) {
  8867. area += Math.abs(this.components[0].getArea());
  8868. for (var i = 1, len = this.components.length; i < len; i++) {
  8869. area -= Math.abs(this.components[i].getArea());
  8870. }
  8871. }
  8872. return area;
  8873. }
  8874. }
  8875. SuperMap.Geometry.Polygon = Polygon;
  8876. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/Rectangle.js
  8877. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8878. * This program are made available under the terms of the Apache License, Version 2.0
  8879. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8880. /**
  8881. * @class SuperMap.Geometry.Rectangle
  8882. * @classdesc 矩形几何对象类。
  8883. * @category BaseTypes Geometry
  8884. * @param {float} x - 矩形左下角点的横坐标。
  8885. * @param {float} y - 矩形左下角点的纵坐标。
  8886. * @param {float} width - 矩形的宽度。
  8887. * @param {float} height - 矩形的高度。
  8888. * @extends {SuperMap.Geometry}
  8889. * @example
  8890. * //x 为矩形左下角点的横坐标;y 为矩形左下角点的纵坐标;w 为矩形的宽度;h 为矩形的高度
  8891. * var x = 1;
  8892. * var y = 2;
  8893. * var w = 10;
  8894. * var h = 20;
  8895. * var recttangle = new SuperMap.Geometry.Rectangle(x, y, w, h);
  8896. */
  8897. class Rectangle extends Geometry {
  8898. constructor(x, y, width, height) {
  8899. super(x, y, width, height);
  8900. /**
  8901. * @member {float} SuperMap.Geometry.Rectangle.prototype.x
  8902. * @description 矩形左下角点的横坐标。
  8903. */
  8904. this.x = x;
  8905. /**
  8906. * @member {float} SuperMap.Geometry.Rectangle.prototype.y
  8907. * @description 矩形左下角点的纵坐标。
  8908. */
  8909. this.y = y;
  8910. /**
  8911. * @member {float} SuperMap.Geometry.Rectangle.prototype.width
  8912. * @description 矩形的宽度。
  8913. */
  8914. this.width = width;
  8915. /**
  8916. * @member {float} SuperMap.Geometry.Rectangle.prototype.height
  8917. * @description 矩形的高度。
  8918. */
  8919. this.height = height;
  8920. this.CLASS_NAME = "SuperMap.Geometry.Rectangle";
  8921. this.geometryType = "Rectangle";
  8922. }
  8923. /**
  8924. * @function SuperMap.Geometry.Rectangle.prototype.calculateBounds
  8925. * @description 计算出此矩形对象的 bounds。
  8926. */
  8927. calculateBounds() {
  8928. this.bounds = new Bounds(this.x, this.y,
  8929. this.x + this.width,
  8930. this.y + this.height);
  8931. }
  8932. /**
  8933. * @function SuperMap.Geometry.Rectangle.prototype.getArea
  8934. * @description 获取矩形对象的面积。
  8935. * @returns {float} 矩形对象面积。
  8936. */
  8937. getArea() {
  8938. var area = this.width * this.height;
  8939. return area;
  8940. }
  8941. }
  8942. SuperMap.Geometry.Rectangle = Rectangle;
  8943. ;// CONCATENATED MODULE: ./src/common/commontypes/geometry/index.js
  8944. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8945. * This program are made available under the terms of the Apache License, Version 2.0
  8946. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8947. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  8948. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8949. * This program are made available under the terms of the Apache License, Version 2.0
  8950. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8951. /**
  8952. * @class SuperMap.Credential
  8953. * @category Security
  8954. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  8955. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  8956. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  8957. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  8958. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  8959. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  8960. * @example
  8961. * var pixcel = new SuperMap.Credential("valueString","token");
  8962. * pixcel.destroy();
  8963. */
  8964. class Credential {
  8965. constructor(value, name) {
  8966. /**
  8967. * @member {string} SuperMap.Bounds.prototype.value
  8968. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  8969. */
  8970. this.value = value ? value : "";
  8971. /**
  8972. * @member {string} [SuperMap.Bounds.prototype.name='token']
  8973. * @description 验证信息前缀,name=value 部分的 name 部分。
  8974. */
  8975. this.name = name ? name : "token";
  8976. this.CLASS_NAME = "SuperMap.Credential";
  8977. }
  8978. /**
  8979. * @function SuperMap.Credential.prototype.getUrlParameters
  8980. * @example
  8981. * var credential = new SuperMap.Credential("valueString","token");
  8982. * //这里 str = "token=valueString";
  8983. * var str = credential.getUrlParameters();
  8984. * @returns {string} 返回安全信息组成的 url 片段。
  8985. */
  8986. getUrlParameters() {
  8987. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  8988. return this.name + "=" + this.value;
  8989. }
  8990. /**
  8991. * @function SuperMap.Bounds.prototype.getValue
  8992. * @description 获取 value。
  8993. * @example
  8994. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  8995. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  8996. * var str = credential.getValue();
  8997. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  8998. */
  8999. getValue() {
  9000. return this.value;
  9001. }
  9002. /**
  9003. *
  9004. * @function SuperMap.Credential.prototype.destroy
  9005. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  9006. * @example
  9007. * var credential = new SuperMap.Credential("valueString","token");
  9008. * credential.destroy();
  9009. */
  9010. destroy() {
  9011. this.value = null;
  9012. this.name = null;
  9013. }
  9014. }
  9015. /**
  9016. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  9017. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  9018. * @constant
  9019. * @example
  9020. * 代码实例:
  9021. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  9022. * var value = "(以iServer为例,这里是申请的token值)";
  9023. * var name = "token";
  9024. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  9025. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  9026. *
  9027. */
  9028. Credential.CREDENTIAL = null;
  9029. SuperMap.Credential = Credential;
  9030. ;// CONCATENATED MODULE: ./src/common/commontypes/Date.js
  9031. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9032. * This program are made available under the terms of the Apache License, Version 2.0
  9033. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9034. /**
  9035. * @name Date
  9036. * @memberOf SuperMap
  9037. * @namespace
  9038. * @category BaseTypes Util
  9039. * @description 包含 parse、toISOString 方法的实现,两个方法用来解析 RFC 3339 日期,遵循 ECMAScript 5 规范。
  9040. */
  9041. var DateExt = SuperMap.Date = {
  9042. /**
  9043. * @description 生成代表一个具体的日期字符串,该日期遵循 ISO 8601 标准(详情查看{@link http://tools.ietf.org/html/rfc3339})。
  9044. * @example
  9045. * var dateString = SuperMap.Date.toISOString(new Date());
  9046. * @param {Date} date - 日期对象。
  9047. * @returns {string} 一个代表日期的字符串。(例如 "2010-08-07T16:58:23.123Z")。
  9048. */
  9049. toISOString: (function () {
  9050. //标准的Date会存在toISOString方法,可以直接调用
  9051. if ("toISOString" in Date.prototype) {
  9052. return function (date) {
  9053. return date.toISOString();
  9054. };
  9055. } else {// 部分浏览器没有,就得自己组合,组合后的字符串规则不变
  9056. function pad(num, len) {
  9057. var str = num + "";
  9058. while (str.length < len) {
  9059. str = "0" + str;
  9060. }
  9061. return str;
  9062. }
  9063. return function (date) {
  9064. var str;
  9065. if (isNaN(date.getTime())) {
  9066. // ECMA-262 says throw RangeError, Firefox returns
  9067. // "Invalid Date"
  9068. str = "Invalid Date";
  9069. } else {
  9070. str =
  9071. date.getUTCFullYear() + "-" +
  9072. pad(date.getUTCMonth() + 1, 2) + "-" +
  9073. pad(date.getUTCDate(), 2) + "T" +
  9074. pad(date.getUTCHours(), 2) + ":" +
  9075. pad(date.getUTCMinutes(), 2) + ":" +
  9076. pad(date.getUTCSeconds(), 2) + "." +
  9077. pad(date.getUTCMilliseconds(), 3) + "Z";
  9078. }
  9079. return str;
  9080. };
  9081. }
  9082. })(),
  9083. /**
  9084. * @description 从一个字符串生成一个日期对象。
  9085. * @example
  9086. * var date = SuperMap.Date.parse("2010-08-07");
  9087. * @param {string} str - 代表日期的字符串。(例如: "2010", "2010-08", "2010-08-07", "2010-08-07T16:58:23.123Z","2010-08-07T11:58:23.123-06")。
  9088. * @returns {Date} 日期对象,如果字符串无法被解析,则返回一个无效的日期。(例如 isNaN(date.getTime()))。
  9089. */
  9090. parse: function (str) {
  9091. var date;
  9092. 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)?$/);
  9093. if (match && (match[1] || match[7])) { // must have at least year or time
  9094. var year = parseInt(match[1], 10) || 0;
  9095. var month = (parseInt(match[2], 10) - 1) || 0;
  9096. var day = parseInt(match[3], 10) || 1;
  9097. date = new Date(Date.UTC(year, month, day));
  9098. // optional time
  9099. var type = match[7];
  9100. if (type) {
  9101. var hours = parseInt(match[4], 10);
  9102. var minutes = parseInt(match[5], 10);
  9103. var secFrac = parseFloat(match[6]);
  9104. var seconds = secFrac | 0;
  9105. var milliseconds = Math.round(1000 * (secFrac - seconds));
  9106. date.setUTCHours(hours, minutes, seconds, milliseconds);
  9107. // check offset
  9108. if (type !== "Z") {
  9109. var hoursOffset = parseInt(type, 10);
  9110. var minutesOffset = parseInt(match[8], 10) || 0;
  9111. var offset = -1000 * (60 * (hoursOffset * 60) + minutesOffset * 60);
  9112. date = new Date(date.getTime() + offset);
  9113. }
  9114. }
  9115. } else {
  9116. date = new Date("invalid");
  9117. }
  9118. return date;
  9119. }
  9120. };
  9121. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  9122. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9123. * This program are made available under the terms of the Apache License, Version 2.0
  9124. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9125. /**
  9126. * @name Event
  9127. * @memberOf SuperMap
  9128. * @namespace
  9129. * @description 事件处理函数.
  9130. */
  9131. var Event = SuperMap.Event = {
  9132. /**
  9133. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  9134. * @type {boolean}
  9135. * @default false
  9136. */
  9137. observers: false,
  9138. /**
  9139. * @description KEY_SPACE
  9140. * @type {number}
  9141. * @default 32
  9142. */
  9143. KEY_SPACE: 32,
  9144. /**
  9145. * @description KEY_BACKSPACE
  9146. * @type {number}
  9147. * @default 8
  9148. */
  9149. KEY_BACKSPACE: 8,
  9150. /**
  9151. * @description KEY_TAB
  9152. * @type {number}
  9153. * @default 9
  9154. */
  9155. KEY_TAB: 9,
  9156. /**
  9157. * @description KEY_RETURN
  9158. * @type {number}
  9159. * @default 13
  9160. */
  9161. KEY_RETURN: 13,
  9162. /**
  9163. * @description KEY_ESC
  9164. * @type {number}
  9165. * @default 27
  9166. */
  9167. KEY_ESC: 27,
  9168. /**
  9169. * @description KEY_LEFT
  9170. * @type {number}
  9171. * @default 37
  9172. */
  9173. KEY_LEFT: 37,
  9174. /**
  9175. * @description KEY_UP
  9176. * @type {number}
  9177. * @default 38
  9178. */
  9179. KEY_UP: 38,
  9180. /**
  9181. * @description KEY_RIGHT
  9182. * @type {number}
  9183. * @default 39
  9184. */
  9185. KEY_RIGHT: 39,
  9186. /**
  9187. * @description KEY_DOWN
  9188. * @type {number}
  9189. * @default 40
  9190. */
  9191. KEY_DOWN: 40,
  9192. /**
  9193. * @description KEY_DELETE
  9194. * @type {number}
  9195. * @default 46
  9196. */
  9197. KEY_DELETE: 46,
  9198. /**
  9199. * @description Cross browser event element detection.
  9200. * @param {Event} event - The event
  9201. * @returns {HTMLElement} The element that caused the event
  9202. */
  9203. element: function (event) {
  9204. return event.target || event.srcElement;
  9205. },
  9206. /**
  9207. * @description Determine whether event was caused by a single touch
  9208. * @param {Event} event - The event
  9209. * @returns {boolean}
  9210. */
  9211. isSingleTouch: function (event) {
  9212. return event.touches && event.touches.length === 1;
  9213. },
  9214. /**
  9215. * @description Determine whether event was caused by a multi touch
  9216. * @param {Event} event - The event
  9217. * @returns {boolean}
  9218. */
  9219. isMultiTouch: function (event) {
  9220. return event.touches && event.touches.length > 1;
  9221. },
  9222. /**
  9223. * @description Determine whether event was caused by a left click.
  9224. * @param {Event} event - The event
  9225. * @returns {boolean}
  9226. */
  9227. isLeftClick: function (event) {
  9228. return (((event.which) && (event.which === 1)) ||
  9229. ((event.button) && (event.button === 1)));
  9230. },
  9231. /**
  9232. * @description Determine whether event was caused by a right mouse click.
  9233. * @param {Event} event - The event
  9234. * @returns {boolean}
  9235. */
  9236. isRightClick: function (event) {
  9237. return (((event.which) && (event.which === 3)) ||
  9238. ((event.button) && (event.button === 2)));
  9239. },
  9240. /**
  9241. * @description Stops an event from propagating.
  9242. * @param {Event} event - The event
  9243. * @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
  9244. */
  9245. stop: function (event, allowDefault) {
  9246. if (!allowDefault) {
  9247. if (event.preventDefault) {
  9248. event.preventDefault();
  9249. } else {
  9250. event.returnValue = false;
  9251. }
  9252. }
  9253. if (event.stopPropagation) {
  9254. event.stopPropagation();
  9255. } else {
  9256. event.cancelBubble = true;
  9257. }
  9258. },
  9259. /**
  9260. * @param {Event} event - The event。
  9261. * @param {string} tagName - html 标签名。
  9262. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  9263. */
  9264. findElement: function (event, tagName) {
  9265. var element = SuperMap.Event.element(event);
  9266. while (element.parentNode && (!element.tagName ||
  9267. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  9268. element = element.parentNode;
  9269. }
  9270. return element;
  9271. },
  9272. /**
  9273. * @description 监听事件,注册事件处理方法。
  9274. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  9275. * @param {string} name - 监听事件的类别名称。
  9276. * @param {function} observer - 注册的事件处理方法。
  9277. * @param {boolean} [useCapture=false] - 是否捕获。
  9278. */
  9279. observe: function (elementParam, name, observer, useCapture) {
  9280. var element = Util.getElement(elementParam);
  9281. useCapture = useCapture || false;
  9282. if (name === 'keypress' &&
  9283. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  9284. || element.attachEvent)) {
  9285. name = 'keydown';
  9286. }
  9287. //if observers cache has not yet been created, create it
  9288. if (!this.observers) {
  9289. this.observers = {};
  9290. }
  9291. //if not already assigned, make a new unique cache ID
  9292. if (!element._eventCacheID) {
  9293. var idPrefix = "eventCacheID_";
  9294. if (element.id) {
  9295. idPrefix = element.id + "_" + idPrefix;
  9296. }
  9297. element._eventCacheID = Util.createUniqueID(idPrefix);
  9298. }
  9299. var cacheID = element._eventCacheID;
  9300. //if there is not yet a hash entry for this element, add one
  9301. if (!this.observers[cacheID]) {
  9302. this.observers[cacheID] = [];
  9303. }
  9304. //add a new observer to this element's list
  9305. this.observers[cacheID].push({
  9306. 'element': element,
  9307. 'name': name,
  9308. 'observer': observer,
  9309. 'useCapture': useCapture
  9310. });
  9311. //add the actual browser event listener
  9312. if (element.addEventListener) {
  9313. if(name === 'mousewheel'){
  9314. // https://www.chromestatus.com/features/6662647093133312
  9315. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  9316. } else {
  9317. element.addEventListener(name, observer, useCapture);
  9318. }
  9319. } else if (element.attachEvent) {
  9320. element.attachEvent('on' + name, observer);
  9321. }
  9322. },
  9323. /**
  9324. * @description Given the id of an element to stop observing, cycle through the
  9325. * element's cached observers, calling stopObserving on each one,
  9326. * skipping those entries which can no longer be removed.
  9327. *
  9328. * @param {(HTMLElement|string)} elementParam -
  9329. */
  9330. stopObservingElement: function (elementParam) {
  9331. var element = Util.getElement(elementParam);
  9332. var cacheID = element._eventCacheID;
  9333. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  9334. },
  9335. /**
  9336. * @param {Array.<Object>} elementObservers - Array of (element, name,
  9337. * observer, usecapture) objects,
  9338. * taken directly from hashtable
  9339. */
  9340. _removeElementObservers: function (elementObservers) {
  9341. if (elementObservers) {
  9342. for (var i = elementObservers.length - 1; i >= 0; i--) {
  9343. var entry = elementObservers[i];
  9344. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  9345. SuperMap.Event.stopObserving.apply(this, args);
  9346. }
  9347. }
  9348. },
  9349. /**
  9350. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  9351. * 保持一致才能确保事件移除成功。
  9352. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  9353. * @param {string} name - 需要移除的被监听事件名称。
  9354. * @param {function} observer - 需要移除的事件处理方法。
  9355. * @param {boolean} [useCapture=false] - 是否捕获。
  9356. * @returns {boolean} Whether or not the event observer was removed
  9357. */
  9358. stopObserving: function (elementParam, name, observer, useCapture) {
  9359. useCapture = useCapture || false;
  9360. var element = Util.getElement(elementParam);
  9361. var cacheID = element._eventCacheID;
  9362. if (name === 'keypress') {
  9363. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  9364. element.detachEvent) {
  9365. name = 'keydown';
  9366. }
  9367. }
  9368. // find element's entry in this.observers cache and remove it
  9369. var foundEntry = false;
  9370. var elementObservers = SuperMap.Event.observers[cacheID];
  9371. if (elementObservers) {
  9372. // find the specific event type in the element's list
  9373. var i = 0;
  9374. while (!foundEntry && i < elementObservers.length) {
  9375. var cacheEntry = elementObservers[i];
  9376. if ((cacheEntry.name === name) &&
  9377. (cacheEntry.observer === observer) &&
  9378. (cacheEntry.useCapture === useCapture)) {
  9379. elementObservers.splice(i, 1);
  9380. if (elementObservers.length == 0) {
  9381. delete SuperMap.Event.observers[cacheID];
  9382. }
  9383. foundEntry = true;
  9384. break;
  9385. }
  9386. i++;
  9387. }
  9388. }
  9389. //actually remove the event listener from browser
  9390. if (foundEntry) {
  9391. if (element.removeEventListener) {
  9392. element.removeEventListener(name, observer, useCapture);
  9393. } else if (element && element.detachEvent) {
  9394. element.detachEvent('on' + name, observer);
  9395. }
  9396. }
  9397. return foundEntry;
  9398. },
  9399. /**
  9400. * @description Cycle through all the element entries in the events cache and call
  9401. * stopObservingElement on each.
  9402. */
  9403. unloadCache: function () {
  9404. // check for SuperMap.Event before checking for observers, because
  9405. // SuperMap.Event may be undefined in IE if no map instance was
  9406. // created
  9407. if (SuperMap.Event && SuperMap.Event.observers) {
  9408. for (var cacheID in SuperMap.Event.observers) {
  9409. var elementObservers = SuperMap.Event.observers[cacheID];
  9410. SuperMap.Event._removeElementObservers.apply(this,
  9411. [elementObservers]);
  9412. }
  9413. SuperMap.Event.observers = false;
  9414. }
  9415. },
  9416. CLASS_NAME: "SuperMap.Event"
  9417. };
  9418. SuperMap.Event = Event;
  9419. /* prevent memory leaks in IE */
  9420. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  9421. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  9422. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9423. * This program are made available under the terms of the Apache License, Version 2.0
  9424. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9425. /**
  9426. * @class SuperMap.Events
  9427. * @classdesc 事件类。
  9428. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  9429. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  9430. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  9431. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  9432. * @param {Object} options - 事件对象选项。
  9433. */
  9434. class Events {
  9435. constructor(object, element, eventTypes, fallThrough, options) {
  9436. /**
  9437. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  9438. * @description 支持的事件。
  9439. * @constant
  9440. * @default [
  9441. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  9442. "click", "dblclick", "rightclick", "dblrightclick","resize",
  9443. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  9444. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  9445. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  9446. ]
  9447. */
  9448. this.BROWSER_EVENTS = [
  9449. "mouseover", "mouseout",
  9450. "mousedown", "mouseup", "mousemove",
  9451. "click", "dblclick", "rightclick", "dblrightclick",
  9452. "resize", "focus", "blur",
  9453. "touchstart", "touchmove", "touchend",
  9454. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  9455. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  9456. "contextmenu"
  9457. ];
  9458. /**
  9459. * @member {Object} SuperMap.Events.prototype.listeners
  9460. * @description Hashtable of Array(function): events listener functions
  9461. */
  9462. this.listeners = {};
  9463. /**
  9464. * @member {Object} SuperMap.Events.prototype.object
  9465. * @description 发布应用程序事件的对象。
  9466. */
  9467. this.object = object;
  9468. /**
  9469. * @member {HTMLElement} SuperMap.Events.prototype.element
  9470. * @description 接受浏览器事件的 DOM 节点。
  9471. */
  9472. this.element = null;
  9473. /**
  9474. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  9475. * @description 支持的事件类型列表。
  9476. */
  9477. this.eventTypes = [];
  9478. /**
  9479. * @member {function} SuperMap.Events.prototype.eventHandler
  9480. * @description 绑定在元素上的事件处理器对象。
  9481. */
  9482. this.eventHandler = null;
  9483. /**
  9484. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  9485. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  9486. */
  9487. this.fallThrough = fallThrough;
  9488. /**
  9489. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  9490. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  9491. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  9492. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  9493. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  9494. * @example
  9495. * function named(evt) {
  9496. * this.xy = this.object.events.getMousePosition(evt);
  9497. * }
  9498. */
  9499. this.includeXY = false;
  9500. /**
  9501. * @member {Object} SuperMap.Events.prototype.extensions
  9502. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  9503. * @example
  9504. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  9505. *
  9506. * SuperMap.Events.foostart = SuperMap.Class({
  9507. * initialize: function(target) {
  9508. * this.target = target;
  9509. * this.target.register("click", this, this.doStuff, {extension: true});
  9510. * // only required if extension provides more than one event type
  9511. * this.target.extensions["foostart"] = true;
  9512. * this.target.extensions["fooend"] = true;
  9513. * },
  9514. * destroy: function() {
  9515. * var target = this.target;
  9516. * target.unregister("click", this, this.doStuff);
  9517. * delete this.target;
  9518. * // only required if extension provides more than one event type
  9519. * delete target.extensions["foostart"];
  9520. * delete target.extensions["fooend"];
  9521. * },
  9522. * doStuff: function(evt) {
  9523. * var propagate = true;
  9524. * if (SuperMap.Event.element(evt).className === "foo") {
  9525. * propagate = false;
  9526. * var target = this.target;
  9527. * target.triggerEvent("foostart");
  9528. * window.setTimeout(function() {
  9529. * target.triggerEvent("fooend");
  9530. * }, 1000);
  9531. * }
  9532. * return propagate;
  9533. * }
  9534. * });
  9535. * // only required if extension provides more than one event type
  9536. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  9537. */
  9538. this.extensions = {};
  9539. /**
  9540. * @member {Object} SuperMap.Events.prototype.extensionCount
  9541. */
  9542. this.extensionCount = {};
  9543. /**
  9544. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  9545. */
  9546. this.clearMouseListener = null;
  9547. Util.extend(this, options);
  9548. if (eventTypes != null) {
  9549. for (var i = 0, len = eventTypes.length; i < len; i++) {
  9550. this.addEventType(eventTypes[i]);
  9551. }
  9552. }
  9553. if (element != null) {
  9554. this.attachToElement(element);
  9555. }
  9556. this.CLASS_NAME = "SuperMap.Events";
  9557. }
  9558. /**
  9559. * @function SuperMap.Events.prototype.destroy
  9560. * @description 移除当前要素 element 上的所有事件监听和处理。
  9561. */
  9562. destroy() {
  9563. for (var e in this.extensions) {
  9564. if (typeof this.extensions[e] !== "boolean") {
  9565. this.extensions[e].destroy();
  9566. }
  9567. }
  9568. this.extensions = null;
  9569. if (this.element) {
  9570. Event.stopObservingElement(this.element);
  9571. if (this.element.hasScrollEvent) {
  9572. Event.stopObserving(
  9573. window, "scroll", this.clearMouseListener
  9574. );
  9575. }
  9576. }
  9577. this.element = null;
  9578. this.listeners = null;
  9579. this.object = null;
  9580. this.eventTypes = null;
  9581. this.fallThrough = null;
  9582. this.eventHandler = null;
  9583. }
  9584. /**
  9585. * @function SuperMap.Events.prototype.addEventType
  9586. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  9587. * @param {string} eventName - 事件名。
  9588. */
  9589. addEventType(eventName) {
  9590. if (!this.listeners[eventName]) {
  9591. this.eventTypes.push(eventName);
  9592. this.listeners[eventName] = [];
  9593. }
  9594. }
  9595. /**
  9596. * @function SuperMap.Events.prototype.attachToElement
  9597. * @description 给 DOM 元素绑定浏览器事件。
  9598. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  9599. */
  9600. attachToElement(element) {
  9601. if (this.element) {
  9602. Event.stopObservingElement(this.element);
  9603. } else {
  9604. // keep a bound copy of handleBrowserEvent() so that we can
  9605. // pass the same function to both Event.observe() and .stopObserving()
  9606. this.eventHandler = FunctionExt.bindAsEventListener(
  9607. this.handleBrowserEvent, this
  9608. );
  9609. // to be used with observe and stopObserving
  9610. this.clearMouseListener = FunctionExt.bind(
  9611. this.clearMouseCache, this
  9612. );
  9613. }
  9614. this.element = element;
  9615. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  9616. var eventType = this.BROWSER_EVENTS[i];
  9617. // every browser event has a corresponding application event
  9618. // (whether it's listened for or not).
  9619. this.addEventType(eventType);
  9620. // use Prototype to register the event cross-browser
  9621. Event.observe(element, eventType, this.eventHandler);
  9622. }
  9623. // disable dragstart in IE so that mousedown/move/up works normally
  9624. Event.observe(element, "dragstart", Event.stop);
  9625. }
  9626. /**
  9627. * @function SuperMap.Events.prototype.on
  9628. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  9629. * @example
  9630. * // 注册一个 "loadstart" 监听事件
  9631. * events.on({"loadstart": loadStartListener});
  9632. *
  9633. * // 同样注册一个 "loadstart" 监听事件
  9634. * events.register("loadstart", undefined, loadStartListener);
  9635. *
  9636. * // 同时为对象注册多个监听事件
  9637. * events.on({
  9638. * "loadstart": loadStartListener,
  9639. * "loadend": loadEndListener,
  9640. * scope: object
  9641. * });
  9642. *
  9643. * // 同时为对象注册多个监听事件,多次调用 register 方法
  9644. * events.register("loadstart", object, loadStartListener);
  9645. * events.register("loadend", object, loadEndListener);
  9646. *
  9647. *
  9648. * @param {Object} object - 添加监听的对象。
  9649. */
  9650. on(object) {
  9651. for (var type in object) {
  9652. if (type !== "scope" && object.hasOwnProperty(type)) {
  9653. this.register(type, object.scope, object[type]);
  9654. }
  9655. }
  9656. }
  9657. /**
  9658. * @function SuperMap.Events.prototype.register
  9659. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  9660. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  9661. * @param {string} type - 事件注册者的名字。
  9662. * @param {Object} [obj=this.object] - 对象绑定的回调。
  9663. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  9664. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  9665. */
  9666. register(type, obj, func, priority) {
  9667. if (type in Events && !this.extensions[type]) {
  9668. this.extensions[type] = new Events[type](this);
  9669. }
  9670. if ((func != null) &&
  9671. (Util.indexOf(this.eventTypes, type) !== -1)) {
  9672. if (obj == null) {
  9673. obj = this.object;
  9674. }
  9675. var listeners = this.listeners[type];
  9676. if (!listeners) {
  9677. listeners = [];
  9678. this.listeners[type] = listeners;
  9679. this.extensionCount[type] = 0;
  9680. }
  9681. var listener = {obj: obj, func: func};
  9682. if (priority) {
  9683. listeners.splice(this.extensionCount[type], 0, listener);
  9684. if (typeof priority === "object" && priority.extension) {
  9685. this.extensionCount[type]++;
  9686. }
  9687. } else {
  9688. listeners.push(listener);
  9689. }
  9690. }
  9691. }
  9692. /**
  9693. * @function SuperMap.Events.prototype.registerPriority
  9694. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  9695. * @param {string} type - 事件注册者的名字。
  9696. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  9697. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  9698. */
  9699. registerPriority(type, obj, func) {
  9700. this.register(type, obj, func, true);
  9701. }
  9702. /**
  9703. * @function SuperMap.Events.prototype.un
  9704. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  9705. * @example
  9706. * // 移除 "loadstart" 事件监听
  9707. * events.un({"loadstart": loadStartListener});
  9708. *
  9709. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  9710. * events.unregister("loadstart", undefined, loadStartListener);
  9711. *
  9712. * // 取消对象多个事件监听
  9713. * events.un({
  9714. * "loadstart": loadStartListener,
  9715. * "loadend": loadEndListener,
  9716. * scope: object
  9717. * });
  9718. *
  9719. * // 取消对象多个事件监听,多次调用unregister方法。
  9720. * events.unregister("loadstart", object, loadStartListener);
  9721. * events.unregister("loadend", object, loadEndListener);
  9722. *
  9723. * @param {Object} object - 移除监听的对象。
  9724. */
  9725. un(object) {
  9726. for (var type in object) {
  9727. if (type !== "scope" && object.hasOwnProperty(type)) {
  9728. this.unregister(type, object.scope, object[type]);
  9729. }
  9730. }
  9731. }
  9732. /**
  9733. * @function SuperMap.Events.prototype.unregister
  9734. * @description 取消注册。
  9735. * @param {string} type - 事件类型。
  9736. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  9737. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  9738. */
  9739. unregister(type, obj, func) {
  9740. if (obj == null) {
  9741. obj = this.object;
  9742. }
  9743. var listeners = this.listeners[type];
  9744. if (listeners != null) {
  9745. for (var i = 0, len = listeners.length; i < len; i++) {
  9746. if (listeners[i].obj === obj && listeners[i].func === func) {
  9747. listeners.splice(i, 1);
  9748. break;
  9749. }
  9750. }
  9751. }
  9752. }
  9753. /**
  9754. * @function SuperMap.Events.prototype.remove
  9755. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  9756. * @param {string} type - 事件类型。
  9757. */
  9758. remove(type) {
  9759. if (this.listeners[type] != null) {
  9760. this.listeners[type] = [];
  9761. }
  9762. }
  9763. /**
  9764. * @function SuperMap.Events.prototype.triggerEvent
  9765. * @description 触发一个特定的注册事件。
  9766. * @param {string} type - 触发事件类型。
  9767. * @param {Event} evt - 事件对象。
  9768. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  9769. */
  9770. triggerEvent(type, evt) {
  9771. var listeners = this.listeners[type];
  9772. // fast path
  9773. if (!listeners || listeners.length == 0) {
  9774. return undefined;
  9775. }
  9776. // prep evt object with object & div references
  9777. if (evt == null) {
  9778. evt = {};
  9779. }
  9780. evt.object = this.object;
  9781. evt.element = this.element;
  9782. if (!evt.type) {
  9783. evt.type = type;
  9784. }
  9785. // execute all callbacks registered for specified type
  9786. // get a clone of the listeners array to
  9787. // allow for splicing during callbacks
  9788. listeners = listeners.slice();
  9789. var continueChain;
  9790. for (var i = 0, len = listeners.length; i < len; i++) {
  9791. var callback = listeners[i];
  9792. // bind the context to callback.obj
  9793. continueChain = callback.func.apply(callback.obj, [evt]);
  9794. if ((continueChain != undefined) && (continueChain === false)) {
  9795. // if callback returns false, execute no more callbacks.
  9796. break;
  9797. }
  9798. }
  9799. // don't fall through to other DOM elements
  9800. if (!this.fallThrough) {
  9801. Event.stop(evt, true);
  9802. }
  9803. return continueChain;
  9804. }
  9805. /**
  9806. * @function SuperMap.Events.prototype.handleBrowserEvent
  9807. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  9808. * @param {Event} evt - 事件对象。
  9809. */
  9810. handleBrowserEvent(evt) {
  9811. var type = evt.type, listeners = this.listeners[type];
  9812. if (!listeners || listeners.length == 0) {
  9813. // noone's listening, bail out
  9814. return;
  9815. }
  9816. // add clientX & clientY to all events - corresponds to average x, y
  9817. var touches = evt.touches;
  9818. if (touches && touches[0]) {
  9819. var x = 0;
  9820. var y = 0;
  9821. var num = touches.length;
  9822. var touch;
  9823. for (var i = 0; i < num; ++i) {
  9824. touch = touches[i];
  9825. x += touch.clientX;
  9826. y += touch.clientY;
  9827. }
  9828. evt.clientX = x / num;
  9829. evt.clientY = y / num;
  9830. }
  9831. if (this.includeXY) {
  9832. evt.xy = this.getMousePosition(evt);
  9833. }
  9834. this.triggerEvent(type, evt);
  9835. }
  9836. /**
  9837. * @function SuperMap.Events.prototype.clearMouseCache
  9838. * @description 清除鼠标缓存。
  9839. */
  9840. clearMouseCache() {
  9841. this.element.scrolls = null;
  9842. this.element.lefttop = null;
  9843. var body = document.body;
  9844. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  9845. navigator.userAgent.match(/iPhone/i))) {
  9846. this.element.offsets = null;
  9847. }
  9848. }
  9849. /**
  9850. * @function SuperMap.Events.prototype.getMousePosition
  9851. * @param {Event} evt - 事件对象。
  9852. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  9853. */
  9854. getMousePosition(evt) {
  9855. if (!this.includeXY) {
  9856. this.clearMouseCache();
  9857. } else if (!this.element.hasScrollEvent) {
  9858. Event.observe(window, "scroll", this.clearMouseListener);
  9859. this.element.hasScrollEvent = true;
  9860. }
  9861. if (!this.element.scrolls) {
  9862. var viewportElement = Util.getViewportElement();
  9863. this.element.scrolls = [
  9864. viewportElement.scrollLeft,
  9865. viewportElement.scrollTop
  9866. ];
  9867. }
  9868. if (!this.element.lefttop) {
  9869. this.element.lefttop = [
  9870. (document.documentElement.clientLeft || 0),
  9871. (document.documentElement.clientTop || 0)
  9872. ];
  9873. }
  9874. if (!this.element.offsets) {
  9875. this.element.offsets = Util.pagePosition(this.element);
  9876. }
  9877. return new Pixel(
  9878. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  9879. - this.element.lefttop[0],
  9880. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  9881. - this.element.lefttop[1]
  9882. );
  9883. }
  9884. }
  9885. SuperMap.Events = Events;
  9886. SuperMap.Events.prototype.BROWSER_EVENTS = [
  9887. "mouseover", "mouseout",
  9888. "mousedown", "mouseup", "mousemove",
  9889. "click", "dblclick", "rightclick", "dblrightclick",
  9890. "resize", "focus", "blur",
  9891. "touchstart", "touchmove", "touchend",
  9892. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  9893. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  9894. "contextmenu"
  9895. ];
  9896. ;// CONCATENATED MODULE: ./src/common/commontypes/Feature.js
  9897. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9898. * This program are made available under the terms of the Apache License, Version 2.0
  9899. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9900. /**
  9901. * @class SuperMap.Feature
  9902. * @category BaseTypes Geometry
  9903. * @classdesc 要素类组合了地理和属性,Feature 类同时具有 marker 和 lonlat 属性。
  9904. * @param {SuperMap.Layer} layer - 图层。
  9905. * @param {SuperMap.LonLat} lonlat - 经纬度。
  9906. * @param {Object} data - 数据对象。
  9907. */
  9908. class Feature {
  9909. constructor(layer, lonlat, data) {
  9910. this.CLASS_NAME = "SuperMap.Feature";
  9911. /**
  9912. * @deprecated
  9913. * @member {SuperMap.Layer} SuperMap.Feature.prototype.layer
  9914. * @description 图层。
  9915. */
  9916. this.layer = layer;
  9917. /**
  9918. * @member {string} SuperMap.Feature.prototype.id
  9919. * @description 要素 ID。
  9920. */
  9921. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  9922. /**
  9923. * @member {SuperMap.LonLat} SuperMap.Feature.prototype.lonlat
  9924. * @description 经纬度。
  9925. *
  9926. */
  9927. this.lonlat = lonlat;
  9928. /**
  9929. * @member {Object} SuperMap.Feature.prototype.data
  9930. * @description 数据对象。
  9931. */
  9932. this.data = (data != null) ? data : {};
  9933. }
  9934. /**
  9935. * @function SuperMap.Feature.prototype.destroy
  9936. * @description 释放相关资源。
  9937. */
  9938. destroy() {
  9939. this.id = null;
  9940. this.lonlat = null;
  9941. this.data = null;
  9942. }
  9943. }
  9944. SuperMap.Feature = Feature;
  9945. ;// CONCATENATED MODULE: ./src/common/commontypes/Vector.js
  9946. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9947. * This program are made available under the terms of the Apache License, Version 2.0
  9948. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9949. /**
  9950. * @class SuperMap.Feature.Vector
  9951. * @category BaseTypes Geometry
  9952. * @classdesc 矢量要素类。该类具有 Geometry 属性存放几何信息,
  9953. * attributes 属性存放非几何信息,另外还包含了 style 属性,用来定义矢量要素的样式,
  9954. * 其中,默认的样式在 {@link SuperMap.Feature.Vector.style} 类中定义,如果没有特别的指定将使用默认的样式。
  9955. * @extends {SuperMap.Feature}
  9956. * @param {SuperMap.Geometry} geometry - 代表要素的几何形状。
  9957. * @param {Object} [attributes] - 描述要素的任意的可序列化属性,将要映射到 attributes 属性中的对象。
  9958. * @param {Object} [style] - 样式对象。
  9959. * @example
  9960. * var geometry = new SuperMap.Geometry.Point(-115,10);
  9961. * var style = {
  9962. * strokeColor:"#339933",
  9963. * strokeOpacity:1,
  9964. * strokeWidth:3,
  9965. * pointRadius:6
  9966. * }
  9967. * var pointFeature = new SuperMap.Feature.Vector(geometry,null,style);
  9968. * vectorLayer.addFeatures(pointFeature);
  9969. */
  9970. class Vector extends Feature {
  9971. constructor(geometry, attributes, style) {
  9972. super(null, null, attributes);
  9973. /**
  9974. * @member {string} SuperMap.Feature.Vector.prototype.fid
  9975. * @description fid
  9976. */
  9977. this.fid = null;
  9978. /**
  9979. * @member {SuperMap.Geometry} SuperMap.Feature.Vector.prototype.geometry
  9980. * @description 该属性用于存放几何信息。
  9981. */
  9982. this.geometry = geometry ? geometry : null;
  9983. /**
  9984. * @member {Object} SuperMap.Feature.Vector.prototype.attributes
  9985. * @description 描述要素的任意的可序列化属性。
  9986. */
  9987. this.attributes = {};
  9988. if (attributes) {
  9989. this.attributes = Util.extend(this.attributes, attributes);
  9990. }
  9991. /**
  9992. * @member {SuperMap.Bounds} SuperMap.Feature.Vector.prototype.bounds
  9993. * @description The box bounding that feature's geometry, that
  9994. * property can be set by an <SuperMap.Format> object when
  9995. * deserializing the feature, so in most cases it represents an
  9996. * information set by the server.
  9997. */
  9998. this.bounds = null;
  9999. /**
  10000. * @member {string} SuperMap.Feature.Vector.prototype.state
  10001. * @description state
  10002. */
  10003. this.state = null;
  10004. /**
  10005. * @member {Object} SuperMap.Feature.Vector.prototype.style
  10006. * @description 要素的样式属性,地图查询返回的 feature 的 style,8C 变为null。
  10007. */
  10008. this.style = style ? style : null;
  10009. /**
  10010. * @member {string} SuperMap.Feature.Vector.prototype.url
  10011. * @description 如果设置了这个属性,在更新或者删除要素时需要考虑 {@link SuperMap.HTTP} 。
  10012. */
  10013. this.url = null;
  10014. this.lonlat = null;
  10015. this.CLASS_NAME = "SuperMap.Feature.Vector";
  10016. // TRASH THIS
  10017. SuperMap.State = {
  10018. /** states */
  10019. UNKNOWN: 'Unknown',
  10020. INSERT: 'Insert',
  10021. UPDATE: 'Update',
  10022. DELETE: 'Delete'
  10023. };
  10024. Vector.style = {
  10025. 'default': {
  10026. fillColor: "#ee9900",
  10027. fillOpacity: 0.4,
  10028. hoverFillColor: "white",
  10029. hoverFillOpacity: 0.8,
  10030. strokeColor: "#ee9900",
  10031. strokeOpacity: 1,
  10032. strokeWidth: 1,
  10033. strokeLinecap: "round",
  10034. strokeDashstyle: "solid",
  10035. hoverStrokeColor: "red",
  10036. hoverStrokeOpacity: 1,
  10037. hoverStrokeWidth: 0.2,
  10038. pointRadius: 6,
  10039. hoverPointRadius: 1,
  10040. hoverPointUnit: "%",
  10041. pointerEvents: "visiblePainted",
  10042. cursor: "inherit",
  10043. fontColor: "#000000",
  10044. labelAlign: "cm",
  10045. labelOutlineColor: "white",
  10046. labelOutlineWidth: 3
  10047. },
  10048. 'select': {
  10049. fillColor: "blue",
  10050. fillOpacity: 0.4,
  10051. hoverFillColor: "white",
  10052. hoverFillOpacity: 0.8,
  10053. strokeColor: "blue",
  10054. strokeOpacity: 1,
  10055. strokeWidth: 2,
  10056. strokeLinecap: "round",
  10057. strokeDashstyle: "solid",
  10058. hoverStrokeColor: "red",
  10059. hoverStrokeOpacity: 1,
  10060. hoverStrokeWidth: 0.2,
  10061. pointRadius: 6,
  10062. hoverPointRadius: 1,
  10063. hoverPointUnit: "%",
  10064. pointerEvents: "visiblePainted",
  10065. cursor: "pointer",
  10066. fontColor: "#000000",
  10067. labelAlign: "cm",
  10068. labelOutlineColor: "white",
  10069. labelOutlineWidth: 3
  10070. },
  10071. 'temporary': {
  10072. fillColor: "#66cccc",
  10073. fillOpacity: 0.2,
  10074. hoverFillColor: "white",
  10075. hoverFillOpacity: 0.8,
  10076. strokeColor: "#66cccc",
  10077. strokeOpacity: 1,
  10078. strokeLinecap: "round",
  10079. strokeWidth: 2,
  10080. strokeDashstyle: "solid",
  10081. hoverStrokeColor: "red",
  10082. hoverStrokeOpacity: 1,
  10083. hoverStrokeWidth: 0.2,
  10084. pointRadius: 6,
  10085. hoverPointRadius: 1,
  10086. hoverPointUnit: "%",
  10087. pointerEvents: "visiblePainted",
  10088. //cursor:"inherit",
  10089. cursor: "default",
  10090. fontColor: "#000000",
  10091. labelAlign: "cm",
  10092. labelOutlineColor: "white",
  10093. labelOutlineWidth: 3
  10094. },
  10095. 'delete': {
  10096. display: "none"
  10097. }
  10098. };
  10099. }
  10100. /**
  10101. * @function SuperMap.Feature.Vector.prototype.destroy
  10102. * @description nullify references to prevent circular references and memory leaks
  10103. */
  10104. destroy() {
  10105. if (this.layer) {
  10106. this.layer.removeFeatures(this);
  10107. this.layer = null;
  10108. }
  10109. this.geometry = null;
  10110. super.destroy();
  10111. }
  10112. /**
  10113. * @function SuperMap.Feature.Vector.prototype.clone
  10114. * @description Create a clone of this vector feature. Does not set any non-standard
  10115. * properties.
  10116. * @returns {SuperMap.Feature.Vector} An exact clone of this vector feature.
  10117. */
  10118. clone() {
  10119. return new Vector(
  10120. this.geometry ? this.geometry.clone() : null,
  10121. this.attributes,
  10122. this.style);
  10123. }
  10124. /**
  10125. * @function SuperMap.Feature.Vector.prototype.toState
  10126. * @description 设置新状态。
  10127. * @param {string} state - 状态。
  10128. */
  10129. toState(state) {
  10130. if (state === SuperMap.State.UPDATE) {
  10131. switch (this.state) {
  10132. case SuperMap.State.UNKNOWN:
  10133. case SuperMap.State.DELETE:
  10134. this.state = state;
  10135. break;
  10136. case SuperMap.State.UPDATE:
  10137. case SuperMap.State.INSERT:
  10138. break;
  10139. }
  10140. } else if (state === SuperMap.State.INSERT) {
  10141. switch (this.state) {
  10142. case SuperMap.State.UNKNOWN:
  10143. break;
  10144. default:
  10145. this.state = state;
  10146. break;
  10147. }
  10148. } else if (state === SuperMap.State.DELETE) {
  10149. switch (this.state) {
  10150. case SuperMap.State.INSERT:
  10151. // the feature should be destroyed
  10152. break;
  10153. case SuperMap.State.DELETE:
  10154. break;
  10155. case SuperMap.State.UNKNOWN:
  10156. case SuperMap.State.UPDATE:
  10157. this.state = state;
  10158. break;
  10159. }
  10160. } else if (state === SuperMap.State.UNKNOWN) {
  10161. this.state = state;
  10162. }
  10163. }
  10164. }
  10165. /**
  10166. *
  10167. * @typedef {Object} SuperMap.Feature.Vector.style
  10168. * @description SuperMap.features 有大量的样式属性,如果没有特别的指定将使用默认的样式,
  10169. * 大部分样式通过 SVG 标准定义属性。
  10170. * - fill properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#FillProperties}
  10171. * - stroke properties 资料介绍:{@link http://www.w3.org/TR/SVG/painting.html#StrokeProperties}
  10172. * @property {boolean} [fill] - 不需要填充则设置为 false。
  10173. * @property {string} [fillColor='#ee9900'] - 十六进制填充颜色。
  10174. * @property {number} [fillOpacity=0.4] - 填充不透明度。
  10175. * @property {boolean} [stroke] - 不需要描边则设为 false。
  10176. * @property {string} [strokeColor='#ee9900'] - 十六进制描边颜色。
  10177. * @property {number} [strokeOpacity=0.4] - 描边的不透明度(0-1)。
  10178. * @property {number} [strokeWidth=1] - 像素描边宽度。
  10179. * @property {string} [strokeLinecap='round'] - strokeLinecap 有三种类型 butt,round,square。
  10180. * @property {string} [strokeDashstyle='solid'] - 有 dot,dash,dashdot,longdash,longdashdot,solid 几种样式。
  10181. * @property {boolean} [graphic] - 不需要则设置为 false。
  10182. * @property {number} [pointRadius=6] - 像素点半径。
  10183. * @property {string} [pointerEvents='visiblePainted'] - pointerEvents。
  10184. * @property {string} [cursor] - cursor。
  10185. * @property {boolean} [allowRotate='false'] - 是否允许图标随着运行方向旋转。用于时空数据图层。
  10186. * @property {string} [externalGraphic] - 连接到用来渲染点的外部的图形。
  10187. * @property {number} [graphicWidth] - 外部图表的像素宽度。
  10188. * @property {number} [graphicHeight] - 外部图表的高宽度。
  10189. * @property {number} [graphicOpacity] - 外部图表的不透明度(0-1)。
  10190. * @property {number} [graphicXOffset] - 外部图表沿着x方向的偏移量。
  10191. * @property {number} [graphicYOffset] - 外部图表沿着y方向的偏移量 Pixel。
  10192. * @property {number} [rotation] - 一个图表沿着其中心点(或者偏移中心指定点)在顺时针方向旋转。
  10193. * @property {number} [graphicZIndex] - 渲染时使用的索引值。
  10194. * @property {string} [graphicName='circle'] - 渲染点时图标使用的名字。支持"circle" , "square", "star", "x", "cross", "triangle"。
  10195. * @property {string} [graphicTitle] - 外部图表的提示框。
  10196. * @property {string} [backgroundGraphic] - 外部图表的背景。
  10197. * @property {number} [backgroundGraphicZIndex] - 背景图渲染时使用的索引值。
  10198. * @property {number} [backgroundXOffset] - 背景图在 x 轴的偏移量。
  10199. * @property {number} [backgroundYOffset] - 背景图在 y 轴的偏移量。
  10200. * @property {number} [backgroundHeight] - 背景图的高度。如果没有设置,将用 graphicHeight。
  10201. * @property {number} [backgroundWidth] - 背景图的宽度。如果没有设置,将用 graphicWidth。
  10202. * @property {boolean} [isUnicode=false] - 这个属性要配合 label 属性来用,当为 true时,label 就可以使用 unicode 编码,
  10203. * 比如 "a" 的 unicode 十六进制编码为 61,则 label 属性可以为 "&#x61;",其中 "&#" 为前缀,标志这个为 unicode 编码,
  10204. * "x" 是指 16 进制,这时页面显示的是 "a";当此值为 false 的时候,label 的内容会被直接输出,
  10205. * 比如,label 为 "&#x61;",这时页面显示的也是 "&#x61;"。
  10206. * @property {string} [label] - 可选的标签文本。
  10207. * @property {string} [labelAlign='cm'] - 标签对齐,是由两个字符组成的字符串,如:"lt", "cm", "rb",
  10208. * 其中第一个字符代表水平方向上的对齐,"l"=left, "c"=center, "r"=right;
  10209. * 第二个字符代表垂直方向上的对齐,"t"=top, "m"=middle, "b"=bottom。
  10210. * @property {number} [labelXOffset] - 标签在 x 轴方向的偏移量。
  10211. * @property {number} [labelYOffset] - 标签在 y 轴方向的偏移量。
  10212. * @property {boolean} [labelSelect=false] - 如果设为 true,标签可以选用 SelectFeature 或者 similar 控件。
  10213. * @property {string} [fontColor='#000000'] - 标签字体颜色。
  10214. * @property {number} [fontOpacity] - 标签透明度 (0-1)。
  10215. * @property {string} [fontFamily] - 标签的字体类型。
  10216. * @property {string} [fontSize] - 标签的字体大小。
  10217. * @property {string} [fontStyle] - 标签的字体样式。
  10218. * @property {string} [fontWeight] - 标签的字体粗细。
  10219. * @property {string} [display] - 如果 display 属性设置为 “none”,符号将没有任何效果。
  10220. * @example
  10221. * // label的用法如下:
  10222. * function addGeoTest(){
  10223. * var geometry = new SuperMap.Geometry.Point(105, 35);
  10224. * var pointFeature = new SuperMap.Feature.Vector(geometry);
  10225. * var styleTest = {
  10226. * label:"supermap",
  10227. * fontColor:"#0000ff",
  10228. * fontOpacity:"0.5",
  10229. * fontFamily:"隶书",
  10230. * fontSize:"8em",
  10231. * fontWeight:"bold",
  10232. * fontStyle:"italic",
  10233. * labelSelect:"true",
  10234. * }
  10235. * pointFeature.style = styleTest;
  10236. * vectorLayer.addFeatures([pointFeature]);
  10237. * }
  10238. */
  10239. SuperMap.Feature.Vector = Vector;
  10240. ;// CONCATENATED MODULE: ./src/common/commontypes/index.js
  10241. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10242. * This program are made available under the terms of the Apache License, Version 2.0
  10243. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10244. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  10245. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10246. * This program are made available under the terms of the Apache License, Version 2.0
  10247. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10248. /**
  10249. * @class SuperMap.Format
  10250. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  10251. * @category BaseTypes Format
  10252. * @param {Object} options - 可选参数。
  10253. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  10254. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  10255. */
  10256. class Format {
  10257. constructor(options) {
  10258. /**
  10259. * @member {Object} SuperMap.Format.prototype.data
  10260. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  10261. */
  10262. this.data = null;
  10263. /**
  10264. * APIProperty: keepData
  10265. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  10266. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  10267. */
  10268. this.keepData = false;
  10269. Util.extend(this, options);
  10270. this.options = options;
  10271. this.CLASS_NAME = "SuperMap.Format";
  10272. }
  10273. /**
  10274. * @function SuperMap.Format.prototype.destroy
  10275. * @description 销毁该格式类,释放相关资源。
  10276. */
  10277. destroy() {
  10278. //用来销毁该格式类,释放相关资源
  10279. }
  10280. /**
  10281. * @function SuperMap.Format.prototype.read
  10282. * @description 来从字符串中读取数据。
  10283. * @param {string} data - 读取的数据。
  10284. */
  10285. read(data) { // eslint-disable-line no-unused-vars
  10286. //用来从字符串中读取数据
  10287. }
  10288. /**
  10289. * @function SuperMap.Format.prototype.write
  10290. * @description 将对象写成字符串。
  10291. * @param {Object} object - 可序列化的对象。
  10292. * @returns {string} 对象被写成字符串。
  10293. */
  10294. write(object) { // eslint-disable-line no-unused-vars
  10295. //用来写字符串
  10296. }
  10297. }
  10298. SuperMap.Format = SuperMap.Format || Format;
  10299. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  10300. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10301. * This program are made available under the terms of the Apache License, Version 2.0
  10302. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10303. /**
  10304. * @class SuperMap.Format.JSON
  10305. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  10306. * @category BaseTypes Format
  10307. * @param {Object} [options] - 参数。
  10308. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  10309. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  10310. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  10311. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  10312. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  10313. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  10314. * @extends {SuperMap.Format}
  10315. */
  10316. class JSONFormat extends Format {
  10317. constructor(options) {
  10318. super(options);
  10319. /**
  10320. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  10321. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  10322. */
  10323. this.indent = " ";
  10324. /**
  10325. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  10326. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  10327. */
  10328. this.space = " ";
  10329. /**
  10330. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  10331. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  10332. */
  10333. this.newline = "\n";
  10334. /**
  10335. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  10336. * @description 用于格式化输出, 表示的是缩进级别。
  10337. */
  10338. this.level = 0;
  10339. /**
  10340. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  10341. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  10342. */
  10343. this.pretty = false;
  10344. /**
  10345. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  10346. * @description 判断浏览器是否原生支持 JSON 格式数据。
  10347. */
  10348. this.nativeJSON = (function () {
  10349. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  10350. })();
  10351. this.CLASS_NAME = "SuperMap.Format.JSON";
  10352. /**
  10353. * @member SuperMap.Format.JSON.prototype.serialize
  10354. * @description 提供一些类型对象转 JSON 字符串的方法。
  10355. */
  10356. this.serialize = {
  10357. /**
  10358. * @function SuperMap.Format.JSON.serialize.object
  10359. * @description 把对象转换为 JSON 字符串。
  10360. * @param {Object} object - 可序列化的对象。
  10361. * @returns {string} JSON 字符串。
  10362. */
  10363. 'object': function (object) {
  10364. // three special objects that we want to treat differently
  10365. if (object == null) {
  10366. return "null";
  10367. }
  10368. if (object.constructor === Date) {
  10369. return this.serialize.date.apply(this, [object]);
  10370. }
  10371. if (object.constructor === Array) {
  10372. return this.serialize.array.apply(this, [object]);
  10373. }
  10374. var pieces = ['{'];
  10375. this.level += 1;
  10376. var key, keyJSON, valueJSON;
  10377. var addComma = false;
  10378. for (key in object) {
  10379. if (object.hasOwnProperty(key)) {
  10380. // recursive calls need to allow for sub-classing
  10381. keyJSON = this.write.apply(this,
  10382. [key, this.pretty]);
  10383. valueJSON = this.write.apply(this,
  10384. [object[key], this.pretty]);
  10385. if (keyJSON != null && valueJSON != null) {
  10386. if (addComma) {
  10387. pieces.push(',');
  10388. }
  10389. pieces.push(this.writeNewline(), this.writeIndent(),
  10390. keyJSON, ':', this.writeSpace(), valueJSON);
  10391. addComma = true;
  10392. }
  10393. }
  10394. }
  10395. this.level -= 1;
  10396. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  10397. return pieces.join('');
  10398. },
  10399. /**
  10400. * @function SuperMap.Format.JSON.serialize.array
  10401. * @description 把数组转换成 JSON 字符串。
  10402. * @param {Array} array - 可序列化的数组。
  10403. * @returns {string} JSON 字符串。
  10404. */
  10405. 'array': function (array) {
  10406. var json;
  10407. var pieces = ['['];
  10408. this.level += 1;
  10409. for (var i = 0, len = array.length; i < len; ++i) {
  10410. // recursive calls need to allow for sub-classing
  10411. json = this.write.apply(this,
  10412. [array[i], this.pretty]);
  10413. if (json != null) {
  10414. if (i > 0) {
  10415. pieces.push(',');
  10416. }
  10417. pieces.push(this.writeNewline(), this.writeIndent(), json);
  10418. }
  10419. }
  10420. this.level -= 1;
  10421. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  10422. return pieces.join('');
  10423. },
  10424. /**
  10425. * @function SuperMap.Format.JSON.serialize.string
  10426. * @description 把字符串转换成 JSON 字符串。
  10427. * @param {string} string - 可序列化的字符串。
  10428. * @returns {string} JSON 字符串。
  10429. */
  10430. 'string': function (string) {
  10431. // If the string contains no control characters, no quote characters, and no
  10432. // backslash characters, then we can simply slap some quotes around it.
  10433. // Otherwise we must also replace the offending characters with safe
  10434. // sequences.
  10435. var m = {
  10436. '\b': '\\b',
  10437. '\t': '\\t',
  10438. '\n': '\\n',
  10439. '\f': '\\f',
  10440. '\r': '\\r',
  10441. '"': '\\"',
  10442. '\\': '\\\\'
  10443. };
  10444. /*eslint-disable no-control-regex*/
  10445. if (/["\\\x00-\x1f]/.test(string)) {
  10446. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  10447. var c = m[b];
  10448. if (c) {
  10449. return c;
  10450. }
  10451. c = b.charCodeAt();
  10452. return '\\u00' +
  10453. Math.floor(c / 16).toString(16) +
  10454. (c % 16).toString(16);
  10455. }) + '"';
  10456. }
  10457. return '"' + string + '"';
  10458. },
  10459. /**
  10460. * @function SuperMap.Format.JSON.serialize.number
  10461. * @description 把数字转换成 JSON 字符串。
  10462. * @param {number} number - 可序列化的数字。
  10463. * @returns {string} JSON 字符串。
  10464. */
  10465. 'number': function (number) {
  10466. return isFinite(number) ? String(number) : "null";
  10467. },
  10468. /**
  10469. * @function SuperMap.Format.JSON.serialize.boolean
  10470. * @description Transform a boolean into a JSON string.
  10471. * @param {boolean} bool - The boolean to be serialized.
  10472. * @returns {string} A JSON string representing the boolean.
  10473. */
  10474. 'boolean': function (bool) {
  10475. return String(bool);
  10476. },
  10477. /**
  10478. * @function SuperMap.Format.JSON.serialize.object
  10479. * @description 将日期对象转换成 JSON 字符串。
  10480. * @param {Date} date - 可序列化的日期对象。
  10481. * @returns {string} JSON 字符串。
  10482. */
  10483. 'date': function (date) {
  10484. function format(number) {
  10485. // Format integers to have at least two digits.
  10486. return (number < 10) ? '0' + number : number;
  10487. }
  10488. return '"' + date.getFullYear() + '-' +
  10489. format(date.getMonth() + 1) + '-' +
  10490. format(date.getDate()) + 'T' +
  10491. format(date.getHours()) + ':' +
  10492. format(date.getMinutes()) + ':' +
  10493. format(date.getSeconds()) + '"';
  10494. }
  10495. };
  10496. }
  10497. /**
  10498. * @function SuperMap.Format.JSON.prototype.read
  10499. * @description 将一个符合 JSON 结构的字符串进行解析。
  10500. * @param {string} json - 符合 JSON 结构的字符串。
  10501. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  10502. * @returns {Object} 对象,数组,字符串或数字。
  10503. */
  10504. read(json, filter) {
  10505. var object;
  10506. if (this.nativeJSON) {
  10507. try {
  10508. object = JSON.parse(json, filter);
  10509. } catch (e) {
  10510. // Fall through if the regexp test fails.
  10511. }
  10512. }
  10513. if (this.keepData) {
  10514. this.data = object;
  10515. }
  10516. return object;
  10517. }
  10518. /**
  10519. * @function SuperMap.Format.JSON.prototype.write
  10520. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  10521. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  10522. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  10523. * @returns {string} 符合 JSON 格式的字符串。
  10524. *
  10525. */
  10526. write(value, pretty) {
  10527. this.pretty = !!pretty;
  10528. var json = null;
  10529. var type = typeof value;
  10530. if (this.serialize[type]) {
  10531. try {
  10532. json = (!this.pretty && this.nativeJSON) ?
  10533. JSON.stringify(value) :
  10534. this.serialize[type].apply(this, [value]);
  10535. } catch (err) {
  10536. //SuperMap.Console.error("Trouble serializing: " + err);
  10537. }
  10538. }
  10539. return json;
  10540. }
  10541. /**
  10542. * @function SuperMap.Format.JSON.prototype.writeIndent
  10543. * @description 根据缩进级别输出一个缩进字符串。
  10544. * @private
  10545. * @returns {string} 一个适当的缩进字符串。
  10546. */
  10547. writeIndent() {
  10548. var pieces = [];
  10549. if (this.pretty) {
  10550. for (var i = 0; i < this.level; ++i) {
  10551. pieces.push(this.indent);
  10552. }
  10553. }
  10554. return pieces.join('');
  10555. }
  10556. /**
  10557. * @function SuperMap.Format.JSON.prototype.writeNewline
  10558. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  10559. * @private
  10560. * @returns {string} 代表新的一行的字符串。
  10561. */
  10562. writeNewline() {
  10563. return (this.pretty) ? this.newline : '';
  10564. }
  10565. /**
  10566. * @function SuperMap.Format.JSON.prototype.writeSpace
  10567. * @private
  10568. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  10569. * @returns {string} 一个空格。
  10570. */
  10571. writeSpace() {
  10572. return (this.pretty) ? this.space : '';
  10573. }
  10574. }
  10575. SuperMap.Format.JSON = JSONFormat;
  10576. ;// CONCATENATED MODULE: ./src/common/iServer/ServerColor.js
  10577. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10578. * This program are made available under the terms of the Apache License, Version 2.0
  10579. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10580. /**
  10581. * @class SuperMap.ServerColor
  10582. * @category iServer Map Theme
  10583. * @classdesc 颜色类。该类使用三原色( RGB )来表达颜色。
  10584. * @param {Object} options - 参数。
  10585. * @param {number} [options.red=255] - 获取或设置红色值。
  10586. * @param {number} [options.green=0] - 获取或设置绿色值。
  10587. * @param {number} [options.blue=0] - 获取或设置蓝色值。
  10588. */
  10589. class ServerColor {
  10590. constructor(red, green, blue) {
  10591. /**
  10592. * @member {number} [SuperMap.ServerColor.prototype.red=255]
  10593. * @description 获取或设置红色值。
  10594. */
  10595. this.red = (!red && red != 0)?255:red;
  10596. /**
  10597. * @member {number} [SuperMap.ServerColor.prototype.green=0]
  10598. * @description 获取或设置绿色值。
  10599. */
  10600. this.green = green||0;
  10601. /**
  10602. * @member {number} [SuperMap.ServerColor.prototype.blue=0]
  10603. * @description 获取或设置蓝色值。
  10604. */
  10605. this.blue = blue||0;
  10606. this.CLASS_NAME = "SuperMap.ServerColor";
  10607. }
  10608. /**
  10609. * @function SuperMap.ServerColor.prototype.destroy
  10610. * @description 释放资源,将引用资源的属性置空。
  10611. */
  10612. destroy() {
  10613. var me = this;
  10614. me.red = null;
  10615. me.green = null;
  10616. me.blue = null;
  10617. }
  10618. /**
  10619. * @function SuperMap.ServerColor.formJson
  10620. * @description 将 JSON 对象转化为 ServerColor 对象。
  10621. * @param {Object} jsonObject - 要转换的 JSON 对象。
  10622. * @returns {SuperMap.ServerColor} 转化后的 ServerColor 对象。
  10623. */
  10624. static fromJson(jsonObject) {
  10625. if (!jsonObject) {
  10626. return;
  10627. }
  10628. var color = new ServerColor();
  10629. var red = 255;
  10630. if (jsonObject.red !== null) {
  10631. red = Number(jsonObject.red);
  10632. }
  10633. color.red = red;
  10634. var green = 0;
  10635. if (jsonObject.green !== null) {
  10636. green = Number(jsonObject.green);
  10637. }
  10638. color.green = green;
  10639. var blue = 0;
  10640. if (jsonObject.blue !== null) {
  10641. blue = Number(jsonObject.blue);
  10642. }
  10643. color.blue = blue;
  10644. return color;
  10645. }
  10646. }
  10647. SuperMap.ServerColor = ServerColor;
  10648. ;// CONCATENATED MODULE: ./src/common/iServer/ServerStyle.js
  10649. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10650. * This program are made available under the terms of the Apache License, Version 2.0
  10651. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10652. /**
  10653. * @class SuperMap.ServerStyle
  10654. * @category iServer Map Theme
  10655. * @classdesc 服务端矢量要素风格类。
  10656. * @description 该类用于定义点状符号、线状符号、填充符号风格及其相关属性。
  10657. * @param {Object} options - 参数。
  10658. * @param {SuperMap.FillGradientMode} options.fillGradientMode - 渐变填充风格的渐变类型。
  10659. * @param {SuperMap.ServerColor} [options.fillBackColor=[255,255,255]] - 填充背景颜色。
  10660. * @param {boolean} [options.fillBackOpaque=false] - 背景是否不透明。
  10661. * @param {SuperMap.ServerColor} [options.fillForeColor=[255,0,0]] - 填充颜色。
  10662. * @param {number} [options.fillGradientAngle=0] - 渐变填充的旋转角度。
  10663. * @param {number} [options.fillGradientOffsetRatioX=0] - 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。
  10664. * @param {number} [options.fillGradientOffsetRatioY=0] - 填充中心点相对于填充区域范围中心点的垂直偏移百分比。
  10665. * @param {number} [options.fillOpaqueRate=100] - 填充不透明度。
  10666. * @param {number} [options.fillSymbolID=0] - 填充符号的编码。
  10667. * @param {SuperMap.ServerColor} [options.lineColor] - 矢量要素的边线颜色。默认 lineColor = new ServerColor(0, 0, 0)。
  10668. * @param {number} [options.lineSymbolID=0] - 线状符号的编码。
  10669. * @param {number} [options.lineWidth=1] - 边线的宽度。
  10670. * @param {number} [options.markerAngle=0] - 点状符号的旋转角度。
  10671. * @param {number} [options.markerSize=1] - 点状符号的大小。
  10672. * @param {number} [options.markerSymbolID=-1] - 点状符号的编码。
  10673. */
  10674. class ServerStyle {
  10675. constructor(options) {
  10676. /**
  10677. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillBackColor
  10678. * @description 填充背景颜色。当填充模式为渐变填充时,该颜色为填充终止色。
  10679. */
  10680. this.fillBackColor = new ServerColor(255, 255, 255);
  10681. /**
  10682. * @member {boolean} [SuperMap.ServerStyle.prototype.fillBackOpaque=false]
  10683. * @description 背景是否不透明。false 表示透明。
  10684. */
  10685. this.fillBackOpaque = false;
  10686. /**
  10687. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.fillForeColor
  10688. * @description 填充颜色。当填充模式为渐变填充时,该颜色为填充起始颜色。
  10689. */
  10690. this.fillForeColor = new ServerColor(255, 0, 0);
  10691. /**
  10692. * @member {SuperMap.FillGradientMode} SuperMap.ServerStyle.prototype.fillGradientMode
  10693. * @description 渐变填充风格的渐变类型。
  10694. */
  10695. this.fillGradientMode = null;
  10696. /**
  10697. * @member {number} SuperMap.ServerStyle.prototype.fillGradientAngle -
  10698. * @description 渐变填充的旋转角度。单位为度,精确到 0.1 度,逆时针方向为正方向。
  10699. */
  10700. this.fillGradientAngle = 0;
  10701. /**
  10702. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioX
  10703. * @description 渐变填充中心点相对于填充区域范围中心点的水平偏移百分比。它们的关系如下:设填充区域范围中心点的坐标为(x0, y0),
  10704. * 填充中心点的坐标为(x, y),填充区域范围的宽度为 a,水平偏移百分比为 dx,则 x=x0 + a*dx/100。
  10705. */
  10706. this.fillGradientOffsetRatioX = 0;
  10707. /**
  10708. * @member {number} SuperMap.ServerStyle.prototype.fillGradientOffsetRatioY
  10709. * @description 填充中心点相对于填充区域范围中心点的垂直偏移百分比。它们的关系如下:<br>
  10710. * 设填充区域范围中心点的坐标为(x0, y0),填充中心点的坐标为(x, y),填充区域范围的高度为 b,垂直偏移百分比为 dy,则 y=y0 + b*dx/100。
  10711. */
  10712. this.fillGradientOffsetRatioY = 0;
  10713. /**
  10714. * @member {number} [SuperMap.ServerStyle.prototype.fillOpaqueRate=100]
  10715. * @description 填充不透明度。合法值为 0 - 100 的数值。其中为 0 表示完全透明;
  10716. * 100 表示完全不透明。赋值小于 0 时按照 0 处理,大于 100 时按照 100 处理。
  10717. */
  10718. this.fillOpaqueRate = 100;
  10719. /**
  10720. * @member {number} SuperMap.ServerStyle.prototype.fillSymbolID
  10721. * @description 填充符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  10722. * 关于填充符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10723. */
  10724. this.fillSymbolID = 0;
  10725. /**
  10726. * @member {SuperMap.ServerColor} SuperMap.ServerStyle.prototype.lineColor
  10727. * @description 矢量要素的边线颜色。如果等级符号是点符号,点符号的颜色由 lineColor 控制。
  10728. */
  10729. this.lineColor = new ServerColor(0, 0, 0);
  10730. /**
  10731. * @member {number} [SuperMap.ServerStyle.prototype.lineSymbolID=0]
  10732. * @description 线状符号的编码。此编码用于唯一标识各普通填充风格的填充符号。
  10733. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10734. */
  10735. this.lineSymbolID = 0;
  10736. /**
  10737. * @member {number} [SuperMap.ServerStyle.prototype.lineWidth=1.0]
  10738. * @description 边线的宽度。单位为毫米,精度到 0.1。
  10739. */
  10740. this.lineWidth = 1;
  10741. /**
  10742. * @member {number} [SuperMap.ServerStyle.prototype.markerAngle=0]
  10743. * @description 点状符号的旋转角度。以度为单位,精确到 0.1 度,逆时针方向为正方向。
  10744. */
  10745. this.markerAngle = 0;
  10746. /**
  10747. * @member {number} [SuperMap.ServerStyle.prototype.markerSize=1.0]
  10748. * @description 点状符号的大小。单位为毫米,精度为 0.1。当该属性设置为0时,采用符号默认大小 1.0 显示。
  10749. * 当该属性设置为非法值时,交由服务器默认处理。
  10750. */
  10751. this.markerSize = 1;
  10752. /**
  10753. * @member {number} [SuperMap.ServerStyle.prototype.markerSymbolID=-1]
  10754. * @description 点状符号的编码。此编码用于唯一标识各点状符号。
  10755. * 关于线状符号的样式与对应的 ID 号请在 SuperMap 桌面软件中查找。
  10756. */
  10757. this.markerSymbolID = -1;
  10758. if (options) {
  10759. Util.extend(this, options);
  10760. }
  10761. this.CLASS_NAME = "SuperMap.ServerStyle";
  10762. }
  10763. /**
  10764. * @function SuperMap.ServerStyle.prototype.destroy
  10765. * @description 释放资源,将引用资源的属性置空。
  10766. */
  10767. destroy() {
  10768. var me = this;
  10769. if (me.fillBackColor) {
  10770. me.fillBackColor.destroy();
  10771. me.fillBackColor = null;
  10772. }
  10773. me.fillBackOpaque = null;
  10774. if (me.fillForeColor) {
  10775. me.fillForeColor.destroy();
  10776. me.fillForeColor = null;
  10777. }
  10778. me.fillGradientMode = null;
  10779. me.fillGradientAngle = null;
  10780. me.fillGradientOffsetRatioX = null;
  10781. me.fillGradientOffsetRatioY = null;
  10782. me.fillOpaqueRate = null;
  10783. me.fillSymbolID = null;
  10784. if (me.lineColor) {
  10785. me.lineColor.destroy();
  10786. me.lineColor = null;
  10787. }
  10788. me.lineSymbolID = null;
  10789. me.lineWidth = null;
  10790. me.markerAngle = null;
  10791. me.markerSize = null;
  10792. me.markerSymbolID = null;
  10793. }
  10794. /**
  10795. * @function SuperMap.ServerStyle.prototype.toServerJSONObject
  10796. * @description 转换成对应的 JSON 格式对象。
  10797. * @returns {Object} 对应的 JSON 格式对象.
  10798. */
  10799. toServerJSONObject() {
  10800. var styleObj = {};
  10801. styleObj = Util.copyAttributes(styleObj, this);
  10802. //暂时先忽略serverColor往Json的转换
  10803. return styleObj;
  10804. }
  10805. /**
  10806. * @function SuperMap.ServerStyle.fromJson
  10807. * @description 将JSON对象转换为 SuperMap.ServerStyle 对象。
  10808. * @param jsonObject - {Object} 要转换的 JSON 对象。
  10809. * @returns {SuperMap.ServerStyle} 转化后的 SuperMap.ServerStyle 对象。
  10810. */
  10811. static fromJson(jsonObject) {
  10812. if (!jsonObject) {
  10813. return;
  10814. }
  10815. return new ServerStyle({
  10816. fillBackColor: ServerColor.fromJson(jsonObject.fillBackColor),
  10817. fillBackOpaque: jsonObject.fillBackOpaque,
  10818. fillForeColor: ServerColor.fromJson(jsonObject.fillForeColor),
  10819. fillGradientMode: jsonObject.fillGradientMode,
  10820. fillGradientAngle: jsonObject.fillGradientAngle,
  10821. fillGradientOffsetRatioX: jsonObject.fillGradientOffsetRatioX,
  10822. fillGradientOffsetRatioY: jsonObject.fillGradientOffsetRatioY,
  10823. fillOpaqueRate: jsonObject.fillOpaqueRate,
  10824. fillSymbolID: jsonObject.fillSymbolID,
  10825. lineColor: ServerColor.fromJson(jsonObject.lineColor),
  10826. lineSymbolID: jsonObject.lineSymbolID,
  10827. lineWidth: jsonObject.lineWidth,
  10828. markerAngle: jsonObject.markerAngle,
  10829. markerSize: jsonObject.markerSize,
  10830. markerSymbolID: jsonObject.markerSymbolID
  10831. });
  10832. }
  10833. }
  10834. SuperMap.ServerStyle = ServerStyle;
  10835. ;// CONCATENATED MODULE: ./src/common/iServer/PointWithMeasure.js
  10836. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10837. * This program are made available under the terms of the Apache License, Version 2.0
  10838. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10839. /**
  10840. * @class SuperMap.PointWithMeasure
  10841. * @category iServer SpatialAnalyst
  10842. * @classdesc 路由点类。路由点是指具有线性度量值 (Measure) 的二维地理坐标点。
  10843. * @param {Object} options - 参数。
  10844. * @param {number} options.measure - 度量值,即路由对象属性值 M。
  10845. * @param {number} options.x - 获取当前点对象在地理坐标系下的 X 坐标值。
  10846. * @param {number} options.y - 获取当前点对象在地理坐标系下的 Y 坐标值。
  10847. * @extends {SuperMap.Geometry.Point}
  10848. */
  10849. class PointWithMeasure extends Point {
  10850. constructor(options) {
  10851. super(options);
  10852. /**
  10853. * @member {number} SuperMap.PointWithMeasure.prototype.measure
  10854. * @description 度量值,即路由对象属性值 M。
  10855. */
  10856. this.measure = null;
  10857. if (options) {
  10858. Util.extend(this, options);
  10859. }
  10860. this.CLASS_NAME = "SuperMap.PointWithMeasure";
  10861. }
  10862. /**
  10863. * @function SuperMap.PointWithMeasure.prototype.equals
  10864. * @description 判断两个路由点对象是否相等。如果两个路由点对象具有相同的坐标以及度量值,则认为是相等的。
  10865. * @param {SuperMap.PointWithMeasure} geom - 需要判断的路由点对象。
  10866. * @returns {boolean} 两个路由点对象是否相等(true 为相等,false 为不等)。
  10867. */
  10868. equals(geom) {
  10869. var equals = false;
  10870. if (geom != null) {
  10871. var isValueEquals = this.x === geom.x && this.y === geom.y && this.measure === geom.measure;
  10872. var isNaNValue = isNaN(this.x) && isNaN(this.y) && isNaN(this.measure);
  10873. var isNaNGeometry = isNaN(geom.x) && isNaN(geom.y) && isNaN(geom.measure);
  10874. equals = ( isValueEquals || ( isNaNValue && isNaNGeometry ));
  10875. }
  10876. return equals;
  10877. }
  10878. /**
  10879. * @function SuperMap.PointWithMeasure.prototype.toJson
  10880. * @description 转换为 JSON 对象。
  10881. * */
  10882. toJson() {
  10883. var result = "{";
  10884. if (this.measure != null && this.measure != undefined) {
  10885. result += "\"measure\":" + this.measure + ",";
  10886. }
  10887. result += "\"x\":" + this.x + ",";
  10888. result += "\"y\":" + this.y;
  10889. result += "}";
  10890. return result;
  10891. }
  10892. /**
  10893. * @function SuperMap.PointWithMeasure.prototype.destroy
  10894. * @description 释放资源,将引用资源的属性置空。
  10895. */
  10896. destroy() {
  10897. var me = this;
  10898. me.measure = null;
  10899. me.x = null;
  10900. me.y = null;
  10901. }
  10902. /**
  10903. * @function SuperMap.PointWithMeasure.fromJson
  10904. * @description 将 JSON 对象转换为{@link SuperMap.PointWithMeasure} 对象。
  10905. * @param {Object} jsonObject - JSON 对象表示的路由点。
  10906. * @returns {SuperMap.PointWithMeasure} 转化后的 PointWithMeasure 对象。
  10907. */
  10908. static fromJson(jsonObject) {
  10909. if (!jsonObject) {
  10910. return;
  10911. }
  10912. return new PointWithMeasure({
  10913. x: jsonObject.x,
  10914. y: jsonObject.y,
  10915. measure: jsonObject.measure
  10916. });
  10917. }
  10918. }
  10919. SuperMap.PointWithMeasure = PointWithMeasure;
  10920. ;// CONCATENATED MODULE: ./src/common/iServer/Route.js
  10921. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10922. * This program are made available under the terms of the Apache License, Version 2.0
  10923. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10924. /**
  10925. * @class SuperMap.Route
  10926. * @category iServer SpatialAnalyst
  10927. * @classdesc 路由对象类。路由对象为一系列有序的带有属性值 M 的 x,y 坐标对,其中 M 值为该结点的距离属性(到已知点的距离)。
  10928. * @param {Array.<SuperMap.Geometry>} points - 形成路由对象的线数组。
  10929. * @param {Object} options - 参数。
  10930. * @param {number} options.id - 路由对象在数据库中的 id。
  10931. * @param {number} options.length - 路由对象的长度。单位与数据集的单位相同。
  10932. * @param {number} [options.maxM] - 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  10933. * @param {number} [options.minM] - 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  10934. * @param {string} [options.type] - 数据类型,如:"LINEM"。
  10935. * @extends {SuperMap.Geometry.Collection}
  10936. */
  10937. class Route extends Collection {
  10938. constructor(points, options) {
  10939. super(points, options);
  10940. /**
  10941. * @member {number} SuperMap.Route.prototype.id
  10942. * @description 路由对象在数据库中的 ID。
  10943. */
  10944. this.id = null;
  10945. /**
  10946. * @member {number} SuperMap.Route.prototype.center
  10947. * @description 路由对象的中心点。
  10948. */
  10949. this.center = null;
  10950. /**
  10951. * @member {string} SuperMap.Route.prototype.style
  10952. * @description 路由对象的样式。
  10953. */
  10954. this.style = null;
  10955. /**
  10956. * @member {number} SuperMap.Route.prototype.length
  10957. * @description 路由对象的长度。单位与数据集的单位相同。
  10958. */
  10959. this.length = null;
  10960. /**
  10961. * @member {number} SuperMap.Route.prototype.maxM
  10962. * @description 最大线性度量值,即所有结点到起始点的量算距离中最大值。
  10963. */
  10964. this.maxM = null;
  10965. /**
  10966. * @member {number} SuperMap.Route.prototype.minM
  10967. * @description 最小线性度量值,即所有结点到起始点的量算距离中最小值。
  10968. */
  10969. this.minM = null;
  10970. /**
  10971. * @member {Array.<number>} SuperMap.Route.prototype.parts
  10972. * @description 服务端几何对象中各个子对象所包含的节点个数。
  10973. */
  10974. this.parts = null;
  10975. /**
  10976. * @member {Array.<Object>} SuperMap.Route.prototype.points
  10977. * @description 路由对象的所有路由点。
  10978. * @example
  10979. * (start code)
  10980. * [
  10981. * {
  10982. * "measure": 0,
  10983. * "y": -4377.027184298267,
  10984. * "x": 4020.0045221720466
  10985. * },
  10986. * {
  10987. * "measure": 37.33288381391519,
  10988. * "y": -4381.569363260499,
  10989. * "x": 4057.0600591960642
  10990. * }
  10991. * ]
  10992. * (end)
  10993. */
  10994. this.points = null;
  10995. /**
  10996. * @member {string} SuperMap.Route.prototype.type
  10997. * @description 服务端几何对象类型。
  10998. */
  10999. this.type = null;
  11000. /**
  11001. * @member {Array.<string>} [SuperMap.Route.prototype.componentTypes=SuperMap.Geometry.LineString]
  11002. * @description components 存储的的几何对象所支持的几何类型数组。
  11003. */
  11004. this.componentTypes = ["SuperMap.Geometry.LinearRing", "SuperMap.Geometry.LineString"];
  11005. if (options) {
  11006. Util.extend(this, options);
  11007. }
  11008. this.CLASS_NAME = "SuperMap.Route";
  11009. this.geometryType = "LINEM";
  11010. }
  11011. /**
  11012. *
  11013. * @function SuperMap.Route.prototype.toJson
  11014. * @description 转换为 JSON 对象。
  11015. * @returns {Object} JSON 对象。
  11016. */
  11017. toJson() {
  11018. var result = "{";
  11019. if (this.id != null && this.id != undefined) {
  11020. result += "\"id\":" + this.id + ",";
  11021. }
  11022. if (this.center != null && this.center != undefined) {
  11023. result += "\"center\":" + this.center + ",";
  11024. }
  11025. if (this.style != null && this.style != undefined) {
  11026. result += "\"style\":" + this.style + ",";
  11027. }
  11028. if (this.length != null && this.length != undefined) {
  11029. result += "\"length\":" + this.length + ",";
  11030. }
  11031. if (this.maxM != null && this.maxM != undefined) {
  11032. result += "\"maxM\":" + this.maxM + ",";
  11033. }
  11034. if (this.minM != null && this.minM != undefined) {
  11035. result += "\"minM\":" + this.minM + ",";
  11036. }
  11037. if (this.type != null && this.type != undefined) {
  11038. result += "\"type\":\"" + this.type + "\",";
  11039. }
  11040. if (this.parts != null && this.parts != undefined) {
  11041. result += "\"parts\":[" + this.parts[0];
  11042. for (var i = 1; i < this.parts.length; i++) {
  11043. result += "," + this.parts[i];
  11044. }
  11045. result += "],";
  11046. }
  11047. if (this.components != null && this.components.length > 0) {
  11048. result += "\"points\":[";
  11049. for (var j = 0, len = this.components.length; j < len; j++) {
  11050. for (var k = 0, len2 = this.components[j].components.length; k < len2; k++) {
  11051. result += this.components[j].components[k].toJson() + ",";
  11052. }
  11053. }
  11054. result = result.replace(/,$/g, '');
  11055. result += "]";
  11056. }
  11057. result = result.replace(/,$/g, '');
  11058. result += "}";
  11059. return result;
  11060. }
  11061. /**
  11062. * @function SuperMap.Route.prototype.destroy
  11063. * @override
  11064. */
  11065. destroy() {
  11066. var me = this;
  11067. me.id = null;
  11068. me.center = null;
  11069. me.style = null;
  11070. me.length = null;
  11071. me.maxM = null;
  11072. me.minM = null;
  11073. me.type = null;
  11074. me.parts = null;
  11075. me.components.length = 0;
  11076. me.components = null;
  11077. me.componentTypes = null;
  11078. }
  11079. /**
  11080. * @function SuperMap.Route.fromJson
  11081. * @description 将 JSON 对象转换为 SuperMap.Route 对象。
  11082. * @param {Object} [jsonObject] - JSON 对象表示的路由对象。
  11083. * @returns {SuperMap.Route} 转化后的 Route 对象。
  11084. */
  11085. static fromJson(jsonObject) {
  11086. if (!jsonObject) {
  11087. return;
  11088. }
  11089. var geoParts = jsonObject.parts || [],
  11090. geoPoints = jsonObject.points || [],
  11091. len = geoParts.length,
  11092. lineList = [];
  11093. if (len > 0) {
  11094. for (var i = 0, pointIndex = 0, pointList = []; i < len; i++) {
  11095. for (var j = 0; j < geoParts[i]; j++) {
  11096. pointList.push(PointWithMeasure.fromJson(geoPoints[pointIndex + j]));
  11097. }
  11098. pointIndex += geoParts[i];
  11099. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  11100. if (pointList[0].equals(pointList[geoParts[i] - 1])) {
  11101. lineList.push(new LinearRing(pointList));
  11102. } else {
  11103. lineList.push(new LineString(pointList));
  11104. }
  11105. pointList = [];
  11106. }
  11107. } else {
  11108. return null;
  11109. }
  11110. return new Route(lineList, {
  11111. id: jsonObject.id,
  11112. center: jsonObject.center,
  11113. style: jsonObject.style,
  11114. length: jsonObject.length,
  11115. maxM: jsonObject.maxM,
  11116. minM: jsonObject.minM,
  11117. type: jsonObject.type,
  11118. parts: jsonObject.parts
  11119. });
  11120. }
  11121. }
  11122. SuperMap.Route = Route;
  11123. ;// CONCATENATED MODULE: ./src/common/iServer/ServerGeometry.js
  11124. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11125. * This program are made available under the terms of the Apache License, Version 2.0
  11126. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11127. /**
  11128. * @class SuperMap.ServerGeometry
  11129. * @category iServer
  11130. * @classdesc 服务端几何对象类。该类描述几何对象(矢量)的特征数据(坐标点对、几何对象的类型等)。基于服务端的空间分析、空间关系运算、查询等 GIS 服务功能使用服务端几何对象。
  11131. * @param {Object} options - 参数。
  11132. * @param {string} options.id - 服务端几何对象唯一标识符。
  11133. * @param {Array.<number>} options.parts - 服务端几何对象中各个子对象所包含的节点个数。
  11134. * @param {Array.<SuperMap.Geometry.Point>} options.points - 组成几何对象的节点的坐标对数组。
  11135. * @param {SuperMap.GeometryType} options.type - 几何对象的类型。
  11136. * @param {SuperMap.ServerStyle} [options.style] - 服务端几何对象的风格。
  11137. */
  11138. class ServerGeometry {
  11139. constructor(options) {
  11140. /**
  11141. * @member {string} SuperMap.ServerGeometry.prototype.id
  11142. * @description 服务端几何对象唯一标识符。
  11143. */
  11144. this.id = 0;
  11145. /**
  11146. * @member {SuperMap.ServerStyle} [SuperMap.ServerGeometry.prototype.style]
  11147. * @description 服务端几何对象的风格(ServerStyle)。
  11148. */
  11149. this.style = null;
  11150. /**
  11151. * @member {Array.<number>} SuperMap.ServerGeometry.prototype.parts
  11152. * @description 服务端几何对象中各个子对象所包含的节点个数。<br>
  11153. * 1.几何对象从结构上可以分为简单几何对象和复杂几何对象。
  11154. * 简单几何对象与复杂几何对象的区别:简单的几何对象一般为单一对象,
  11155. * 而复杂的几何对象由多个简单对象组成或经过一定的空间运算之后产生,
  11156. * 如:矩形为简单的区域对象,而中空的矩形为复杂的区域对象。<br>
  11157. * 2.通常情况,一个简单几何对象的子对象就是它本身,
  11158. * 因此对于简单对象来说的该字段为长度为1的整型数组,
  11159. * 该字段的值就是这个简单对象节点的个数。
  11160. * 如果一个几何对象是由几个简单对象组合而成的,
  11161. * 例如,一个岛状几何对象由 3 个简单的多边形组成而成,
  11162. * 那么这个岛状的几何对象的 Parts 字段值就是一个长度为 3 的整型数组,
  11163. * 数组中每个成员的值分别代表这三个多边形所包含的节点个数。
  11164. */
  11165. this.parts = null;
  11166. /**
  11167. * @member {Array.<SuperMap.Geometry.Point>} SuperMap.ServerGeometry.prototype.points
  11168. * @description 组成几何对象的节点的坐标对数组。<br>
  11169. * 1.所有几何对象(点、线、面)都是由一些简单的点坐标组成的,
  11170. * 该字段存放了组成几何对象的点坐标的数组。
  11171. * 对于简单的面对象,他的起点和终点的坐标点相同。<br>
  11172. * 2.对于复杂的几何对象,根据 Parts 属性来确定每一个组成复杂几何对象的简单对象所对应的节点的个数,
  11173. * 从而确定 Points 字段中坐标对的分配归属问题。
  11174. */
  11175. this.points = null;
  11176. /**
  11177. * @member {SuperMap.GeometryType} SuperMap.ServerGeometry.prototype.type
  11178. * @description 几何对象的类型(GeometryType)。
  11179. */
  11180. this.type = null;
  11181. /**
  11182. * @member {Object} SuperMap.ServerGeometry.prototype.prjCoordSys
  11183. * @description 投影坐标参数,现仅在缓冲区分析中有效。
  11184. */
  11185. this.prjCoordSys = null;
  11186. if (options) {
  11187. Util.extend(this, options);
  11188. }
  11189. this.CLASS_NAME = 'SuperMap.ServerGeometry';
  11190. }
  11191. /**
  11192. * @function SuperMap.ServerGeometry.prototype.destroy
  11193. * @description 释放资源,将引用资源的属性置空。
  11194. */
  11195. destroy() {
  11196. var me = this;
  11197. me.id = null;
  11198. me.style = null;
  11199. me.parts = null;
  11200. me.partTopo = null;
  11201. me.points = null;
  11202. me.type = null;
  11203. me.prjCoordSys = null;
  11204. }
  11205. /**
  11206. * @function SuperMap.ServerGeometry.prototype.toGeometry
  11207. * @description 将服务端几何对象 ServerGeometry 转换为客户端几何对象 Geometry。
  11208. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11209. */
  11210. toGeometry() {
  11211. var me = this,
  11212. geoType = me.type;
  11213. switch (geoType.toUpperCase()) {
  11214. case GeometryType.POINT:
  11215. return me.toGeoPoint();
  11216. case GeometryType.LINE:
  11217. return me.toGeoLine();
  11218. case GeometryType.LINEM:
  11219. return me.toGeoLinem();
  11220. case GeometryType.REGION:
  11221. return me.toGeoRegion();
  11222. case GeometryType.POINTEPS:
  11223. return me.toGeoPoint();
  11224. case GeometryType.LINEEPS:
  11225. return me.toGeoLineEPS();
  11226. case GeometryType.REGIONEPS:
  11227. return me.toGeoRegionEPS();
  11228. case GeometryType.GEOCOMPOUND:
  11229. return me.transformGeoCompound();
  11230. }
  11231. }
  11232. /**
  11233. * @function SuperMap.ServerGeometry.prototype.toGeoPoint
  11234. * @description 将服务端的点几何对象转换为客户端几何对象。包括 Point、MultiPoint。
  11235. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11236. */
  11237. toGeoPoint() {
  11238. var me = this,
  11239. geoParts = me.parts || [],
  11240. geoPoints = me.points || [],
  11241. len = geoParts.length;
  11242. if (len > 0) {
  11243. if (len === 1) {
  11244. return new Point(geoPoints[0].x, geoPoints[0].y);
  11245. } else {
  11246. var pointList = [];
  11247. for (let i = 0; i < len; i++) {
  11248. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  11249. }
  11250. return new MultiPoint(pointList);
  11251. }
  11252. } else {
  11253. return null;
  11254. }
  11255. }
  11256. /**
  11257. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  11258. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  11259. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11260. */
  11261. toGeoLine() {
  11262. var me = this,
  11263. geoParts = me.parts || [],
  11264. geoPoints = me.points || [],
  11265. len = geoParts.length;
  11266. if (len > 0) {
  11267. if (len === 1) {
  11268. let pointList = [];
  11269. for (let i = 0; i < geoParts[0]; i++) {
  11270. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  11271. }
  11272. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  11273. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  11274. return new LinearRing(pointList);
  11275. } else {
  11276. return new LineString(pointList);
  11277. }
  11278. } else {
  11279. let lineList = [];
  11280. for (let i = 0; i < len; i++) {
  11281. let pointList = [];
  11282. for (let j = 0; j < geoParts[i]; j++) {
  11283. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  11284. }
  11285. lineList.push(new LineString(pointList));
  11286. geoPoints.splice(0, geoParts[i]);
  11287. }
  11288. return new MultiLineString(lineList);
  11289. }
  11290. } else {
  11291. return null;
  11292. }
  11293. }
  11294. /**
  11295. * @function SuperMap.ServerGeometry.prototype.toGeoLineEPS
  11296. * @description 将服务端的线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  11297. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11298. */
  11299. toGeoLineEPS() {
  11300. var me = this,
  11301. geoParts = me.parts || [],
  11302. geoPoints = me.points || [],
  11303. i,
  11304. j,
  11305. pointList,
  11306. lineList,
  11307. lineEPS,
  11308. len = geoParts.length;
  11309. if (len > 0) {
  11310. if (len === 1) {
  11311. for (i = 0, pointList = []; i < geoParts[0]; i++) {
  11312. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y, geoPoints[i].type));
  11313. }
  11314. //判断线是否闭合,如果闭合,则返回LinearRing,否则返回LineString
  11315. if (pointList[0].equals(pointList[geoParts[0] - 1])) {
  11316. lineEPS = LineString.createLineEPS(pointList);
  11317. return new LinearRing(lineEPS);
  11318. } else {
  11319. lineEPS = LineString.createLineEPS(pointList);
  11320. return new LineString(lineEPS);
  11321. }
  11322. } else {
  11323. for (i = 0, lineList = []; i < len; i++) {
  11324. for (j = 0, pointList = []; j < geoParts[i]; j++) {
  11325. pointList.push(new Point(geoPoints[j].x, geoPoints[j].y));
  11326. }
  11327. lineEPS = LineString.createLineEPS(pointList);
  11328. lineList.push(new LineString(lineEPS));
  11329. geoPoints.splice(0, geoParts[i]);
  11330. }
  11331. return new MultiLineString(lineList);
  11332. }
  11333. } else {
  11334. return null;
  11335. }
  11336. }
  11337. /**
  11338. * @function SuperMap.ServerGeometry.prototype.toGeoLine
  11339. * @description 将服务端的路由线几何对象转换为客户端几何对象。包括 LinearRing、LineString、MultiLineString。
  11340. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11341. */
  11342. toGeoLinem() {
  11343. var me = this;
  11344. return Route.fromJson(me);
  11345. }
  11346. /**
  11347. * @function SuperMap.ServerGeometry.prototype.toGeoRegion
  11348. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  11349. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11350. */
  11351. toGeoRegion() {
  11352. var me = this,
  11353. geoParts = me.parts || [],
  11354. geoTopo = me.partTopo || [],
  11355. geoPoints = me.points || [],
  11356. len = geoParts.length;
  11357. if (len <= 0) {
  11358. return null;
  11359. }
  11360. var polygonArray = [];
  11361. var pointList = [];
  11362. if (len == 1) {
  11363. for (let i = 0; i < geoPoints.length; i++) {
  11364. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  11365. }
  11366. polygonArray.push(new Polygon([new LinearRing(pointList)]));
  11367. return new MultiPolygon(polygonArray);
  11368. }
  11369. //处理复杂面
  11370. var CCWArray = [];
  11371. var areaArray = [];
  11372. var polygonArrayTemp = [];
  11373. var polygonBounds = [];
  11374. //polyon岛洞标识数组,初始都是岛。
  11375. var CCWIdent = [];
  11376. for (let i = 0, pointIndex = 0; i < len; i++) {
  11377. for (let j = 0; j < geoParts[i]; j++) {
  11378. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  11379. }
  11380. pointIndex += geoParts[i];
  11381. var polygon = new Polygon([new LinearRing(pointList)]);
  11382. pointList = [];
  11383. polygonArrayTemp.push(polygon);
  11384. if (geoTopo.length === 0) {
  11385. polygonBounds.push(polygon.getBounds());
  11386. }
  11387. CCWIdent.push(1);
  11388. areaArray.push(polygon.getArea());
  11389. }
  11390. //根据面积排序
  11391. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  11392. //iServer 9D新增字段
  11393. if (geoTopo.length === 0) {
  11394. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  11395. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  11396. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  11397. //目标polygon索引列表 -1标示没有被任何polygon包含,
  11398. var targetArray = [];
  11399. for (let i = 1; i < polygonArrayTemp.length; i++) {
  11400. for (let j = i - 1; j >= 0; j--) {
  11401. targetArray[i] = -1;
  11402. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  11403. CCWIdent[i] = CCWIdent[j] * -1;
  11404. if (CCWIdent[i] < 0) {
  11405. targetArray[i] = j;
  11406. }
  11407. break;
  11408. }
  11409. }
  11410. }
  11411. for (let i = 0; i < polygonArrayTemp.length; i++) {
  11412. if (CCWIdent[i] > 0) {
  11413. polygonArray.push(polygonArrayTemp[i]);
  11414. } else {
  11415. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  11416. polygonArrayTemp[i].components
  11417. );
  11418. //占位
  11419. polygonArray.push('');
  11420. }
  11421. }
  11422. } else {
  11423. //根据面积排序
  11424. //ServerGeometry.bubbleSort(areaArray, polygonArrayTemp,geoTopo);
  11425. polygonArray = new Array();
  11426. for (let i = 0; i < polygonArrayTemp.length; i++) {
  11427. if (geoTopo[i] && geoTopo[i] == -1) {
  11428. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  11429. } else {
  11430. if (CCWArray.length > 0 && polygonArray.length > 0) {
  11431. polygonArray[polygonArray.length - 1].components = polygonArray[
  11432. polygonArray.length - 1
  11433. ].components.concat(CCWArray);
  11434. CCWArray = [];
  11435. }
  11436. polygonArray.push(polygonArrayTemp[i]);
  11437. }
  11438. if (i == len - 1) {
  11439. var polyLength = polygonArray.length;
  11440. if (polyLength) {
  11441. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  11442. CCWArray
  11443. );
  11444. } else {
  11445. for (let k = 0, length = CCWArray.length; k < length; k++) {
  11446. polygonArray.push(new Polygon(CCWArray));
  11447. }
  11448. }
  11449. }
  11450. }
  11451. }
  11452. return new MultiPolygon(polygonArray);
  11453. }
  11454. /**
  11455. * @function SuperMap.ServerGeometry.prototype.toGeoRegionEPS
  11456. * @description 将服务端的面几何对象转换为客户端几何对象。类型为 Polygon。
  11457. * @returns {SuperMap.Geometry} 转换后的客户端几何对象。
  11458. */
  11459. toGeoRegionEPS() {
  11460. var me = this,
  11461. geoParts = me.parts || [],
  11462. geoTopo = me.partTopo || [],
  11463. geoPoints = me.points || [],
  11464. len = geoParts.length;
  11465. if (len <= 0) {
  11466. return null;
  11467. }
  11468. var polygonArray = [];
  11469. var pointList = [];
  11470. var lineEPS;
  11471. if (len == 1) {
  11472. for (var i = 0; i < geoPoints.length; i++) {
  11473. pointList.push(new Point(geoPoints[i].x, geoPoints[i].y));
  11474. }
  11475. lineEPS = LineString.createLineEPS(pointList);
  11476. polygonArray.push(new Polygon([new LinearRing(lineEPS)]));
  11477. return new MultiPolygon(polygonArray);
  11478. }
  11479. //处理复杂面
  11480. var CCWArray = [];
  11481. var areaArray = [];
  11482. var polygonArrayTemp = [];
  11483. var polygonBounds = [];
  11484. //polyon岛洞标识数组,初始都是岛。
  11485. var CCWIdent = [];
  11486. for (let i = 0, pointIndex = 0; i < len; i++) {
  11487. for (let j = 0; j < geoParts[i]; j++) {
  11488. pointList.push(new Point(geoPoints[pointIndex + j].x, geoPoints[pointIndex + j].y));
  11489. }
  11490. pointIndex += geoParts[i];
  11491. lineEPS = LineString.createLineEPS(pointList);
  11492. var polygon = new Polygon([new LinearRing(lineEPS)]);
  11493. pointList = [];
  11494. polygonArrayTemp.push(polygon);
  11495. if (geoTopo.length === 0) {
  11496. polygonBounds.push(polygon.getBounds());
  11497. }
  11498. CCWIdent.push(1);
  11499. areaArray.push(polygon.getArea());
  11500. }
  11501. //根据面积排序
  11502. ServerGeometry.bubbleSort(areaArray, polygonArrayTemp, geoTopo, polygonBounds);
  11503. //iServer 9D新增字段
  11504. if (geoTopo.length === 0) {
  11505. //岛洞底层判断原则:将所有的子对象按照面积排序,面积最大的直接判定为岛(1),从面积次大的开始处理,
  11506. // 如果发现该对象在某个面积大于它的对象之中(即被包含),则根据包含它的对象的标识(1 or -1),指定其标识(-1 or 1),
  11507. // 依次处理完所有对象,就得到了一个标识数组,1表示岛,-1表示洞
  11508. //目标polygon索引列表 -1标示没有被任何polygon包含,
  11509. var targetArray = [];
  11510. for (let i = 1; i < polygonArrayTemp.length; i++) {
  11511. for (let j = i - 1; j >= 0; j--) {
  11512. targetArray[i] = -1;
  11513. if (polygonBounds[j].containsBounds(polygonBounds[i])) {
  11514. CCWIdent[i] = CCWIdent[j] * -1;
  11515. if (CCWIdent[i] < 0) {
  11516. targetArray[i] = j;
  11517. }
  11518. break;
  11519. }
  11520. }
  11521. }
  11522. for (let i = 0; i < polygonArrayTemp.length; i++) {
  11523. if (CCWIdent[i] > 0) {
  11524. polygonArray.push(polygonArrayTemp[i]);
  11525. } else {
  11526. polygonArray[targetArray[i]].components = polygonArray[targetArray[i]].components.concat(
  11527. polygonArrayTemp[i].components
  11528. );
  11529. //占位
  11530. polygonArray.push('');
  11531. }
  11532. }
  11533. } else {
  11534. //根据面积排序
  11535. polygonArray = new Array();
  11536. for (let i = 0; i < polygonArrayTemp.length; i++) {
  11537. if (geoTopo[i] && geoTopo[i] == -1) {
  11538. CCWArray = CCWArray.concat(polygonArrayTemp[i].components);
  11539. } else {
  11540. if (CCWArray.length > 0 && polygonArray.length > 0) {
  11541. polygonArray[polygonArray.length - 1].components = polygonArray[
  11542. polygonArray.length - 1
  11543. ].components.concat(CCWArray);
  11544. CCWArray = [];
  11545. }
  11546. polygonArray.push(polygonArrayTemp[i]);
  11547. }
  11548. if (i == len - 1) {
  11549. var polyLength = polygonArray.length;
  11550. if (polyLength) {
  11551. polygonArray[polyLength - 1].components = polygonArray[polyLength - 1].components.concat(
  11552. CCWArray
  11553. );
  11554. } else {
  11555. for (let k = 0, length = CCWArray.length; k < length; k++) {
  11556. polygonArray.push(new Polygon(CCWArray));
  11557. }
  11558. }
  11559. }
  11560. }
  11561. }
  11562. return new MultiPolygon(polygonArray);
  11563. }
  11564. transformGeoCompound() {
  11565. const me = this,
  11566. geoParts = me.geoParts || [],
  11567. len = geoParts.length;
  11568. if (len <= 0) {
  11569. return null;
  11570. }
  11571. const geometryList = [];
  11572. for (let index = 0; index < len; index++) {
  11573. const geometry = geoParts[index];
  11574. geometryList.push(new ServerGeometry(geometry).toGeometry());
  11575. }
  11576. return new Collection(geometryList);
  11577. }
  11578. /**
  11579. * @function SuperMap.ServerGeometry.prototype.fromJson
  11580. * @description 将 JSON 对象表示服务端几何对象转换为 ServerGeometry。
  11581. * @param {Object} jsonObject - 要转换的 JSON 对象。
  11582. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  11583. */
  11584. static fromJson(jsonObject) {
  11585. if (!jsonObject) {
  11586. return;
  11587. }
  11588. return new ServerGeometry({
  11589. id: jsonObject.id,
  11590. style: ServerStyle.fromJson(jsonObject.style),
  11591. parts: jsonObject.parts,
  11592. partTopo: jsonObject.partTopo,
  11593. points: jsonObject.points,
  11594. center: jsonObject.center,
  11595. length: jsonObject.length,
  11596. maxM: jsonObject.maxM,
  11597. minM: jsonObject.minM,
  11598. type: jsonObject.type
  11599. });
  11600. }
  11601. /**
  11602. * @function SuperMap.ServerGeometry.prototype.fromGeometry
  11603. * @description 将客户端 Geometry 转换成服务端 ServerGeometry。
  11604. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  11605. * @returns {SuperMap.ServerGeometry} 转换后的 ServerGeometry 对象。
  11606. */
  11607. static fromGeometry(geometry) {
  11608. if (!geometry) {
  11609. return;
  11610. }
  11611. var id = 0,
  11612. parts = [],
  11613. points = [],
  11614. type = null,
  11615. icomponents = geometry.components,
  11616. className = geometry.CLASS_NAME,
  11617. prjCoordSys = { epsgCode: geometry.SRID };
  11618. if (!isNaN(geometry.id)) {
  11619. id = geometry.id;
  11620. }
  11621. //坑爹的改法,没法,为了支持态势标绘,有时间就得全改
  11622. if (
  11623. className != 'SuperMap.Geometry.LinearRing' &&
  11624. className != 'SuperMap.Geometry.LineString' &&
  11625. (geometry instanceof MultiPoint || geometry instanceof MultiLineString)
  11626. ) {
  11627. let ilen = icomponents.length;
  11628. for (let i = 0; i < ilen; i++) {
  11629. let partPointsCount = icomponents[i].getVertices().length;
  11630. parts.push(partPointsCount);
  11631. for (let j = 0; j < partPointsCount; j++) {
  11632. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  11633. }
  11634. }
  11635. //这里className不是多点就全部是算线
  11636. type = className == 'SuperMap.Geometry.MultiPoint' ? GeometryType.POINT : GeometryType.LINE;
  11637. } else if (geometry instanceof MultiPolygon) {
  11638. let ilen = icomponents.length;
  11639. for (let i = 0; i < ilen; i++) {
  11640. let polygon = icomponents[i],
  11641. linearRingOfPolygon = polygon.components,
  11642. linearRingOfPolygonLen = linearRingOfPolygon.length;
  11643. for (let j = 0; j < linearRingOfPolygonLen; j++) {
  11644. let partPointsCount = linearRingOfPolygon[j].getVertices().length + 1;
  11645. parts.push(partPointsCount);
  11646. for (let k = 0; k < partPointsCount - 1; k++) {
  11647. points.push(
  11648. new Point(
  11649. linearRingOfPolygon[j].getVertices()[k].x,
  11650. linearRingOfPolygon[j].getVertices()[k].y
  11651. )
  11652. );
  11653. }
  11654. points.push(
  11655. new Point(linearRingOfPolygon[j].getVertices()[0].x, linearRingOfPolygon[j].getVertices()[0].y)
  11656. );
  11657. }
  11658. }
  11659. type = GeometryType.REGION;
  11660. } else if (geometry instanceof Polygon) {
  11661. let ilen = icomponents.length;
  11662. for (let i = 0; i < ilen; i++) {
  11663. let partPointsCount = icomponents[i].getVertices().length + 1;
  11664. parts.push(partPointsCount);
  11665. for (let j = 0; j < partPointsCount - 1; j++) {
  11666. points.push(new Point(icomponents[i].getVertices()[j].x, icomponents[i].getVertices()[j].y));
  11667. }
  11668. points.push(new Point(icomponents[i].getVertices()[0].x, icomponents[i].getVertices()[0].y));
  11669. }
  11670. type = GeometryType.REGION;
  11671. } else {
  11672. let geometryVerticesCount = geometry.getVertices().length;
  11673. for (let j = 0; j < geometryVerticesCount; j++) {
  11674. points.push(new Point(geometry.getVertices()[j].x, geometry.getVertices()[j].y));
  11675. }
  11676. if (geometry instanceof LinearRing) {
  11677. points.push(new Point(geometry.getVertices()[0].x, geometry.getVertices()[0].y));
  11678. geometryVerticesCount++;
  11679. }
  11680. parts.push(geometryVerticesCount);
  11681. type = geometry instanceof Point ? GeometryType.POINT : GeometryType.LINE;
  11682. }
  11683. return new ServerGeometry({
  11684. id: id,
  11685. style: null,
  11686. parts: parts,
  11687. points: points,
  11688. type: type,
  11689. prjCoordSys: prjCoordSys
  11690. });
  11691. }
  11692. /**
  11693. * @function SuperMap.ServerGeometry.prototype.IsClockWise
  11694. * @description 判断 linearRing 中的点的顺序。返回值大于 0,逆时针;小于 0,顺时针。
  11695. * @param {SuperMap.Geometry} geometry - 要转换的客户端 Geometry 对象。
  11696. * @returns {number} 返回值大于 0,逆时针;小于 0,顺时针。
  11697. */
  11698. static IsClockWise(points) {
  11699. var length = points.length;
  11700. if (length < 3) {
  11701. return 0.0;
  11702. }
  11703. var s = points[0].y * (points[length - 1].x - points[1].x);
  11704. points.push(points[0]);
  11705. for (var i = 1; i < length; i++) {
  11706. s += points[i].y * (points[i - 1].x - points[i + 1].x);
  11707. }
  11708. return s * 0.5;
  11709. }
  11710. static bubbleSort(areaArray, pointList, geoTopo, polygonBounds) {
  11711. for (var i = 0; i < areaArray.length; i++) {
  11712. for (var j = 0; j < areaArray.length; j++) {
  11713. if (areaArray[i] > areaArray[j]) {
  11714. var d = areaArray[j];
  11715. areaArray[j] = areaArray[i];
  11716. areaArray[i] = d;
  11717. var b = pointList[j];
  11718. pointList[j] = pointList[i];
  11719. pointList[i] = b;
  11720. if (geoTopo && geoTopo.length > 0) {
  11721. var c = geoTopo[j];
  11722. geoTopo[j] = geoTopo[i];
  11723. geoTopo[i] = c;
  11724. }
  11725. if (polygonBounds && polygonBounds.length > 0) {
  11726. var f = polygonBounds[j];
  11727. polygonBounds[j] = polygonBounds[i];
  11728. polygonBounds[i] = f;
  11729. }
  11730. }
  11731. }
  11732. }
  11733. }
  11734. }
  11735. SuperMap.ServerGeometry = ServerGeometry;
  11736. ;// CONCATENATED MODULE: ./src/common/format/GeoJSON.js
  11737. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  11738. * This program are made available under the terms of the Apache License, Version 2.0
  11739. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  11740. /**
  11741. * @class SuperMap.Format.GeoJSON
  11742. * @classdesc GeoJSON 的读和写。使用 {@link SuperMap.Format.GeoJSON} 构造器创建一个 GeoJSON 解析器。
  11743. * @category BaseTypes Format
  11744. * @param {Object} [options] - 参数。
  11745. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  11746. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  11747. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  11748. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  11749. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  11750. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  11751. * @param {boolean} [options.ignoreExtraDims=true] - 忽略维度超过 2 的几何要素。
  11752. * @extends {SuperMap.Format.JSON}
  11753. */
  11754. class GeoJSON extends JSONFormat {
  11755. constructor(options) {
  11756. super(options);
  11757. /**
  11758. * @member {boolean} [SuperMap.Format.GeoJSON.prototype.ignoreExtraDims=true]
  11759. * @description 忽略维度超过 2 的几何要素。
  11760. */
  11761. this.ignoreExtraDims = true;
  11762. this.CLASS_NAME = "SuperMap.Format.GeoJSON";
  11763. /**
  11764. * @member {Object} SuperMap.Format.GeoJSON.prototype.parseCoords
  11765. * @private
  11766. * @description 一个属性名对应着 GeoJSON 对象的几何类型的对象。每个属性其实都是一个实际上做解析用的方法。
  11767. */
  11768. this.parseCoords = {
  11769. /**
  11770. * @function SuperMap.Format.GeoJSON.parseCoords.point
  11771. * @description 将一组坐标转成一个 {@link SuperMap.Geometry} 对象。
  11772. * @param {Object} array - GeoJSON 片段中的一组坐标。
  11773. * @returns {SuperMap.Geometry} 一个几何对象。
  11774. */
  11775. "point": function (array) {
  11776. if (this.ignoreExtraDims === false &&
  11777. array.length != 2) {
  11778. throw "Only 2D points are supported: " + array;
  11779. }
  11780. return new Point(array[0], array[1]);
  11781. },
  11782. /**
  11783. * @function SuperMap.Format.GeoJSON.parseCoords.multipoint
  11784. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11785. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11786. * @returns {SuperMap.Geometry} 一个几何对象。
  11787. */
  11788. "multipoint": function (array) {
  11789. var points = [];
  11790. var p = null;
  11791. for (var i = 0, len = array.length; i < len; ++i) {
  11792. try {
  11793. p = this.parseCoords["point"].apply(this, [array[i]]);
  11794. } catch (err) {
  11795. throw err;
  11796. }
  11797. points.push(p);
  11798. }
  11799. return new MultiPoint(points);
  11800. },
  11801. /**
  11802. * @function SuperMap.Format.GeoJSON.parseCoords.linestring
  11803. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11804. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11805. * @returns {SuperMap.Geometry} 一个几何对象。
  11806. */
  11807. "linestring": function (array) {
  11808. var points = [];
  11809. var p = null;
  11810. for (var i = 0, len = array.length; i < len; ++i) {
  11811. try {
  11812. p = this.parseCoords["point"].apply(this, [array[i]]);
  11813. } catch (err) {
  11814. throw err;
  11815. }
  11816. points.push(p);
  11817. }
  11818. return new LineString(points);
  11819. },
  11820. /**
  11821. * @function SuperMap.Format.GeoJSON.parseCoords.multilinestring
  11822. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11823. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11824. * @returns {SuperMap.Geometry} 一个几何对象。
  11825. */
  11826. "multilinestring": function (array) {
  11827. var lines = [];
  11828. var l = null;
  11829. for (var i = 0, len = array.length; i < len; ++i) {
  11830. try {
  11831. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  11832. } catch (err) {
  11833. throw err;
  11834. }
  11835. lines.push(l);
  11836. }
  11837. return new MultiLineString(lines);
  11838. },
  11839. /**
  11840. * @function SuperMap.Format.GeoJSON.parseCoords.polygon
  11841. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11842. * @returns {SuperMap.Geometry} 一个几何对象。
  11843. */
  11844. "polygon": function (array) {
  11845. var rings = [];
  11846. var r, l;
  11847. for (var i = 0, len = array.length; i < len; ++i) {
  11848. try {
  11849. l = this.parseCoords["linestring"].apply(this, [array[i]]);
  11850. } catch (err) {
  11851. throw err;
  11852. }
  11853. r = new LinearRing(l.components);
  11854. rings.push(r);
  11855. }
  11856. return new Polygon(rings);
  11857. },
  11858. /**
  11859. * @function SuperMap.Format.GeoJSON.parseCoords.multipolygon
  11860. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11861. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11862. * @returns {SuperMap.Geometry} 一个几何对象。
  11863. */
  11864. "multipolygon": function (array) {
  11865. var polys = [];
  11866. var p = null;
  11867. for (var i = 0, len = array.length; i < len; ++i) {
  11868. try {
  11869. p = this.parseCoords["polygon"].apply(this, [array[i]]);
  11870. } catch (err) {
  11871. throw err;
  11872. }
  11873. polys.push(p);
  11874. }
  11875. return new MultiPolygon(polys);
  11876. },
  11877. /**
  11878. * @function SuperMap.Format.GeoJSON.parseCoords.box
  11879. * @description 将坐标组数组转化成为一个 {@link SuperMap.Geometry} 对象。
  11880. * @param {Object} array - GeoJSON 片段中的坐标组数组。
  11881. * @returns {SuperMap.Geometry} 一个几何对象。
  11882. */
  11883. "box": function (array) {
  11884. if (array.length != 2) {
  11885. throw "GeoJSON box coordinates must have 2 elements";
  11886. }
  11887. return new Polygon([
  11888. new LinearRing([
  11889. new Point(array[0][0], array[0][1]),
  11890. new Point(array[1][0], array[0][1]),
  11891. new Point(array[1][0], array[1][1]),
  11892. new Point(array[0][0], array[1][1]),
  11893. new Point(array[0][0], array[0][1])
  11894. ])
  11895. ]);
  11896. }
  11897. };
  11898. /**
  11899. * @member {Object} SuperMap.Format.GeoJSON.prototype.extract
  11900. * @private
  11901. * @description 一个属性名对应着GeoJSON类型的对象。其值为相应的实际的解析方法。
  11902. */
  11903. this.extract = {
  11904. /**
  11905. * @function SuperMap.Format.GeoJSON.extract.feature
  11906. * @description 返回一个表示单个要素对象的 GeoJSON 的一部分。
  11907. * @param {SuperMap.ServerFeature} feature - iServer 要素对象。
  11908. * @returns {Object} 一个表示点的对象。
  11909. */
  11910. 'feature': function (feature) {
  11911. var geom = this.extract.geometry.apply(this, [feature.geometry]);
  11912. var json = {
  11913. "type": "Feature",
  11914. "properties": this.createAttributes(feature),
  11915. "geometry": geom
  11916. };
  11917. if (feature.geometry && feature.geometry.type === 'TEXT') {
  11918. json.properties.texts = feature.geometry.texts;
  11919. json.properties.textStyle = feature.geometry.textStyle;
  11920. }
  11921. if (feature.fid) {
  11922. json.id = feature.fid;
  11923. }
  11924. if (feature.ID) {
  11925. json.id = feature.ID;
  11926. }
  11927. return json;
  11928. },
  11929. /**
  11930. * @function SuperMap.Format.GeoJSON.extract.geometry
  11931. * @description 返回一个表示单个几何对象的 GeoJSON 的一部分。
  11932. * @param {Object} geometry - iServer 几何对象。
  11933. * @returns {Object} 一个表示几何体的对象。
  11934. */
  11935. 'geometry': function (geometry) {
  11936. if (geometry == null) {
  11937. return null;
  11938. }
  11939. if (!geometry.parts && geometry.points) {
  11940. geometry.parts = [geometry.points.length];
  11941. }
  11942. var geo = geometry.hasOwnProperty('geometryType')
  11943. ? geometry
  11944. : new ServerGeometry(geometry).toGeometry() || geometry;
  11945. var geometryType = geo.geometryType || geo.type;
  11946. var data;
  11947. if (geometryType === "LinearRing") {
  11948. geometryType = "LineString";
  11949. }
  11950. if (geometryType === "LINEM") {
  11951. geometryType = "MultiLineString";
  11952. }
  11953. data = this.extract[geometryType.toLowerCase()].apply(this, [geo]);
  11954. geometryType = geometryType === 'TEXT' ? 'Point' : geometryType;
  11955. var json;
  11956. if (geometryType === "Collection") {
  11957. json = {
  11958. "type": "GeometryCollection",
  11959. "geometries": data
  11960. };
  11961. } else {
  11962. json = {
  11963. "type": geometryType,
  11964. "coordinates": data
  11965. };
  11966. }
  11967. return json;
  11968. },
  11969. /**
  11970. * @function SuperMap.Format.GeoJSON.extract.point
  11971. * @description 从一个点对象中返回一个坐标组。
  11972. * @param {SuperMap.Geometry.Point} point - 一个点对象。
  11973. * @returns {Array} 一个表示一个点的坐标组。
  11974. */
  11975. 'point': function (point) {
  11976. var p = [point.x, point.y];
  11977. for (var name in point) {
  11978. if (name !== "x" && name !== "y" && point[name] !== null && !isNaN(point[name])) {
  11979. p.push(point[name]);
  11980. }
  11981. }
  11982. return p;
  11983. },
  11984. /**
  11985. * @function SuperMap.Format.GeoJSON.extract.point
  11986. * @description 从一个文本对象中返回一个坐标组。
  11987. * @param {Object} geo - 一个文本对象。
  11988. * @returns {Array} 一个表示一个点的坐标组。
  11989. */
  11990. 'text': function (geo) {
  11991. return [geo.points[0].x, geo.points[0].y];
  11992. },
  11993. /**
  11994. * @function SuperMap.Format.GeoJSON.extract.multipoint
  11995. * @description 从一个多点对象中返一个坐标组数组。
  11996. * @param {SuperMap.Geometry.MultiPoint} multipoint - 多点对象。
  11997. * @returns {Array} 一个表示多点的坐标组数组。
  11998. */
  11999. 'multipoint': function (multipoint) {
  12000. var array = [];
  12001. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  12002. array.push(this.extract.point.apply(this, [multipoint.components[i]]));
  12003. }
  12004. return array;
  12005. },
  12006. /**
  12007. * @function SuperMap.Format.GeoJSON.extract.linestring
  12008. * @description 从一个线对象中返回一个坐标组数组。
  12009. * @param {SuperMap.Geometry.Linestring} linestring - 线对象。
  12010. * @returns {Array} 一个表示线对象的坐标组数组。
  12011. */
  12012. 'linestring': function (linestring) {
  12013. var array = [];
  12014. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  12015. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  12016. }
  12017. return array;
  12018. },
  12019. /**
  12020. * @function SuperMap.Format.GeoJSON.extract.multilinestring
  12021. * @description 从一个多线对象中返回一个线数组。
  12022. * @param {SuperMap.Geometry.MultiLinestring} multilinestring - 多线对象。
  12023. *
  12024. * @returns {Array} 一个表示多线的线数组。
  12025. */
  12026. 'multilinestring': function (multilinestring) {
  12027. var array = [];
  12028. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  12029. array.push(this.extract.linestring.apply(this, [multilinestring.components[i]]));
  12030. }
  12031. return array;
  12032. },
  12033. /**
  12034. * @function SuperMap.Format.GeoJSON.extract.polygon
  12035. * @description 从一个面对象中返回一组线环。
  12036. * @param {SuperMap.Geometry.Polygon} polygon - 面对象。
  12037. * @returns {Array} 一组表示面的线环。
  12038. */
  12039. 'polygon': function (polygon) {
  12040. var array = [];
  12041. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  12042. array.push(this.extract.linestring.apply(this, [polygon.components[i]]));
  12043. }
  12044. return array;
  12045. },
  12046. /**
  12047. * @function SuperMap.Format.GeoJSON.extract.multipolygon
  12048. * @description 从一个多面对象中返回一组面。
  12049. * @param {SuperMap.Geometry.MultiPolygon} multipolygon - 多面对象。
  12050. * @returns {Array} 一组表示多面的面。
  12051. */
  12052. 'multipolygon': function (multipolygon) {
  12053. var array = [];
  12054. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  12055. array.push(this.extract.polygon.apply(this, [multipolygon.components[i]]));
  12056. }
  12057. return array;
  12058. },
  12059. /**
  12060. * @function SuperMap.Format.GeoJSON.extract.collection
  12061. * @description 从一个几何要素集合中一组几何要素数组。
  12062. * @param {SuperMap.Geometry.Collection} collection - 几何要素集合。
  12063. * @returns {Array} 一组表示几何要素集合的几何要素数组。
  12064. */
  12065. 'collection': function (collection) {
  12066. var len = collection.components.length;
  12067. var array = new Array(len);
  12068. for (var i = 0; i < len; ++i) {
  12069. array[i] = this.extract.geometry.apply(this, [collection.components[i]]);
  12070. }
  12071. return array;
  12072. }
  12073. };
  12074. }
  12075. /**
  12076. * @function SuperMap.Format.GeoJSON.prototype.read
  12077. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为 SuperMap Feature 对象。
  12078. * @param {GeoJSONObject} json - GeoJSON 对象。
  12079. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  12080. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  12081. * @returns {Object} 返回值依赖于 type 参数的值。
  12082. * -如果 type 等于 "FeatureCollection",返回值将会是 {@link SuperMap.Feature.Vector} 数组。
  12083. * -如果 type 为 "Geometry",输入的 JSON 对象必须表示一个唯一的几何体,然后返回值就会是 {@link SuperMap.Feature.Geometry}。
  12084. * -如果 type 为 "Feature",输入的 JSON 对象也必须表示的一个要素,这样返回值才会是 {@link SuperMap.Feature.Vector}。
  12085. */
  12086. read(json, type, filter) {
  12087. type = (type) ? type : "FeatureCollection";
  12088. var results = null;
  12089. var obj = null;
  12090. if (typeof json == "string") {
  12091. obj = super.read(json, filter);
  12092. } else {
  12093. obj = json;
  12094. }
  12095. if (!obj) {
  12096. //SuperMap.Console.error("Bad JSON: " + json);
  12097. } else if (typeof (obj.type) != "string") {
  12098. //SuperMap.Console.error("Bad GeoJSON - no type: " + json);
  12099. } else if (this.isValidType(obj, type)) {
  12100. switch (type) {
  12101. case "Geometry":
  12102. try {
  12103. results = this.parseGeometry(obj);
  12104. } catch (err) {
  12105. //SuperMap.Console.error(err);
  12106. }
  12107. break;
  12108. case "Feature":
  12109. try {
  12110. results = this.parseFeature(obj);
  12111. results.type = "Feature";
  12112. } catch (err) {
  12113. //SuperMap.Console.error(err);
  12114. }
  12115. break;
  12116. case "FeatureCollection":
  12117. // for type FeatureCollection, we allow input to be any type
  12118. results = [];
  12119. switch (obj.type) {
  12120. case "Feature":
  12121. try {
  12122. results.push(this.parseFeature(obj));
  12123. } catch (err) {
  12124. results = null;
  12125. //SuperMap.Console.error(err);
  12126. }
  12127. break;
  12128. case "FeatureCollection":
  12129. for (var i = 0, len = obj.features.length; i < len; ++i) {
  12130. try {
  12131. results.push(this.parseFeature(obj.features[i]));
  12132. } catch (err) {
  12133. results = null;
  12134. // SuperMap.Console.error(err);
  12135. }
  12136. }
  12137. break;
  12138. default:
  12139. try {
  12140. var geom = this.parseGeometry(obj);
  12141. results.push(new Vector(geom));
  12142. } catch (err) {
  12143. results = null;
  12144. //SuperMap.Console.error(err);
  12145. }
  12146. }
  12147. break;
  12148. default:
  12149. break;
  12150. }
  12151. }
  12152. return results;
  12153. }
  12154. /**
  12155. * @function SuperMap.Format.GeoJSON.prototype.write
  12156. * @description iServer Geometry JSON 对象 转 GeoJSON对象字符串。
  12157. * @param {Object} obj - iServer Geometry JSON 对象。
  12158. * @param {boolean} [pretty=false] - 是否使用换行和缩进来控制输出。
  12159. * @returns {GeoJSONObject} 一个 GeoJSON 字符串,它表示了输入的几何对象,要素对象,或者要素对象数组。
  12160. */
  12161. write(obj, pretty) {
  12162. return super.write(this.toGeoJSON(obj), pretty);
  12163. }
  12164. /**
  12165. * @function SuperMap.Format.GeoJSON.prototype.fromGeoJSON
  12166. * @version 9.1.1
  12167. * @description 将 GeoJSON 对象或者GeoJSON 对象字符串转换为iServer Feature JSON。
  12168. * @param {GeoJSONObject} json - GeoJSON 对象。
  12169. * @param {string} [type='FeaureCollection'] - 可选的字符串,它决定了输出的格式。支持的值有:"Geometry","Feature",和 "FeatureCollection",如果此值为null。
  12170. * @param {Function} filter - 对象中每个层次每个键值对都会调用此函数得出一个结果。每个值都会被 filter 函数的结果所替换掉。这个函数可被用来将某些对象转化成某个类相应的对象,或者将日期字符串转化成Date对象。
  12171. * @returns {Object} iServer Feature JSON。
  12172. */
  12173. fromGeoJSON(json, type, filter) {
  12174. let feature = this.read(json, type, filter);
  12175. if (!Util.isArray(feature)) {
  12176. return this._toiSevrerFeature(feature);
  12177. }
  12178. return feature.map((element) => {
  12179. return this._toiSevrerFeature(element);
  12180. })
  12181. }
  12182. /**
  12183. * @function SuperMap.Format.GeoJSON.prototype.toGeoJSON
  12184. * @version 9.1.1
  12185. * @description 将 iServer Feature JSON 对象转换为 GeoJSON 对象。
  12186. * @param {Object} obj - iServer Feature JSON。
  12187. * @returns {GeoJSONObject} GeoJSON 对象。
  12188. */
  12189. toGeoJSON(obj) {
  12190. var geojson = {
  12191. "type": null
  12192. };
  12193. if (Util.isArray(obj)) {
  12194. geojson.type = "FeatureCollection";
  12195. var numFeatures = obj.length;
  12196. geojson.features = new Array(numFeatures);
  12197. for (var i = 0; i < numFeatures; ++i) {
  12198. var element = obj[i];
  12199. if (isGeometry(element)) {
  12200. let feature = {};
  12201. feature.geometry = element;
  12202. geojson.features[i] = this.extract.feature.apply(this, [feature]);
  12203. } else {
  12204. geojson.features[i] = this.extract.feature.apply(this, [element]);
  12205. }
  12206. }
  12207. } else if (isGeometry(obj)) {
  12208. let feature = {};
  12209. feature.geometry = obj;
  12210. geojson = this.extract.feature.apply(this, [feature]);
  12211. } else {
  12212. geojson = this.extract.feature.apply(this, [obj]);
  12213. }
  12214. function isGeometry(input) {
  12215. return (input.hasOwnProperty("parts") && input.hasOwnProperty("points")) || input.hasOwnProperty("geoParts");
  12216. }
  12217. return geojson;
  12218. }
  12219. /**
  12220. * @function SuperMap.Format.GeoJSON.prototype.isValidType
  12221. * @description 检查一个 GeoJSON 对象是否和给定的类型相符的合法的对象。
  12222. * @returns {boolean} GeoJSON 是否是给定类型的合法对象。
  12223. * @private
  12224. */
  12225. isValidType(obj, type) {
  12226. var valid = false;
  12227. switch (type) {
  12228. case "Geometry":
  12229. if (Util.indexOf(
  12230. ["Point", "MultiPoint", "LineString", "MultiLineString",
  12231. "Polygon", "MultiPolygon", "Box", "GeometryCollection"
  12232. ],
  12233. obj.type) == -1) {
  12234. // unsupported geometry type
  12235. //SuperMap.Console.error("Unsupported geometry type: " +
  12236. // obj.type);
  12237. } else {
  12238. valid = true;
  12239. }
  12240. break;
  12241. case "FeatureCollection":
  12242. // allow for any type to be converted to a feature collection
  12243. valid = true;
  12244. break;
  12245. default:
  12246. // for Feature types must match
  12247. if (obj.type == type) {
  12248. valid = true;
  12249. } else {
  12250. //SuperMap.Console.error("Cannot convert types from " +
  12251. //obj.type + " to " + type);
  12252. }
  12253. }
  12254. return valid;
  12255. }
  12256. /**
  12257. * @function SuperMap.Format.GeoJSON.prototype.parseFeature
  12258. * @description 将一个 GeoJSON 中的 feature 转化成 {@link SuperMap.Feature.Vector}> 对象。
  12259. * @private
  12260. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  12261. * @returns {SuperMap.Feature.Vector} 一个要素。
  12262. */
  12263. parseFeature(obj) {
  12264. var feature, geometry, attributes, bbox;
  12265. attributes = (obj.properties) ? obj.properties : {};
  12266. bbox = (obj.geometry && obj.geometry.bbox) || obj.bbox;
  12267. try {
  12268. geometry = this.parseGeometry(obj.geometry);
  12269. } catch (err) {
  12270. // deal with bad geometries
  12271. throw err;
  12272. }
  12273. feature = new Vector(geometry, attributes);
  12274. if (bbox) {
  12275. feature.bounds = Bounds.fromArray(bbox);
  12276. }
  12277. if (obj.id) {
  12278. feature.fid = obj.id;
  12279. }
  12280. return feature;
  12281. }
  12282. /**
  12283. * @function SuperMap.Format.GeoJSON.prototype.parseGeometry
  12284. * @description 将一个 GeoJSON 中的几何要素转化成 {@link SuperMap.Geometry} 对象。
  12285. * @param {GeoJSONObject} obj - 从 GeoJSON 对象中创建一个对象。
  12286. * @returns {SuperMap.Geometry} 一个几何要素。
  12287. * @private
  12288. */
  12289. parseGeometry(obj) {
  12290. if (obj == null) {
  12291. return null;
  12292. }
  12293. var geometry;
  12294. if (obj.type == "GeometryCollection") {
  12295. if (!(Util.isArray(obj.geometries))) {
  12296. throw "GeometryCollection must have geometries array: " + obj;
  12297. }
  12298. var numGeom = obj.geometries.length;
  12299. var components = new Array(numGeom);
  12300. for (var i = 0; i < numGeom; ++i) {
  12301. components[i] = this.parseGeometry.apply(
  12302. this, [obj.geometries[i]]
  12303. );
  12304. }
  12305. geometry = new Collection(components);
  12306. } else {
  12307. if (!(Util.isArray(obj.coordinates))) {
  12308. throw "Geometry must have coordinates array: " + obj;
  12309. }
  12310. if (!this.parseCoords[obj.type.toLowerCase()]) {
  12311. throw "Unsupported geometry type: " + obj.type;
  12312. }
  12313. try {
  12314. geometry = this.parseCoords[obj.type.toLowerCase()].apply(
  12315. this, [obj.coordinates]
  12316. );
  12317. } catch (err) {
  12318. // deal with bad coordinates
  12319. throw err;
  12320. }
  12321. }
  12322. return geometry;
  12323. }
  12324. /**
  12325. * @function SuperMap.Format.GeoJSON.prototype.createCRSObject
  12326. * @description 从一个要素对象中创建一个坐标参考系对象。
  12327. * @param {SuperMap.Feature.Vector} object - 要素对象。
  12328. * @private
  12329. * @returns {GeoJSONObject} 一个可作为 GeoJSON 对象的 CRS 属性使用的对象。
  12330. */
  12331. createCRSObject(object) {
  12332. var proj = object.layer.projection.toString();
  12333. var crs = {};
  12334. if (proj.match(/epsg:/i)) {
  12335. var code = parseInt(proj.substring(proj.indexOf(":") + 1));
  12336. if (code == 4326) {
  12337. crs = {
  12338. "type": "name",
  12339. "properties": {
  12340. "name": "urn:ogc:def:crs:OGC:1.3:CRS84"
  12341. }
  12342. };
  12343. } else {
  12344. crs = {
  12345. "type": "name",
  12346. "properties": {
  12347. "name": "EPSG:" + code
  12348. }
  12349. };
  12350. }
  12351. }
  12352. return crs;
  12353. }
  12354. _toiSevrerFeature(feature) {
  12355. const attributes = feature.attributes;
  12356. const attrNames = [];
  12357. const attrValues = [];
  12358. for (var attr in attributes) {
  12359. attrNames.push(attr);
  12360. attrValues.push(attributes[attr]);
  12361. }
  12362. const newFeature = {
  12363. fieldNames: attrNames,
  12364. fieldValues: attrValues,
  12365. geometry: ServerGeometry.fromGeometry(feature.geometry)
  12366. };
  12367. newFeature.geometry.id = feature.fid;
  12368. return newFeature;
  12369. }
  12370. createAttributes(feature) {
  12371. if (!feature) {
  12372. return null;
  12373. }
  12374. var attr = {};
  12375. processFieldsAttributes(feature, attr);
  12376. var exceptKeys = ["fieldNames", "fieldValues", "geometry", "stringID", "ID"];
  12377. for (var key in feature) {
  12378. if (exceptKeys.indexOf(key) > -1) {
  12379. continue;
  12380. }
  12381. attr[key] = feature[key];
  12382. }
  12383. function processFieldsAttributes(feature, attributes) {
  12384. if (!(feature.hasOwnProperty("fieldNames") && feature.hasOwnProperty("fieldValues"))) {
  12385. return;
  12386. }
  12387. var names = feature.fieldNames,
  12388. values = feature.fieldValues;
  12389. for (var i in names) {
  12390. attributes[names[i]] = values[i];
  12391. }
  12392. }
  12393. return attr;
  12394. }
  12395. }
  12396. SuperMap.Format.GeoJSON = GeoJSON;
  12397. ;// CONCATENATED MODULE: ./src/common/format/WKT.js
  12398. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12399. * This program are made available under the terms of the Apache License, Version 2.0
  12400. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12401. /**
  12402. * @class SuperMap.Format.WKT
  12403. * @classdesc 用于读写常见文本的类。通过 {@link SuperMap.Format.WKT} 构造器来创建一个新的实例。
  12404. * @category BaseTypes Format
  12405. * @extends {SuperMap.Format}
  12406. * @param {Object} options - 可选的选项对象,其属性将被设置到实例。option 具体配置项继承自 {@link SuperMap.Format}。
  12407. */
  12408. class WKT extends Format {
  12409. constructor(options) {
  12410. super(options);
  12411. this.regExes = {
  12412. 'typeStr': /^\s*(\w+)\s*\(\s*(.*)\s*\)\s*$/,
  12413. 'spaces': /\s+/,
  12414. 'parenComma': /\)\s*,\s*\(/,
  12415. 'doubleParenComma': /\)\s*\)\s*,\s*\(\s*\(/, // can't use {2} here
  12416. 'trimParens': /^\s*\(?(.*?)\)?\s*$/
  12417. };
  12418. this.CLASS_NAME = "SuperMap.Format.WKT"; /**
  12419. * @private
  12420. * @description Object with properties corresponding to the geometry types.
  12421. * Property values are functions that do the actual data extraction.
  12422. */
  12423. this.extract = {
  12424. /**
  12425. * @description Return a space delimited string of point coordinates.
  12426. * @param {SuperMap.Geometry.Point} point
  12427. * @returns {string} A string of coordinates representing the point
  12428. */
  12429. 'point': function (point) {
  12430. return point.x + ' ' + point.y;
  12431. },
  12432. /**
  12433. * @description Return a comma delimited string of point coordinates from a multipoint.
  12434. * @param {SuperMap.Geometry.MultiPoint} multipoint
  12435. * @returns {string} A string of point coordinate strings representing
  12436. * the multipoint
  12437. */
  12438. 'multipoint'(multipoint) {
  12439. var array = [];
  12440. for (var i = 0, len = multipoint.components.length; i < len; ++i) {
  12441. array.push('(' +
  12442. this.extract.point.apply(this, [multipoint.components[i]]) +
  12443. ')');
  12444. }
  12445. return array.join(',');
  12446. },
  12447. /**
  12448. * @description Return a comma delimited string of point coordinates from a line.
  12449. * @param {SuperMap.Geometry.LineString} linestring
  12450. * @returns {string} A string of point coordinate strings representing
  12451. * the linestring
  12452. */
  12453. 'linestring'(linestring) {
  12454. var array = [];
  12455. for (var i = 0, len = linestring.components.length; i < len; ++i) {
  12456. array.push(this.extract.point.apply(this, [linestring.components[i]]));
  12457. }
  12458. return array.join(',');
  12459. },
  12460. /**
  12461. * @description Return a comma delimited string of linestring strings from a multilinestring.
  12462. * @param {SuperMap.Geometry.MultiLineString} multilinestring
  12463. * @returns {string} A string of of linestring strings representing
  12464. * the multilinestring
  12465. */
  12466. 'multilinestring'(multilinestring) {
  12467. var array = [];
  12468. for (var i = 0, len = multilinestring.components.length; i < len; ++i) {
  12469. array.push('(' +
  12470. this.extract.linestring.apply(this, [multilinestring.components[i]]) +
  12471. ')');
  12472. }
  12473. return array.join(',');
  12474. },
  12475. /**
  12476. * @description Return a comma delimited string of linear ring arrays from a polygon.
  12477. * @param {SuperMap.Geometry.Polygon} polygon
  12478. * @returns {string} An array of linear ring arrays representing the polygon
  12479. */
  12480. 'polygon'(polygon) {
  12481. var array = [];
  12482. for (var i = 0, len = polygon.components.length; i < len; ++i) {
  12483. array.push('(' +
  12484. this.extract.linestring.apply(this, [polygon.components[i]]) +
  12485. ')');
  12486. }
  12487. return array.join(',');
  12488. },
  12489. /**
  12490. * @description Return an array of polygon arrays from a multipolygon.
  12491. * @param {SuperMap.Geometry.MultiPolygon} multipolygon
  12492. * @returns {string} An array of polygon arrays representing
  12493. * the multipolygon
  12494. */
  12495. 'multipolygon'(multipolygon) {
  12496. var array = [];
  12497. for (var i = 0, len = multipolygon.components.length; i < len; ++i) {
  12498. array.push('(' +
  12499. this.extract.polygon.apply(this, [multipolygon.components[i]]) +
  12500. ')');
  12501. }
  12502. return array.join(',');
  12503. },
  12504. /**
  12505. * @description Return the WKT portion between 'GEOMETRYCOLLECTION(' and ')' for an <SuperMap.Geometry.Collection>
  12506. * @param {SuperMap.Geometry.Collection} collection
  12507. * @returns {string} internal WKT representation of the collection
  12508. */
  12509. 'collection'(collection) {
  12510. var array = [];
  12511. for (var i = 0, len = collection.components.length; i < len; ++i) {
  12512. array.push(this.extractGeometry.apply(this, [collection.components[i]]));
  12513. }
  12514. return array.join(',');
  12515. }
  12516. };
  12517. /**
  12518. * @private
  12519. * @description Object with properties corresponding to the geometry types.
  12520. * Property values are functions that do the actual parsing.
  12521. */
  12522. this.parse = {
  12523. /**
  12524. * @private
  12525. * @description Return point feature given a point WKT fragment.
  12526. * @param {string} str A WKT fragment representing the point
  12527. * @returns {SuperMap.Feature.Vector} A point feature
  12528. *
  12529. */
  12530. 'point': function (str) {
  12531. var coords = StringExt.trim(str).split(this.regExes.spaces);
  12532. return new Vector(new Point(coords[0], coords[1])
  12533. );
  12534. },
  12535. /**
  12536. * @description Return a multipoint feature given a multipoint WKT fragment.
  12537. * @param {string} A WKT fragment representing the multipoint
  12538. * @returns {SuperMap.Feature.Vector} A multipoint feature
  12539. * @private
  12540. */
  12541. 'multipoint': function (str) {
  12542. var point;
  12543. var points = StringExt.trim(str).split(',');
  12544. var components = [];
  12545. for (var i = 0, len = points.length; i < len; ++i) {
  12546. point = points[i].replace(this.regExes.trimParens, '$1');
  12547. components.push(this.parse.point.apply(this, [point]).geometry);
  12548. }
  12549. return new Vector(
  12550. new MultiPoint(components)
  12551. );
  12552. },
  12553. /**
  12554. * @description Return a linestring feature given a linestring WKT fragment.
  12555. * @param {string} A WKT fragment representing the linestring
  12556. * @returns {SuperMap.Feature.Vector} A linestring feature
  12557. * @private
  12558. */
  12559. 'linestring': function (str) {
  12560. var points = StringExt.trim(str).split(',');
  12561. var components = [];
  12562. for (var i = 0, len = points.length; i < len; ++i) {
  12563. components.push(this.parse.point.apply(this, [points[i]]).geometry);
  12564. }
  12565. return new Vector(
  12566. new LineString(components)
  12567. );
  12568. },
  12569. /**
  12570. * @description Return a multilinestring feature given a multilinestring WKT fragment.
  12571. * @param {string} A WKT fragment representing the multilinestring
  12572. * @returns {SuperMap.Feature.Vector} A multilinestring feature
  12573. * @private
  12574. */
  12575. 'multilinestring': function (str) {
  12576. var line;
  12577. var lines = StringExt.trim(str).split(this.regExes.parenComma);
  12578. var components = [];
  12579. for (var i = 0, len = lines.length; i < len; ++i) {
  12580. line = lines[i].replace(this.regExes.trimParens, '$1');
  12581. components.push(this.parse.linestring.apply(this, [line]).geometry);
  12582. }
  12583. return new Vector(
  12584. new MultiLineString(components)
  12585. );
  12586. },
  12587. /**
  12588. * @description Return a polygon feature given a polygon WKT fragment.
  12589. * @param {string} A WKT fragment representing the polygon
  12590. * @returns {SuperMap.Feature.Vector} A polygon feature
  12591. * @private
  12592. */
  12593. 'polygon': function (str) {
  12594. var ring, linestring, linearring;
  12595. var rings = StringExt.trim(str).split(this.regExes.parenComma);
  12596. var components = [];
  12597. for (var i = 0, len = rings.length; i < len; ++i) {
  12598. ring = rings[i].replace(this.regExes.trimParens, '$1');
  12599. linestring = this.parse.linestring.apply(this, [ring]).geometry;
  12600. linearring = new LinearRing(linestring.components);
  12601. components.push(linearring);
  12602. }
  12603. return new Vector(
  12604. new Polygon(components)
  12605. );
  12606. },
  12607. /**
  12608. * @private
  12609. * @description Return a multipolygon feature given a multipolygon WKT fragment.
  12610. * @param {string} A WKT fragment representing the multipolygon
  12611. * @returns {SuperMap.Feature.Vector} A multipolygon feature
  12612. *
  12613. */
  12614. 'multipolygon': function (str) {
  12615. var polygon;
  12616. var polygons = StringExt.trim(str).split(this.regExes.doubleParenComma);
  12617. var components = [];
  12618. for (var i = 0, len = polygons.length; i < len; ++i) {
  12619. polygon = polygons[i].replace(this.regExes.trimParens, '$1');
  12620. components.push(this.parse.polygon.apply(this, [polygon]).geometry);
  12621. }
  12622. return new Vector(
  12623. new MultiPolygon(components)
  12624. );
  12625. },
  12626. /**
  12627. * @description Return an array of features given a geometrycollection WKT fragment.
  12628. * @param {string} A WKT fragment representing the geometrycollection
  12629. * @returns {Array} An array of SuperMap.Feature.Vector
  12630. * @private
  12631. */
  12632. 'geometrycollection': function (str) {
  12633. // separate components of the collection with |
  12634. str = str.replace(/,\s*([A-Za-z])/g, '|$1');
  12635. var wktArray = StringExt.trim(str).split('|');
  12636. var components = [];
  12637. for (var i = 0, len = wktArray.length; i < len; ++i) {
  12638. components.push(this.read(wktArray[i]));
  12639. }
  12640. return components;
  12641. }
  12642. };
  12643. }
  12644. /**
  12645. * @function SuperMap.Format.WKT.prototype.read
  12646. * @description Deserialize a WKT string and return a vector feature or an
  12647. * array of vector features. Supports WKT for POINT, MULTIPOINT,
  12648. * LINESTRING, MULTILINESTRING, POLYGON, MULTIPOLYGON, and
  12649. * GEOMETRYCOLLECTION.
  12650. * @param {string} wkt - A WKT string
  12651. * @returns {SuperMap.Feature.Vector|Array} A feature or array of features for
  12652. * GEOMETRYCOLLECTION WKT.
  12653. */
  12654. read(wkt) {
  12655. var features, type, str;
  12656. wkt = wkt.replace(/[\n\r]/g, " ");
  12657. var matches = this.regExes.typeStr.exec(wkt);
  12658. if (matches) {
  12659. type = matches[1].toLowerCase();
  12660. str = matches[2];
  12661. if (this.parse[type]) {
  12662. features = this.parse[type].apply(this, [str]);
  12663. }
  12664. }
  12665. return features;
  12666. }
  12667. /**
  12668. * @function SuperMap.Format.WKT.prototype.write
  12669. * @description Serialize a feature or array of features into a WKT string.
  12670. * @param {(SuperMap.Feature.Vector|Array)} features - A feature or array of features
  12671. * @returns {string} The WKT string representation of the input geometries
  12672. */
  12673. write(features) {
  12674. var collection, geometry, isCollection;
  12675. if (features.constructor === Array) {
  12676. collection = features;
  12677. isCollection = true;
  12678. } else {
  12679. collection = [features];
  12680. isCollection = false;
  12681. }
  12682. var pieces = [];
  12683. if (isCollection) {
  12684. pieces.push('GEOMETRYCOLLECTION(');
  12685. }
  12686. for (var i = 0, len = collection.length; i < len; ++i) {
  12687. if (isCollection && i > 0) {
  12688. pieces.push(',');
  12689. }
  12690. geometry = collection[i].geometry;
  12691. pieces.push(this.extractGeometry(geometry));
  12692. }
  12693. if (isCollection) {
  12694. pieces.push(')');
  12695. }
  12696. return pieces.join('');
  12697. }
  12698. /**
  12699. * @function SuperMap.Format.WKT.prototype.extractGeometry
  12700. * @description Entry point to construct the WKT for a single Geometry object.
  12701. * @param {SuperMap.Geometry} geometry
  12702. * @returns {string} A WKT string of representing the geometry
  12703. */
  12704. extractGeometry(geometry) {
  12705. var type = geometry.CLASS_NAME.split('.')[2].toLowerCase();
  12706. if (!this.extract[type]) {
  12707. return null;
  12708. }
  12709. var wktType = type === 'collection' ? 'GEOMETRYCOLLECTION' : type.toUpperCase();
  12710. var data = wktType + '(' + this.extract[type].apply(this, [geometry]) + ')';
  12711. return data;
  12712. }
  12713. }
  12714. SuperMap.Format.WKT = WKT;
  12715. ;// CONCATENATED MODULE: ./src/common/format/index.js
  12716. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12717. * This program are made available under the terms of the Apache License, Version 2.0
  12718. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12719. ;// CONCATENATED MODULE: ./src/common/control/TimeControlBase.js
  12720. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  12721. * This program are made available under the terms of the Apache License, Version 2.0
  12722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  12723. /**
  12724. * @class SuperMap.TimeControlBase
  12725. * @classdesc 时间控制基类类。
  12726. * @category Control
  12727. * @param {Object} options - 该类开放的可选属性。
  12728. * @param {number} [options.speed=1] - 速度。不能小于 0,(每帧渲染的数据之间的间隔为1),设置越大速度越快。
  12729. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms),服务器刷新的时间间隔。
  12730. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  12731. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时以当前时间进行设置,建议设置。
  12732. * @param {boolean} [options.repeat=true] - 是否重复循环。
  12733. * @param {boolean} [options.reverse=false] - 是否反向。
  12734. */
  12735. class TimeControlBase {
  12736. constructor(options) {
  12737. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  12738. var me = this;
  12739. options = options || {};
  12740. /**
  12741. * @member {number} [SuperMap.TimeControlBase.prototype.speed=1]
  12742. * @description 步长,必须为非负数,默认为1(表示前后两次渲染的数据之间的间隔为1)
  12743. */
  12744. this.speed = (options.speed && options.speed >= 0) ? options.speed : 1;
  12745. /**
  12746. * @member {number} [SuperMap.TimeControlBase.prototype.frequency=1000]
  12747. * @description 刷新频率(单位ms),服务器刷新的时间间隔。
  12748. */
  12749. this.frequency = (options.speed && options.frequency >= 0) ? options.frequency : 1000;
  12750. /**
  12751. * @member {number} [SuperMap.TimeControlBase.prototype.startTime=0]
  12752. * @description 记录的起始时间,必须为数字,
  12753. * 如果不设置,初始化时为0,建议设置
  12754. */
  12755. this.startTime = (options.startTime && options.startTime != null) ? options.startTime : 0;
  12756. /**
  12757. * @member {number} SuperMap.TimeControlBase.prototype.endTime
  12758. * @description 记录的结束时间,必须为数字,
  12759. * 如果不设置,初始化时以当前时间进行设置,建议设置
  12760. */
  12761. this.endTime = (options.endTime && options.endTime != null && options.endTime >= me.startTime) ? options.endTime : +new Date();
  12762. /**
  12763. * @member {boolean} [SuperMap.TimeControlBase.prototype.repeat=true]
  12764. * @description 是否重复循环。
  12765. */
  12766. this.repeat = (options.repeat !== undefined) ? options.repeat : true;
  12767. /**
  12768. * @member {boolean} [SuperMap.TimeControlBase.prototype.reverse=false]
  12769. * @description 是否反向。
  12770. */
  12771. this.reverse = (options.reverse !== undefined) ? options.reverse : false;
  12772. /**
  12773. * @member {number} SuperMap.TimeControlBase.prototype.currentTime
  12774. * @description 记录近期的时间,也就是当前帧运行到的时间。
  12775. */
  12776. this.currentTime = null;
  12777. /**
  12778. * @member {number} SuperMap.TimeControlBase.prototype.oldTime
  12779. * @description 记录上一帧的时间,也就是之前运行到的时间。
  12780. */
  12781. this.oldTime = null;
  12782. /**
  12783. * @member {boolean} [SuperMap.TimeControlBase.prototype.running=false]
  12784. * @description 记录当前是否处于运行中。
  12785. */
  12786. this.running = false;
  12787. /**
  12788. * @private
  12789. * @member {Array.<string>} SuperMap.TimeControlBase.prototype.EVENT_TYPES
  12790. * @description 此类支持的事件类型。
  12791. *
  12792. */
  12793. this.EVENT_TYPES = ["start", "pause", "stop"];
  12794. /**
  12795. * @private
  12796. * @member {SuperMap.Events} SuperMap.TimeControlBase.prototype.events
  12797. * @description 事件
  12798. */
  12799. me.events = new Events(this, null, this.EVENT_TYPES);
  12800. me.speed = Number(me.speed);
  12801. me.frequency = Number(me.frequency);
  12802. me.startTime = Number(me.startTime);
  12803. me.endTime = Number(me.endTime);
  12804. me.startTime = Date.parse(new Date(me.startTime));
  12805. me.endTime = Date.parse(new Date(me.endTime));
  12806. //初始化当前时间
  12807. me.currentTime = me.startTime;
  12808. this.CLASS_NAME = "SuperMap.TimeControlBase";
  12809. }
  12810. /**
  12811. * @function SuperMap.TimeControlBase.prototype.updateOptions
  12812. * @param {Object} options - 设置参数得可选参数。设置步长,刷新频率、开始结束时间、是否循环、是否反向。
  12813. */
  12814. updateOptions(options) {
  12815. //设置步长,刷新频率、开始结束时间、是否循环、是否反向
  12816. var me = this;
  12817. options = options || {};
  12818. if (options.speed && options.speed >= 0) {
  12819. me.speed = options.speed;
  12820. me.speed = Number(me.speed);
  12821. }
  12822. if (options.speed && options.frequency >= 0) {
  12823. me.frequency = options.frequency;
  12824. me.frequency = Number(me.frequency);
  12825. }
  12826. if (options.startTime && options.startTime != null) {
  12827. me.startTime = options.startTime;
  12828. me.startTime = Date.parse(new Date(me.startTime));
  12829. }
  12830. if (options.endTime && options.endTime != null && options.endTime >= me.startTime) {
  12831. me.endTime = options.endTime;
  12832. me.endTime = Date.parse(new Date(me.endTime));
  12833. }
  12834. if (options.repeat != null) {
  12835. me.repeat = options.repeat;
  12836. }
  12837. if (options.reverse != null) {
  12838. me.reverse = options.reverse;
  12839. }
  12840. }
  12841. /**
  12842. * @function SuperMap.TimeControlBase.prototype.start
  12843. * @description 开始。
  12844. */
  12845. start() {
  12846. var me = this;
  12847. if (!me.running) {
  12848. me.running = true;
  12849. me.tick();
  12850. me.events.triggerEvent('start', me.currentTime);
  12851. }
  12852. }
  12853. /**
  12854. * @function SuperMap.TimeControlBase.prototype.pause
  12855. * @description 暂停。
  12856. */
  12857. pause() {
  12858. var me = this;
  12859. me.running = false;
  12860. me.events.triggerEvent('pause', me.currentTime);
  12861. }
  12862. /**
  12863. * @function SuperMap.TimeControlBase.prototype.stop
  12864. * @description 停止,停止后返回起始状态。
  12865. */
  12866. stop() {
  12867. var me = this;
  12868. //停止时 时间设置为开始时间
  12869. me.currentTime = me.startTime;
  12870. //如果正在运行,修改为初始时间即可绘制一帧
  12871. if (me.running) {
  12872. me.running = false;
  12873. }
  12874. me.events.triggerEvent('stop', me.currentTime);
  12875. }
  12876. /**
  12877. * @function SuperMap.TimeControlBase.prototype.toggle
  12878. * @description 开关切换,切换的是开始和暂停。
  12879. */
  12880. toggle() {
  12881. var me = this;
  12882. if (me.running) {
  12883. me.pause();
  12884. } else {
  12885. me.start();
  12886. }
  12887. }
  12888. /**
  12889. * @function SuperMap.TimeControlBase.prototype.setSpeed
  12890. * @description 设置步长。
  12891. * @param {number} [speed=1] - 步长,必须为非负数。
  12892. * @returns {boolean} true 代表设置成功,false 设置失败(speed 小于 0 时失败)。
  12893. */
  12894. setSpeed(speed) {
  12895. var me = this;
  12896. if (speed >= 0) {
  12897. me.speed = speed;
  12898. return true;
  12899. }
  12900. return false;
  12901. }
  12902. /**
  12903. * @function SuperMap.TimeControlBase.prototype.getSpeed
  12904. * @description 获取步长。
  12905. * @returns {number} 返回当前的步长
  12906. */
  12907. getSpeed() {
  12908. return this.speed;
  12909. }
  12910. /**
  12911. * @function SuperMap.TimeControlBase.prototype.setFrequency
  12912. * @description 设置刷新频率。
  12913. * @param {number} [frequency=1000] - 刷新频率,单位为 ms。
  12914. * @returns {boolean} true 代表设置成功,false 设置失败(frequency 小于 0 时失败)。
  12915. */
  12916. setFrequency(frequency) {
  12917. var me = this;
  12918. if (frequency >= 0) {
  12919. me.frequency = frequency;
  12920. return true;
  12921. }
  12922. return false;
  12923. }
  12924. /**
  12925. * @function SuperMap.TimeControlBase.prototype.getFrequency
  12926. * @description 获取刷新频率。
  12927. * @returns {number} 返回当前的刷新频率。
  12928. */
  12929. getFrequency() {
  12930. return this.frequency;
  12931. }
  12932. /**
  12933. * @function SuperMap.TimeControlBase.prototype.setStartTime
  12934. * @description 设置起始时间,设置完成后如果当前时间小于起始时间,则从起始时间开始。
  12935. * @param {number} startTime - 需要设置的起始时间。
  12936. * @returns {boolean} true 代表设置成功,false 设置失败(startTime 大于结束时间时失败)。
  12937. */
  12938. setStartTime(startTime) {
  12939. var me = this;
  12940. startTime = Date.parse(new Date(startTime));
  12941. //起始时间不得大于结束时间
  12942. if (startTime > me.endTime) {
  12943. return false;
  12944. }
  12945. me.startTime = startTime;
  12946. //如果当前时间小于了起始时间,则从当前起始时间开始
  12947. if (me.currentTime < me.startTime) {
  12948. me.currentTime = me.startTime;
  12949. me.tick();
  12950. }
  12951. return true;
  12952. }
  12953. /**
  12954. * @function SuperMap.TimeControlBase.prototype.getStartTime
  12955. * @description 获取起始时间。
  12956. * @returns {number} 返回当前的起始时间。
  12957. */
  12958. getStartTime() {
  12959. return this.startTime;
  12960. }
  12961. /**
  12962. * @function SuperMap.TimeControlBase.prototype.setEndTime
  12963. * @description 设置结束时间,设置完成后如果当前时间大于结束,则从起始时间开始。
  12964. * @param {number} endTime - 需要设置的结束时间。
  12965. * @returns {boolean} true 代表设置成功,false 设置失败(endTime 小于开始时间时失败)。
  12966. */
  12967. setEndTime(endTime) {
  12968. var me = this;
  12969. me.endTime = Date.parse(new Date(me.endTime));
  12970. //结束时间不得小于开始时间
  12971. if (endTime < me.startTime) {
  12972. return false;
  12973. }
  12974. me.endTime = endTime;
  12975. //如果当前时间大于了结束时间,则从起始时间开始
  12976. if (me.currentTime >= me.endTime) {
  12977. me.currentTime = me.startTime;
  12978. me.tick();
  12979. }
  12980. return true;
  12981. }
  12982. /**
  12983. * @function SuperMap.TimeControlBase.prototype.getEndTime
  12984. * @description 获取结束时间。
  12985. * @returns {number} 返回当前的结束时间。
  12986. */
  12987. getEndTime() {
  12988. return this.endTime;
  12989. }
  12990. /**
  12991. * @function SuperMap.TimeControlBase.prototype.setCurrentTime
  12992. * @description 设置当前时间。
  12993. * @param {number} currentTime - 需要设置的当前时间。
  12994. * @returns {boolean} true 代表设置成功,false 设置失败。
  12995. */
  12996. setCurrentTime(currentTime) {
  12997. var me = this;
  12998. me.currentTime = Date.parse(new Date(me.currentTime));
  12999. //结束时间不得小于开始时间
  13000. if (currentTime >= me.startTime && currentTime <= me.endTime) {
  13001. me.currentTime = currentTime;
  13002. me.startTime = me.currentTime;
  13003. me.tick();
  13004. return true;
  13005. }
  13006. return false;
  13007. }
  13008. /**
  13009. * @function SuperMap.TimeControlBase.prototype.getCurrentTime
  13010. * @description 获取当前时间。
  13011. * @returns {number} 返回当前时间。
  13012. */
  13013. getCurrentTime() {
  13014. return this.currentTime;
  13015. }
  13016. /**
  13017. * @function SuperMap.TimeControlBase.prototype.setRepeat
  13018. * @description 设置是否重复循环。
  13019. * @param {boolean} [repeat=true] - 是否重复循环。
  13020. */
  13021. setRepeat(repeat) {
  13022. this.repeat = repeat;
  13023. }
  13024. /**
  13025. * @function SuperMap.TimeControlBase.prototype.getRepeat
  13026. * @description 获取是否重复循环,默认是 true。
  13027. * @returns {boolean} 返回是否重复循环。
  13028. */
  13029. getRepeat() {
  13030. return this.repeat;
  13031. }
  13032. /**
  13033. * @function SuperMap.TimeControlBase.prototype.setReverse
  13034. * @description 设置是否反向。
  13035. * @param {boolean} [reverse=false] - 是否反向。
  13036. */
  13037. setReverse(reverse) {
  13038. this.reverse = reverse;
  13039. }
  13040. /**
  13041. * @function SuperMap.TimeControlBase.prototype.getReverse
  13042. * @description 获取是否反向,默认是false。
  13043. * @returns {boolean} 返回是否反向。
  13044. */
  13045. getReverse() {
  13046. return this.reverse;
  13047. }
  13048. /**
  13049. * @function SuperMap.TimeControlBase.prototype.getRunning
  13050. * @description 获取运行状态。
  13051. * @returns {boolean} true 代表正在运行,false 发表没有运行。
  13052. */
  13053. getRunning() {
  13054. return this.running;
  13055. }
  13056. /**
  13057. * @function SuperMap.TimeControlBase.prototype.destroy
  13058. * @description 销毁 Animator 对象,释放资源。
  13059. */
  13060. destroy() {
  13061. var me = this;
  13062. me.speed = null;
  13063. me.frequency = null;
  13064. me.startTime = null;
  13065. me.endTime = null;
  13066. me.currentTime = null;
  13067. me.repeat = null;
  13068. me.running = false;
  13069. me.reverse = null;
  13070. }
  13071. tick() {
  13072. //TODO 每次刷新执行的操作。子类实现
  13073. }
  13074. }
  13075. SuperMap.TimeControlBase = TimeControlBase;
  13076. ;// CONCATENATED MODULE: ./src/common/control/TimeFlowControl.js
  13077. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13078. * This program are made available under the terms of the Apache License, Version 2.0
  13079. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13080. /**
  13081. * @class SuperMap.TimeFlowControl
  13082. * @classdesc 时间管理类。
  13083. * @category Control
  13084. * @description 此类只负责时间上的控制,具体执行的操作需要用户在初始化时的回调函数内部进行实现。
  13085. * 如设置起始时间为 1000,结束时间是 2000,步长设置为 1,
  13086. * 那么表示按照每次1年(可以通过 setSpeed 进行修改)的变化从公元 1000 年开始到公元 2000 年为止,默认每 1 秒会 1 次(通过 setFrequency 修改)
  13087. * @extends {SuperMap.TimeControlBase}
  13088. * @param {function} callback - 每次刷新回调函数。具体的效果需要用户在此回调函数里面实现。
  13089. * @param {Object} options - 该类开放的可选属性。
  13090. * @param {number} [options.speed=1] - 步长(单位 ms)。不能小于 0,(每次刷新的数据之间的间隔为 1ms)。
  13091. * @param {number} [options.frequency=1000] - 刷新频率(单位 ms)。
  13092. * @param {number} [options.startTime=0] - 起始时间,必须为数字,且小于等于 endTime。如果不设置,初始化时为 0,建议设置。
  13093. * @param {number} [options.endTime] - 结束时间,必须为数字,且大于等于 startTime。如果不设置,初始化时使用 new Date() 以当前时间进行设置,建议设置。
  13094. * @param {boolean} [options.repeat=true] - 是否重复循环。
  13095. * @param {boolean} [options.reverse=false] - 是否反向。
  13096. */
  13097. class TimeFlowControl extends TimeControlBase {
  13098. constructor(callback, options) {
  13099. super(options);
  13100. var me = this;
  13101. /**
  13102. * @member SuperMap.TimeFlowControl.prototype.callback -{function}
  13103. * @description 每次刷新执行的回调函数。
  13104. */
  13105. me.callback = callback;
  13106. //先让IE下支持bind方法
  13107. if (!Function.prototype.bind) {
  13108. Function.prototype.bind = function (oThis) {
  13109. if (typeof this !== "function") {
  13110. throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");
  13111. }
  13112. var aArgs = Array.prototype.slice.call(arguments, 1),
  13113. fToBind = this,
  13114. fNOP = function () {
  13115. //empty Function
  13116. },
  13117. fBound = function () {
  13118. return fToBind.apply(this instanceof fNOP && oThis
  13119. ? this
  13120. : oThis,
  13121. aArgs.concat(Array.prototype.slice.call(arguments)));
  13122. };
  13123. fNOP.prototype = this.prototype;
  13124. fBound.prototype = new fNOP();
  13125. return fBound;
  13126. };
  13127. }
  13128. //保证 this.tick 的上下文还是 TimeControl 这个对象
  13129. me.update = me.update.bind(me);
  13130. me.oldTime = me.currentTime;
  13131. me.CLASS_NAME = "SuperMap.TimeFlowControl";
  13132. }
  13133. /**
  13134. * @function SuperMap.TimeFlowControl.prototype.updateOptions
  13135. * @override
  13136. */
  13137. updateOptions(options) {
  13138. options = options || {};
  13139. super.updateOptions(options);
  13140. }
  13141. /**
  13142. * @function SuperMap.TimeFlowControl.prototype.start
  13143. * @override
  13144. */
  13145. start() {
  13146. var me = this;
  13147. if (me.running) {
  13148. return;
  13149. }
  13150. me.running = true;
  13151. if (me.reverse) {
  13152. if (me.currentTime === me.startTime) {
  13153. me.oldTime = me.endTime;
  13154. me.currentTime = me.oldTime;
  13155. }
  13156. } else {
  13157. if (me.oldTime === me.endTime) {
  13158. me.currentTime = me.startTime;
  13159. me.oldTime = me.currentTime;
  13160. }
  13161. }
  13162. me.tick();
  13163. }
  13164. /**
  13165. * @function SuperMap.TimeFlowControl.prototype.stop
  13166. * @override
  13167. */
  13168. stop() {
  13169. super.stop();
  13170. var me = this;
  13171. me.oldTime = me.currentTime;
  13172. if (me.running) {
  13173. me.running = false;
  13174. }
  13175. //清除定时tick
  13176. me.intervalId && window.clearTimeout(me.intervalId);
  13177. }
  13178. /**
  13179. * @function SuperMap.TimeFlowControl.prototype.destroy
  13180. * @override
  13181. */
  13182. destroy() {
  13183. super.destroy();
  13184. var me = this;
  13185. me.oldTime = null;
  13186. me.callback = null;
  13187. }
  13188. /**
  13189. * @function SuperMap.TimeFlowControl.prototype.tick
  13190. * @description 定时刷新。
  13191. */
  13192. tick() {
  13193. var me = this;
  13194. me.intervalId && window.clearInterval(me.intervalId);
  13195. me.intervalId = null;
  13196. me.update();
  13197. me.intervalId = window.setInterval(me.update, me.frequency);
  13198. }
  13199. /**
  13200. * @function SuperMap.TimeFlowControl.prototype.update
  13201. * @override
  13202. */
  13203. update() {
  13204. var me = this;
  13205. //判定是否还需要继续
  13206. if (!me.running) {
  13207. return;
  13208. }
  13209. //调用回调函数
  13210. me.callback && me.callback(me.currentTime); //destroy之后callback就为空,所以需要判定一下
  13211. if (!me.reverse) {
  13212. //如果相等,则代表上一帧已经运行到了最后,下一帧运行初始化的状态
  13213. if (me.currentTime === me.endTime) {
  13214. //不循环时
  13215. if (!me.repeat) {
  13216. me.running = false;
  13217. me.stop();
  13218. return null;
  13219. }
  13220. me.stop();
  13221. me.currentTime = me.startTime;
  13222. me.oldTime = me.currentTime;
  13223. me.start();
  13224. } else {//否则时间递增
  13225. me.oldTime = me.currentTime;
  13226. me.currentTime += me.speed;
  13227. }
  13228. if (me.currentTime >= me.endTime) {
  13229. me.currentTime = me.endTime;
  13230. }
  13231. } else {
  13232. //如果相等,则代表上一帧已经运行到了最前,下一帧运行结束的状态
  13233. if (me.currentTime === me.startTime) {
  13234. //不循环时
  13235. if (!me.repeat) {
  13236. me.running = false;
  13237. return null;
  13238. }
  13239. me.oldTime = me.endTime;
  13240. me.currentTime = me.oldTime;
  13241. } else {//否则时间递减
  13242. me.currentTime = me.oldTime;
  13243. me.oldTime -= me.speed;
  13244. }
  13245. if (me.oldTime <= me.startTime) {
  13246. me.oldTime = me.startTime;
  13247. }
  13248. }
  13249. }
  13250. }
  13251. SuperMap.TimeFlowControl = TimeFlowControl;
  13252. ;// CONCATENATED MODULE: ./src/common/control/index.js
  13253. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13254. * This program are made available under the terms of the Apache License, Version 2.0
  13255. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13256. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  13257. var polyfill = __webpack_require__(107);
  13258. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  13259. var fetch = __webpack_require__(693);
  13260. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  13261. var fetch_jsonp = __webpack_require__(144);
  13262. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  13263. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  13264. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13265. * This program are made available under the terms of the Apache License, Version 2.0
  13266. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13267. let FetchRequest_fetch = window.fetch;
  13268. var setFetch = function (newFetch) {
  13269. FetchRequest_fetch = newFetch;
  13270. }
  13271. /**
  13272. * @function SuperMap.setCORS
  13273. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  13274. * @param {boolean} cors - 是否允许跨域请求。
  13275. */
  13276. var setCORS = SuperMap.setCORS = function (cors) {
  13277. SuperMap.CORS = cors;
  13278. }
  13279. /**
  13280. * @function SuperMap.isCORS
  13281. * @description 是是否允许跨域请求。
  13282. * @returns {boolean} 是否允许跨域请求。
  13283. */
  13284. var isCORS = SuperMap.isCORS = function () {
  13285. if (SuperMap.CORS != undefined) {
  13286. return SuperMap.CORS;
  13287. }
  13288. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  13289. }
  13290. /**
  13291. * @function SuperMap.setRequestTimeout
  13292. * @description 设置请求超时时间。
  13293. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  13294. */
  13295. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  13296. return SuperMap.RequestTimeout = timeout;
  13297. }
  13298. /**
  13299. * @function SuperMap.getRequestTimeout
  13300. * @description 获取请求超时时间。
  13301. * @returns {number} 请求超时时间。
  13302. */
  13303. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  13304. return SuperMap.RequestTimeout || 45000;
  13305. }
  13306. var FetchRequest = SuperMap.FetchRequest = {
  13307. commit: function (method, url, params, options) {
  13308. method = method ? method.toUpperCase() : method;
  13309. switch (method) {
  13310. case 'GET':
  13311. return this.get(url, params, options);
  13312. case 'POST':
  13313. return this.post(url, params, options);
  13314. case 'PUT':
  13315. return this.put(url, params, options);
  13316. case 'DELETE':
  13317. return this.delete(url, params, options);
  13318. default:
  13319. return this.get(url, params, options);
  13320. }
  13321. },
  13322. supportDirectRequest: function (url, options) {
  13323. if (Util.isInTheSameDomain(url)) {
  13324. return true;
  13325. }
  13326. if (options.crossOrigin != undefined) {
  13327. return options.crossOrigin;
  13328. } else {
  13329. return isCORS() || options.proxy;
  13330. }
  13331. },
  13332. get: function (url, params, options) {
  13333. options = options || {};
  13334. var type = 'GET';
  13335. url = Util.urlAppend(url, this._getParameterString(params || {}));
  13336. url = this._processUrl(url, options);
  13337. if (!this.supportDirectRequest(url, options)) {
  13338. url = url.replace('.json', '.jsonp');
  13339. var config = {
  13340. url: url,
  13341. data: params
  13342. };
  13343. return SuperMap.Util.RequestJSONPPromise.GET(config);
  13344. }
  13345. if (!this.urlIsLong(url)) {
  13346. return this._fetch(url, params, options, type);
  13347. } else {
  13348. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  13349. }
  13350. },
  13351. delete: function (url, params, options) {
  13352. options = options || {};
  13353. var type = 'DELETE';
  13354. url = Util.urlAppend(url, this._getParameterString(params || {}));
  13355. url = this._processUrl(url, options);
  13356. if (!this.supportDirectRequest(url, options)) {
  13357. url = url.replace('.json', '.jsonp');
  13358. var config = {
  13359. url: url += "&_method=DELETE",
  13360. data: params
  13361. };
  13362. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  13363. }
  13364. if (this.urlIsLong(url)) {
  13365. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  13366. }
  13367. return this._fetch(url, params, options, type);
  13368. },
  13369. post: function (url, params, options) {
  13370. options = options || {};
  13371. if (!this.supportDirectRequest(url, options)) {
  13372. url = url.replace('.json', '.jsonp');
  13373. var config = {
  13374. url: url += "&_method=POST",
  13375. data: params
  13376. };
  13377. return SuperMap.Util.RequestJSONPPromise.POST(config);
  13378. }
  13379. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  13380. },
  13381. put: function (url, params, options) {
  13382. options = options || {};
  13383. url = this._processUrl(url, options);
  13384. if (!this.supportDirectRequest(url, options)) {
  13385. url = url.replace('.json', '.jsonp');
  13386. var config = {
  13387. url: url += "&_method=PUT",
  13388. data: params
  13389. };
  13390. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  13391. }
  13392. return this._fetch(url, params, options, 'PUT');
  13393. },
  13394. urlIsLong: function (url) {
  13395. //当前url的字节长度。
  13396. var totalLength = 0,
  13397. charCode = null;
  13398. for (var i = 0, len = url.length; i < len; i++) {
  13399. //转化为Unicode编码
  13400. charCode = url.charCodeAt(i);
  13401. if (charCode < 0x007f) {
  13402. totalLength++;
  13403. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  13404. totalLength += 2;
  13405. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  13406. totalLength += 3;
  13407. }
  13408. }
  13409. return totalLength < 2000 ? false : true;
  13410. },
  13411. _postSimulatie: function (type, url, params, options) {
  13412. var separator = url.indexOf('?') > -1 ? '&' : '?';
  13413. url += separator + '_method=' + type;
  13414. if (typeof params !== 'string') {
  13415. params = JSON.stringify(params);
  13416. }
  13417. return this.post(url, params, options);
  13418. },
  13419. _processUrl: function (url, options) {
  13420. if (this._isMVTRequest(url)) {
  13421. return url;
  13422. }
  13423. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  13424. if (url.indexOf('?') < 0) {
  13425. url += '.json';
  13426. } else {
  13427. var urlArrays = url.split('?');
  13428. if (urlArrays.length === 2) {
  13429. url = urlArrays[0] + '.json?' + urlArrays[1];
  13430. }
  13431. }
  13432. }
  13433. if (options && options.proxy) {
  13434. if (typeof options.proxy === 'function') {
  13435. url = options.proxy(url);
  13436. } else {
  13437. url = decodeURIComponent(url);
  13438. url = options.proxy + encodeURIComponent(url);
  13439. }
  13440. }
  13441. return url;
  13442. },
  13443. _fetch: function (url, params, options, type) {
  13444. options = options || {};
  13445. options.headers = options.headers || {};
  13446. if (!options.headers['Content-Type']) {
  13447. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  13448. }
  13449. if (options.timeout) {
  13450. return this._timeout(
  13451. options.timeout,
  13452. FetchRequest_fetch(url, {
  13453. method: type,
  13454. headers: options.headers,
  13455. body: type === 'PUT' || type === 'POST' ? params : undefined,
  13456. credentials: this._getWithCredentials(options),
  13457. mode: 'cors',
  13458. timeout: getRequestTimeout()
  13459. }).then(function (response) {
  13460. return response;
  13461. })
  13462. );
  13463. }
  13464. return FetchRequest_fetch(url, {
  13465. method: type,
  13466. body: type === 'PUT' || type === 'POST' ? params : undefined,
  13467. headers: options.headers,
  13468. credentials: this._getWithCredentials(options),
  13469. mode: 'cors',
  13470. timeout: getRequestTimeout()
  13471. }).then(function (response) {
  13472. return response;
  13473. });
  13474. },
  13475. _getWithCredentials: function (options) {
  13476. if (options.withCredentials === true) {
  13477. return 'include';
  13478. }
  13479. if (options.withCredentials === false) {
  13480. return 'omit';
  13481. }
  13482. return 'same-origin';
  13483. },
  13484. _fetchJsonp: function (url, options) {
  13485. options = options || {};
  13486. return fetch_jsonp_default()(url, {
  13487. method: 'GET',
  13488. timeout: options.timeout
  13489. }).then(function (response) {
  13490. return response;
  13491. });
  13492. },
  13493. _timeout: function (seconds, promise) {
  13494. return new Promise(function (resolve, reject) {
  13495. setTimeout(function () {
  13496. reject(new Error('timeout'));
  13497. }, seconds);
  13498. promise.then(resolve, reject);
  13499. });
  13500. },
  13501. _getParameterString: function (params) {
  13502. var paramsArray = [];
  13503. for (var key in params) {
  13504. var value = params[key];
  13505. if (value != null && typeof value !== 'function') {
  13506. var encodedValue;
  13507. if (Array.isArray(value) || value.toString() === '[object Object]') {
  13508. encodedValue = encodeURIComponent(JSON.stringify(value));
  13509. } else {
  13510. encodedValue = encodeURIComponent(value);
  13511. }
  13512. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  13513. }
  13514. }
  13515. return paramsArray.join('&');
  13516. },
  13517. _isMVTRequest: function (url) {
  13518. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  13519. }
  13520. }
  13521. SuperMap.Util.RequestJSONPPromise = {
  13522. limitLength: 1500,
  13523. queryKeys: [],
  13524. queryValues: [],
  13525. supermap_callbacks: {},
  13526. addQueryStrings: function (values) {
  13527. var me = this;
  13528. for (var key in values) {
  13529. me.queryKeys.push(key);
  13530. if (typeof values[key] !== 'string') {
  13531. values[key] = SuperMap.Util.toJSON(values[key]);
  13532. }
  13533. var tempValue = encodeURIComponent(values[key]);
  13534. me.queryValues.push(tempValue);
  13535. }
  13536. },
  13537. issue: function (config) {
  13538. var me = this,
  13539. uid = me.getUid(),
  13540. url = config.url,
  13541. splitQuestUrl = [];
  13542. var p = new Promise(function (resolve) {
  13543. me.supermap_callbacks[uid] = function (response) {
  13544. delete me.supermap_callbacks[uid];
  13545. resolve(response);
  13546. };
  13547. });
  13548. // me.addQueryStrings({
  13549. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  13550. // });
  13551. var sectionURL = url,
  13552. keysCount = 0; //此次sectionURL中有多少个key
  13553. var length = me.queryKeys ? me.queryKeys.length : 0;
  13554. for (var i = 0; i < length; i++) {
  13555. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  13556. //+2 for ("&"or"?")and"="
  13557. if (keysCount == 0) {
  13558. return false;
  13559. }
  13560. splitQuestUrl.push(sectionURL);
  13561. sectionURL = url;
  13562. keysCount = 0;
  13563. i--;
  13564. } else {
  13565. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  13566. var leftValue = me.queryValues[i];
  13567. while (leftValue.length > 0) {
  13568. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  13569. if (sectionURL.indexOf('?') > -1) {
  13570. sectionURL += '&';
  13571. } else {
  13572. sectionURL += '?';
  13573. }
  13574. var tempLeftValue = leftValue.substring(0, leftLength);
  13575. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  13576. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  13577. leftLength -= 1;
  13578. tempLeftValue = leftValue.substring(0, leftLength);
  13579. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  13580. leftLength -= 2;
  13581. tempLeftValue = leftValue.substring(0, leftLength);
  13582. }
  13583. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  13584. leftValue = leftValue.substring(leftLength);
  13585. if (tempLeftValue.length > 0) {
  13586. splitQuestUrl.push(sectionURL);
  13587. sectionURL = url;
  13588. keysCount = 0;
  13589. }
  13590. }
  13591. } else {
  13592. keysCount++;
  13593. if (sectionURL.indexOf('?') > -1) {
  13594. sectionURL += '&';
  13595. } else {
  13596. sectionURL += '?';
  13597. }
  13598. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  13599. }
  13600. }
  13601. }
  13602. splitQuestUrl.push(sectionURL);
  13603. me.send(
  13604. splitQuestUrl,
  13605. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  13606. config && config.proxy
  13607. );
  13608. return p;
  13609. },
  13610. getUid: function () {
  13611. var uid = new Date().getTime(),
  13612. random = Math.floor(Math.random() * 1e17);
  13613. return uid * 1000 + random;
  13614. },
  13615. send: function (splitQuestUrl, callback, proxy) {
  13616. var len = splitQuestUrl.length;
  13617. if (len > 0) {
  13618. var jsonpUserID = new Date().getTime();
  13619. for (var i = 0; i < len; i++) {
  13620. var url = splitQuestUrl[i];
  13621. if (url.indexOf('?') > -1) {
  13622. url += '&';
  13623. } else {
  13624. url += '?';
  13625. }
  13626. url += 'sectionCount=' + len;
  13627. url += '&sectionIndex=' + i;
  13628. url += '&jsonpUserID=' + jsonpUserID;
  13629. if (proxy) {
  13630. url = decodeURIComponent(url);
  13631. url = proxy + encodeURIComponent(url);
  13632. }
  13633. fetch_jsonp_default()(url, {
  13634. jsonpCallbackFunction: callback,
  13635. timeout: 30000
  13636. });
  13637. }
  13638. }
  13639. },
  13640. GET: function (config) {
  13641. var me = this;
  13642. me.queryKeys.length = 0;
  13643. me.queryValues.length = 0;
  13644. me.addQueryStrings(config.params);
  13645. return me.issue(config);
  13646. },
  13647. POST: function (config) {
  13648. var me = this;
  13649. me.queryKeys.length = 0;
  13650. me.queryValues.length = 0;
  13651. me.addQueryStrings({
  13652. requestEntity: config.data
  13653. });
  13654. return me.issue(config);
  13655. },
  13656. PUT: function (config) {
  13657. var me = this;
  13658. me.queryKeys.length = 0;
  13659. me.queryValues.length = 0;
  13660. me.addQueryStrings({
  13661. requestEntity: config.data
  13662. });
  13663. return me.issue(config);
  13664. },
  13665. DELETE: function (config) {
  13666. var me = this;
  13667. me.queryKeys.length = 0;
  13668. me.queryValues.length = 0;
  13669. me.addQueryStrings({
  13670. requestEntity: config.data
  13671. });
  13672. return me.issue(config);
  13673. }
  13674. };
  13675. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  13676. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  13677. * This program are made available under the terms of the Apache License, Version 2.0
  13678. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  13679. /**
  13680. * @name SecurityManager
  13681. * @memberOf SuperMap
  13682. * @namespace
  13683. * @category Security
  13684. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  13685. * > 使用说明:
  13686. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  13687. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  13688. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  13689. */
  13690. class SecurityManager {
  13691. /**
  13692. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  13693. * @function SuperMap.SecurityManager.generateToken
  13694. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  13695. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  13696. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  13697. */
  13698. static generateToken(url, tokenParam) {
  13699. var serverInfo = this.servers[url];
  13700. if (!serverInfo) {
  13701. return;
  13702. }
  13703. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  13704. return response.text();
  13705. });
  13706. }
  13707. /**
  13708. * @description 注册安全服务器相关信息。
  13709. * @function SuperMap.SecurityManager.registerServers
  13710. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  13711. */
  13712. static registerServers(serverInfos) {
  13713. this.servers = this.servers || {};
  13714. if (!Util.isArray(serverInfos)) {
  13715. serverInfos = [serverInfos];
  13716. }
  13717. for (var i = 0; i < serverInfos.length; i++) {
  13718. var serverInfo = serverInfos[i];
  13719. this.servers[serverInfo.server] = serverInfo;
  13720. }
  13721. }
  13722. /**
  13723. * @description 服务请求都会自动带上这个 token。
  13724. * @function SuperMap.SecurityManager.registerToken
  13725. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  13726. * @param {string} token - token
  13727. */
  13728. static registerToken(url, token) {
  13729. this.tokens = this.tokens || {};
  13730. if (!url || !token) {
  13731. return;
  13732. }
  13733. var domain = this._getTokenStorageKey(url);
  13734. this.tokens[domain] = token;
  13735. }
  13736. /**
  13737. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  13738. * @function SuperMap.SecurityManager.registerKey
  13739. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  13740. * @param {string} key - key
  13741. */
  13742. static registerKey(ids, key) {
  13743. this.keys = this.keys || {};
  13744. if (!ids || ids.length < 1 || !key) {
  13745. return;
  13746. }
  13747. ids = (Util.isArray(ids)) ? ids : [ids];
  13748. for (var i = 0; i < ids.length; i++) {
  13749. var id = this._getUrlRestString(ids[0]) || ids[0];
  13750. this.keys[id] = key;
  13751. }
  13752. }
  13753. /**
  13754. * @description 获取服务器信息。
  13755. * @function SuperMap.SecurityManager.getServerInfo
  13756. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  13757. * @returns {SuperMap.ServerInfo} 服务器信息。
  13758. */
  13759. static getServerInfo(url) {
  13760. this.servers = this.servers || {};
  13761. return this.servers[url];
  13762. }
  13763. /**
  13764. * @description 根据 Url 获取token。
  13765. * @function SuperMap.SecurityManager.getToken
  13766. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  13767. * @returns {string} token
  13768. */
  13769. static getToken(url) {
  13770. if (!url) {
  13771. return;
  13772. }
  13773. this.tokens = this.tokens || {};
  13774. var domain = this._getTokenStorageKey(url);
  13775. return this.tokens[domain];
  13776. }
  13777. /**
  13778. * @description 根据 Url 获取 key。
  13779. * @function SuperMap.SecurityManager.getKey
  13780. * @param {string} id - id
  13781. * @returns {string} key
  13782. */
  13783. static getKey(id) {
  13784. this.keys = this.keys || {};
  13785. var key = this._getUrlRestString(id) || id;
  13786. return this.keys[key];
  13787. }
  13788. /**
  13789. * @description iServer 登录验证。
  13790. * @function SuperMap.SecurityManager.loginiServer
  13791. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13792. * @param {string} username - 用户名。
  13793. * @param {string} password - 密码。
  13794. * @param {boolean} [rememberme=false] - 是否记住。
  13795. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  13796. */
  13797. static loginiServer(url, username, password, rememberme) {
  13798. url = Util.urlPathAppend(url, 'services/security/login');
  13799. var loginInfo = {
  13800. username: username && username.toString(),
  13801. password: password && password.toString(),
  13802. rememberme: rememberme
  13803. };
  13804. loginInfo = JSON.stringify(loginInfo);
  13805. var requestOptions = {
  13806. headers: {
  13807. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13808. }
  13809. };
  13810. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  13811. return response.json();
  13812. });
  13813. }
  13814. /**
  13815. * @description iServer登出。
  13816. * @function SuperMap.SecurityManager.logoutiServer
  13817. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13818. * @returns {Promise} 是否登出成功。
  13819. */
  13820. static logoutiServer(url) {
  13821. url = Util.urlPathAppend(url, 'services/security/logout');
  13822. var requestOptions = {
  13823. headers: {
  13824. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13825. },
  13826. withoutFormatSuffix: true
  13827. };
  13828. return FetchRequest.get(url, "", requestOptions).then(function () {
  13829. return true;
  13830. }).catch(function () {
  13831. return false;
  13832. });
  13833. }
  13834. /**
  13835. * @description Online 登录验证。
  13836. * @function SuperMap.SecurityManager.loginOnline
  13837. * @param {string} callbackLocation - 跳转位置。
  13838. * @param {boolean} [newTab=true] - 是否新窗口打开。
  13839. */
  13840. static loginOnline(callbackLocation, newTab) {
  13841. var loginUrl = SecurityManager.SSO + "/login?service=" + callbackLocation;
  13842. this._open(loginUrl, newTab);
  13843. }
  13844. /**
  13845. * @description iPortal登录验证。
  13846. * @function SuperMap.SecurityManager.loginiPortal
  13847. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13848. * @param {string} username - 用户名。
  13849. * @param {string} password - 密码。
  13850. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  13851. */
  13852. static loginiPortal(url, username, password) {
  13853. url = Util.urlPathAppend(url, 'web/login');
  13854. var loginInfo = {
  13855. username: username && username.toString(),
  13856. password: password && password.toString()
  13857. };
  13858. loginInfo = JSON.stringify(loginInfo);
  13859. var requestOptions = {
  13860. headers: {
  13861. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13862. },
  13863. withCredentials: true
  13864. };
  13865. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  13866. return response.json();
  13867. });
  13868. }
  13869. /**
  13870. * @description iPortal 登出。
  13871. * @function SuperMap.SecurityManager.logoutiPortal
  13872. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13873. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  13874. */
  13875. static logoutiPortal(url) {
  13876. url = Util.urlPathAppend(url, 'services/security/logout');
  13877. var requestOptions = {
  13878. headers: {
  13879. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  13880. },
  13881. withCredentials: true,
  13882. withoutFormatSuffix: true
  13883. };
  13884. return FetchRequest.get(url, "", requestOptions).then(function () {
  13885. return true;
  13886. }).catch(function () {
  13887. return false;
  13888. });
  13889. }
  13890. /**
  13891. * @description iManager 登录验证。
  13892. * @function SuperMap.SecurityManager.loginManager
  13893. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  13894. * @param {Object} [loginInfoParams] - iManager 登录参数。
  13895. * @param {string} loginInfoParams.userName - 用户名。
  13896. * @param {string} loginInfoParams.password - 密码。
  13897. * @param {Object} options
  13898. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  13899. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  13900. */
  13901. static loginManager(url, loginInfoParams, options) {
  13902. if (!Util.isInTheSameDomain(url)) {
  13903. var isNewTab = options ? options.isNewTab : true;
  13904. this._open(url, isNewTab);
  13905. return;
  13906. }
  13907. var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
  13908. var params = loginInfoParams || {};
  13909. var loginInfo = {
  13910. username: params.userName && params.userName.toString(),
  13911. password: params.password && params.password.toString()
  13912. };
  13913. loginInfo = JSON.stringify(loginInfo);
  13914. var requestOptions = {
  13915. headers: {
  13916. 'Accept': '*/*',
  13917. 'Content-Type': 'application/json'
  13918. }
  13919. };
  13920. var me = this;
  13921. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  13922. response.text().then(function (result) {
  13923. me.imanagerToken = result;
  13924. return result;
  13925. });
  13926. });
  13927. }
  13928. /**
  13929. * @description 清空全部验证信息。
  13930. * @function SuperMap.SecurityManager.destroyAllCredentials
  13931. */
  13932. static destroyAllCredentials() {
  13933. this.keys = null;
  13934. this.tokens = null;
  13935. this.servers = null;
  13936. }
  13937. /**
  13938. * @description 清空令牌信息。
  13939. * @function SuperMap.SecurityManager.destroyToken
  13940. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  13941. */
  13942. static destroyToken(url) {
  13943. if (!url) {
  13944. return;
  13945. }
  13946. var domain = this._getTokenStorageKey(url);
  13947. this.tokens = this.tokens || {};
  13948. if (this.tokens[domain]) {
  13949. delete this.tokens[domain];
  13950. }
  13951. }
  13952. /**
  13953. * @description 清空服务授权码。
  13954. * @function SuperMap.SecurityManager.destroyKey
  13955. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  13956. */
  13957. static destroyKey(url) {
  13958. if (!url) {
  13959. return;
  13960. }
  13961. this.keys = this.keys || {};
  13962. var key = this._getUrlRestString(url) || url;
  13963. if (this.keys[key]) {
  13964. delete this.keys[key];
  13965. }
  13966. }
  13967. static _open(url, newTab) {
  13968. newTab = (newTab != null) ? newTab : true;
  13969. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  13970. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  13971. var options =
  13972. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  13973. ",top=" + offsetY + ", left=" + offsetX +
  13974. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  13975. if (newTab) {
  13976. window.open(url, 'login');
  13977. } else {
  13978. window.open(url, 'login', options);
  13979. }
  13980. }
  13981. static _getTokenStorageKey(url) {
  13982. var patten = /(.*?):\/\/([^\/]+)/i;
  13983. var result = url.match(patten);
  13984. if (!result) {
  13985. return url;
  13986. }
  13987. return result[0];
  13988. }
  13989. static _getUrlRestString(url) {
  13990. if (!url) {
  13991. return url;
  13992. }
  13993. // var patten = /http:\/\/(.*\/rest)/i;
  13994. var patten = /(http|https):\/\/(.*\/rest)/i;
  13995. var result = url.match(patten);
  13996. if (!result) {
  13997. return url;
  13998. }
  13999. return result[0];
  14000. }
  14001. }
  14002. SecurityManager.INNER_WINDOW_WIDTH = 600;
  14003. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  14004. SecurityManager.SSO = "https://sso.supermap.com";
  14005. SecurityManager.ONLINE = "https://www.supermapol.com";
  14006. SuperMap.SecurityManager = SecurityManager;
  14007. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerServiceBase.js
  14008. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14009. * This program are made available under the terms of the Apache License, Version 2.0
  14010. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14011. /**
  14012. * @class SuperMap.iManagerServiceBase
  14013. * @classdesc iManager 服务基类(有权限限制的类需要实现此类)。
  14014. * @category iManager
  14015. * @param {string} url - iManager 首页地址,如:http://localhost:8390/imanager。
  14016. * @param {Object} options - 服务参数。
  14017. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14018. * @param {Object} [options.headers] - 请求头。
  14019. */
  14020. class IManagerServiceBase {
  14021. constructor(url,options) {
  14022. if (url) {
  14023. var end = url.substr(url.length - 1, 1);
  14024. this.serviceUrl = end === "/" ? url.substr(0, url.length - 2) : url;
  14025. }
  14026. this.options = options || {};
  14027. this.CLASS_NAME = "SuperMap.iManagerServiceBase";
  14028. }
  14029. /**
  14030. * @function SuperMap.iManagerServiceBase.prototype.request
  14031. * @description 子类统一通过该方法发送请求。
  14032. * @param {string} url - 请求 URL。
  14033. * @param {string} [method='GET'] - 请求类型。
  14034. * @param {Object} [requestOptions] - 请求选项。
  14035. * @param {Object} param - 请求参数。
  14036. * @description 发送请求。
  14037. * @returns {Promise} Promise 对象。
  14038. */
  14039. request(method, url, param, requestOptions) {
  14040. requestOptions = requestOptions || {
  14041. headers: {
  14042. 'Accept': '*/*',
  14043. 'Content-Type': 'application/json'
  14044. }
  14045. };
  14046. if (!requestOptions.hasOwnProperty("withCredentials")) {
  14047. requestOptions['withCredentials'] = true;
  14048. }
  14049. requestOptions['crossOrigin'] = this.options.crossOrigin;
  14050. requestOptions['headers'] = this.options.headers;
  14051. var token = SecurityManager.imanagerToken;
  14052. if (token) {
  14053. if (!requestOptions.headers) {
  14054. requestOptions.headers = [];
  14055. }
  14056. requestOptions.headers['X-Auth-Token'] = token;
  14057. }
  14058. if (param) {
  14059. param = JSON.stringify(param);
  14060. }
  14061. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  14062. return response.json();
  14063. });
  14064. }
  14065. }
  14066. SuperMap.iManagerServiceBase = IManagerServiceBase;
  14067. ;// CONCATENATED MODULE: ./src/common/iManager/iManagerCreateNodeParam.js
  14068. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14069. * This program are made available under the terms of the Apache License, Version 2.0
  14070. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14071. /**
  14072. * @class SuperMap.iManagerCreateNodeParam
  14073. * @classdesc iManager 创建节点参数。
  14074. * @category iManager
  14075. * @param {Object} [params] - iManager 创建节点参数。
  14076. *
  14077. */
  14078. class IManagerCreateNodeParam {
  14079. constructor(params) {
  14080. params = params || {};
  14081. this.nodeSpec = 'SMALL'; //取值范围: ['SMALL','MEDIUM','LARGE'] 以及自定义的环境规格名称
  14082. this.nodeCount = 1; //要创建vm的个数
  14083. this.nodeName = ''; //vm名称
  14084. this.password = ''; //vm的密码,空表示随机分配
  14085. this.description = ''; //描述信息
  14086. this.physicalMachineName = ''; //vm所属的物理机名称.
  14087. this.ips = []; //vm的ip,空数组表示随机分配
  14088. this.userName = ''; //vm所属用户
  14089. Util.extend(this, params);
  14090. }
  14091. }
  14092. SuperMap.iManagerCreateNodeParam = IManagerCreateNodeParam;
  14093. ;// CONCATENATED MODULE: ./src/common/iManager/iManager.js
  14094. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14095. * This program are made available under the terms of the Apache License, Version 2.0
  14096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14097. /**
  14098. * @class SuperMap.iManager
  14099. * @classdesc iManager 服务类。
  14100. * @category iManager
  14101. * @param {string} serviceUrl - iManager 首页地址。
  14102. *
  14103. */
  14104. class IManager extends IManagerServiceBase {
  14105. constructor(iManagerUrl) {
  14106. super(iManagerUrl);
  14107. }
  14108. /**
  14109. * @function SuperMap.iManager.prototype.load
  14110. * @description 获取所有服务接口,验证是否已登录授权。
  14111. * @returns {Promise} Promise 对象。
  14112. */
  14113. load() {
  14114. return this.request("GET", this.serviceUrl + '/web/api/service.json');
  14115. }
  14116. /**
  14117. * @function SuperMap.iManager.prototype.createIServer
  14118. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  14119. * @description 创建 iServer。
  14120. * @returns {Promise} Promise 对象。
  14121. */
  14122. createIServer(createParam) {
  14123. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/server.json', new IManagerCreateNodeParam(createParam));
  14124. }
  14125. /**
  14126. * @function SuperMap.iManager.prototype.createIPortal
  14127. * @param {SuperMap.iManagerCreateNodeParam} createParam - 创建参数。
  14128. * @description 创建 iPortal。
  14129. * @returns {Promise} Promise 对象。
  14130. */
  14131. createIPortal(createParam) {
  14132. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/portal.json', new IManagerCreateNodeParam(createParam));
  14133. }
  14134. /**
  14135. * @function SuperMap.iManager.prototype.iServerList
  14136. * @description 获取所有创建的 iServer。
  14137. * @returns {Promise} Promise 对象。
  14138. */
  14139. iServerList() {
  14140. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/server.json');
  14141. }
  14142. /**
  14143. * @function SuperMap.iManager.prototype.iPortalList
  14144. * @description 获取所有创建的 iPortal。
  14145. * @returns {Promise} Promise 对象。
  14146. */
  14147. iPortalList() {
  14148. return this.request("GET", this.serviceUrl + '/icloud/web/nodes/portal.json');
  14149. }
  14150. /**
  14151. * @function SuperMap.iManager.prototype.startNodes
  14152. * @param {Array} ids - 需要启动节点的 ID 数组。e.g:['1']。
  14153. * @description 启动节点。
  14154. * @returns {Promise} Promise 对象。
  14155. */
  14156. startNodes(ids) {
  14157. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/started.json', ids);
  14158. }
  14159. /**
  14160. * @function SuperMap.iManager.prototype.stopNodes
  14161. * @param {Array} ids - 需要停止节点的 ID 数组。e.g:['1']。
  14162. * @description 停止节点。
  14163. * @returns {Promise} Promise 对象。
  14164. */
  14165. stopNodes(ids) {
  14166. return this.request("POST", this.serviceUrl + '/icloud/web/nodes/stopped.json', ids);
  14167. }
  14168. }
  14169. SuperMap.iManager = IManager;
  14170. ;// CONCATENATED MODULE: ./src/common/iManager/index.js
  14171. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14172. * This program are made available under the terms of the Apache License, Version 2.0
  14173. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14174. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalServiceBase.js
  14175. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14176. * This program are made available under the terms of the Apache License, Version 2.0
  14177. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14178. /**
  14179. * @class SuperMap.iPortalServiceBase
  14180. * @classdesc iPortal 服务基类(有权限限制的类需要实现此类)。
  14181. * @category iPortal/Online
  14182. * @param {string} url - iPortal 服务地址。
  14183. * @param {Object} options - 可选参数。
  14184. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  14185. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  14186. * @param {Object} [options.headers] - 请求头。
  14187. */
  14188. class IPortalServiceBase {
  14189. constructor(url, options) {
  14190. options = options || {};
  14191. this.serviceUrl = url;
  14192. this.serverType = ServerType.iPortal;
  14193. this.CLASS_NAME = "SuperMap.iPortalServiceBase";
  14194. this.withCredentials = options.withCredentials || false;
  14195. this.crossOrigin = options.crossOrigin
  14196. this.headers = options.headers
  14197. }
  14198. /**
  14199. * @function SuperMap.iPortalServiceBase.prototype.request
  14200. * @description 子类统一通过该方法发送请求。
  14201. * @param {string} [method='GET'] - 请求类型。
  14202. * @param {string} url - 服务地址。
  14203. * @param {Object} param - 请求参数。
  14204. * @param {Object} [requestOptions] - fetch 请求配置项。
  14205. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  14206. */
  14207. request(method, url, param, requestOptions = {headers: this.headers, crossOrigin: this.crossOrigin, withCredentials: this.withCredentials }) {
  14208. url = this.createCredentialUrl(url);
  14209. return FetchRequest.commit(method, url, param, requestOptions).then(function (response) {
  14210. return response.json();
  14211. });
  14212. }
  14213. /**
  14214. * @function SuperMap.iPortalServiceBase.prototype.createCredentialUrl
  14215. * @description 追加授权信息。
  14216. * @param {string} url - 创建证书 URL 地址。
  14217. * @returns {string} 携带 token 或 key 的新地址。
  14218. */
  14219. createCredentialUrl(url) {
  14220. var newUrl = url,
  14221. credential = this.getCredential();
  14222. if (credential) {
  14223. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  14224. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  14225. newUrl += credential.getUrlParameters();
  14226. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  14227. newUrl += "&" + credential.getUrlParameters();
  14228. } else {
  14229. newUrl += "?" + credential.getUrlParameters();
  14230. }
  14231. }
  14232. return newUrl;
  14233. }
  14234. /**
  14235. * @function SuperMap.iPortalServiceBase.prototype.getCredential
  14236. * @description 获取 token。
  14237. * @returns {string} 返回获取的 token。
  14238. *
  14239. */
  14240. getCredential() {
  14241. var credential,
  14242. value = SecurityManager.getToken(this.serviceUrl);
  14243. credential = value ? new Credential(value, "token") : null;
  14244. if (!credential) {
  14245. value = this.getKey();
  14246. credential = value ? new Credential(value, "key") : null;
  14247. }
  14248. return credential;
  14249. }
  14250. /**
  14251. * @function SuperMap.iPortalServiceBase.prototype.getKey
  14252. * @description 其子类需要重写该方法,修改其中获取 key 的字段,存储 key 可能是服务 ID 字段,可能是 URL。
  14253. */
  14254. getKey() {
  14255. //return SuperMap.SecurityManager.getKey(this.id);
  14256. //或
  14257. //return SuperMap.SecurityManager.getKey(this.serviceUrl);
  14258. }
  14259. }
  14260. SuperMap.iPortalServiceBase = IPortalServiceBase;
  14261. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryParam.js
  14262. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14263. * This program are made available under the terms of the Apache License, Version 2.0
  14264. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14265. /**
  14266. * @class SuperMap.iPortalQueryParam
  14267. * @classdesc iPortal 资源查询参数。
  14268. * @version 10.0.1
  14269. * @category iPortal/Online
  14270. * @param {Object} params - iPortal 资源查询具体参数。
  14271. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型
  14272. * @param {number} [params.pageSize] - 分页中每页大小。
  14273. * @param {number} [params.currentPage] - 分页页码。
  14274. * @param {SuperMap.OrderBy} [params.orderBy] - 排序字段。
  14275. * @param {SuperMap.OrderType} [params.orderType] - 根据升序还是降序过滤。
  14276. * @param {SuperMap.SearchType} [params.searchType] - 根据查询的范围进行过滤。
  14277. * @param {Array} [params.tags] - 标签。
  14278. * @param {Array} [params.dirIds] - 目录 id
  14279. * @param {Array} [params.resourceSubTypes] - 根据资源的子类型进行过滤。
  14280. * @param {SuperMap.AggregationTypes} [params.aggregationTypes] - 聚合查询的类型。
  14281. * @param {string} [params.text] - 搜索的关键词。
  14282. * @param {Array} [params.groupIds] - 根据群组进行过滤。
  14283. * @param {Array} [params.departmentIds] - 根据部门进行过滤。
  14284. */
  14285. class IPortalQueryParam {
  14286. constructor(params) {
  14287. params = params || {};
  14288. this.resourceType = ""; // 空为全部 MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  14289. this.pageSize = 12; // 每页多少条
  14290. this.currentPage = 1; // 第几页
  14291. this.orderBy = "UPDATETIME"; // UPDATETIME HEATLEVEL
  14292. this.orderType = "DESC"; // DESC ASC
  14293. this.searchType = "PUBLIC"; // PUBLIC SHARETOME_RES MYDEPARTMENT_RES MYGROUP_RES MY_RES
  14294. this.tags = []; // 标签
  14295. this.dirIds = []; // 类别
  14296. this.resourceSubTypes = []; // 类型
  14297. this.aggregationTypes = []; // TAG TYPE SUBTYPE
  14298. this.text = ""; // 搜索字段
  14299. this.groupIds = []; // 群组Id过滤
  14300. this.departmentIds = []; // 部门Id过滤
  14301. Util.extend(this, params);
  14302. }
  14303. }
  14304. SuperMap.iPortalQueryParam = IPortalQueryParam;
  14305. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalQueryResult.js
  14306. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14307. * This program are made available under the terms of the Apache License, Version 2.0
  14308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14309. /**
  14310. * @class SuperMap.iPortalQueryResult
  14311. * @classdesc iPortal 资源结果集封装类。
  14312. * @version 10.0.1
  14313. * @category iPortal/Online
  14314. * @param {Object} queryResult - 资源参数。
  14315. * @param {Array} [queryResult.content] - 页面内容。
  14316. * @param {number} [queryResult.total] - 总记录数。
  14317. * @param {number} [queryResult.currentPage] - 当前第几页。
  14318. * @param {number} [queryResult.pageSize] - 每页大小。
  14319. * @param {Object} [queryResult.aggregations] - 聚合查询的结果。
  14320. */
  14321. class IPortalQueryResult {
  14322. constructor(queryResult) {
  14323. queryResult = queryResult || {};
  14324. this.content = [];
  14325. this.total = 0;
  14326. this.currentPage = 1;
  14327. this.pageSize = 12;
  14328. this.aggregations = null;
  14329. Util.extend(this, queryResult);
  14330. }
  14331. }
  14332. SuperMap.iPortalQueryResult = IPortalQueryResult;
  14333. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalResource.js
  14334. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14335. * This program are made available under the terms of the Apache License, Version 2.0
  14336. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14337. /**
  14338. * @class SuperMap.iPortalResource
  14339. * @classdesc iPortal 资源详情类。
  14340. * @version 10.0.1
  14341. * @category iPortal/Online
  14342. * @param {string} portalUrl - 资源地址。
  14343. * @param {Object} resourceInfo - 资源详情参数。
  14344. * @param {Array} [resourceInfo.authorizeSetting] - 资源的授权信息
  14345. * @param {string} [resourceInfo.bounds] - 资源的坐标范围
  14346. * @param {string} [resourceInfo.bounds4326] - 资源的坐标范围,转换为EPSG 4326坐标系统后的地理范围。
  14347. * @param {string} [resourceInfo.checkStatus] - 资源的审核状态,可以是:空,SUCCESSFUL,UNCHECKED,FAILED
  14348. * @param {Date} [resourceInfo.createTime] - 资源的创建时间
  14349. * @param {string} [resourceInfo.description] - 资源描述
  14350. * @param {number} [resourceInfo.dirId] - 资源所在的门户目录的id
  14351. * @param {number} [resourceInfo.epsgCode] - 门户资源基于的坐标系的EPSG值。
  14352. * @param {number} [resourceInfo.heatLevel] - 记录资源的访问量或下载量。
  14353. * @param {string} [resourceInfo.id] - 资源存储到ElasticSearch中的文档id
  14354. * @param {string} [resourceInfo.name] - 资源名称
  14355. * @param {number} [resourceInfo.personalDirId] - 资源所在的个人目录的id
  14356. * @param {number} [resourceInfo.resourceId] - 资源表(maps,services等)里的id
  14357. * @param {string} [resourceInfo.resourceSubType] - 某类资源的具体子类型。
  14358. * @param {SuperMap.ResourceType} [resourceInfo.resourceType] - 资源类型
  14359. * @param {number} [resourceInfo.serviceRootUrlId] - 批量注册服务时,服务根地址的ID
  14360. * @param {Array} [resourceInfo.tags] - 资源的标签
  14361. * @param {string} [resourceInfo.thumbnail] - 资源的缩略图
  14362. * @param {Date} [resourceInfo.updateTime] - 资源的更新时间
  14363. * @param {string} [resourceInfo.userName] - 搜索的关键词
  14364. * @param {Object} [resourceInfo.sourceJSON] - 提供了门户项目返回的所有信息。
  14365. * @extends {SuperMap.iPortalServiceBase}
  14366. */
  14367. class IPortalResource extends IPortalServiceBase {
  14368. constructor(portalUrl, resourceInfo) {
  14369. super(portalUrl);
  14370. resourceInfo = resourceInfo || {};
  14371. this.authorizeSetting = [];
  14372. this.bounds = "";
  14373. this.bounds4326 = "";
  14374. this.checkStatus = "";
  14375. this.createTime = 0;
  14376. this.description = null;
  14377. this.dirId = null;
  14378. this.epsgCode = 0;
  14379. this.heatLevel = 0;
  14380. this.id = 0;
  14381. this.name = "";
  14382. this.personalDirId = null;
  14383. this.resourceId = 0;
  14384. this.resourceSubType = null;
  14385. this.resourceType = null;
  14386. this.serviceRootUrlId = null;
  14387. this.tags = null;
  14388. this.thumbnail = null;
  14389. this.updateTime = 0;
  14390. this.userName = "";
  14391. this.sourceJSON = {};//返回门户资源详细信息
  14392. Util.extend(this, resourceInfo); // INSIGHTS_WORKSPACE MAP_DASHBOARD
  14393. this.resourceUrl = portalUrl + "/web/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  14394. if (this.withCredentials) {
  14395. this.resourceUrl = portalUrl + "/web/mycontent/"+this.resourceType.replace("_","").toLowerCase()+"s/" + this.resourceId;
  14396. }
  14397. // if (this.id) {
  14398. // this.mapUrl = mapUrl + "/" + this.id;
  14399. // }
  14400. }
  14401. /**
  14402. * @function SuperMap.iPortalResource.prototype.load
  14403. * @description 加载资源信息。
  14404. * @returns {Promise} 返回 Promise 对象。如果成功,Promise 没有返回值,请求返回结果自动填充到该类的属性中;如果失败,Promise 返回值包含错误信息。
  14405. */
  14406. load() {
  14407. var me = this;
  14408. return me.request("GET", me.resourceUrl + ".json")
  14409. .then(function (resourceInfo) {
  14410. if (resourceInfo.error) {
  14411. return resourceInfo;
  14412. }
  14413. me.sourceJSON = resourceInfo;
  14414. });
  14415. }
  14416. /**
  14417. * @function SuperMap.iPortalResource.prototype.update
  14418. * @description 更新资源属性信息。
  14419. * @returns {Promise} 返回包含更新操作状态的 Promise 对象。
  14420. */
  14421. update() {
  14422. var resourceName = this.resourceType.replace("_","").toLowerCase();
  14423. var options = {
  14424. headers: {'Content-Type': 'application/x-www-form-urlencoded'}
  14425. };
  14426. if( resourceName === 'data') {
  14427. this.resourceUrl = this.resourceUrl + "/attributes.json";
  14428. }
  14429. var entity = JSON.stringify(this.sourceJSON);
  14430. //对服务资源进行编辑时,请求体内容只留关键字字段(目前如果是全部字段 更新返回成功 但其实没有真正的更新)
  14431. if( resourceName === 'service') {
  14432. var serviceInfo = {
  14433. authorizeSetting:this.sourceJSON.authorizeSetting,
  14434. metadata:this.sourceJSON.metadata,
  14435. tags:this.sourceJSON.tags,
  14436. thumbnail:this.sourceJSON.thumbnail,
  14437. tokenRefreshUrl:this.sourceJSON.tokenRefreshUrl
  14438. };
  14439. entity = JSON.stringify(serviceInfo);
  14440. }
  14441. return this.request("PUT", this.resourceUrl, entity, options);
  14442. }
  14443. }
  14444. SuperMap.iPortalResource = IPortalResource;
  14445. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareParam.js
  14446. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14447. * This program are made available under the terms of the Apache License, Version 2.0
  14448. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14449. /**
  14450. * @class SuperMap.iPortalShareParam
  14451. * @classdesc iPortal 资源共享参数。
  14452. * @version 10.0.1
  14453. * @category iPortal/Online
  14454. * @param {Object} params - iPortal 资源共享具体参数。
  14455. * @param {SuperMap.ResourceType} [params.resourceType] - 资源类型。
  14456. * @param {Array} [params.ids] - 资源的id数组。
  14457. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  14458. */
  14459. class IPortalShareParam {
  14460. constructor(params) {
  14461. params = params || {};
  14462. this.ids = [];
  14463. this.entities = [];
  14464. this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
  14465. Util.extend(this, params);
  14466. }
  14467. }
  14468. SuperMap.iPortalShareParam = IPortalShareParam;
  14469. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortal.js
  14470. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14471. * This program are made available under the terms of the Apache License, Version 2.0
  14472. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14473. /**
  14474. * @class SuperMap.iPortal
  14475. * @classdesc 对接 SuperMap iPortal 基础服务。
  14476. * @category iPortal/Online
  14477. * @extends {SuperMap.iPortalServiceBase}
  14478. * @param {string} iportalUrl - 地址。
  14479. * @param {Object} options - 参数。
  14480. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  14481. */
  14482. class IPortal extends IPortalServiceBase {
  14483. constructor(iportalUrl, options) {
  14484. super(iportalUrl, options);
  14485. this.iportalUrl = iportalUrl;
  14486. options = options || {};
  14487. this.withCredentials = options.withCredentials || false;
  14488. }
  14489. /**
  14490. * @function SuperMap.iPortal.prototype.load
  14491. * @description 加载页面。
  14492. * @returns {Promise} 返回包含 iportal web 资源信息的 Promise 对象。
  14493. */
  14494. load() {
  14495. return FetchRequest.get(this.iportalUrl + "/web");
  14496. }
  14497. /**
  14498. * @function SuperMap.iPortal.prototype.queryResources
  14499. * @description 查询资源。
  14500. * @version 10.0.1
  14501. * @param {SuperMap.iPortalQueryParam} queryParams - 查询参数。
  14502. * @returns {Promise} 返回包含所有资源结果的 Promise 对象。
  14503. */
  14504. queryResources(queryParams) {
  14505. if (!(queryParams instanceof IPortalQueryParam)) {
  14506. return new Promise( function(resolve){
  14507. resolve(
  14508. "queryParams is not instanceof iPortalQueryParam !"
  14509. );
  14510. });
  14511. }
  14512. var me = this;
  14513. var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
  14514. queryParams.t = new Date().getTime();
  14515. return this.request("GET", resourceUrl, queryParams).then(function(result) {
  14516. var content = [];
  14517. result.content.forEach(function(item) {
  14518. content.push(new IPortalResource(me.iportalUrl, item));
  14519. });
  14520. let queryResult = new IPortalQueryResult();
  14521. queryResult.content = content;
  14522. queryResult.total = result.total;
  14523. queryResult.currentPage = result.currentPage;
  14524. queryResult.pageSize = result.pageSize;
  14525. queryResult.aggregations = result.aggregations;
  14526. return queryResult;
  14527. });
  14528. }
  14529. /**
  14530. * @function SuperMap.iPortal.prototype.updateResourcesShareSetting
  14531. * @description 更新共享设置。
  14532. * @version 10.0.1
  14533. * @param {SuperMap.iPortalShareParam} shareParams - 共享的参数。
  14534. * @returns {Promise} 返回包含共享资源结果的 Promise 对象。
  14535. */
  14536. updateResourcesShareSetting(shareParams) {
  14537. if (!(shareParams instanceof IPortalShareParam)) {
  14538. return new Promise( function(resolve){
  14539. resolve(
  14540. "shareParams is not instanceof iPortalShareParam !"
  14541. );
  14542. });
  14543. }
  14544. var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
  14545. if(resourceUrlName === "datas"){
  14546. resourceUrlName = "mycontent/"+resourceUrlName;
  14547. }
  14548. var cloneShareParams = {
  14549. ids: shareParams.ids,
  14550. entities: shareParams.entities
  14551. }
  14552. var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
  14553. return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
  14554. return result;
  14555. });
  14556. }
  14557. }
  14558. SuperMap.iPortal = IPortal;
  14559. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalShareEntity.js
  14560. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14561. * This program are made available under the terms of the Apache License, Version 2.0
  14562. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14563. /**
  14564. * @class SuperMap.iPortalShareEntity
  14565. * @classdesc iPortal 资源共享实体参数。
  14566. * @version 10.0.1
  14567. * @category iPortal/Online
  14568. * @param {Object} shareEntity - iPortal 资源共享实体具体参数。
  14569. * @param {SuperMap.PermissionType} [shareEntity.permissionType] - 权限类型。
  14570. * @param {SuperMap.EntityType} [shareEntity.entityType] - 实体类型
  14571. * @param {string} [shareEntity.entityName] - 实体 Name。对应的 USER(用户)、 ROLE(角色)、GROUP(用户组)、IPORTALGROUP(群组)的名称。
  14572. * @param {number} [shareEntity.entityId] - 实体的 id。用于群组的授权。
  14573. */
  14574. class IPortalShareEntity {
  14575. constructor(shareEntity) {
  14576. shareEntity = shareEntity || {};
  14577. this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
  14578. this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
  14579. this.entityName = "GUEST"; // GUEST or 具体用户 name
  14580. this.entityId = null;
  14581. Util.extend(this, shareEntity);
  14582. }
  14583. }
  14584. SuperMap.iPortalShareEntity = IPortalShareEntity;
  14585. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddResourceParam.js
  14586. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14587. * This program are made available under the terms of the Apache License, Version 2.0
  14588. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14589. /**
  14590. * @class SuperMap.iPortalAddResourceParam
  14591. * @classdesc iPortal 添加资源参数。
  14592. * @version 10.0.1
  14593. * @category iPortal/Online
  14594. * @param {Object} params - iPortal 添加资源具体参数。
  14595. * @param {String} [params.rootUrl] - 服务地址。
  14596. * @param {Array} [params.tags] - 标签。
  14597. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  14598. */
  14599. class IPortalAddResourceParam {
  14600. constructor(params) {
  14601. params = params || {};
  14602. this.rootUrl = "";
  14603. this.tags = [];
  14604. this.entities = [];
  14605. Util.extend(this, params);
  14606. }
  14607. }
  14608. SuperMap.iPortalAddResourceParam = IPortalAddResourceParam;
  14609. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalRegisterServiceParam.js
  14610. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14611. * This program are made available under the terms of the Apache License, Version 2.0
  14612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14613. /**
  14614. * @class SuperMap.iPortalRegisterServiceParam
  14615. * @classdesc iPortal 注册服务参数。
  14616. * @version 10.0.1
  14617. * @category iPortal/Online
  14618. * @param {Object} params - iPortal 注册服务具体参数。
  14619. * @param {String} [params.type] - 服务类型。
  14620. * @param {Array} [params.tags] - 服务标签。
  14621. * @param {SuperMap.iPortalShareEntity} [params.entities] - 资源的实体共享参数
  14622. * @param {Object} [params.metadata] - 服务元信息。
  14623. * @param {Array} [params.addedMapNames] - 地图服务列表。
  14624. * @param {Array} [params.addedSceneNames] - 场景服务列表。
  14625. */
  14626. class IPortalRegisterServiceParam {
  14627. constructor(params) {
  14628. params = params || {};
  14629. this.type = ""; // SUPERMAP_REST ARCGIS_REST WMS WFS WCS WPS WMTS OTHERS
  14630. this.tags = [];
  14631. this.entities = [];
  14632. this.metadata = {};
  14633. this.addedMapNames = [];
  14634. this.addedSceneNames = [];
  14635. Util.extend(this, params);
  14636. }
  14637. }
  14638. SuperMap.iPortalRegisterServiceParam = IPortalRegisterServiceParam;
  14639. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalAddDataParam.js
  14640. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14641. * This program are made available under the terms of the Apache License, Version 2.0
  14642. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14643. /**
  14644. * @class SuperMap.iPortalAddDataParam
  14645. * @classdesc iPortal 上传/注册数据所需的参数。
  14646. * @version 10.0.1
  14647. * @category iPortal/Online
  14648. * @param {Object} params - iPortal 上传/注册数据所需的具体参数。
  14649. * @param {string} params.fileName - 文件名称
  14650. * @param {SuperMap.DataItemType} params.type - 数据类型。
  14651. * @param {Array} [params.tags] - 数据的标签
  14652. * @param {SuperMap.iPortalDataMetaInfoParam} [params.dataMetaInfo] - 数据元信息
  14653. */
  14654. class IPortalAddDataParam {
  14655. constructor(params) {
  14656. params = params || {};
  14657. this.fileName = "";
  14658. this.type = "";
  14659. this.tags = [];
  14660. this.dataMetaInfo = {};
  14661. Util.extend(this, params);
  14662. }
  14663. }
  14664. SuperMap.iPortalAddDataParam = IPortalAddDataParam;
  14665. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataMetaInfoParam.js
  14666. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14667. * This program are made available under the terms of the Apache License, Version 2.0
  14668. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14669. /**
  14670. * @class SuperMap.iPortalDataMetaInfoParam
  14671. * @classdesc iPortal 上传数据/注册数据元信息所需的参数。
  14672. * @version 10.0.1
  14673. * @category iPortal/Online
  14674. * @param {Object} params - iPortal 获取数据项id excel csv类型的数据所需数据元信息具体参数。
  14675. * @param {string} params.xField - X 坐标字段
  14676. * @param {string} params.yField - Y 坐标字段
  14677. * @param {number} params.xIndex - x所在列(关系型存储下CSV或EXCEL数据时必填)
  14678. * @param {number} params.yIndex - y所在列(关系型存储下CSV或EXCEL数据时必填)
  14679. * @param {array} [params.fieldTypes] - 设置字段类型(关系型存储下CSV或EXCEL数据时可选填)。默认类型为:WTEXT。该参数按照CSV文件字段顺序从左到右依次设置,其中默认字段类型可省略不设置。例如,CSV文件中有10个字段,如果只需设定第1,2,4个字段,可设置为[a,b,,c]。
  14680. * @param {string} params.separator - 分隔符(关系型存储下CSV数据时必填)
  14681. * @param {boolean} params.firstRowIsHead - 是否带表头(关系型存储下CSV数据时必填)
  14682. * @param {boolean} params.url - HDFS注册目录地址
  14683. * @param {SuperMap.iPortalDataStoreInfoParam} params.dataStoreInfo - 注册数据时的数据存储信息
  14684. */
  14685. class IPortalDataMetaInfoParam {
  14686. constructor(params) {
  14687. params = params || {};
  14688. this.xField = "";
  14689. this.yField = "";
  14690. this.fileEncoding = "UTF-8";
  14691. this.xIndex = 1;
  14692. this.yIndex = 1;
  14693. this.fieldTypes = [];
  14694. this.separator = "";
  14695. this.firstRowIsHead = true;
  14696. this.url = "";
  14697. this.dataStoreInfo = {};
  14698. Util.extend(this, params);
  14699. }
  14700. }
  14701. SuperMap.iPortalDataMetaInfoParam = IPortalDataMetaInfoParam;
  14702. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataStoreInfoParam.js
  14703. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14704. * This program are made available under the terms of the Apache License, Version 2.0
  14705. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14706. /**
  14707. * @class SuperMap.iPortalDataStoreInfoParam
  14708. * @classdesc iPortal 注册一个HBASE HDFS数据存储类。
  14709. * @version 10.0.1
  14710. * @category iPortal/Online
  14711. * @param {Object} params - iPortal 注册一个HBASE HDFS数据存储类具体参数。
  14712. * @param {string} params.type - 大数据文件共享类型和空间数据库类型,包括大数据文件共享HDFS 目录(HDFS)和空间数据库HBASE
  14713. * @param {string} params.url - HDFS数据存储目录地址
  14714. * @param {SuperMap.iPortalDataConnectionInfoParam} [params.connectionInfo] - HBASE空间数据库服务的连接信息
  14715. */
  14716. class IPortalDataStoreInfoParam {
  14717. constructor(params) {
  14718. params = params || {};
  14719. this.type = "";
  14720. this.url = "";
  14721. this.connectionInfo = {};
  14722. Util.extend(this, params);
  14723. }
  14724. }
  14725. SuperMap.iPortalDataStoreInfoParam = IPortalDataStoreInfoParam;
  14726. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalDataConnectionInfoParam.js
  14727. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14728. * This program are made available under the terms of the Apache License, Version 2.0
  14729. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14730. /**
  14731. * @class SuperMap.iPortalDataConnectionInfoParam
  14732. * @classdesc iPortal HBASE数据源连接信息类。
  14733. * @version 10.0.1
  14734. * @category iPortal/Online
  14735. * @param {Object} params - iPortal HBASE数据源连接信息类具体参数。
  14736. * @param {string} params.dataBase - 数据源连接的数据库名。
  14737. * @param {string} params.server - 服务地址。
  14738. */
  14739. class IPortalDataConnectionInfoParam {
  14740. constructor(params) {
  14741. params = params || {};
  14742. this.dataBase = "";
  14743. this.server = "";
  14744. Util.extend(this, params);
  14745. }
  14746. }
  14747. SuperMap.iPortalDataConnectionInfoParam = IPortalDataConnectionInfoParam;
  14748. ;// CONCATENATED MODULE: ./src/common/iPortal/iPortalUser.js
  14749. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  14750. * This program are made available under the terms of the Apache License, Version 2.0
  14751. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  14752. /**
  14753. * @class SuperMap.iPortalUser
  14754. * @classdesc iPortal 门户中用户信息的封装类。用于管理用户资源,包括可删除,添加资源。
  14755. * @version 10.0.1
  14756. * @category iPortal/Online
  14757. * @param {string} iportalUrl - iportal根地址。
  14758. * @extends {SuperMap.iPortalServiceBase}
  14759. *
  14760. */
  14761. class IPortalUser extends IPortalServiceBase {
  14762. constructor(iportalUrl) {
  14763. super(iportalUrl);
  14764. this.iportalUrl = iportalUrl;
  14765. }
  14766. /**
  14767. * @function SuperMap.iPortalUser.prototype.deleteResources
  14768. * @description 删除资源。
  14769. * @param {Object} params - 删除资源所需的参数对象:{ids,resourceType}。
  14770. * @returns {Promise} 返回包含删除操作状态的 Promise 对象。
  14771. */
  14772. deleteResources(params) {
  14773. var resourceName = params.resourceType.replace("_","").toLowerCase();
  14774. var deleteResourceUrl = this.iportalUrl+"/web/" + resourceName +"s.json?ids=" + encodeURI(JSON.stringify(params.ids));
  14775. if( resourceName === 'data') {
  14776. deleteResourceUrl = this.iportalUrl + "/web/mycontent/datas/delete.json";
  14777. return this.request("POST", deleteResourceUrl, JSON.stringify(params.ids));
  14778. }
  14779. return this.request("DELETE", deleteResourceUrl);
  14780. }
  14781. /**
  14782. * @function SuperMap.iPortalUser.prototype.addMap
  14783. * @description 添加地图。
  14784. * @version 10.1.0
  14785. * @param {SuperMap.iPortalAddResourceParam} addMapParams - 添加地图的参数。
  14786. * @returns {Promise} 返回包含添加地图结果的 Promise 对象。
  14787. */
  14788. addMap(addMapParams) {
  14789. if (!(addMapParams instanceof IPortalAddResourceParam)) {
  14790. return this.getErrMsgPromise("addMapParams is not instanceof IPortalAddResourceParam !");
  14791. }
  14792. let cloneAddMapParams = {
  14793. rootUrl: addMapParams.rootUrl,
  14794. tags: addMapParams.tags,
  14795. authorizeSetting: addMapParams.entities
  14796. }
  14797. let addMapUrl = this.iportalUrl + "/web/maps/batchaddmaps.json";
  14798. return this.request("POST", addMapUrl, JSON.stringify(cloneAddMapParams)).then(function(result) {
  14799. return result;
  14800. });
  14801. }
  14802. /**
  14803. * @function SuperMap.iPortalUser.prototype.addScene
  14804. * @description 添加场景。
  14805. * @version 10.1.0
  14806. * @param {SuperMap.iPortalAddResourceParam} addSceneParams - 添加场景的参数。
  14807. * @returns {Promise} 返回包含添加场景结果的 Promise 对象。
  14808. */
  14809. addScene(addSceneParams) {
  14810. if (!(addSceneParams instanceof IPortalAddResourceParam)) {
  14811. return this.getErrMsgPromise("addSceneParams is not instanceof IPortalAddResourceParam !");
  14812. }
  14813. let cloneAddSceneParams = {
  14814. rootUrl: addSceneParams.rootUrl,
  14815. tags: addSceneParams.tags,
  14816. authorizeSetting: addSceneParams.entities
  14817. }
  14818. let addSceneUrl = this.iportalUrl + "/web/scenes/batchaddscenes.json";
  14819. return this.request("POST", addSceneUrl, JSON.stringify(cloneAddSceneParams)).then(function(result) {
  14820. return result;
  14821. });
  14822. }
  14823. /**
  14824. * @function SuperMap.iPortalUser.prototype.registerService
  14825. * @description 注册服务。
  14826. * @version 10.1.0
  14827. * @param {SuperMap.iPortalRegisterServiceParam} registerParams - 注册服务的参数。
  14828. * @returns {Promise} 返回包含注册服务结果的 Promise 对象。
  14829. */
  14830. registerService(registerParams) {
  14831. if(!(registerParams instanceof IPortalRegisterServiceParam)) {
  14832. return this.getErrMsgPromise("registerParams is not instanceof IPortalRegisterServiceParam !");
  14833. }
  14834. let cloneRegisterParams = {
  14835. type: registerParams.type,
  14836. tags: registerParams.tags,
  14837. authorizeSetting: registerParams.entities,
  14838. metadata: registerParams.metadata,
  14839. addedMapNames: registerParams.addedMapNames,
  14840. addedSceneNames: registerParams.addedSceneNames
  14841. }
  14842. let registerUrl = this.iportalUrl + "/web/services.json";
  14843. return this.request("POST", registerUrl, JSON.stringify(cloneRegisterParams)).then(result => {
  14844. return result;
  14845. });
  14846. }
  14847. /**
  14848. * @function SuperMap.iPortalUser.prototype.getErrMsgPromise
  14849. * @description 获取包含错误信息的Promise对象。
  14850. * @version 10.1.0
  14851. * @param {String} errMsg - 传入的错误信息。
  14852. * @returns {Promise} 返回包含错误信息的 Promise 对象。
  14853. */
  14854. getErrMsgPromise(errMsg) {
  14855. return new Promise(resolve => {
  14856. resolve(errMsg);
  14857. })
  14858. }
  14859. /**
  14860. * @function SuperMap.iPortalUser.prototype.uploadDataRequest
  14861. * @description 上传数据。
  14862. * @version 10.1.0
  14863. * @param {number} id - 上传数据的资源id。
  14864. * @param {Object} formData - 请求体为文本数据流。
  14865. * @returns {Promise} 返回包含上传数据操作的 Promise 对象。
  14866. */
  14867. uploadDataRequest(id,formData) {
  14868. var uploadDataUrl = this.iportalUrl + "/web/mycontent/datas/"+id+"/upload.json";
  14869. return this.request("POST",uploadDataUrl,formData);
  14870. }
  14871. /**
  14872. * @function SuperMap.iPortalUser.prototype.addData
  14873. * @description 上传/注册数据。
  14874. * @version 10.1.0
  14875. * @param {SuperMap.iPortalAddDataParam} params - 上传/注册数据所需的参数。
  14876. * @param {Object} [formData] - 请求体为文本数据流(上传数据时传入)。
  14877. * @returns {Promise} 返回上传/注册数据的 Promise 对象。
  14878. */
  14879. addData(params,formData) {
  14880. if(!(params instanceof IPortalAddDataParam)){
  14881. return this.getErrMsgPromise("params is not instanceof iPortalAddDataParam !");
  14882. }
  14883. var datasUrl = this.iportalUrl + "/web/mycontent/datas.json";
  14884. var entity = {
  14885. fileName:params.fileName,
  14886. tags:params.tags,
  14887. type:params.type
  14888. };
  14889. var type = params.type.toLowerCase();
  14890. var dataMetaInfo;
  14891. if(type === "excel" || type === "csv"){
  14892. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  14893. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  14894. }
  14895. dataMetaInfo = {
  14896. xField:params.dataMetaInfo.xField,
  14897. yField:params.dataMetaInfo.yField
  14898. }
  14899. if(type === 'csv') {
  14900. dataMetaInfo.fileEncoding = params.dataMetaInfo.fileEncoding
  14901. }
  14902. entity.coordType = "WGS84";
  14903. entity.dataMetaInfo = dataMetaInfo;
  14904. }else if(type === "hdfs" || type === "hbase") {
  14905. if(!(params.dataMetaInfo instanceof IPortalDataMetaInfoParam)){
  14906. return this.getErrMsgPromise("params.dataMetaInfo is not instanceof iPortalDataMetaInfoParam !");
  14907. }
  14908. if(!(params.dataMetaInfo.dataStoreInfo instanceof IPortalDataStoreInfoParam)){
  14909. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo is not instanceof iPortalDataStoreInfoParam !");
  14910. }
  14911. var dataStoreInfo = {
  14912. type:params.dataMetaInfo.dataStoreInfo.type
  14913. }
  14914. switch (type) {
  14915. case "hdfs":
  14916. dataStoreInfo.url = params.dataMetaInfo.dataStoreInfo.url;
  14917. dataMetaInfo = {
  14918. url: params.dataMetaInfo.url,
  14919. dataStoreInfo:dataStoreInfo
  14920. }
  14921. break;
  14922. case "hbase":
  14923. if(!(params.dataMetaInfo.dataStoreInfo.connectionInfo instanceof IPortalDataConnectionInfoParam)){
  14924. return this.getErrMsgPromise("params.dataMetaInfo.dataStoreInfo.connectionInfo is not instanceof iPortalDataConnectionInfoParam !");
  14925. }
  14926. dataStoreInfo.connectionInfo = {
  14927. dataBase:params.dataMetaInfo.dataStoreInfo.connectionInfo.dataBase,
  14928. server:params.dataMetaInfo.dataStoreInfo.connectionInfo.server,
  14929. engineType:'HBASE'
  14930. }
  14931. dataStoreInfo.datastoreType = "SPATIAL";//该字段SPATIAL表示HBASE注册
  14932. dataMetaInfo = {
  14933. dataStoreInfo:dataStoreInfo
  14934. }
  14935. break;
  14936. }
  14937. entity.dataMetaInfo = dataMetaInfo;
  14938. }
  14939. return this.request("POST",datasUrl,JSON.stringify(entity)).then(res=>{
  14940. if(type === "hdfs" || type === "hbase"){
  14941. return res;
  14942. }else {
  14943. if(res.childID) {
  14944. return this.uploadDataRequest(res.childID,formData);
  14945. }else {
  14946. return res.customResult;
  14947. }
  14948. }
  14949. })
  14950. }
  14951. /**
  14952. * @function SuperMap.iPortalUser.prototype.publishOrUnpublish
  14953. * @description 发布/取消发布。
  14954. * @version 10.1.0
  14955. * @param {object} options - 发布/取消发布数据服务所需的参数。
  14956. * @param {object} options.dataId - 数据项id。
  14957. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  14958. * @param {object} [options.dataServiceId] - 发布的服务 id。
  14959. * @param {boolean} forPublish - 是否取消发布。
  14960. * @returns {Promise} 返回发布/取消发布数据服务的 Promise 对象。
  14961. */
  14962. publishOrUnpublish(option,forPublish){
  14963. if(!option.dataId || !option.serviceType) {
  14964. return this.getErrMsgPromise("option.dataID and option.serviceType are Required!");
  14965. }
  14966. var dataId = option.dataId;
  14967. var dataServiceId = option.dataServiceId;
  14968. var serviceType = option.serviceType;
  14969. var publishUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?serviceType=" + serviceType;
  14970. if (dataServiceId) {
  14971. publishUrl += "&dataServiceId=" + dataServiceId;
  14972. }
  14973. return this.request("PUT",publishUrl,JSON.stringify(forPublish)).then(res=>{
  14974. // 发起服务状态查询
  14975. if(forPublish) {
  14976. // 发布服务的结果异步处理
  14977. // var publishStateUrl = this.iportalUrl + "web/mycontent/datas/" + dataId + "/publishstatus.rjson";
  14978. if (!dataServiceId) { // 发布服务时会回传serviceIDs,发布服务之前serviceIDs为空
  14979. dataServiceId = res.customResult;
  14980. }
  14981. return dataServiceId;
  14982. }else {
  14983. // 取消发布的结果同步处理
  14984. return res;
  14985. }
  14986. });
  14987. }
  14988. /**
  14989. * @function SuperMap.iPortalUser.prototype.getDataPublishedStatus
  14990. * @description 查询服务状态,发起服务状态查询。
  14991. * @version 10.1.0
  14992. * @param {number} dataId - 查询服务状态的数据项id。
  14993. * @param {string} dataServiceId - 发布的服务id。
  14994. * @returns {Promise} 返回查询服务状态的 Promise 对象。
  14995. */
  14996. getDataPublishedStatus(dataId,dataServiceId){
  14997. var publishStateUrl = this.iportalUrl + "/web/mycontent/datas/" + dataId + "/publishstatus.json?dataServiceId="+dataServiceId+"&forPublish=true";
  14998. return this.request("GET",publishStateUrl);
  14999. }
  15000. /**
  15001. * @function SuperMap.iPortalUser.prototype.unPublishedDataService
  15002. * @description 取消发布。
  15003. * @version 10.1.0
  15004. * @param {object} options - 取消发布服务具体参数。
  15005. * @param {object} options.dataId - 数据项id。
  15006. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  15007. * @param {object} [options.dataServiceId] - 发布的服务 id。
  15008. * @returns {Promise} 返回取消发布数据服务的 Promise 对象。
  15009. */
  15010. unPublishDataService(option){
  15011. return this.publishOrUnpublish(option,false);
  15012. }
  15013. /**
  15014. * @function SuperMap.iPortalUser.prototype.publishedDataService
  15015. * @description 发布数据服务。
  15016. * @version 10.1.0
  15017. * @param {object} options - 发布数据服务具体参数。
  15018. * @param {object} options.dataId - 数据项id。
  15019. * @param {object} options.serviceType - 发布的服务类型,目前支持发布的服务类型包括:RESTDATA, RESTMAP, RESTREALSPACE, RESTSPATIALANALYST。
  15020. * @param {object} [options.dataServiceId] - 发布的服务 id。
  15021. * @returns {Promise} 返回发布数据服务的 Promise 对象。
  15022. */
  15023. publishDataService(option){
  15024. return this.publishOrUnpublish(option,true);
  15025. }
  15026. }
  15027. SuperMap.iPortalUser = IPortalUser;
  15028. ;// CONCATENATED MODULE: ./src/common/iPortal/index.js
  15029. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15030. * This program are made available under the terms of the Apache License, Version 2.0
  15031. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15032. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  15033. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15034. * This program are made available under the terms of the Apache License, Version 2.0
  15035. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15036. /**
  15037. * @class SuperMap.CommonServiceBase
  15038. * @category iServer
  15039. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  15040. * @param {string} url - 服务地址。
  15041. * @param {Object} options - 参数。
  15042. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  15043. * @param {string} [options.proxy] - 服务代理地址。
  15044. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  15045. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  15046. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15047. * @param {Object} [options.headers] - 请求头。
  15048. */
  15049. class CommonServiceBase {
  15050. constructor(url, options) {
  15051. let me = this;
  15052. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  15053. this.events = null;
  15054. this.eventListeners = null;
  15055. this.url = null;
  15056. this.urls = null;
  15057. this.proxy = null;
  15058. this.serverType = null;
  15059. this.index = null;
  15060. this.length = null;
  15061. this.options = null;
  15062. this.totalTimes = null;
  15063. this.POLLING_TIMES = 3;
  15064. this._processSuccess = null;
  15065. this._processFailed = null;
  15066. this.isInTheSameDomain = null;
  15067. this.withCredentials = false;
  15068. if (Util.isArray(url)) {
  15069. me.urls = url;
  15070. me.length = url.length;
  15071. me.totalTimes = me.length;
  15072. if (me.length === 1) {
  15073. me.url = url[0];
  15074. } else {
  15075. me.index = parseInt(Math.random() * me.length);
  15076. me.url = url[me.index];
  15077. }
  15078. } else {
  15079. me.totalTimes = 1;
  15080. me.url = url;
  15081. }
  15082. if (Util.isArray(url) && !me.isServiceSupportPolling()) {
  15083. me.url = url[0];
  15084. me.totalTimes = 1;
  15085. }
  15086. me.serverType = me.serverType || ServerType.ISERVER;
  15087. options = options || {};
  15088. this.crossOrigin = options.crossOrigin;
  15089. this.headers = options.headers;
  15090. Util.extend(this, options);
  15091. me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
  15092. me.events = new Events(me, null, me.EVENT_TYPES, true);
  15093. if (me.eventListeners instanceof Object) {
  15094. me.events.on(me.eventListeners);
  15095. }
  15096. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  15097. }
  15098. /**
  15099. * @function SuperMap.CommonServiceBase.prototype.destroy
  15100. * @description 释放资源,将引用的资源属性置空。
  15101. */
  15102. destroy() {
  15103. let me = this;
  15104. if (Util.isArray(me.urls)) {
  15105. me.urls = null;
  15106. me.index = null;
  15107. me.length = null;
  15108. me.totalTimes = null;
  15109. }
  15110. me.url = null;
  15111. me.options = null;
  15112. me._processSuccess = null;
  15113. me._processFailed = null;
  15114. me.isInTheSameDomain = null;
  15115. me.EVENT_TYPES = null;
  15116. if (me.events) {
  15117. me.events.destroy();
  15118. me.events = null;
  15119. }
  15120. if (me.eventListeners) {
  15121. me.eventListeners = null;
  15122. }
  15123. }
  15124. /**
  15125. * @function SuperMap.CommonServiceBase.prototype.request
  15126. * @description: 该方法用于向服务发送请求。
  15127. * @param {Object} options - 参数。
  15128. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  15129. * @param {string} [options.url] - 发送请求的地址。
  15130. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  15131. * @param {string} [options.data] - 发送到服务器的数据。
  15132. * @param {function} options.success - 请求成功后的回调函数。
  15133. * @param {function} options.failure - 请求失败后的回调函数。
  15134. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  15135. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  15136. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  15137. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15138. * @param {Object} [options.headers] - 请求头。
  15139. */
  15140. request(options) {
  15141. let me = this;
  15142. options.url = options.url || me.url;
  15143. options.proxy = options.proxy || me.proxy;
  15144. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  15145. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  15146. options.headers = options.headers || me.headers;
  15147. options.isInTheSameDomain = me.isInTheSameDomain;
  15148. //为url添加安全认证信息片段
  15149. let credential = this.getCredential(options.url);
  15150. if (credential) {
  15151. options.url = Util.urlAppend(options.url, credential.getUrlParameters());
  15152. }
  15153. me.calculatePollingTimes();
  15154. me._processSuccess = options.success;
  15155. me._processFailed = options.failure;
  15156. options.scope = me;
  15157. options.success = me.getUrlCompleted;
  15158. options.failure = me.getUrlFailed;
  15159. me.options = options;
  15160. me._commit(me.options);
  15161. }
  15162. /**
  15163. * @function SuperMap.CommonServiceBase.prototype.getCredential
  15164. * @description 获取凭据信息
  15165. * @param {string} url - 服务地址。
  15166. * @returns {SuperMap.Credential} 凭据信息对象。
  15167. */
  15168. getCredential(url) {
  15169. let keyUrl = url,
  15170. credential, value;
  15171. switch (this.serverType) {
  15172. case ServerType.IPORTAL:
  15173. value = SecurityManager.getToken(keyUrl);
  15174. credential = value ? new Credential(value, "token") : null;
  15175. if (!credential) {
  15176. value = SecurityManager.getKey(keyUrl);
  15177. credential = value ? new Credential(value, "key") : null;
  15178. }
  15179. break;
  15180. case ServerType.ONLINE:
  15181. value = SecurityManager.getKey(keyUrl);
  15182. credential = value ? new Credential(value, "key") : null;
  15183. break;
  15184. default:
  15185. //iServer or others
  15186. value = SecurityManager.getToken(keyUrl);
  15187. credential = value ? new Credential(value, "token") : null;
  15188. break;
  15189. }
  15190. return credential;
  15191. }
  15192. /**
  15193. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  15194. * @description 请求成功后执行此方法。
  15195. * @param {Object} result - 服务器返回的结果对象。
  15196. */
  15197. getUrlCompleted(result) {
  15198. let me = this;
  15199. me._processSuccess(result);
  15200. }
  15201. /**
  15202. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  15203. * @description 请求失败后执行此方法。
  15204. * @param {Object} result - 服务器返回的结果对象。
  15205. */
  15206. getUrlFailed(result) {
  15207. let me = this;
  15208. if (me.totalTimes > 0) {
  15209. me.totalTimes--;
  15210. me.ajaxPolling();
  15211. } else {
  15212. me._processFailed(result);
  15213. }
  15214. }
  15215. /**
  15216. *
  15217. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  15218. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  15219. */
  15220. ajaxPolling() {
  15221. let me = this,
  15222. url = me.options.url,
  15223. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  15224. me.index = parseInt(Math.random() * me.length);
  15225. me.url = me.urls[me.index];
  15226. url = url.replace(re, re.exec(me.url)[0]);
  15227. me.options.url = url;
  15228. me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
  15229. me._commit(me.options);
  15230. }
  15231. /**
  15232. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  15233. * @description 计算剩余请求失败执行次数。
  15234. */
  15235. calculatePollingTimes() {
  15236. let me = this;
  15237. if (me.times) {
  15238. if (me.totalTimes > me.POLLING_TIMES) {
  15239. if (me.times > me.POLLING_TIMES) {
  15240. me.totalTimes = me.POLLING_TIMES;
  15241. } else {
  15242. me.totalTimes = me.times;
  15243. }
  15244. } else {
  15245. if (me.times < me.totalTimes) {
  15246. me.totalTimes = me.times;
  15247. }
  15248. }
  15249. } else {
  15250. if (me.totalTimes > me.POLLING_TIMES) {
  15251. me.totalTimes = me.POLLING_TIMES;
  15252. }
  15253. }
  15254. me.totalTimes--;
  15255. }
  15256. /**
  15257. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  15258. * @description 判断服务是否支持轮询。
  15259. */
  15260. isServiceSupportPolling() {
  15261. let me = this;
  15262. return !(
  15263. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  15264. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  15265. );
  15266. }
  15267. /**
  15268. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  15269. * @description 状态完成,执行此方法。
  15270. * @param {Object} result - 服务器返回的结果对象。
  15271. */
  15272. serviceProcessCompleted(result) {
  15273. result = Util.transformResult(result);
  15274. this.events.triggerEvent("processCompleted", {
  15275. result: result
  15276. });
  15277. }
  15278. /**
  15279. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  15280. * @description 状态失败,执行此方法。
  15281. * @param {Object} result - 服务器返回的结果对象。
  15282. */
  15283. serviceProcessFailed(result) {
  15284. result = Util.transformResult(result);
  15285. let error = result.error || result;
  15286. this.events.triggerEvent("processFailed", {
  15287. error: error
  15288. });
  15289. }
  15290. _commit(options) {
  15291. if (options.method === "POST" || options.method === "PUT") {
  15292. if (options.params) {
  15293. options.url = Util.urlAppend(options.url,
  15294. Util.getParameterString(options.params || {}));
  15295. }
  15296. options.params = options.data;
  15297. }
  15298. FetchRequest.commit(options.method, options.url, options.params, {
  15299. headers: options.headers,
  15300. withCredentials: options.withCredentials,
  15301. crossOrigin: options.crossOrigin,
  15302. timeout: options.async ? 0 : null,
  15303. proxy: options.proxy
  15304. }).then(function (response) {
  15305. if (response.text) {
  15306. return response.text();
  15307. }
  15308. if (response.json) {
  15309. return response.json();
  15310. }
  15311. return response;
  15312. }).then(function (text) {
  15313. var result = text;
  15314. if (typeof text === "string") {
  15315. result = new JSONFormat().read(text);
  15316. }
  15317. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  15318. if (result && result.error) {
  15319. result = {
  15320. error: result.error
  15321. };
  15322. } else {
  15323. result = {
  15324. error: result
  15325. };
  15326. }
  15327. }
  15328. if (result.error) {
  15329. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  15330. failure(result);
  15331. } else {
  15332. result.succeed = result.succeed == undefined ? true : result.succeed;
  15333. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  15334. success(result);
  15335. }
  15336. }).catch(function (e) {
  15337. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  15338. failure(e);
  15339. })
  15340. }
  15341. }
  15342. SuperMap.CommonServiceBase = CommonServiceBase;
  15343. /**
  15344. * 服务器请求回调函数
  15345. * @callback RequestCallback
  15346. * @example
  15347. * var requestCallback = function (serviceResult){
  15348. * console.log(serviceResult.result);
  15349. * }
  15350. * new QueryService(url).queryByBounds(param, requestCallback);
  15351. * @param {Object} serviceResult
  15352. * @param {Object} serviceResult.result 服务器返回结果。
  15353. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  15354. * @param {Object} serviceResult.type 事件类型。
  15355. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  15356. */
  15357. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  15358. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15359. * This program are made available under the terms of the Apache License, Version 2.0
  15360. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15361. /**
  15362. * @class SuperMap.GeoCodingParameter
  15363. * @category iServer AddressMatch
  15364. * @classdesc 地理正向匹配参数类。
  15365. * @param {Object} options - 参数。
  15366. * @param {string} options.address - 地点关键词。
  15367. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  15368. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  15369. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  15370. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  15371. * @param {number} [options.maxReturn] - 最大返回结果数。
  15372. */
  15373. class GeoCodingParameter {
  15374. constructor(options) {
  15375. if (options.filters && typeof(options.filters) === 'string') {
  15376. options.filters = options.filters.split(',');
  15377. }
  15378. /**
  15379. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  15380. * @description 地点关键词。
  15381. */
  15382. this.address = null;
  15383. /**
  15384. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  15385. * @description 设置返回对象的起始索引值。
  15386. */
  15387. this.fromIndex = null;
  15388. /**
  15389. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  15390. * @description 设置返回对象的结束索引值。
  15391. */
  15392. this.toIndex = null;
  15393. /**
  15394. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  15395. * @description 过滤字段,限定查询区域。
  15396. */
  15397. this.filters = null;
  15398. /**
  15399. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  15400. * @description 查询结果的坐标系。
  15401. */
  15402. this.prjCoordSys = null;
  15403. /**
  15404. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  15405. * @description 最大返回结果数。
  15406. */
  15407. this.maxReturn = null;
  15408. Util.extend(this, options);
  15409. }
  15410. /**
  15411. * @function SuperMap.GeoCodingParameter.prototype.destroy
  15412. * @description 释放资源,将引用资源的属性置空。
  15413. */
  15414. destroy() {
  15415. this.address = null;
  15416. this.fromIndex = null;
  15417. this.toIndex = null;
  15418. this.filters = null;
  15419. this.prjCoordSys = null;
  15420. this.maxReturn = null;
  15421. }
  15422. }
  15423. SuperMap.GeoCodingParameter = GeoCodingParameter;
  15424. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  15425. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15426. * This program are made available under the terms of the Apache License, Version 2.0
  15427. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15428. /**
  15429. * @class SuperMap.GeoDecodingParameter
  15430. * @category iServer AddressMatch
  15431. * @classdesc 地理反向匹配参数类。
  15432. * @param {Object} options - 参数。
  15433. * @param {number} options.x - 查询位置的横坐标。
  15434. * @param {number} options.y - 查询位置的纵坐标。
  15435. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  15436. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  15437. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  15438. * @param {number} [options.maxReturn] - 最大返回结果数。
  15439. * @param {number} [options.geoDecodingRadius] - 查询半径。
  15440. */
  15441. class GeoDecodingParameter {
  15442. constructor(options) {
  15443. if (options.filters) {
  15444. options.filters = options.filters.split(',');
  15445. }
  15446. /**
  15447. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  15448. * @description 查询位置的横坐标。
  15449. */
  15450. this.x = null;
  15451. /**
  15452. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  15453. * @description 查询位置的纵坐标。
  15454. */
  15455. this.y = null;
  15456. /**
  15457. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  15458. * @description 设置返回对象的起始索引值。
  15459. */
  15460. this.fromIndex = null;
  15461. /**
  15462. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  15463. * @description 设置返回对象的结束索引值。
  15464. */
  15465. this.toIndex = null;
  15466. /**
  15467. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  15468. * @description 过滤字段,限定查询区域。
  15469. */
  15470. this.filters = null;
  15471. /**
  15472. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  15473. * @description 查询结果的坐标系。
  15474. */
  15475. this.prjCoordSys = null;
  15476. /**
  15477. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  15478. * @description 最大返回结果数。
  15479. */
  15480. this.maxReturn = null;
  15481. /**
  15482. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  15483. * @description 查询半径。
  15484. */
  15485. this.geoDecodingRadius = null;
  15486. Util.extend(this, options);
  15487. }
  15488. /**
  15489. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  15490. * @description 释放资源,将引用资源的属性置空。
  15491. */
  15492. destroy() {
  15493. this.x = null;
  15494. this.y = null;
  15495. this.fromIndex = null;
  15496. this.toIndex = null;
  15497. this.filters = null;
  15498. this.prjCoordSys = null;
  15499. this.maxReturn = null;
  15500. this.geoDecodingRadius = null;
  15501. }
  15502. }
  15503. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  15504. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  15505. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15506. * This program are made available under the terms of the Apache License, Version 2.0
  15507. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15508. /**
  15509. * @class SuperMap.AddressMatchService
  15510. * @category iServer AddressMatch
  15511. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  15512. * @param {string} url - 地址匹配服务地址。
  15513. * @param {Object} options - 参数。
  15514. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15515. * @param {Object} [options.headers] - 请求头。
  15516. */
  15517. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  15518. constructor(url, options) {
  15519. super(url, options);
  15520. this.options = options || {};
  15521. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  15522. }
  15523. /**
  15524. * @function SuperMap.AddressMatchService.prototype.destroy
  15525. * @override
  15526. */
  15527. destroy() {
  15528. super.destroy();
  15529. }
  15530. /**
  15531. * @function SuperMap.AddressMatchService.prototype.code
  15532. * @param {string} url - 正向地址匹配服务地址。
  15533. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  15534. */
  15535. code(url, params) {
  15536. if (!(params instanceof GeoCodingParameter)) {
  15537. return;
  15538. }
  15539. this.processAsync(url, params);
  15540. }
  15541. /**
  15542. * @function SuperMap.AddressMatchService.prototype.decode
  15543. * @param {string} url - 反向地址匹配服务地址。
  15544. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  15545. */
  15546. decode(url, params) {
  15547. if (!(params instanceof GeoDecodingParameter)) {
  15548. return;
  15549. }
  15550. this.processAsync(url, params);
  15551. }
  15552. /**
  15553. * @function SuperMap.AddressMatchService.prototype.processAsync
  15554. * @description 负责将客户端的动态分段服务参数传递到服务端。
  15555. * @param {string} url - 服务地址。
  15556. * @param {Object} params - 参数。
  15557. */
  15558. processAsync(url, params) {
  15559. this.request({
  15560. method: 'GET',
  15561. url,
  15562. params,
  15563. scope: this,
  15564. success: this.serviceProcessCompleted,
  15565. failure: this.serviceProcessFailed
  15566. });
  15567. }
  15568. /**
  15569. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  15570. * @param {Object} result - 服务器返回的结果对象。
  15571. * @description 服务流程是否完成
  15572. */
  15573. serviceProcessCompleted(result) {
  15574. if (result.succeed) {
  15575. delete result.succeed;
  15576. }
  15577. super.serviceProcessCompleted(result);
  15578. }
  15579. /**
  15580. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  15581. * @param {Object} result - 服务器返回的结果对象。
  15582. * @description 服务流程是否失败
  15583. */
  15584. serviceProcessFailed(result) {
  15585. super.serviceProcessFailed(result);
  15586. }
  15587. }
  15588. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  15589. ;// CONCATENATED MODULE: ./src/common/iServer/AggQueryBuilderParameter.js
  15590. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15591. * This program are made available under the terms of the Apache License, Version 2.0
  15592. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15593. /**
  15594. * @class SuperMap.AggQueryBuilderParameter
  15595. * @classdesc 聚合查询 QueryBuilder 参数基类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  15596. * @category iServer Data FeatureResults
  15597. * @param {Object} option - 初始化参数。
  15598. * @param {string} option.name - 查询结果名称。
  15599. * @param {SuperMap.AggregationQueryBuilderType} option.queryType - 查询类型。
  15600. */
  15601. class AggQueryBuilderParameter {
  15602. constructor(option) {
  15603. /**
  15604. * @member {string} SuperMap.AggQueryBuilderParameter.prototype.name
  15605. * @description 查询结果名称。
  15606. */
  15607. this.name = null;
  15608. /**
  15609. * @member {SuperMap.AggregationQueryBuilderType} SuperMap.AggQueryBuilderParameter.prototype.queryType
  15610. * @description 查询类型。
  15611. */
  15612. this.queryType = null;
  15613. this.CLASS_NAME = "SuperMap.AggQueryBuilderParameter";
  15614. Util.extend(this, option);
  15615. }
  15616. destroy() {
  15617. var me = this;
  15618. me.name = null;
  15619. me.queryType = null;
  15620. }
  15621. }
  15622. SuperMap.AggQueryBuilderParameter = AggQueryBuilderParameter;
  15623. ;// CONCATENATED MODULE: ./src/common/iServer/AggregationParameter.js
  15624. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15625. * This program are made available under the terms of the Apache License, Version 2.0
  15626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15627. /**
  15628. * @class SuperMap.AggregationParameter
  15629. * @classdesc 聚合查询参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  15630. * @category iServer Data FeatureResults
  15631. * @param {Object} options - 初始化参数。
  15632. * @param {string} options.aggName - 聚合名称。
  15633. * @param {SuperMap.AggregationType} options.aggType - 聚合类型设置。
  15634. * @param {string} options.aggFieldName - 聚合字段。
  15635. * @param {SuperMap.AggregationParameter} options.subAgg - 子聚合类。
  15636. *
  15637. */
  15638. class AggregationParameter {
  15639. constructor(options) {
  15640. /**
  15641. * @member {string} SuperMap.AggregationParameter.prototype.aggName
  15642. * @description 聚合名称。
  15643. */
  15644. this.aggName = null;
  15645. /**
  15646. * @member {SuperMap.AggregationType} SuperMap.AggregationParameter.prototype.aggType
  15647. * @description 聚合类型设置类。
  15648. */
  15649. this.aggType = null;
  15650. /**
  15651. * @member {string} SuperMap.AggregationParameter.prototype.aggFieldName
  15652. * @description 聚合字段。
  15653. */
  15654. this.aggFieldName = null;
  15655. /**
  15656. * @member {SuperMap.AggregationParameter} SuperMap.AggregationParameter.prototype.subAgg
  15657. * @description 子聚合。
  15658. */
  15659. this.subAgg = null;
  15660. this.CLASS_NAME = "SuperMap.AggregationParameter";
  15661. Util.extend(this, options);
  15662. }
  15663. destroy() {
  15664. var me = this;
  15665. me.aggName = null;
  15666. me.aggFieldName = null;
  15667. me.aggType = null;
  15668. if (me.subAgg) {
  15669. me.subAgg = null;
  15670. }
  15671. }
  15672. }
  15673. SuperMap.AggregationParameter = AggregationParameter;
  15674. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationParameters.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.AreaSolarRadiationParameters
  15680. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  15681. * @classdesc 地区太阳辐射参数类。
  15682. * @param {Object} options - 参数。
  15683. * @param {string} options.dataset - 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"的形式来表示,例如:JingjinTerrain@Jingjin。
  15684. * @param {string} options.targetDatasourceName - 指定的存储结果数据集的数据源名称, 例如:"Jingjin"。
  15685. * @param {string} options.totalGridName - 指定地区太阳辐射总辐射量数据集的名称。
  15686. * @param {string} options.diffuseDatasetGridName - 指定地区太阳辐射散射辐射量数据集的名称。
  15687. * @param {string} options.durationDatasetGridName - 指定地区太阳辐射太阳直射持续时间数据集的名称。
  15688. * @param {string} options.directDatasetGridName - 指定地区太阳辐射直射辐射量数据集的名称。
  15689. * @param {number} options.latitude - 待计算区域的纬度值。
  15690. * @param {string} [options.timeMode = 'MULTIDAYS'] - 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  15691. * @param {number} options.dayStart - 起始日期(年内的第几天)。
  15692. * @param {number} options.dayEnd - 结束日期(年内的第几天)。
  15693. * @param {number} [options.hourStart] - 起始时间(一天中的第几个小时)。
  15694. * @param {number} [options.hourEnd] - 结束时间(一天中的第几个小时)。
  15695. * @param {number} [options.transmittance] - 太阳辐射穿过大气的透射率。
  15696. * @param {number} [options.hourInterval=0.5] - 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确,如果修改此参数,必须使用整数)。
  15697. * @param {number} [options.dayInterval=5] - 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确,必须使用整数)。
  15698. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  15699. */
  15700. class AreaSolarRadiationParameters {
  15701. constructor(options) {
  15702. /**
  15703. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.dataset
  15704. * @description 要用来做地区太阳辐射数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示,例如:JingjinTerrain@Jingjin。注:地区太阳辐射数据必须为栅格数据集。
  15705. */
  15706. this.dataset = null;
  15707. /**
  15708. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.targetDatasourceName
  15709. * @description 指定的存储结果数据集的数据源名称,例如:"Jingjin"。
  15710. */
  15711. this.targetDatasourceName = null;
  15712. /**
  15713. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.totalGridName
  15714. * @description 指定地区太阳辐射总辐射量数据集的名称。
  15715. */
  15716. this.totalGridName = null;
  15717. /**
  15718. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.diffuseDatasetGridName
  15719. * @description 指定地区太阳辐射散射辐射量数据集的名称。
  15720. */
  15721. this.diffuseDatasetGridName = null;
  15722. /**
  15723. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  15724. * @description 指定地区太阳辐射太阳直射持续时间数据集的名称。
  15725. */
  15726. this.durationDatasetGridName = null;
  15727. /**
  15728. * @member {string} SuperMap.AreaSolarRadiationParameters.prototype.durationDatasetGridName
  15729. * @description 指定地区太阳辐射直射辐射量数据集的名称。
  15730. */
  15731. this.directDatasetGridName = null;
  15732. /**
  15733. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.latitude
  15734. * @description 待计算区域的纬度值。
  15735. */
  15736. this.latitude = null;
  15737. /**
  15738. * @member {string} [SuperMap.AreaSolarRadiationParameters.prototype.timeMode='MULTIDAYS']
  15739. * @description 时间模式。可选值"WITHINDAY"(单日)或"MULTIDAYS"(多日)。
  15740. */
  15741. this.timeMode = "MULTIDAYS";
  15742. /**
  15743. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayStart
  15744. * @description 起始日期(年内的第几天)。
  15745. */
  15746. this.dayStart = null;
  15747. /**
  15748. * @member {number} SuperMap.AreaSolarRadiationParameters.prototype.dayEnd
  15749. * @description 结束日期(年内的第几天)。
  15750. */
  15751. this.dayEnd = null;
  15752. /**
  15753. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourStart]
  15754. * @description 起始时间(一天中的第几个小时)。
  15755. */
  15756. this.hourStart = null;
  15757. /**
  15758. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourEnd]
  15759. * @description 结束时间(一天中的第几个小时)。
  15760. */
  15761. this.hourEnd = null;
  15762. /**
  15763. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.transmittance]
  15764. * @description 太阳辐射穿过大气的透射率。
  15765. */
  15766. this.transmittance = null;
  15767. /**
  15768. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.hourInterval=0.5]
  15769. * @description 计算时的小时间隔(设置的越小计算量越大并且计算结果更精确, 如果修改此参数,必须使用整数)
  15770. */
  15771. this.hourInterval = null;
  15772. /**
  15773. * @member {number} [SuperMap.AreaSolarRadiationParameters.prototype.dayInterval=5]
  15774. * @description 计算时的天数间隔(设置的越小计算量越大并且计算结果更精确, 必须使用整数)
  15775. */
  15776. this.dayInterval = null;
  15777. /**
  15778. * @member {boolean} [SuperMap.AreaSolarRadiationParameters.prototype.deleteExistResultDataset=false]
  15779. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  15780. */
  15781. this.deleteExistResultDataset = false;
  15782. Util.extend(this, options);
  15783. this.CLASS_NAME = "SuperMap.AreaSolarRadiationParameters";
  15784. }
  15785. /**
  15786. * @function SuperMap.AreaSolarRadiationParameters.prototype.destroy
  15787. * @description 释放资源,将引用资源的属性置空。
  15788. */
  15789. destroy() {
  15790. var me = this;
  15791. me.dataset = null;
  15792. me.zFactor = 1.0;
  15793. me.averageCurvatureName = null;
  15794. me.profileCurvatureName = null;
  15795. me.planCurvatureName = null;
  15796. me.deleteExistResultDataset = true;
  15797. }
  15798. /**
  15799. * @function SuperMap.AreaSolarRadiationParameters.toObject
  15800. * @param {SuperMap.AreaSolarRadiationParameters} param - 地区太阳辐射参数类。
  15801. * @param {SuperMap.AreaSolarRadiationParameters} tempObj - 地区太阳辐射参数对象。
  15802. * @returns {Object} JSON对象。
  15803. * @description 将SuperMap.AreaSolarRadiationParameters对象转换成JSON对象。
  15804. */
  15805. static toObject(param, tempObj) {
  15806. var parameter = {};
  15807. for (var name in param) {
  15808. if (name !== "dataset") {
  15809. var name1 = (name === "latitude" || name === "timeMode" || name === "dayStart");
  15810. var name2 = (name === "dayEnd" || name === "hourStart" || name === "hourEnd");
  15811. var name3 = (name === "transmittance" || name === "hourInterval" || name === "dayInterval");
  15812. if (name1 || name2 || name3) {
  15813. parameter[name] = param[name];
  15814. } else {
  15815. tempObj[name] = param[name];
  15816. }
  15817. }
  15818. }
  15819. tempObj["parameter"] = parameter;
  15820. }
  15821. }
  15822. SuperMap.AreaSolarRadiationParameters = AreaSolarRadiationParameters;
  15823. ;// CONCATENATED MODULE: ./src/common/iServer/SpatialAnalystBase.js
  15824. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15825. * This program are made available under the terms of the Apache License, Version 2.0
  15826. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15827. /**
  15828. * @class SuperMap.SpatialAnalystBase
  15829. * @category iServer SpatialAnalyst
  15830. * @classdesc 空间分析服务基类。
  15831. * @param {string} url - 地址。
  15832. * @param {Object} options - 参数。
  15833. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15834. * @param {Object} [options.headers] - 请求头。
  15835. * @extends {SuperMap.CommonServiceBase}
  15836. */
  15837. class SpatialAnalystBase extends CommonServiceBase {
  15838. constructor(url, options) {
  15839. super(url, options);
  15840. /**
  15841. * @member {SuperMap.DataFormat} [SuperMap.SpatialAnalystBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  15842. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"。
  15843. */
  15844. this.format = DataFormat.GEOJSON;
  15845. this.CLASS_NAME = "SuperMap.SpatialAnalystBase";
  15846. }
  15847. /**
  15848. * @function SuperMap.SpatialAnalystBase.prototype.destroy
  15849. * @override
  15850. */
  15851. destroy() {
  15852. super.destroy();
  15853. this.format = null;
  15854. }
  15855. /**
  15856. * @function SuperMap.SpatialAnalystBase.prototype.serviceProcessCompleted
  15857. * @description 分析完成,执行此方法。
  15858. * @param {Object} result - 服务器返回的结果对象。
  15859. */
  15860. serviceProcessCompleted(result) {
  15861. var me = this, analystResult;
  15862. result = Util.transformResult(result);
  15863. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  15864. //批量分析时会返回多个结果
  15865. if (Util.isArray(result)) {
  15866. for (var i = 0; i < result.length; i++) {
  15867. result[i] = me.toGeoJSONResult(result[i])
  15868. }
  15869. analystResult = result;
  15870. } else {
  15871. analystResult = me.toGeoJSONResult(result);
  15872. }
  15873. }
  15874. if (!analystResult) {
  15875. analystResult = result;
  15876. }
  15877. me.events.triggerEvent("processCompleted", {result: analystResult});
  15878. }
  15879. /**
  15880. * @function SuperMap.SpatialAnalystBase.prototype.toGeoJSONResult
  15881. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  15882. * @param {Object} result - 服务器返回的结果对象。
  15883. *
  15884. */
  15885. toGeoJSONResult(result) {
  15886. if (!result) {
  15887. return null;
  15888. }
  15889. //批量叠加分析时结果这样处理
  15890. if (result.result && result.result.resultGeometry) {
  15891. result = result.result
  15892. }
  15893. var geoJSONFormat = new GeoJSON();
  15894. if (result.recordsets) {
  15895. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  15896. if (recordsets[i].features) {
  15897. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  15898. }
  15899. }
  15900. } else if (result.recordset && result.recordset.features) {
  15901. result.recordset.features =geoJSONFormat.toGeoJSON(result.recordset.features);
  15902. }
  15903. if (result.resultGeometry) {
  15904. result.resultGeometry = geoJSONFormat.toGeoJSON(result.resultGeometry);
  15905. }
  15906. if (result.regions) {
  15907. result.regions = geoJSONFormat.toGeoJSON(result.regions);
  15908. }
  15909. return result;
  15910. }
  15911. }
  15912. SuperMap.SpatialAnalystBase = SpatialAnalystBase;
  15913. ;// CONCATENATED MODULE: ./src/common/iServer/AreaSolarRadiationService.js
  15914. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15915. * This program are made available under the terms of the Apache License, Version 2.0
  15916. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15917. /**
  15918. * @class SuperMap.AreaSolarRadiationService
  15919. * @category iServer SpatialAnalyst SolarRadiationAnalyst
  15920. * @classdesc 地区太阳辐射服务类。
  15921. * @param {string} url - 服务的访问地址。如:</br>http://localhost:8090/iserver/services/spatialanalyst-sample/restjsr/spatialanalyst。</br>
  15922. * @param {Object} options - 参数。</br>
  15923. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  15924. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  15925. * @param {Object} [options.headers] - 请求头。
  15926. * @extends {SuperMap.SpatialAnalystBase}
  15927. * @example 例如:
  15928. * (start code)
  15929. * var myAreaSolarRadiationService = new SuperMap.AreaSolarRadiationService(url);
  15930. * myAreaSolarRadiationService.on({
  15931. * "processCompleted": processCompleted,
  15932. * "processFailed": processFailed
  15933. * }
  15934. * );
  15935. * (end)
  15936. *
  15937. */
  15938. class AreaSolarRadiationService extends SpatialAnalystBase {
  15939. constructor(url, options) {
  15940. super(url, options);
  15941. this.CLASS_NAME = "SuperMap.AreaSolarRadiationService";
  15942. }
  15943. /**
  15944. * @function SuperMap.AreaSolarRadiationService.prototype.destroy
  15945. * @override
  15946. */
  15947. destroy() {
  15948. super.destroy();
  15949. }
  15950. /**
  15951. * @function SuperMap.AreaSolarRadiationService.prototype.processAsync
  15952. * @description 负责将客户端的查询参数传递到服务端。
  15953. * @param {SuperMap.AreaSolarRadiationParameters} parameter - 地区太阳辐射参数。
  15954. */
  15955. processAsync(parameter) {
  15956. if (!(parameter instanceof AreaSolarRadiationParameters)) {
  15957. return;
  15958. }
  15959. var me = this;
  15960. var parameterObject = {};
  15961. if (parameter instanceof AreaSolarRadiationParameters) {
  15962. me.url = Util.urlPathAppend(me.url, `datasets/${parameter.dataset}/solarradiation`);
  15963. }
  15964. me.url = Util.urlAppend(me.url, 'returnContent=true');
  15965. AreaSolarRadiationParameters.toObject(parameter, parameterObject);
  15966. var jsonParameters = Util.toJSON(parameterObject);
  15967. me.request({
  15968. method: 'POST',
  15969. data: jsonParameters,
  15970. scope: me,
  15971. success: me.serviceProcessCompleted,
  15972. failure: me.serviceProcessFailed
  15973. });
  15974. }
  15975. }
  15976. SuperMap.AreaSolarRadiationService = AreaSolarRadiationService;
  15977. ;// CONCATENATED MODULE: ./src/common/iServer/BufferDistance.js
  15978. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  15979. * This program are made available under the terms of the Apache License, Version 2.0
  15980. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  15981. /**
  15982. * @class SuperMap.BufferDistance
  15983. * @category iServer SpatialAnalyst BufferAnalyst
  15984. * @classdesc 缓冲区分析的缓冲距离类。通过该类可以设置缓冲区分析的缓冲距离,距离可以是数值也可以是数值型的字段表达式。
  15985. * @param {Object} options - 参数。
  15986. * @param {string} [options.exp] - 以数值型的字段表达式作为缓冲区分析的距离值。
  15987. * @param {number} [options.value=100] - 以数值作为缓冲区分析的距离值。单位:米。
  15988. */
  15989. class BufferDistance {
  15990. constructor(options) {
  15991. /**
  15992. * @member {string} [SuperMap.BufferDistance.prototype.exp]
  15993. * @description 以数值型的字段表达式作为缓冲区分析的距离值。
  15994. */
  15995. this.exp = null;
  15996. /**
  15997. * @member {number} [SuperMap.BufferDistance.prototype.value=100]
  15998. * @description 以数值作为缓冲区分析的距离值。单位:米。
  15999. */
  16000. this.value = 100;
  16001. Util.extend(this, options);
  16002. this.CLASS_NAME = "SuperMap.BufferDistance";
  16003. }
  16004. /**
  16005. * @function SuperMap.BufferDistance.prototype.destroy
  16006. * @description 释放资源,将引用资源的属性置空。
  16007. */
  16008. destroy() {
  16009. this.exp = null;
  16010. this.value = null;
  16011. }
  16012. }
  16013. SuperMap.BufferDistance = BufferDistance;
  16014. ;// CONCATENATED MODULE: ./src/common/iServer/BufferSetting.js
  16015. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16016. * This program are made available under the terms of the Apache License, Version 2.0
  16017. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16018. /**
  16019. * @class SuperMap.BufferSetting
  16020. * @category iServer SpatialAnalyst BufferAnalyst
  16021. * @classdesc 缓冲区分析通用设置类。
  16022. * @param {Object} options - 参数。
  16023. * @param {SuperMap.BufferEndType} [options.endType=SuperMap.BufferEndType.FLAT] - 缓冲区端点枚举值。
  16024. * @param {SuperMap.BufferDistance} [options.leftDistance=100] - 左侧缓冲距离。
  16025. * @param {SuperMap.BufferDistance} [options.rightDistance=100] - 右侧缓冲距离。
  16026. * @param {number} [options.semicircleLineSegment=4] - 圆头缓冲圆弧处线段的个数。
  16027. * @param {SuperMap.BufferRadiusUnit} [options.radiusUnit=SuperMap.BufferRadiusUnit.METER] - 缓冲半径单位。
  16028. */
  16029. class BufferSetting {
  16030. constructor(options) {
  16031. /**
  16032. * @member {SuperMap.BufferEndType} [SuperMap.BufferSetting.prototype.endType = SuperMap.BufferEndType.FLAT]
  16033. * @description 缓冲区端点枚举值。分为平头和圆头两种。
  16034. */
  16035. this.endType = BufferEndType.FLAT;
  16036. /**
  16037. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.leftDistance=100]
  16038. * @description 左侧缓冲距离。
  16039. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  16040. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  16041. */
  16042. this.leftDistance = new BufferDistance();
  16043. /**
  16044. * @member {SuperMap.BufferDistance} [SuperMap.BufferSetting.prototype.rightDistance=100]
  16045. * @description 右侧缓冲距离。
  16046. * 当为 GeometryBufferAnalyst 时,单位为默认地图的投影系的单位(如3857为米,4326为度),
  16047. * 当为 DatasetBufferAnalyst 时,单位通过{@link BufferSetting.radiusUnit}设置(默认全部为米)。
  16048. */
  16049. this.rightDistance = new BufferDistance();
  16050. /**
  16051. * @member {number} [SuperMap.BufferSetting.prototype.semicircleLineSegment=4]
  16052. * @description 圆头缓冲圆弧处线段的个数。即用多少个线段来模拟一个半圆。
  16053. */
  16054. this.semicircleLineSegment = 4;
  16055. /**
  16056. * @member {SuperMap.BufferRadiusUnit} [SuperMap.BufferSetting.prototype.radiusUnit = SuperMap.BufferRadiusUnit.METER]
  16057. * @description 缓冲半径单位,可以是{@link SuperMap.BufferRadiusUnit.METER}、{@link SuperMap.BufferRadiusUnit.MILIMETER}、
  16058. * {@link SuperMap.BufferRadiusUnit.CENTIMETER}、{@link SuperMap.BufferRadiusUnit.DECIMETER}、{@link SuperMap.BufferRadiusUnit.KILOMETER}、
  16059. * {@link SuperMap.BufferRadiusUnit.FOOT}、{@link SuperMap.BufferRadiusUnit.INCH}、{@link SuperMap.BufferRadiusUnit.MILE}、{@link SuperMap.BufferRadiusUnit.YARD}。
  16060. * 仅对BufferAnalyst有效。
  16061. */
  16062. this.radiusUnit = BufferRadiusUnit.METER;
  16063. if (options) {
  16064. Util.extend(this, options);
  16065. }
  16066. this.CLASS_NAME = "SuperMap.BufferSetting";
  16067. }
  16068. /**
  16069. * @function SuperMap.BufferSetting.prototype.destroy
  16070. * @description 释放资源,将引用资源的属性置空。
  16071. */
  16072. destroy() {
  16073. let me = this;
  16074. me.endType = null;
  16075. if (me.leftDistance) {
  16076. me.leftDistance.destroy();
  16077. me.leftDistance = null;
  16078. }
  16079. if (me.rightDistance) {
  16080. me.rightDistance.destroy();
  16081. me.rightDistance = null;
  16082. }
  16083. me.semicircleLineSegment = null;
  16084. me.radiusUnit = null;
  16085. }
  16086. }
  16087. SuperMap.BufferSetting = BufferSetting;
  16088. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystParameters.js
  16089. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16090. * This program are made available under the terms of the Apache License, Version 2.0
  16091. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16092. /**
  16093. * @class SuperMap.BufferAnalystParameters
  16094. * @category iServer SpatialAnalyst BufferAnalyst
  16095. * @classdesc 缓冲区分析参数基类。
  16096. * @param {Object} options - 参数。
  16097. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  16098. */
  16099. class BufferAnalystParameters {
  16100. constructor(options) {
  16101. var me = this;
  16102. /**
  16103. * @member {SuperMap.BufferSetting} [SuperMap.BufferAnalystParameters.prototype.bufferSetting]
  16104. * @description 设置缓冲区通用参数。为缓冲区分析提供必要的参数信息,包括左缓冲距离、右缓冲距离、端点类型、圆头缓冲圆弧处线段的个数信息。
  16105. */
  16106. me.bufferSetting = new BufferSetting();
  16107. Util.extend(this, options);
  16108. this.CLASS_NAME = "SuperMap.BufferAnalystParameters";
  16109. }
  16110. /**
  16111. * @function SuperMap.BufferAnalystParameters.prototype.destroy
  16112. * @description 释放资源,将引用资源的属性置空。
  16113. */
  16114. destroy() {
  16115. var me = this;
  16116. if (me.bufferSetting) {
  16117. me.bufferSetting.destroy();
  16118. me.bufferSetting = null;
  16119. }
  16120. }
  16121. }
  16122. SuperMap.BufferAnalystParameters = BufferAnalystParameters;
  16123. ;// CONCATENATED MODULE: ./src/common/iServer/DataReturnOption.js
  16124. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16125. * This program are made available under the terms of the Apache License, Version 2.0
  16126. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16127. /**
  16128. * @class SuperMap.DataReturnOption
  16129. * @category iServer SpatialAnalyst
  16130. * @classdesc 数据返回设置类。
  16131. * @param {Object} options - 参数。
  16132. * @param {number} [options.expectCount=1000] - 设置返回的最大记录数,小于或者等于 0 时表示返回所有记录数。
  16133. * @param {string} [options.dataset] - 设置结果数据集标识,当 dataReturnMode 为 {@link SuperMap.DataReturnMode.DATASET_ONLY}或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  16134. * 作为返回数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  16135. * @param {SuperMap.DataReturnMode} [options.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY] - 数据返回模式。
  16136. * @param {boolean} [options.deleteExistResultDataset=true] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  16137. */
  16138. class DataReturnOption {
  16139. constructor(options) {
  16140. /**
  16141. * @member {number} [SuperMap.DataReturnOption.prototype.expectCount=1000]
  16142. * @description 设置返回的最大记录数,小于或者等于0时表示返回所有记录数。
  16143. */
  16144. this.expectCount = 1000;
  16145. /**
  16146. * @member {string} [SuperMap.DataReturnOption.prototype.dataset]
  16147. * @description 设置结果数据集标识,当dataReturnMode为 {@link SuperMap.DataReturnMode.DATASET_ONLY}
  16148. * 或{@link SuperMap.DataReturnMode.DATASET_AND_RECORDSET}时有效,
  16149. * 作为返回数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  16150. */
  16151. this.dataset = null;
  16152. /**
  16153. * @member {SuperMap.DataReturnMode} [SuperMap.DataReturnOption.prototype.dataReturnMode=SuperMap.DataReturnMode.RECORDSET_ONLY]
  16154. * @description 数据返回模式。
  16155. */
  16156. this.dataReturnMode = DataReturnMode.RECORDSET_ONLY;
  16157. /**
  16158. * @member {boolean} [SuperMap.DataReturnOption.prototype.deleteExistResultDataset=true]
  16159. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  16160. */
  16161. this.deleteExistResultDataset = true;
  16162. Util.extend(this, options);
  16163. this.CLASS_NAME = "SuperMap.DataReturnOption";
  16164. }
  16165. /**
  16166. * @function SuperMap.DataReturnOption.prototype.destroy
  16167. * @description 释放资源,将引用资源的属性置空。
  16168. */
  16169. destroy() {
  16170. var me = this;
  16171. me.expectCount = null;
  16172. me.dataset = null;
  16173. me.dataReturnMode = null;
  16174. me.deleteExistResultDataset = null;
  16175. }
  16176. }
  16177. SuperMap.DataReturnOption = DataReturnOption;
  16178. ;// CONCATENATED MODULE: ./src/common/iServer/JoinItem.js
  16179. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16180. * This program are made available under the terms of the Apache License, Version 2.0
  16181. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16182. /**
  16183. * @class SuperMap.JoinItem
  16184. * @category iServer
  16185. * @classdesc 连接信息类。
  16186. * 该类用于矢量数据集与外部表的连接。外部表可以为另一个矢量数据集(其中纯属性数据集中没有空间几何信息)所对应的 DBMS 表,也可以是用户自建的业务表。
  16187. * 需要注意的是,矢量数据集与外部表必须属于同一数据源。表之间的联系的建立有两种方式,一种是连接(join),一种是关联(link)。
  16188. * 连接,实际上是依据相同的字段将一个外部表追加到指定的表;而关联是基于一个相同的字段定义了两个表格之间的联系,但不是实际的追加。
  16189. * 用于连接两个表的字段的名称不一定相同,但类型必须一致。当两个表格之间建立了连接,通过对主表进行操作,可以对外部表进行查询,制作专题图以及分析等。
  16190. * 当两个表格之间是一对一或多对一的关系时,可以使用 join 连接。当为多对一的关系时,允许指定多个字段之间的关联。
  16191. *(注意:SuperMap.JoinItem 目前支持左连接和内连接,不支持全连接和右连接,UDB 引擎不支持内连接。并且用于建立连接的两个表必须在同一个数据源下。)
  16192. * @param {Object} options - 参数。
  16193. * @param {string} options.foreignTableName - 外部表的名称。
  16194. * @param {string} options.joinFilter - 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  16195. * @param {SuperMap.JoinType} options.joinType - 两个表之间连接类型。
  16196. * @example 下面以 SQL 查询说明 joinItem 的使用方法:
  16197. *(start code)
  16198. * function queryBySQL() {
  16199. * // 设置与外部表的连接信息
  16200. * var joinItem = new SuperMap.JoinItem({
  16201. * foreignTableName: "foreignTable",
  16202. * joinFilter: "foreignTable.CONTINENT = Countries.CONTINENT",
  16203. * joinType: "LEFTJOIN"
  16204. * })
  16205. * var queryParam, queryBySQLParams, queryBySQLService;
  16206. * // 设置查询参数,在查询参数中添加joinItem关联条件信息
  16207. * queryParam = new SuperMap.FilterParameter({
  16208. * name: "Countries@World",
  16209. * joinItems: [joinItem]
  16210. * }),
  16211. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  16212. * queryParams: [queryParam]
  16213. * }),
  16214. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  16215. * eventListeners: { "processCompleted": processCompleted, "processFailed": processFailed}
  16216. * });
  16217. * queryBySQLService.processAsync(queryBySQLParams);
  16218. * }
  16219. * function processCompleted(queryEventArgs) {//todo}
  16220. * function processFailed(e) {//todo}
  16221. * (end)
  16222. */
  16223. class JoinItem {
  16224. constructor(options) {
  16225. /**
  16226. * @member {string} SuperMap.JoinItem.prototype.foreignTableName
  16227. * @description 外部表的名称。
  16228. * 如果外部表的名称是以 “表名@数据源名” 命名方式,则该属性只需赋值表名。
  16229. * 例如:外部表 Name@changchun,Name 为表名,changchun 为数据源名称,则该属性的赋值应为:Name。
  16230. */
  16231. this.foreignTableName = null;
  16232. /**
  16233. * @member {string} SuperMap.JoinItem.prototype.joinFilter
  16234. * @description 矢量数据集与外部表之间的连接表达式,即设定两个表之间关联的字段。
  16235. * 例如,将房屋面数据集(Building)的 district 字段与房屋拥有者的纯属性数据集(Owner)的 region 字段相连接,
  16236. * 两个数据集对应的表名称分别为 Table_Building 和 Table_Owner,
  16237. * 则连接表达式为 Table_Building.district = Table_Owner.region。
  16238. * 当有多个字段相连接时,用 AND 将多个表达式相连。
  16239. */
  16240. this.joinFilter = null;
  16241. /**
  16242. * @member {SuperMap.JoinType} SuperMap.JoinItem.prototype.joinType
  16243. * @description 两个表之间连接类型。
  16244. * 连接类型决定了对两个表进行连接查询后返回的记录的情况。
  16245. */
  16246. this.joinType = null;
  16247. if (options) {
  16248. Util.extend(this, options);
  16249. }
  16250. this.CLASS_NAME = "SuperMap.JoinItem";
  16251. }
  16252. /**
  16253. * @function SuperMap.JoinItem.prototype.destroy
  16254. * @description 释放资源,将引用资源的属性置空。
  16255. */
  16256. destroy() {
  16257. var me = this;
  16258. me.foreignTableName = null;
  16259. me.joinFilter = null;
  16260. me.joinType = null;
  16261. }
  16262. /**
  16263. * @function SuperMap.JoinItem.prototype.toServerJSONObject
  16264. * @description 转换成对应的 JSON 格式对象。
  16265. */
  16266. toServerJSONObject() {
  16267. var dataObj = {};
  16268. dataObj = Util.copyAttributes(dataObj, this);
  16269. //joinFilter基本是个纯属性对象,这里不再做转换
  16270. return dataObj;
  16271. }
  16272. }
  16273. SuperMap.JoinItem = JoinItem;
  16274. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  16275. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16276. * This program are made available under the terms of the Apache License, Version 2.0
  16277. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16278. // eslint-disable-line no-unused-vars
  16279. /**
  16280. * @class SuperMap.DatasourceConnectionInfo
  16281. * @category iServer Data
  16282. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  16283. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  16284. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  16285. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  16286. * @category iServer Data
  16287. * @param {Object} options - 参数。
  16288. * @param {string} options.alias - 数据源别名。
  16289. * @param {string} options.dataBase - 数据源连接的数据库名。
  16290. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  16291. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  16292. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  16293. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  16294. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  16295. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  16296. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  16297. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  16298. * @param {string} [options.user] - 登录数据库的用户名。
  16299. */
  16300. class DatasourceConnectionInfo {
  16301. constructor(options) {
  16302. /**
  16303. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  16304. * @description 数据源别名。
  16305. */
  16306. this.alias = null;
  16307. /**
  16308. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  16309. * @description 数据源是否自动连接数据。
  16310. */
  16311. this.connect = null;
  16312. /**
  16313. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  16314. * @description 数据源连接的数据库名。
  16315. */
  16316. this.dataBase = null;
  16317. /**
  16318. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  16319. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  16320. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  16321. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  16322. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  16323. */
  16324. this.driver = null;
  16325. /**
  16326. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  16327. * @description 数据源连接的引擎类型。
  16328. */
  16329. this.engineType = null;
  16330. /**
  16331. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  16332. * @description 是否以独占方式打开数据源。
  16333. */
  16334. this.exclusive = null;
  16335. /**
  16336. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  16337. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  16338. */
  16339. this.OpenLinkTable = null;
  16340. /**
  16341. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  16342. * @description 登录数据源连接的数据库或文件的密码。
  16343. */
  16344. this.password = null;
  16345. /**
  16346. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  16347. * @description 是否以只读方式打开数据源。
  16348. */
  16349. this.readOnly = null;
  16350. /**
  16351. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  16352. * @description 数据库服务器名、文件名或服务地址。
  16353. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  16354. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  16355. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  16356. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  16357. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  16358. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  16359. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  16360. * 8.对于 SuperMapCould 数据源,为其服务地址。
  16361. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  16362. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  16363. */
  16364. this.server = null;
  16365. /**
  16366. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  16367. * @description 登录数据库的用户名。
  16368. */
  16369. this.user = null;
  16370. if (options) {
  16371. Util.extend(this, options);
  16372. }
  16373. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  16374. }
  16375. /**
  16376. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  16377. * @description 释放资源,将引用资源的属性置空。
  16378. */
  16379. destroy() {
  16380. var me = this;
  16381. me.alias = null;
  16382. me.connect = null;
  16383. me.dataBase = null;
  16384. me.driver = null;
  16385. me.engineType = null;
  16386. me.exclusive = null;
  16387. me.OpenLinkTable = null;
  16388. me.password = null;
  16389. me.readOnly = null;
  16390. me.server = null;
  16391. me.user = null;
  16392. }
  16393. }
  16394. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  16395. ;// CONCATENATED MODULE: ./src/common/iServer/LinkItem.js
  16396. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16397. * This program are made available under the terms of the Apache License, Version 2.0
  16398. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16399. /**
  16400. * @class SuperMap.LinkItem
  16401. * @constructs SuperMap.LinkItem
  16402. * @category iServer
  16403. * @classdesc 关联信息类。
  16404. * @description 该类用于矢量数据集与外部表的关联。 外部表是另一个数据集(其中纯属性数据集中没有空间几何信息)中的 DBMS 表,
  16405. * 矢量数据集与外部表可以属于不同的数据源,但数据源类型目前只支持 SQL Server 和 Oracle 类型。使用 LinkItem 时,
  16406. * 空间数据和属性数据必须满足关联条件,即主空间数据集与外部属性表之间存在关联字段。{@link SuperMap.LinkItem}
  16407. * 只支持左连接,UDB、PostgreSQL 和 DB2 数据源不支持 {@link SuperMap.LinkItem};另外,用于建立关联关系的两个表可以不在同一个数据源下。注意:<br>
  16408. * 1. 使用 {@link SuperMap.LinkItem} 的约束条件为:空间数据和属性数据必须有关联条件,即主空间数据集与外部属性表之间存在关联字段;<br>
  16409. * 2. 使用外关联表制作专题图时,所关联的字段必须设置表名,例如,如果所关联的字段为 BaseMap_R 数据集的 SmID,就要写成 BaseMap_R.SMID。
  16410. * @param {Object} options - 参数。
  16411. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceConnectionInfo - 关联的外部数据源信息。
  16412. * @param {Array.<string>} options.foreignKeys - 主空间数据集的外键。
  16413. * @param {string} options.foreignTable - 关联的外部属性表的名称。
  16414. * @param {Array.<string>} options.linkFields - 欲保留的外部属性表的字段。
  16415. * @param {string} options.linkFilter - 与外部属性表的连接条件。
  16416. * @param {string} options.name - 此关联信息对象的名称。
  16417. * @param {Array.<string>} options.primaryKeys - 需要关联的外部属性表的主键。
  16418. * @example 下面以 SQL 查询说明 linkitem 的使用方法:
  16419. * function queryBySQL() {
  16420. * // 设置关联的外部数据库信息,alias表示数据库别名
  16421. * var dc = new SuperMap.DatasourceConnectionInfo({
  16422. * dataBase: "RelQuery",
  16423. * server: "{ip}:{port}",
  16424. * user: "sa",
  16425. * password: "map",
  16426. * driver: "SQL Server",
  16427. * connect: true,
  16428. * OpenLinkTable: false,
  16429. * alias: "RelQuery",
  16430. * engineType: EngineType.SQLPLUS,
  16431. * readOnly: false,
  16432. * exclusive: false
  16433. * });
  16434. * // 设置关联信息
  16435. * var linkItem = new SuperMap.LinkItem({
  16436. * datasourceConnectionInfo: dc,
  16437. * foreignKeys: ["name"],
  16438. * foreignTable: "Pop_2011",
  16439. * linkFields: ["SmID as Pid","pop"],
  16440. * name: "link",
  16441. * primatryKeys: ["name"],
  16442. * });
  16443. * // 设置查询参数,在查询参数中添加linkItem关联条件信息
  16444. * var queryParam, queryBySQLParams, queryBySQLService;
  16445. * queryParam = new SuperMap.FilterParameter({
  16446. * name: "Province@RelQuery",
  16447. * fields: ["SmID","name"],
  16448. * attributeFilter: "SmID<7",
  16449. * linkItems: [linkItem]
  16450. * }),
  16451. * queryBySQLParams = new SuperMap.QueryBySQLParameters({
  16452. * queryParams: [queryParam]
  16453. * }),
  16454. * queryBySQLService = new SuperMap.QueryBySQLService(url, {
  16455. * eventListeners: {
  16456. * "processCompleted": processCompleted,
  16457. * "processFailed": processFailed
  16458. * }
  16459. * });
  16460. * queryBySQLService.processAsync(queryBySQLParams);
  16461. * }
  16462. * function processCompleted(queryEventArgs) {//todo}
  16463. * function processFailed(e) {//todo}
  16464. *
  16465. */
  16466. class LinkItem {
  16467. constructor(options) {
  16468. /**
  16469. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.LinkItem.prototype.datasourceConnectionInfo
  16470. * @description 关联的外部数据源信息。
  16471. */
  16472. this.datasourceConnectionInfo = null;
  16473. /**
  16474. * @member {Array.<string>} SuperMap.LinkItem.prototype.foreignKeys
  16475. * @description 主空间数据集的外键。
  16476. */
  16477. this.foreignKeys = null;
  16478. /**
  16479. * @member {string} SuperMap.LinkItem.prototype.foreignTable
  16480. * @description 关联的外部属性表的名称,目前仅支持 Supermap 管理的表,即另一个矢量数据集所对应的 DBMS 表。
  16481. */
  16482. this.foreignTable = null;
  16483. /**
  16484. * @member {Array.<string>} SuperMap.LinkItem.prototype.linkFields
  16485. * @description 欲保留的外部属性表的字段。如果不设置字段或者设置的字段在外部属性表中不存在的话则不返
  16486. * 回任何外部属性表的属性信息。如果欲保留的外部表字段与主表字段存在同名,则还需要指定一个不存在字段名作为外部表的字段别名。
  16487. */
  16488. this.linkFields = null;
  16489. /**
  16490. * @member {string} SuperMap.LinkItem.prototype.linkFilter
  16491. * @description 与外部属性表的连接条件。
  16492. */
  16493. this.linkFilter = null;
  16494. /**
  16495. * @member {string} SuperMap.LinkItem.prototype.name
  16496. * @description 此关联信息对象的名称。
  16497. */
  16498. this.name = null;
  16499. /**
  16500. * @member {Array.<string>} SuperMap.LinkItem.prototype.primaryKeys
  16501. * @description 需要关联的外部属性表的主键。
  16502. */
  16503. this.primaryKeys = null;
  16504. if (options) {
  16505. Util.extend(this, options);
  16506. }
  16507. this.CLASS_NAME = "SuperMap.LinkItem";
  16508. }
  16509. /**
  16510. * @function SuperMap.LinkItem.prototype.destroy
  16511. * @description 释放资源,将引用资源的属性置空。
  16512. */
  16513. destroy() {
  16514. var me = this;
  16515. if (me.datasourceConnectionInfo instanceof DatasourceConnectionInfo) {
  16516. me.datasourceConnectionInfo.destroy();
  16517. me.datasourceConnectionInfo = null;
  16518. }
  16519. me.foreignKeys = null;
  16520. me.foreignTable = null;
  16521. me.linkFields = null;
  16522. me.linkFilter = null;
  16523. me.name = null;
  16524. me.primaryKeys = null;
  16525. }
  16526. }
  16527. SuperMap.LinkItem = LinkItem;
  16528. ;// CONCATENATED MODULE: ./src/common/iServer/FilterParameter.js
  16529. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16530. * This program are made available under the terms of the Apache License, Version 2.0
  16531. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16532. /**
  16533. * @class SuperMap.FilterParameter
  16534. * @category iServer
  16535. * @classdesc 查询过滤条件参数类。该类用于设置查询数据集的查询过滤参数。
  16536. * @param {Object} options - 参数。
  16537. * @param {string} options.attributeFilter - 属性过滤条件。
  16538. * @param {string} options.name - 查询数据集名称或者图层名称。
  16539. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 与外部表的连接信息 SuperMap.JoinItem 数组。
  16540. * @param {Array.<SuperMap.LinkItem>} [options.linkItems] - 与外部表的关联信息 SuperMap.LinkItem 数组。
  16541. * @param {Array.<string>} [options.ids] - 查询 id 数组,即属性表中的 SmID 值。
  16542. * @param {string} [options.orderBy] - 查询排序的字段,orderBy 的字段须为数值型的。
  16543. * @param {string} [options.groupBy] - 查询分组条件的字段。
  16544. * @param {Array.<string>} [options.fields] - 查询字段数组。
  16545. */
  16546. class FilterParameter {
  16547. constructor(options) {
  16548. /**
  16549. * @member {string} SuperMap.FilterParameter.prototype.attributeFilter
  16550. * @description 属性过滤条件。
  16551. * 相当于 SQL 语句中的 WHERE 子句,其格式为:WHERE <条件表达式>,
  16552. * attributeFilter 就是其中的“条件表达式”。
  16553. * 该字段的用法为 attributeFilter = "过滤条件"。
  16554. * 例如,要查询字段 fieldValue 小于100的记录,设置 attributeFilter = "fieldValue < 100";
  16555. * 要查询字段 name 的值为“酒店”的记录,设置 attributeFilter = "name like '%酒店%'",等等。
  16556. */
  16557. this.attributeFilter = null;
  16558. /**
  16559. * @member {string} SuperMap.FilterParameter.prototype.name
  16560. * @description 查询数据集名称或者图层名称,根据实际的查询对象而定。
  16561. * 一般情况下该字段为数据集名称,但在进行与地图相关功能的操作时,
  16562. * 需要设置为图层名称(图层名称格式:数据集名称@数据源别名)。
  16563. * 因为一个地图的图层可能是来自于不同数据源的数据集,
  16564. * 而不同的数据源中可能存在同名的数据集,
  16565. * 使用数据集名称不能唯一的确定数据集,
  16566. * 所以在进行与地图相关功能的操作时,该值需要设置为图层名称。
  16567. */
  16568. this.name = null;
  16569. /**
  16570. * @member {Array.<SuperMap.JoinItem>} [SuperMap.FilterParameter.prototype.joinItems]
  16571. * @description 与外部表的连接信息 SuperMap.JoinItem 数组。
  16572. */
  16573. this.joinItems = null;
  16574. /**
  16575. * @member {Array.<SuperMap.LinkItem>} [SuperMap.FilterParameter.prototype.linkItems]
  16576. * @description 与外部表的关联信息 LinkItem 数组。
  16577. */
  16578. this.linkItems = null;
  16579. /**
  16580. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.ids]
  16581. * @description 查询 id 数组,即属性表中的 SmID 值。
  16582. */
  16583. this.ids = null;
  16584. /**
  16585. * @member {string} [SuperMap.FilterParameter.prototype.orderBy]
  16586. * @description 查询排序的字段,orderBy的字段须为数值型的。
  16587. * 相当于 SQL 语句中的 ORDER BY 子句,其格式为:ORDER BY <列名>,
  16588. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  16589. * 对单个字段排序时,该字段的用法为 orderBy = "字段名";
  16590. * 对多个字段排序时,字段之间以英文逗号进行分割,用法为 orderBy = "字段名1, 字段名2"。
  16591. * 例如,现有一个国家数据集,它有两个字段分别为“SmArea”和“pop_1994”,
  16592. * 分别表示国家的面积和1994年的各国人口数量。
  16593. * 如果要按照各国人口数量对记录进行排序,则 orderBy = "pop_1994";
  16594. * 如果要以面积和人口进行排序,则 orderBy = "SmArea, pop_1994"。
  16595. */
  16596. this.orderBy = null;
  16597. /**
  16598. * @member {string} [SuperMap.FilterParameter.prototype.groupBy]
  16599. * @description 查询分组条件的字段。
  16600. * 相当于 SQL 语句中的 GROUP BY 子句,其格式为:GROUP BY <列名>,
  16601. * 列名即属性表中每一列的名称,列又可称为属性,在 SuperMap 中又称为字段。
  16602. * 对单个字段分组时,该字段的用法为 groupBy = "字段名";
  16603. * 对多个字段分组时,字段之间以英文逗号进行分割,用法为 groupBy = "字段名1, 字段名2"。
  16604. * 例如,现有一个全球城市数据集,该数据集有两个字段分别为“Continent”和“Country”,
  16605. * 分别表示某个城市所属的洲和国家。
  16606. * 如果要按照国家对全球的城市进行分组, 可以设置 groupBy = "Country";
  16607. * 如果以洲和国家对城市进行分组,设置 groupBy = "Continent, Country"。
  16608. */
  16609. this.groupBy = null;
  16610. /**
  16611. * @member {Array.<string>} [SuperMap.FilterParameter.prototype.fields]
  16612. * @description 查询字段数组,如果不设置则使用系统返回的所有字段。
  16613. */
  16614. this.fields = null;
  16615. if (options) {
  16616. Util.extend(this, options);
  16617. }
  16618. this.CLASS_NAME = "SuperMap.FilterParameter";
  16619. }
  16620. /**
  16621. * @function SuperMap.FilterParameter.prototype.destroy
  16622. * @description 释放资源,将引用资源的属性置空。
  16623. */
  16624. destroy() {
  16625. var me = this;
  16626. me.attributeFilter = null;
  16627. me.name = null;
  16628. if (me.joinItems) {
  16629. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  16630. joinItems[i].destroy();
  16631. }
  16632. me.joinItems = null;
  16633. }
  16634. if (me.linkItems) {
  16635. for (let i = 0, linkItems = me.linkItems, len = linkItems.length; i < len; i++) {
  16636. linkItems[i].destroy();
  16637. }
  16638. me.linkItems = null;
  16639. }
  16640. me.ids = null;
  16641. me.orderBy = null;
  16642. me.groupBy = null;
  16643. me.fields = null;
  16644. }
  16645. }
  16646. SuperMap.FilterParameter = FilterParameter;
  16647. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetBufferAnalystParameters.js
  16648. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16649. * This program are made available under the terms of the Apache License, Version 2.0
  16650. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16651. /**
  16652. * @class SuperMap.DatasetBufferAnalystParameters
  16653. * @category iServer SpatialAnalyst BufferAnalyst
  16654. * @classdesc 数据集缓冲区分析参数类。
  16655. * @param {Object} options - 参数。
  16656. * @param {string} options.dataset - 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  16657. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  16658. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  16659. * @param {boolean} [options.isAttributeRetained=true] - 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  16660. * @param {boolean} [options.isUnion=false] - 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  16661. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  16662. *
  16663. * @extends {SuperMap.BufferAnalystParameters}
  16664. */
  16665. class DatasetBufferAnalystParameters extends BufferAnalystParameters {
  16666. constructor(options) {
  16667. super(options);
  16668. /**
  16669. * @member {string} SuperMap.DatasetBufferAnalystParameters.prototype.dataset
  16670. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如“数据集名称@数据源别名”形式来表示。
  16671. */
  16672. this.dataset = null;
  16673. /**
  16674. * @member {SuperMap.FilterParameter} [SuperMap.DatasetBufferAnalystParameters.prototype.filterQueryParameter]
  16675. * @description 设置数据集中几何对象的过滤条件。只有满足此条件的几何对象才参与缓冲区分析。
  16676. */
  16677. this.filterQueryParameter = new FilterParameter();
  16678. /**
  16679. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetBufferAnalystParameters.prototype.resultSetting]
  16680. * @description 结果返回设置类。
  16681. */
  16682. this.resultSetting = new DataReturnOption();
  16683. /**
  16684. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isAttributeRetained=true]
  16685. * @description 是否保留进行缓冲区分析的对象的字段属性。当 isUnion 字段为 false 时该字段有效。
  16686. */
  16687. this.isAttributeRetained = true;
  16688. /**
  16689. * @member {boolean} [SuperMap.DatasetBufferAnalystParameters.prototype.isUnion=false]
  16690. * @description 是否将缓冲区与源记录集中的对象合并后返回。对于面对象而言,要求源数据集中的面对象不相交。
  16691. */
  16692. this.isUnion = false;
  16693. Util.extend(this, options);
  16694. this.CLASS_NAME = "SuperMap.DatasetBufferAnalystParameters";
  16695. }
  16696. /**
  16697. * @function SuperMap.DatasetBufferAnalystParameters.prototype.destroy
  16698. * @override
  16699. */
  16700. destroy() {
  16701. super.destroy();
  16702. var me = this;
  16703. me.dataset = null;
  16704. if (me.filterQueryParameter) {
  16705. me.filterQueryParameter.destroy();
  16706. me.filterQueryParameter = null;
  16707. }
  16708. if (me.resultSetting) {
  16709. me.resultSetting.destroy();
  16710. me.resultSetting = null;
  16711. }
  16712. me.isAttributeRetained = null;
  16713. me.isUnion = null;
  16714. }
  16715. /**
  16716. * @function SuperMap.DatasetBufferAnalystParameters.toObject
  16717. * @param {SuperMap.DatasetBufferAnalystParameters} datasetBufferAnalystParameters - 数据集缓冲区分析参数类。
  16718. * @param {SuperMap.DatasetBufferAnalystParameters} tempObj - 数据集缓冲区分析参数对象。
  16719. * @description 将数据集缓冲区分析参数对象转换为 JSON 对象。
  16720. * @returns {Object} JSON 对象。
  16721. */
  16722. static toObject(datasetBufferAnalystParameters, tempObj) {
  16723. for (var name in datasetBufferAnalystParameters) {
  16724. if (name === "bufferSetting") {
  16725. datasetBufferAnalystParameters.bufferSetting.radiusUnit = datasetBufferAnalystParameters.bufferSetting.radiusUnit.toUpperCase();
  16726. tempObj.bufferAnalystParameter = datasetBufferAnalystParameters.bufferSetting;
  16727. } else if (name === "resultSetting") {
  16728. tempObj.dataReturnOption = datasetBufferAnalystParameters.resultSetting;
  16729. } else if (name === "dataset") {
  16730. continue;
  16731. } else {
  16732. tempObj[name] = datasetBufferAnalystParameters[name];
  16733. }
  16734. }
  16735. }
  16736. }
  16737. SuperMap.DatasetBufferAnalystParameters = DatasetBufferAnalystParameters;
  16738. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBufferAnalystParameters.js
  16739. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16740. * This program are made available under the terms of the Apache License, Version 2.0
  16741. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16742. /**
  16743. * @class SuperMap.GeometryBufferAnalystParameters
  16744. * @category iServer SpatialAnalyst BufferAnalyst
  16745. * @classdesc 几何对象缓冲区分析参数类
  16746. * 对指定的某个几何对象做缓冲区分析。通过该类可以指定要做缓冲区分析的几何对象、缓冲区参数等。
  16747. * @param {Object} options - 参数。
  16748. * @param {Object} options.sourceGeometry - 要做缓冲区分析的几何对象。
  16749. * @param {number} options.sourceGeometrySRID - 缓冲区几何对象投影坐标参数, 如 4326,3857。
  16750. * @param {SuperMap.BufferSetting} [options.bufferSetting] - 设置缓冲区通用参数。
  16751. * @extends {SuperMap.BufferAnalystParameters}
  16752. */
  16753. class GeometryBufferAnalystParameters extends BufferAnalystParameters {
  16754. constructor(options) {
  16755. super(options);
  16756. /**
  16757. * @member {Object} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometry
  16758. * @description 要做缓冲区分析的几何对象。<br>
  16759. * 点类型可以是:{@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>
  16760. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  16761. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  16762. */
  16763. this.sourceGeometry = null;
  16764. /**
  16765. * @member {number} SuperMap.GeometryBufferAnalystParameters.prototype.sourceGeometrySRID
  16766. * @description 缓冲区几何对象投影坐标参数, 如 4326,3857。
  16767. */
  16768. this.sourceGeometrySRID = null;
  16769. if (options) {
  16770. Util.extend(this, options);
  16771. }
  16772. this.CLASS_NAME = " SuperMap.GeometryBufferAnalystParameters";
  16773. }
  16774. /**
  16775. * @function SuperMap.GeometryBufferAnalystParameters.prototype.destroy
  16776. * @override
  16777. */
  16778. destroy() {
  16779. super.destroy();
  16780. var me = this;
  16781. if (me.sourceGeometry) {
  16782. me.sourceGeometry.destroy();
  16783. me.sourceGeometry = null;
  16784. }
  16785. }
  16786. /**
  16787. * @function SuperMap.GeometryBufferAnalystParameters.toObject
  16788. * @param {SuperMap.GeometryBufferAnalystParameters} geometryBufferAnalystParameters - 几何对象缓冲区分析参数类。
  16789. * @param {SuperMap.GeometryBufferAnalystParameters} tempObj - 几何对象缓冲区分析参数对象。
  16790. * @description 将几何对象缓冲区分析参数对象转换为 JSON 对象。
  16791. * @returns {Object} JSON 对象。
  16792. */
  16793. static toObject(geometryBufferAnalystParameters, tempObj) {
  16794. for (var name in geometryBufferAnalystParameters) {
  16795. if (name === "bufferSetting") {
  16796. var tempBufferSetting = {};
  16797. for (var key in geometryBufferAnalystParameters.bufferSetting) {
  16798. tempBufferSetting[key] = geometryBufferAnalystParameters.bufferSetting[key];
  16799. }
  16800. tempObj.analystParameter = tempBufferSetting;
  16801. } else if (name === "sourceGeometry") {
  16802. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryBufferAnalystParameters.sourceGeometry);
  16803. } else {
  16804. tempObj[name] = geometryBufferAnalystParameters[name];
  16805. }
  16806. }
  16807. }
  16808. }
  16809. SuperMap.GeometryBufferAnalystParameters = GeometryBufferAnalystParameters;
  16810. ;// CONCATENATED MODULE: ./src/common/iServer/BufferAnalystService.js
  16811. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16812. * This program are made available under the terms of the Apache License, Version 2.0
  16813. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16814. /**
  16815. * @class SuperMap.BufferAnalystService
  16816. * @category iServer SpatialAnalyst BufferAnalyst
  16817. * @classdesc 缓冲区分析服务类。
  16818. * 该类负责将客户设置的缓冲区分析参数传递给服务端,并接收服务端返回的缓冲区分析结果数据。
  16819. * 缓冲区分析结果通过该类支持的事件的监听函数参数获取。
  16820. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  16821. * @param {Object} options - 参数。</br>
  16822. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  16823. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  16824. * @param {Object} [options.headers] - 请求头。
  16825. * @extends {SuperMap.SpatialAnalystBase}
  16826. * @example 例如:
  16827. * (start code)
  16828. * var myBufferAnalystService = new SuperMap.BufferAnalystService(url, {
  16829. * eventListeners: {
  16830. * "processCompleted": bufferCompleted,
  16831. * "processFailed": bufferFailed
  16832. * }
  16833. * });
  16834. * (end)
  16835. *
  16836. *
  16837. */
  16838. class BufferAnalystService extends SpatialAnalystBase {
  16839. constructor(url, options) {
  16840. super(url, options);
  16841. /**
  16842. * @member {string} SuperMap.BufferAnalystService.prototype.mode
  16843. * @description 缓冲区分析类型
  16844. */
  16845. this.mode = null;
  16846. if (options) {
  16847. Util.extend(this, options);
  16848. }
  16849. this.CLASS_NAME = "SuperMap.BufferAnalystService";
  16850. }
  16851. /**
  16852. * @function SuperMap.BufferAnalystService.prototype.destroy
  16853. * @override
  16854. */
  16855. destroy() {
  16856. super.destroy();
  16857. this.mode = null;
  16858. }
  16859. /**
  16860. * @method SuperMap.BufferAnalystService.prototype.processAsync
  16861. * @description 负责将客户端的查询参数传递到服务端。
  16862. * @param {SuperMap.BufferAnalystParameters} parameter - 缓冲区分析参数
  16863. */
  16864. processAsync(parameter) {
  16865. var parameterObject = {};
  16866. var me = this;
  16867. if (parameter instanceof DatasetBufferAnalystParameters) {
  16868. me.mode = 'datasets';
  16869. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/buffer');
  16870. DatasetBufferAnalystParameters.toObject(parameter, parameterObject);
  16871. } else if (parameter instanceof GeometryBufferAnalystParameters) {
  16872. me.mode = 'geometry';
  16873. me.url = Util.urlPathAppend(me.url, 'geometry/buffer');
  16874. GeometryBufferAnalystParameters.toObject(parameter, parameterObject);
  16875. }
  16876. var jsonParameters = Util.toJSON(parameterObject);
  16877. me.url = Util.urlAppend(me.url, 'returnContent=true');
  16878. me.request({
  16879. method: "POST",
  16880. data: jsonParameters,
  16881. scope: me,
  16882. success: me.serviceProcessCompleted,
  16883. failure: me.serviceProcessFailed
  16884. });
  16885. }
  16886. }
  16887. SuperMap.BufferAnalystService = BufferAnalystService;
  16888. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  16889. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16890. * This program are made available under the terms of the Apache License, Version 2.0
  16891. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16892. /**
  16893. * @class SuperMap.OutputSetting
  16894. * @category iServer ProcessingService
  16895. * @classdesc 分布式分析输出类型设置类。
  16896. * @param {Object} options - 参数。
  16897. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  16898. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  16899. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  16900. * @param {string} [options.outputPath] - 分析结果输出路径。
  16901. */
  16902. class OutputSetting {
  16903. constructor(options) {
  16904. /**
  16905. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  16906. * @description 分布式分析的输出类型。
  16907. */
  16908. this.type = OutputType.UDB;
  16909. /**
  16910. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  16911. * @description 分布式分析的输出结果数据集名称。
  16912. */
  16913. this.datasetName = "analystResult";
  16914. /**
  16915. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  16916. * @description 分布式分析的输出结果数据源连接信息。
  16917. */
  16918. this.datasourceInfo = null;
  16919. /**
  16920. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  16921. * @description 分布式分析的分析结果输出路径。
  16922. */
  16923. this.outputPath = "";
  16924. Util.extend(this, options);
  16925. this.CLASS_NAME = "SuperMap.OutputSetting";
  16926. }
  16927. /**
  16928. * @function SuperMap.OutputSetting.prototype.destroy
  16929. * @description 释放资源,将引用资源的属性置空。
  16930. */
  16931. destroy() {
  16932. var me = this;
  16933. me.type = null;
  16934. me.datasetName = null;
  16935. me.outputPath = null;
  16936. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  16937. me.datasourceInfo.destroy();
  16938. me.datasourceInfo = null;
  16939. }
  16940. }
  16941. }
  16942. SuperMap.OutputSetting = OutputSetting;
  16943. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  16944. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  16945. * This program are made available under the terms of the Apache License, Version 2.0
  16946. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  16947. /**
  16948. * @class SuperMap.MappingParameters
  16949. * @category iServer ProcessingService
  16950. * @classdesc 分析后结果可视化的参数类。
  16951. * @param {Object} options - 参数。
  16952. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  16953. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  16954. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  16955. * @param {number} [options.rangeCount] - 专题图分段个数。
  16956. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  16957. */
  16958. class MappingParameters {
  16959. constructor(options) {
  16960. /**
  16961. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  16962. * @description 栅格分段专题图子项数组。
  16963. */
  16964. this.items = null;
  16965. /**
  16966. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  16967. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  16968. */
  16969. this.numericPrecision = 1;
  16970. /**
  16971. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  16972. * @description 专题图分段模式。
  16973. */
  16974. this.rangeMode = RangeMode.EQUALINTERVAL;
  16975. /**
  16976. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  16977. * @description 专题图分段个数。
  16978. */
  16979. this.rangeCount = "";
  16980. /**
  16981. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  16982. * @description 专题图颜色渐变模式。
  16983. */
  16984. this.colorGradientType = ColorGradientType.YELLOW_RED;
  16985. Util.extend(this, options);
  16986. this.CLASS_NAME = "SuperMap.MappingParameters";
  16987. }
  16988. /**
  16989. * @function SuperMap.MappingParameters.prototype.destroy
  16990. * @description 释放资源,将引用资源的属性置空。
  16991. */
  16992. destroy() {
  16993. var me = this;
  16994. if (me.items) {
  16995. if (me.items.length > 0) {
  16996. for (var item in me.items) {
  16997. me.items[item].destroy();
  16998. me.items[item] = null;
  16999. }
  17000. }
  17001. me.items = null;
  17002. }
  17003. me.numericPrecision = null;
  17004. me.rangeMode = null;
  17005. me.rangeCount = null;
  17006. me.colorGradientType = null;
  17007. }
  17008. }
  17009. SuperMap.MappingParameters = MappingParameters;
  17010. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  17011. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17012. * This program are made available under the terms of the Apache License, Version 2.0
  17013. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17014. /**
  17015. * @class SuperMap.BuffersAnalystJobsParameter
  17016. * @category iServer ProcessingService BufferAnalyst
  17017. * @classdesc 缓冲区分析任务参数类。
  17018. * @param {Object} options - 参数。
  17019. * @param {string} options.datasetName - 数据集名。
  17020. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  17021. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  17022. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  17023. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  17024. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  17025. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  17026. */
  17027. class BuffersAnalystJobsParameter {
  17028. constructor(options) {
  17029. /**
  17030. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  17031. * @description 数据集名。
  17032. */
  17033. this.datasetName = '';
  17034. /**
  17035. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  17036. * @description 分析范围。
  17037. */
  17038. this.bounds = '';
  17039. /**
  17040. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  17041. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  17042. */
  17043. this.distance = '';
  17044. /**
  17045. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  17046. * @description 缓冲距离字段。
  17047. */
  17048. this.distanceField = '';
  17049. /**
  17050. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  17051. * @description 缓冲距离单位。
  17052. */
  17053. this.distanceUnit = AnalystSizeUnit.METER;
  17054. /**
  17055. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  17056. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  17057. */
  17058. this.dissolveField = '';
  17059. /**
  17060. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  17061. * @description 输出参数设置类。
  17062. */
  17063. this.output = null;
  17064. /**
  17065. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  17066. * @description 分析后结果可视化的参数类。
  17067. */
  17068. this.mappingParameters = null;
  17069. if (!options) {
  17070. return this;
  17071. }
  17072. Util.extend(this, options);
  17073. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  17074. }
  17075. /**
  17076. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  17077. * @description 释放资源,将引用资源的属性置空。
  17078. */
  17079. destroy() {
  17080. this.datasetName = null;
  17081. this.bounds = null;
  17082. this.distance = null;
  17083. this.distanceField = null;
  17084. this.distanceUnit = null;
  17085. this.dissolveField = null;
  17086. if (this.output instanceof OutputSetting) {
  17087. this.output.destroy();
  17088. this.output = null;
  17089. }
  17090. if (this.mappingParameters instanceof MappingParameters) {
  17091. this.mappingParameters.destroy();
  17092. this.mappingParameters = null;
  17093. }
  17094. }
  17095. /**
  17096. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  17097. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  17098. * @param {Object} tempObj - 目标对象。
  17099. * @description 生成缓冲区分析任务对象。
  17100. */
  17101. static toObject(BuffersAnalystJobsParameter, tempObj) {
  17102. for (var name in BuffersAnalystJobsParameter) {
  17103. if (name === 'datasetName') {
  17104. tempObj['input'] = tempObj['input'] || {};
  17105. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  17106. continue;
  17107. }
  17108. if (name === 'output') {
  17109. tempObj['output'] = tempObj['output'] || {};
  17110. tempObj['output'] = BuffersAnalystJobsParameter[name];
  17111. continue;
  17112. }
  17113. tempObj['analyst'] = tempObj['analyst'] || {};
  17114. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  17115. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  17116. } else {
  17117. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  17118. }
  17119. if (name === 'mappingParameters') {
  17120. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  17121. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  17122. }
  17123. }
  17124. }
  17125. }
  17126. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  17127. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  17128. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17129. * This program are made available under the terms of the Apache License, Version 2.0
  17130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17131. /**
  17132. * @class SuperMap.ProcessingServiceBase
  17133. * @category iServer ProcessingService
  17134. * @classdesc 分布式分析服务基类
  17135. * @extends {SuperMap.CommonServiceBase}
  17136. * @param {string} url - 分布式分析服务地址。
  17137. * @param {Object} options - 参数。
  17138. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  17139. * @param {number} options.index - 服务访问地址在数组中的位置。
  17140. * @param {number} options.length - 服务访问地址数组长度。
  17141. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  17142. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  17143. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17144. * @param {Object} [options.headers] - 请求头。
  17145. */
  17146. class ProcessingServiceBase extends CommonServiceBase {
  17147. constructor(url, options) {
  17148. options = options || {};
  17149. /*
  17150. * Constant: EVENT_TYPES
  17151. * {Array.<string>}
  17152. * 此类支持的事件类型
  17153. * - *processCompleted* 创建成功后触发的事件。
  17154. * - *processFailed* 创建失败后触发的事件 。
  17155. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  17156. */
  17157. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  17158. super(url, options);
  17159. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  17160. }
  17161. /**
  17162. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  17163. * @override
  17164. */
  17165. destroy() {
  17166. super.destroy();
  17167. }
  17168. /**
  17169. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  17170. * @description 获取分布式分析任务。
  17171. * @param {string} url - 资源地址。
  17172. */
  17173. getJobs(url) {
  17174. var me = this;
  17175. FetchRequest.get(me._processUrl(url), null, {
  17176. proxy: me.proxy
  17177. }).then(function (response) {
  17178. return response.json();
  17179. }).then(function (result) {
  17180. me.events.triggerEvent("processCompleted", {
  17181. result: result
  17182. });
  17183. }).catch(function (e) {
  17184. me.eventListeners.processFailed({
  17185. error: e
  17186. });
  17187. });
  17188. }
  17189. /**
  17190. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  17191. * @description 添加分布式分析任务。
  17192. * @param {string} url - 资源根地址。
  17193. * @param {Object} params - 创建一个空间分析的请求参数。
  17194. * @param {string} paramType - 请求参数类型。
  17195. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  17196. */
  17197. addJob(url, params, paramType, seconds) {
  17198. var me = this,
  17199. parameterObject = null;
  17200. if (params && params instanceof paramType) {
  17201. parameterObject = new Object();
  17202. paramType.toObject(params, parameterObject);
  17203. }
  17204. let headers = Object.assign({
  17205. 'Content-Type': 'application/x-www-form-urlencoded'
  17206. }, me.headers || {})
  17207. var options = {
  17208. proxy: me.proxy,
  17209. headers,
  17210. withCredentials: me.withCredentials,
  17211. crossOrigin: me.crossOrigin,
  17212. isInTheSameDomain: me.isInTheSameDomain
  17213. };
  17214. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  17215. return response.json();
  17216. }).then(function (result) {
  17217. if (result.succeed) {
  17218. me.serviceProcessCompleted(result, seconds);
  17219. } else {
  17220. me.serviceProcessFailed(result);
  17221. }
  17222. }).catch(function (e) {
  17223. me.serviceProcessFailed({
  17224. error: e
  17225. });
  17226. });
  17227. }
  17228. serviceProcessCompleted(result, seconds) {
  17229. result = Util.transformResult(result);
  17230. seconds = seconds || 1000;
  17231. var me = this;
  17232. if (result) {
  17233. var id = setInterval(function () {
  17234. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  17235. _t: new Date().getTime()
  17236. })
  17237. .then(function (response) {
  17238. return response.json();
  17239. }).then(function (job) {
  17240. me.events.triggerEvent("processRunning", {
  17241. id: job.id,
  17242. state: job.state
  17243. });
  17244. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  17245. clearInterval(id);
  17246. me.events.triggerEvent("processFailed", {
  17247. error: job.state.errorMsg,
  17248. state: job.state.runState
  17249. });
  17250. }
  17251. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  17252. clearInterval(id);
  17253. me.events.triggerEvent("processCompleted", {
  17254. result: job
  17255. });
  17256. }
  17257. }).catch(function (e) {
  17258. clearInterval(id);
  17259. me.events.triggerEvent("processFailed", {
  17260. error: e
  17261. });
  17262. });
  17263. }, seconds);
  17264. }
  17265. }
  17266. serviceProcessFailed(result) {
  17267. super.serviceProcessFailed(result);
  17268. }
  17269. _processUrl(url) {
  17270. if (SecurityManager.getToken(url)) {
  17271. url = Util.urlAppend(url, 'token=' + SecurityManager.getToken(url));
  17272. }
  17273. return url;
  17274. }
  17275. }
  17276. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  17277. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  17278. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17279. * This program are made available under the terms of the Apache License, Version 2.0
  17280. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17281. /**
  17282. * @class SuperMap.BuffersAnalystJobsService
  17283. * @category iServer ProcessingService BufferAnalyst
  17284. * @classdesc 缓冲区分析服务类
  17285. * @extends {SuperMap.ProcessingServiceBase}
  17286. * @param {string} url - 服务地址。
  17287. * @param {Object} options - 参数。
  17288. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17289. * @param {Object} [options.headers] - 请求头。
  17290. */
  17291. class BuffersAnalystJobsService extends ProcessingServiceBase {
  17292. constructor(url, options) {
  17293. super(url, options);
  17294. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  17295. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  17296. }
  17297. /**
  17298. *@override
  17299. */
  17300. destroy() {
  17301. super.destroy();
  17302. }
  17303. /**
  17304. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  17305. * @description 获取缓冲区分析所有任务
  17306. */
  17307. getBuffersJobs() {
  17308. super.getJobs(this.url);
  17309. }
  17310. /**
  17311. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  17312. * @description 获取指定id的缓冲区分析服务
  17313. * @param {string} id - 指定要获取数据的id。
  17314. */
  17315. getBuffersJob(id) {
  17316. super.getJobs(Util.urlPathAppend(this.url, id));
  17317. }
  17318. /**
  17319. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  17320. * @description 新建缓冲区分析服务
  17321. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  17322. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  17323. */
  17324. addBuffersJob(params, seconds) {
  17325. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  17326. }
  17327. }
  17328. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  17329. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystParameters.js
  17330. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17331. * This program are made available under the terms of the Apache License, Version 2.0
  17332. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17333. /**
  17334. * @class SuperMap.BurstPipelineAnalystParameters
  17335. * @category iServer NetworkAnalyst BurstAnalyse
  17336. * @classdesc 爆管分析参数类。
  17337. * @param {Object} options - 参数。
  17338. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  17339. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  17340. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  17341. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  17342. */
  17343. class BurstPipelineAnalystParameters {
  17344. constructor(options) {
  17345. var me = this;
  17346. /**
  17347. * @member {Array.<number>} SuperMap.BurstPipelineAnalystParameters.prototype.sourceNodeIDs
  17348. * @description 指定的设施点 ID 数组。
  17349. */
  17350. this.sourceNodeIDs = null;
  17351. /**
  17352. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.edgeID]
  17353. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  17354. */
  17355. this.edgeID = null;
  17356. /**
  17357. * @member {number} [SuperMap.BurstPipelineAnalystParameters.prototype.nodeID]
  17358. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  17359. */
  17360. this.nodeID = null;
  17361. /**
  17362. * @member {boolean} [SuperMap.BurstPipelineAnalystParameters.prototype.isUncertainDirectionValid=false]
  17363. * @description 指定不确定流向是否有效。
  17364. * 指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行。
  17365. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  17366. */
  17367. this.isUncertainDirectionValid = false;
  17368. Util.extend(me, options);
  17369. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystParameters";
  17370. }
  17371. /**
  17372. * @function SuperMap.BurstPipelineAnalystParameters.prototype.destroy
  17373. * @description 释放资源,将引用资源的属性置空。
  17374. */
  17375. destroy() {
  17376. var me = this;
  17377. me.sourceNodeIDs = null;
  17378. me.edgeID = null;
  17379. me.nodeID = null;
  17380. me.isUncertainDirectionValid = null;
  17381. }
  17382. }
  17383. SuperMap.BurstPipelineAnalystParameters = BurstPipelineAnalystParameters;
  17384. ;// CONCATENATED MODULE: ./src/common/iServer/NetworkAnalystServiceBase.js
  17385. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17386. * This program are made available under the terms of the Apache License, Version 2.0
  17387. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17388. /**
  17389. * @class SuperMap.NetworkAnalystServiceBase
  17390. * @category iServer NetworkAnalyst
  17391. * @classdesc 网络分析服务基类。
  17392. * @description 网络分析服务基类。
  17393. * @extends {SuperMap.CommonServiceBase}
  17394. * @param {string} url - 网络分析服务地址。
  17395. * @param {Object} options - 参数。
  17396. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17397. * @param {Object} [options.headers] - 请求头。
  17398. */
  17399. class NetworkAnalystServiceBase extends CommonServiceBase {
  17400. constructor(url, options) {
  17401. super(url, options);
  17402. /**
  17403. * @member {SuperMap.DataFormat} [SuperMap.NetworkAnalystServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  17404. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为 "ISERVER","GEOJSON"
  17405. */
  17406. this.format = DataFormat.GEOJSON;
  17407. this.CLASS_NAME = "SuperMap.NetworkAnalystServiceBase";
  17408. }
  17409. /**
  17410. * @function SuperMap.NetworkAnalystServiceBase.prototype.destroy
  17411. * @description 释放资源,将引用的资源属性置空。
  17412. */
  17413. destroy() {
  17414. super.destroy();
  17415. this.format = null;
  17416. }
  17417. /**
  17418. * @function SuperMap.NetworkAnalystServiceBase.prototype.serviceProcessCompleted
  17419. * @description 分析完成,执行此方法。
  17420. * @param {Object} result - 服务器返回的结果对象。
  17421. */
  17422. serviceProcessCompleted(result) {
  17423. var me = this, analystResult;
  17424. result = Util.transformResult(result);
  17425. if (result && me.format === DataFormat.GEOJSON && typeof me.toGeoJSONResult === 'function') {
  17426. analystResult = me.toGeoJSONResult(result);
  17427. }
  17428. if (!analystResult) {
  17429. analystResult = result;
  17430. }
  17431. me.events.triggerEvent("processCompleted", {result: analystResult});
  17432. }
  17433. /**
  17434. * @function SuperMap.NetworkAnalystServiceBase.prototype.toGeoJSONResult
  17435. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。只处理结果中的路由,由子类实现。
  17436. * @param {Object} result - 服务器返回的结果对象。
  17437. * @returns {GeoJSONObject} GeoJSON 对象。
  17438. */
  17439. toGeoJSONResult(result) { // eslint-disable-line no-unused-vars
  17440. return null;
  17441. }
  17442. }
  17443. SuperMap.NetworkAnalystServiceBase = NetworkAnalystServiceBase;
  17444. ;// CONCATENATED MODULE: ./src/common/iServer/BurstPipelineAnalystService.js
  17445. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17446. * This program are made available under the terms of the Apache License, Version 2.0
  17447. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17448. /**
  17449. * @class SuperMap.BurstPipelineAnalystService
  17450. * @category iServer NetworkAnalyst BurstAnalyse
  17451. * @classdesc 爆管分析服务类,即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组、普通结点 ID 数组及其上下游弧段 ID 数组。
  17452. * @extends {SuperMap.NetworkAnalystServiceBase}
  17453. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  17454. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源},
  17455. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  17456. * @param {Object} options - 参数。
  17457. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  17458. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17459. * @param {Object} [options.headers] - 请求头。
  17460. */
  17461. class BurstPipelineAnalystService extends NetworkAnalystServiceBase {
  17462. constructor(url, options) {
  17463. super(url, options);
  17464. this.CLASS_NAME = "SuperMap.BurstPipelineAnalystService";
  17465. }
  17466. /**
  17467. * @function SuperMap.BurstPipelineAnalystService.prototype.destroy
  17468. * @override
  17469. */
  17470. destroy() {
  17471. super.destroy();
  17472. }
  17473. /**
  17474. * @function SuperMap.BurstPipelineAnalystService.prototype.processAsync
  17475. * @description 负责将客户端的查询参数传递到服务端。
  17476. * @params {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析参数类
  17477. */
  17478. processAsync(params) {
  17479. if (!(params instanceof BurstPipelineAnalystParameters)) {
  17480. return null;
  17481. }
  17482. var me = this, jsonObject;
  17483. me.url = Util.urlPathAppend(me.url, 'burstAnalyse');
  17484. jsonObject = {
  17485. sourceNodeIDs: params.sourceNodeIDs,
  17486. isUncertainDirectionValid: params.isUncertainDirectionValid
  17487. };
  17488. //必传参数不正确,就终止
  17489. if (params.edgeID !== null && params.nodeID !== null) {
  17490. throw new Error('edgeID and nodeID cannot be null at the same time.');
  17491. }
  17492. if (params.edgeID === null && params.nodeID === null) {
  17493. throw new Error('edgeID and nodeID cannot be null at the same time.');
  17494. }
  17495. if (params.edgeID !== null) {
  17496. jsonObject.edgeID = params.edgeID;
  17497. } else {
  17498. jsonObject.nodeID = params.nodeID;
  17499. }
  17500. me.request({
  17501. method: "GET",
  17502. params: jsonObject,
  17503. scope: me,
  17504. success: me.serviceProcessCompleted,
  17505. failure: me.serviceProcessFailed
  17506. });
  17507. }
  17508. }
  17509. SuperMap.BurstPipelineAnalystService = BurstPipelineAnalystService;
  17510. ;// CONCATENATED MODULE: ./src/common/iServer/ChartFeatureInfoSpecsService.js
  17511. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17512. * This program are made available under the terms of the Apache License, Version 2.0
  17513. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17514. /**
  17515. * @class SuperMap.ChartFeatureInfoSpecsService
  17516. * @category iServer Map Chart
  17517. * @classdesc 海图物标信息服务类,通过该服务类可以查询到服务端支持的所有海图物标信息。
  17518. * 用户可以通过两种方式获取查询结果:
  17519. * 一种是通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件;
  17520. * 另一种是使用 AsyncResponder 类实现异步处理。
  17521. * @extends {SuperMap.CommonServiceBase}
  17522. * @param {string} url - 地图(特指海图)服务地址。
  17523. * 如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  17524. * 发送请求格式类似于:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图/chartFeatureInfoSpecs.json"。
  17525. * @param {Object} options - 参数。
  17526. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  17527. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  17528. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式,参数格式为"ISERVER","GEOJSON"。
  17529. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17530. * @param {Object} [options.headers] - 请求头。
  17531. */
  17532. class ChartFeatureInfoSpecsService extends CommonServiceBase {
  17533. constructor(url, options) {
  17534. super(url, options);
  17535. this.CLASS_NAME = "SuperMap.ChartFeatureInfoSpecsService";
  17536. }
  17537. /**
  17538. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.destroy
  17539. * @override
  17540. */
  17541. destroy() {
  17542. super.destroy();
  17543. Util.reset(this);
  17544. }
  17545. /**
  17546. * @function SuperMap.ChartFeatureInfoSpecsService.prototype.processAsync
  17547. * @description 根据地图(特指海图)服务地址与服务端完成异步通讯,获取物标信息。
  17548. * 当查询物标信息成功时,将触发 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE
  17549. * 事件。用可以通过户两种方式获取图层信息:
  17550. * 1. 通过 AsyncResponder 类获取(推荐使用);
  17551. * 2. 通过监听 ChartFeatureInfoSpecsEvent.PROCESS_COMPLETE 事件获取。
  17552. */
  17553. processAsync() {
  17554. var me = this, method = "GET";
  17555. if (!me.isTempLayers) {
  17556. Util.urlPathAppend(me.url,'chartFeatureInfoSpecs');
  17557. }
  17558. me.request({
  17559. method: method,
  17560. params: null,
  17561. scope: me,
  17562. success: me.serviceProcessCompleted,
  17563. failure: me.serviceProcessFailed
  17564. });
  17565. }
  17566. }
  17567. SuperMap.ChartFeatureInfoSpecsService = ChartFeatureInfoSpecsService;
  17568. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryFilterParameter.js
  17569. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17570. * This program are made available under the terms of the Apache License, Version 2.0
  17571. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17572. /**
  17573. * @class SuperMap.ChartQueryFilterParameter
  17574. * @category iServer Map Chart
  17575. * @classdesc 海图查询过滤参数类,用于设置海图查询的过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  17576. * @param {Object} options - 参数。
  17577. * @param {string} options.attributeFilter - 属性字段过滤条件。
  17578. * @param {number} options.chartFeatureInfoSpecCode - 查询的物标代号。
  17579. * @param {boolean} [options.isQueryPoint] - 是否查询点。
  17580. * @param {boolean} [options.isQueryLine] - 是否查询线。
  17581. * @param {boolean} [options.isQueryRegion] - 是否查询面。
  17582. */
  17583. class ChartQueryFilterParameter {
  17584. constructor(options) {
  17585. /**
  17586. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryPoint]
  17587. * @description 是否查询点。
  17588. */
  17589. this.isQueryPoint = null;
  17590. /**
  17591. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryLine]
  17592. * @description 是否查询线。
  17593. */
  17594. this.isQueryLine = null;
  17595. /**
  17596. * @member {boolean} [SuperMap.ChartQueryFilterParameter.prototype.isQueryRegion]
  17597. * @description 是否查询面。
  17598. */
  17599. this.isQueryRegion = null;
  17600. /**
  17601. * @member {string} SuperMap.ChartQueryFilterParameter.prototype.attributeFilter
  17602. * @description 属性字段过滤条件。
  17603. */
  17604. this.attributeFilter = null;
  17605. /**
  17606. * @member {number} SuperMap.ChartQueryFilterParameter.prototype.chartFeatureInfoSpecCode
  17607. * @description 查询的物标代号。
  17608. */
  17609. this.chartFeatureInfoSpecCode = null;
  17610. Util.extend(this, options);
  17611. this.CLASS_NAME = "SuperMap.ChartQueryFilterParameter";
  17612. }
  17613. /**
  17614. * @function SuperMap.ChartQueryFilterParameter.prototype.destroy
  17615. * @description 释放资源,将引用资源的属性置空。
  17616. */
  17617. destroy() {
  17618. var me = this;
  17619. me.isQueryPoint = null;
  17620. me.isQueryLine = null;
  17621. me.isQueryRegion = null;
  17622. me.attributeFilter = null;
  17623. me.chartFeatureInfoSpecCode = null;
  17624. }
  17625. /**
  17626. * @function SuperMap.ChartQueryFilterParameter.prototype.toJson
  17627. * @description 将属性信息转化成 JSON 格式字符串。
  17628. */
  17629. toJson() {
  17630. var json = "";
  17631. json += "\"isQueryPoint\":" + this.isQueryPoint + ",";
  17632. json += "\"isQueryLine\":" + this.isQueryLine + ",";
  17633. json += "\"isQueryRegion\":" + this.isQueryRegion + ",";
  17634. if (this.attributeFilter) {
  17635. json += "\"attributeFilter\": \"" + this.attributeFilter + "\",";
  17636. }
  17637. json += "\"chartFeatureInfoSpecCode\":" + this.chartFeatureInfoSpecCode;
  17638. json = "{" + json + "}";
  17639. return json;
  17640. }
  17641. }
  17642. SuperMap.ChartQueryFilterParameter = ChartQueryFilterParameter;
  17643. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryParameters.js
  17644. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17645. * This program are made available under the terms of the Apache License, Version 2.0
  17646. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17647. /**
  17648. * @class SuperMap.ChartQueryParameters
  17649. * @category iServer Map Chart
  17650. * @classdesc 海图查询参数类,该类用于设置海图查询时的相关参数,海图查询分为海图属性查询和海图范围查询两类,通过属性 queryMode 指定查询模式。
  17651. * 必设属性有:queryMode、chartLayerNames、chartQueryFilterParameters。当进行海图范围查询时,必设属性还包括 bounds。
  17652. * @param {Object} options - 参数。
  17653. * @param {string} options.queryMode - 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery")。
  17654. * @param {Array.<string>} options.chartLayerNames - 查询的海图图层的名称。
  17655. * @param {Array.<{SuperMap.ChartQueryFilterParameter}>} options.chartQueryFilterParameters - 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  17656. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 海图查询范围。当进行海图范围查询时,此参数为必选。
  17657. * @param {boolean} [options.returnContent=true] - 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  17658. * @param {number} [options.startRecord=0] - 查询起始记录位置。
  17659. * @param {number} [options.expectCount] - 期望查询结果返回的记录数,该值大于0。
  17660. */
  17661. class ChartQueryParameters {
  17662. constructor(options) {
  17663. /**
  17664. * @member {string} SuperMap.ChartQueryParameters.prototype.queryMode
  17665. * @description 海图查询模式类型,支持两种查询方式:海图属性查询("ChartAttributeQuery")和海图空间查询("ChartBoundsQuery") 。
  17666. */
  17667. this.queryMode = null;
  17668. /**
  17669. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.ChartQueryParameters.prototype.bounds
  17670. * @description 海图查询范围。
  17671. */
  17672. this.bounds = null;
  17673. /**
  17674. * @member {Array.<string>} SuperMap.ChartQueryParameters.prototype.chartLayerNames
  17675. * @description 查询的海图图层的名称。
  17676. */
  17677. this.chartLayerNames = null;
  17678. /**
  17679. * @member {Array.<SuperMap.ChartQueryFilterParameter>} SuperMap.ChartQueryParameters.prototype.chartQueryFilterParameters
  17680. * @description 海图查询过滤参数。包括:物标代码、物标可应用对象的选择(是否查询点、线或面)、属性字段过滤条件。
  17681. */
  17682. this.chartQueryFilterParameters = null;
  17683. /**
  17684. * @member {boolean} [SuperMap.ChartQueryParameters.prototype.returnContent=true]
  17685. * @description 获取或设置是返回查询结果记录集 recordsets,还是返回查询结果的资源 resourceInfo。
  17686. */
  17687. this.returnContent = true;
  17688. /**
  17689. * @member {number} [SuperMap.ChartQueryParameters.prototype.startRecord=0]
  17690. * @description 查询起始记录位置。
  17691. */
  17692. this.startRecord = 0;
  17693. /**
  17694. * @member {number} [SuperMap.ChartQueryParameters.prototype.expectCount]
  17695. * @description 期望查询结果返回的记录数,该值大于0。
  17696. */
  17697. this.expectCount = null;
  17698. Util.extend(this, options);
  17699. this.CLASS_NAME = "SuperMap.ChartQueryParameters";
  17700. }
  17701. /**
  17702. * @function SuperMap.ChartQueryParameters.prototype.destroy
  17703. * @description 释放资源,将引用资源的属性置空。
  17704. */
  17705. destroy() {
  17706. var me = this;
  17707. me.queryMode = null;
  17708. me.bounds = null;
  17709. me.chartLayerNames = null;
  17710. me.chartQueryFilterParameters = null;
  17711. me.returnContent = true;
  17712. me.startRecord = 0;
  17713. me.expectCount = null;
  17714. }
  17715. /**
  17716. * @function SuperMap.ChartQueryParameters.prototype.getVariablesJson
  17717. * @description 将属性信息转换成能够被服务识别的 JSON 格式字符串。
  17718. * @returns {string} JSON 字符串。
  17719. */
  17720. getVariablesJson() {
  17721. var json = "";
  17722. json += "\"queryMode\":\"" + this.queryMode + "\",";
  17723. if (this.chartLayerNames && this.chartLayerNames.length) {
  17724. var chartLayersArray = [];
  17725. var layerLength = this.chartLayerNames.length;
  17726. for (var i = 0; i < layerLength; i++) {
  17727. chartLayersArray.push("\"" + this.chartLayerNames[i] + "\"");
  17728. }
  17729. var layerNames = "[" + chartLayersArray.join(",") + "]";
  17730. json += "\"chartLayerNames\":" + layerNames + ",";
  17731. }
  17732. if (this.queryMode === "ChartBoundsQuery" && this.bounds) {
  17733. json += "\"bounds\":" + "{" + "\"leftBottom\":" + "{" + "\"x\":" + this.bounds.left + "," +
  17734. "\"y\":" + this.bounds.bottom + "}" + "," + "\"rightTop\":" + "{" + "\"x\":" + this.bounds.right + "," +
  17735. "\"y\":" + this.bounds.top + "}" + "},";
  17736. }
  17737. if (this.chartQueryFilterParameters && this.chartQueryFilterParameters.length) {
  17738. var chartParamArray = [];
  17739. var chartLength = this.chartQueryFilterParameters.length;
  17740. for (var j = 0; j < chartLength; j++) {
  17741. var chartQueryFilterParameter = this.chartQueryFilterParameters[j];
  17742. if (!(chartQueryFilterParameter instanceof ChartQueryFilterParameter)) {
  17743. continue;
  17744. }
  17745. chartParamArray.push(chartQueryFilterParameter.toJson());
  17746. }
  17747. var chartParamsJson = "[" + chartParamArray.join(",") + "]";
  17748. chartParamsJson = "\"chartQueryParams\":" + chartParamsJson + ",";
  17749. chartParamsJson += "\"startRecord\":" + this.startRecord + ",";
  17750. chartParamsJson += "\"expectCount\":" + this.expectCount;
  17751. chartParamsJson = "{" + chartParamsJson + "}";
  17752. json += "\"chartQueryParameters\":" + chartParamsJson;
  17753. }
  17754. json = "{" + json + "}";
  17755. return json;
  17756. }
  17757. }
  17758. SuperMap.ChartQueryParameters = ChartQueryParameters;
  17759. ;// CONCATENATED MODULE: ./src/common/iServer/QueryParameters.js
  17760. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17761. * This program are made available under the terms of the Apache License, Version 2.0
  17762. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17763. /**
  17764. * @class SuperMap.QueryParameters
  17765. * @category iServer Map QueryResults
  17766. * @classdesc 查询参数基类。距离查询、SQL 查询、几何地物查询等各自的参数均继承此类。
  17767. * @param {Object} options - 参数。
  17768. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  17769. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  17770. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  17771. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  17772. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  17773. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  17774. * @param {number} [options.startRecord=0] - 查询起始记录号。
  17775. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  17776. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  17777. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  17778. */
  17779. class QueryParameters {
  17780. constructor(options) {
  17781. if (!options) {
  17782. return;
  17783. }
  17784. /**
  17785. * @member {string} [SuperMap.QueryParameters.prototype.customParams]
  17786. * @description 自定义参数,供扩展使用。
  17787. */
  17788. this.customParams = null;
  17789. /**
  17790. * @member {Object} [SuperMap.QueryParameters.prototype.prjCoordSys]
  17791. * @description 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}
  17792. */
  17793. this.prjCoordSys = null;
  17794. /**
  17795. * @member {number} [SuperMap.QueryParameters.prototype.expectCount=100000]
  17796. * @description 期望返回结果记录个数,默认返回100000条查询记录,
  17797. * 如果实际不足100000条则返回实际记录条数。
  17798. */
  17799. this.expectCount = 100000;
  17800. /**
  17801. * @member {SuperMap.GeometryType} [SuperMap.QueryParameters.prototype.networkType=SuperMap.GeometryType.LINE]
  17802. * @description 网络数据集对应的查询类型,分为点和线两种类型。
  17803. */
  17804. this.networkType = GeometryType.LINE;
  17805. /**
  17806. * @member {SuperMap.QueryOption} [SuperMap.QueryParameters.prototype.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY]
  17807. * @description 查询结果类型枚举类。
  17808. * 该类描述查询结果返回类型,包括只返回属性、
  17809. * 只返回几何实体以及返回属性和几何实体。
  17810. */
  17811. this.queryOption = QueryOption.ATTRIBUTEANDGEOMETRY;
  17812. /**
  17813. * @member {Array.<SuperMap.FilterParameter>} SuperMap.QueryParameters.prototype.queryParams
  17814. * @description 查询过滤条件参数数组。
  17815. * 该类用于设置查询数据集的查询过滤参数。
  17816. */
  17817. this.queryParams = null;
  17818. /**
  17819. * @member {number} [SuperMap.QueryParameters.prototype.startRecord=0]
  17820. * @description 查询起始记录号。
  17821. */
  17822. this.startRecord = 0;
  17823. /**
  17824. * @member {number} [SuperMap.QueryParameters.prototype.holdTime=10]
  17825. * @description 资源在服务端保存的时间,单位为分钟。
  17826. */
  17827. this.holdTime = 10;
  17828. /**
  17829. * @member {boolean} [SuperMap.QueryParameters.prototype.returnCustomResult=false]
  17830. * @description 仅供三维使用。
  17831. */
  17832. this.returnCustomResult = false;
  17833. /**
  17834. * @member {boolean} [SuperMap.QueryParameters.prototype.returnFeatureWithFieldCaption=false]
  17835. * @description 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  17836. */
  17837. this.returnFeatureWithFieldCaption = false;
  17838. Util.extend(this, options);
  17839. this.CLASS_NAME = "SuperMap.QueryParameters";
  17840. }
  17841. /**
  17842. * @function SuperMap.QueryParameters.prototype.destroy
  17843. * @description 释放资源,将引用资源的属性置空。
  17844. */
  17845. destroy() {
  17846. var me = this;
  17847. me.customParams = null;
  17848. me.expectCount = null;
  17849. me.networkType = null;
  17850. me.queryOption = null;
  17851. if (me.queryParams) {
  17852. for (var i = 0, qps = me.queryParams, len = qps.length; i < len; i++) {
  17853. qps[i].destroy();
  17854. }
  17855. me.queryParams = null;
  17856. }
  17857. me.startRecord = null;
  17858. me.holdTime = null;
  17859. me.returnCustomResult = null;
  17860. me.prjCoordSys = null;
  17861. }
  17862. }
  17863. SuperMap.QueryParameters = QueryParameters;
  17864. ;// CONCATENATED MODULE: ./src/common/iServer/ChartQueryService.js
  17865. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  17866. * This program are made available under the terms of the Apache License, Version 2.0
  17867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  17868. /**
  17869. * @class SuperMap.ChartQueryService
  17870. * @category iServer Map Chart
  17871. * @classdesc 海图查询服务类。该类负责将海图查询所需参数(ChartQueryParameters)传递至服务端,并获取服务端的返回结果。
  17872. * 用户可以通过两种方式获取查询结果:
  17873. * 1.通过 AsyncResponder 类获取(推荐使用);
  17874. * 2.通过监听 QueryEvent.PROCESS_COMPLETE 事件获取。
  17875. * @extends {SuperMap.CommonServiceBase}
  17876. * @param {string} url - 地图查询服务访问地址。如:"http://localhost:8090/iserver/services/map-ChartW/rest/maps/海图"。
  17877. * @param {Object} options - 参数。
  17878. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  17879. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  17880. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为"ISERVER","GEOJSON"。
  17881. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  17882. * @param {Object} [options.headers] - 请求头。
  17883. * @example
  17884. * 下面示例显示了如何进行海图属性查询:
  17885. * var nameArray = ["GB4X0000_52000"];
  17886. * var chartQueryFilterParameter = new ChartQueryFilterParameter({
  17887. * isQueryPoint:true,
  17888. * isQueryLine:true,
  17889. * isQueryRegion:true,
  17890. * attributeFilter:"SmID<10",
  17891. * chartFeatureInfoSpecCode:1
  17892. * });
  17893. *
  17894. * var chartQueryParameters = new SuperMap.ChartQueryParameters({
  17895. * queryMode:"ChartAttributeQuery",
  17896. * chartLayerNames:nameArray,
  17897. * returnContent:true,
  17898. * chartQueryFilterParameters:[chartQueryFilterParameter]
  17899. * });
  17900. *
  17901. * var chartQueryService = new SuperMap.ChartQueryService(url);
  17902. *
  17903. * chartQueryService.events.on({
  17904. * "processCompleted":processCompleted,
  17905. * "processFailed":processFailed
  17906. * });
  17907. * chartQueryService.processAsync(chartQueryParameters);
  17908. */
  17909. class ChartQueryService extends CommonServiceBase {
  17910. constructor(url, options) {
  17911. super(url, options);
  17912. options = options || {};
  17913. /**
  17914. * @member {boolean} SuperMap.ChartQueryService.prototype.returnContent
  17915. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  17916. */
  17917. this.returnContent = null;
  17918. /**
  17919. * @member {SuperMap.DataFormat} SuperMap.ChartQueryService.prototype.format
  17920. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式
  17921. * 参数格式为"ISERVER","GEOJSON",GEOJSON
  17922. */
  17923. this.format = DataFormat.GEOJSON;
  17924. Util.extend(this, options);
  17925. var me = this;
  17926. if (options.format) {
  17927. me.format = options.format.toUpperCase();
  17928. }
  17929. if (!me.url) {
  17930. return;
  17931. }
  17932. me.url = Util.urlPathAppend(me.url, 'queryResults');
  17933. this.CLASS_NAME = "SuperMap.ChartQueryService";
  17934. }
  17935. /**
  17936. * @function SuperMap.ChartQueryService.prototype.destroy
  17937. * @override
  17938. */
  17939. destroy() {
  17940. var me = this;
  17941. CommonServiceBase.prototype.destroy.apply(this, arguments);
  17942. me.returnContent = null;
  17943. me.format = null;
  17944. }
  17945. /**
  17946. * @function SuperMap.ChartQueryService.prototype.processAsync
  17947. * @description 使用服务地址 URL 实例化 ChartQueryService 对象。
  17948. * @param {SuperMap.ChartQueryParameters} params - 查询参数。
  17949. */
  17950. processAsync(params) {
  17951. //todo重点需要添加代码的地方
  17952. if (!(params instanceof ChartQueryParameters)) {
  17953. return;
  17954. }
  17955. var me = this, jsonParameters;
  17956. me.returnContent = params.returnContent;
  17957. jsonParameters = params.getVariablesJson();
  17958. if (me.returnContent) {
  17959. me.url = Util.urlAppend(me.url, 'returnContent=true');
  17960. }
  17961. me.request({
  17962. method: "POST",
  17963. data: jsonParameters,
  17964. scope: me,
  17965. success: me.serviceProcessCompleted,
  17966. failure: me.serviceProcessFailed
  17967. });
  17968. }
  17969. /**
  17970. * @function SuperMap.ChartQueryService.prototype.serviceProcessCompleted
  17971. * @description 查询完成,执行此方法。
  17972. * @param {Object} result - 服务器返回的结果对象。
  17973. */
  17974. serviceProcessCompleted(result) {
  17975. var me = this;
  17976. result = Util.transformResult(result);
  17977. if (result && result.recordsets && me.format === DataFormat.GEOJSON) {
  17978. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  17979. if (recordsets[i].features) {
  17980. var geoJSONFormat = new GeoJSON();
  17981. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  17982. }
  17983. }
  17984. }
  17985. me.events.triggerEvent("processCompleted", {result: result});
  17986. }
  17987. /**
  17988. * @function SuperMap.ChartQueryService.prototype.getQueryParameters
  17989. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  17990. * @param {Object} params - JSON 字符串表示的查询参数。
  17991. * @returns {SuperMap.QueryParameters} 返回查询结果
  17992. */
  17993. getQueryParameters(params) {
  17994. return new QueryParameters({
  17995. queryMode: params.queryMode,
  17996. bounds: params.bounds,
  17997. chartLayerNames: params.chartLayerNames,
  17998. chartQueryFilterParameters: params.chartQueryFilterParameters,
  17999. returnContent: params.returnContent
  18000. });
  18001. }
  18002. }
  18003. SuperMap.ChartQueryService = ChartQueryService;
  18004. ;// CONCATENATED MODULE: ./src/common/iServer/ClipParameter.js
  18005. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18006. * This program are made available under the terms of the Apache License, Version 2.0
  18007. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18008. /**
  18009. * @class SuperMap.ClipParameter
  18010. * @category iServer SpatialAnalyst InterpolationAnalyst
  18011. * @classdesc 用于裁剪的参数。
  18012. * @description 优先使用用户指定的裁剪区域多边形进行裁剪,也可以通过指定数据源和数据集名,从而使用指定数据集的边界多边形进行裁剪。
  18013. * @param {Object} options - 参数。
  18014. * @param {string} [options.clipDatasetName] - 裁剪的数据集名。
  18015. * @param {string} [options.clipDatasourceName] - 裁剪的数据集所在数据源的名字。
  18016. * @param {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} [options.clipRegion] - 用户指定的裁剪区域。
  18017. * @param {boolean} [options.isClipInRegion=true] - 是否对裁剪区内的数据集进行裁剪。
  18018. * @param {boolean} [options.isExactClip=true] - 是否使用精确裁剪。
  18019. */
  18020. class ClipParameter {
  18021. constructor(options) {
  18022. /**
  18023. * @member {string} SuperMap.ClipParameter.prototype.clipDatasetName
  18024. * @description 用于裁剪的数据集名,clipDatasetName 与 clipRegion 必须设置一个。
  18025. */
  18026. this.clipDatasetName = null;
  18027. /**
  18028. * @member {string} SuperMap.ClipParameter.prototype.clipDatasourceName
  18029. * @description 用于裁剪的数据集所在数据源的名字。当 clipRegion 不设置时起作用。
  18030. */
  18031. this.clipDatasourceName = null;
  18032. /**
  18033. * @member {(SuperMap.Geometry.Polygon|L.Polygon|L.GeoJSON|ol.geom.Polygon|ol.format.GeoJSON)} SuperMap.ClipParameter.prototype.clipRegion
  18034. * @description 用户指定的裁剪区域,优先使用,clipDatasetName 与 clipRegion 必须设置一个。
  18035. */
  18036. this.clipRegion = null;
  18037. /**
  18038. * @member {boolean} [SuperMap.ClipParameter.prototype.isClipInRegion=true]
  18039. * @description 是否对裁剪区内的数据集进行裁剪。若为 true,则对裁剪区域内的结果进行裁剪,若为 false,则对裁剪区域外的结果进行裁剪。
  18040. */
  18041. this.isClipInRegion = true;
  18042. /**
  18043. * @member {boolean} [SuperMap.ClipParameter.prototype.isExactClip=true]
  18044. * @description 是否使用精确裁剪。
  18045. */
  18046. this.isExactClip = null;
  18047. if (options) {
  18048. Util.extend(this, options);
  18049. }
  18050. this.CLASS_NAME = "SuperMap.ClipParameter";
  18051. }
  18052. /**
  18053. * @function SuperMap.ClipParameter.prototype.destroy
  18054. * @description 释放资源,将引用资源的属性置空。
  18055. */
  18056. destroy() {
  18057. var me = this;
  18058. me.clipDatasetName = null;
  18059. me.clipDatasourceName = null;
  18060. me.clipRegion = null;
  18061. me.isClipInRegion = null;
  18062. me.isExactClip = null;
  18063. }
  18064. /**
  18065. * @function SuperMap.ClipParameter.prototype.toJSON
  18066. * @description 将 ClipParameter 对象转化为 JSON 字符串。
  18067. * @returns {string} 返回转换后的 JSON 字符串。
  18068. */
  18069. toJSON() {
  18070. return Util.toJSON({
  18071. isClipInRegion: this.isClipInRegion,
  18072. clipDatasetName: this.clipDatasetName,
  18073. clipDatasourceName: this.clipDatasourceName,
  18074. isExactClip: this.isExactClip,
  18075. clipRegion: ServerGeometry.fromGeometry(this.clipRegion)
  18076. });
  18077. }
  18078. }
  18079. SuperMap.ClipParameter = ClipParameter;
  18080. ;// CONCATENATED MODULE: ./src/common/iServer/ColorDictionary.js
  18081. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18082. * This program are made available under the terms of the Apache License, Version 2.0
  18083. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18084. /**
  18085. * @class SuperMap.ColorDictionary
  18086. * @category iServer Map Theme
  18087. * @classdesc 颜色对照表类。
  18088. * @description 颜色对照表中的键名为具体的高程值,键值表示该高程值要显示的颜色。对于栅格图层中高程值小于颜色对照表中高程最小值的点使用颜色对照表中高程最小值对应的颜色,对于栅格图层中高程值大于颜色对照表中高程最大值的点使用颜色对照表中高程最大值对应的颜色,对于栅格图层中高程值在颜色对照表中没有对应颜色的点,则查找颜色对照表中与当前高程值相邻的两个高程对应的颜色,然后通过渐变运算要显示的颜色。如果设置了颜色对照表的话,则颜色表设置无效。
  18089. * @param {Object} options - 参数。
  18090. * @param {number} options.elevation - 高程值。
  18091. * @param {SuperMap.ServerColor} options.color - 服务端颜色类。
  18092. */
  18093. class ColorDictionary {
  18094. constructor(options) {
  18095. options = options || {};
  18096. /**
  18097. * @member {number} SuperMap.ColorDictionary.prototype.elevation
  18098. * @description 高程值。
  18099. */
  18100. this.elevation = null;
  18101. /**
  18102. * @member {SuperMap.ServerColor} SuperMap.ColorDictionary.prototype.color
  18103. * @description 服务端颜色类。
  18104. */
  18105. this.color = null;
  18106. Util.extend(this, options);
  18107. var me = this,
  18108. c = me.color;
  18109. if (c) {
  18110. me.color = new ServerColor(c.red, c.green, c.blue);
  18111. }
  18112. this.CLASS_NAME = "SuperMap.ColorDictionary";
  18113. }
  18114. /**
  18115. * @function SuperMap.ColorDictionary.prototype.destroy
  18116. * @description 释放资源,将引用资源的属性置空。
  18117. */
  18118. destroy() {
  18119. Util.reset(this);
  18120. }
  18121. /**
  18122. * @function SuperMap.ColorDictionary.prototype.toServerJSONObject
  18123. * @description 转换成对应的 JSON 格式对象。
  18124. * @returns {Object} JSON 对象。
  18125. */
  18126. toServerJSONObject() {
  18127. var dataObj = {};
  18128. dataObj = Util.copyAttributes(dataObj, this);
  18129. return dataObj;
  18130. }
  18131. }
  18132. SuperMap.ColorDictionary = ColorDictionary;
  18133. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystResultSetting.js
  18134. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18135. * This program are made available under the terms of the Apache License, Version 2.0
  18136. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18137. /**
  18138. * @class SuperMap.TransportationAnalystResultSetting
  18139. * @category iServer NetworkAnalyst
  18140. * @classdesc 交通网络分析结果参数类。
  18141. * @description 通过该类设置交通网络分析返回的结果,包括是否返回图片、是否返回弧段空间信息、是否返回结点空间信息等。
  18142. * @param {Object} options - 参数。
  18143. * @param {boolean} [options.returnEdgeFeatures=false] - 是否在分析结果中包含弧段要素集合。
  18144. * @param {boolean} [options.returnEdgeGeometry=false] - 返回的弧段要素集合中是否包含几何对象信息。
  18145. * @param {boolean} [options.returnEdgeIDs=false] - 返回结果中是否包含经过弧段 ID 集合。
  18146. * @param {boolean} [options.returnNodeFeatures=false] - 是否在分析结果中包含结点要素集合。
  18147. * @param {boolean} [options.returnNodeGeometry=false] - 返回的结点要素集合中是否包含几何对象信息。
  18148. * @param {boolean} [options.returnNodeIDs=false] - 返回结果中是否包含经过结点 ID 集合。
  18149. * @param {boolean} [options.returnPathGuides=false] - 返回分析结果中是否包含行驶导引集合。
  18150. * @param {boolean} [options.returnRoutes=false] - 返回分析结果中是否包含路由对象的集合。
  18151. */
  18152. class TransportationAnalystResultSetting {
  18153. constructor(options) {
  18154. if (!options) {
  18155. return;
  18156. }
  18157. /**
  18158. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeFeatures
  18159. * @description 是否在分析结果中包含弧段要素集合。弧段要素包括弧段的空间信息和属性信息。
  18160. */
  18161. this.returnEdgeFeatures = false;
  18162. /**
  18163. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeGeometry=false]
  18164. * @description 返回的弧段要素集合中是否包含几何对象信息。
  18165. */
  18166. this.returnEdgeGeometry = false;
  18167. /**
  18168. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnEdgeIDs=false]
  18169. * @description 返回结果中是否包含经过弧段 ID 集合。
  18170. */
  18171. this.returnEdgeIDs = false;
  18172. /**
  18173. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeFeatures=false]
  18174. * @description 是否在分析结果中包含结点要素集合。
  18175. * 结点要素包括结点的空间信息和属性信息。其中返回的结点要素是否包含空间信息可通过 returnNodeGeometry 字段设置。
  18176. */
  18177. this.returnNodeFeatures = false;
  18178. /**
  18179. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeGeometry=false]
  18180. * @description 返回的结点要素集合中是否包含几何对象信息。
  18181. */
  18182. this.returnNodeGeometry = false;
  18183. /**
  18184. * @member {boolean} [SuperMap.TransportationAnalystResultSetting.prototype.returnNodeIDs=false]
  18185. * @description 返回结果中是否包含经过结点 ID 集合。
  18186. */
  18187. this.returnNodeIDs = false;
  18188. /**
  18189. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnPathGuides
  18190. * @description 返回分析结果中是否包含行驶导引集合。
  18191. */
  18192. this.returnPathGuides = false;
  18193. /**
  18194. * @member {boolean} SuperMap.TransportationAnalystResultSetting.prototype.returnRoutes
  18195. * @description 返回分析结果中是否包含路由对象的集合。
  18196. */
  18197. this.returnRoutes = false;
  18198. Util.extend(this, options);
  18199. this.CLASS_NAME = "SuperMap.TransportationAnalystResultSetting";
  18200. }
  18201. /**
  18202. * @function SuperMap.TransportationAnalystResultSetting.prototype.destroy
  18203. * @description 释放资源,将引用资源的属性置空。
  18204. */
  18205. destroy() {
  18206. var me = this;
  18207. me.returnEdgeFeatures = null;
  18208. me.returnEdgeGeometry = null;
  18209. me.returnEdgeIDs = null;
  18210. me.returnNodeFeatures = null;
  18211. me.returnNodeGeometry = null;
  18212. me.returnNodeIDs = null;
  18213. me.returnPathGuides = null;
  18214. me.returnRoutes = null;
  18215. }
  18216. }
  18217. SuperMap.TransportationAnalystResultSetting = TransportationAnalystResultSetting;
  18218. ;// CONCATENATED MODULE: ./src/common/iServer/TransportationAnalystParameter.js
  18219. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18220. * This program are made available under the terms of the Apache License, Version 2.0
  18221. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18222. /**
  18223. * @class SuperMap.TransportationAnalystParameter
  18224. * @category iServer NetworkAnalyst
  18225. * @classdesc 交通网络分析通用参数类。
  18226. * @description 该类主要用来提供交通网络分析所需的通用参数。
  18227. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息,还可以对分析结果包含的内容进行一些设置。
  18228. * @param {Object} options - 参数。
  18229. * @param {Array.<number>} options.barrierEdgeIDs - 网络分析中障碍弧段的 ID 数组。
  18230. * @param {Array.<number>} options.barrierNodeIDs - 网络分析中障碍点的 ID 数组。
  18231. * @param {string} options.turnWeightField - 转向权重字段的名称。
  18232. * @param {SuperMap.TransportationAnalystResultSetting} options.resultSetting - 分析结果返回内容。
  18233. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [options.barrierPoints] - 网络分析中 Point2D 类型的障碍点数组。
  18234. * @param {string} [options.weightFieldName] - 阻力字段的名称。
  18235. */
  18236. class TransportationAnalystParameter {
  18237. constructor(options) {
  18238. if (!options) {
  18239. return;
  18240. }
  18241. /**
  18242. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierEdgeIDs
  18243. * @description 网络分析中障碍弧段的 ID 数组。弧段设置为障碍边之后,表示双向都不通。
  18244. */
  18245. this.barrierEdgeIDs = null;
  18246. /**
  18247. * @member {Array.<number>} SuperMap.TransportationAnalystParameter.prototype.barrierNodeIDs
  18248. * @description 网络分析中障碍点的 ID 数组。结点设置为障碍点之后,表示任何方向都不能通过此结点。
  18249. */
  18250. this.barrierNodeIDs = null;
  18251. /**
  18252. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransportationAnalystParameter.prototype.barrierPoints
  18253. * @description 网络分析中 Point2D 类型的障碍点数组。障碍点表示任何方向都不能通过此点。</br>
  18254. * 当各网络分析参数类中的 isAnalyzeById 属性设置为 false 时,该属性才生效。
  18255. */
  18256. this.barrierPoints = null;
  18257. /**
  18258. * @member {string} [SuperMap.TransportationAnalystParameter.prototype.weightFieldName]
  18259. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段,例如表示时间、长度等的字段都可以用作阻力字段。
  18260. * 该字段默值为服务器发布的所有耗费字段的第一个字段。
  18261. */
  18262. this.weightFieldName = null;
  18263. /**
  18264. * @member {string} SuperMap.TransportationAnalystParameter.prototype.turnWeightField
  18265. * @description 转向权重字段的名称。
  18266. */
  18267. this.turnWeightField = null;
  18268. /**
  18269. * @member {SuperMap.TransportationAnalystResultSetting} SuperMap.TransportationAnalystParameter.prototype.resultSetting
  18270. * @description 分析结果返回内容。
  18271. */
  18272. this.resultSetting = new TransportationAnalystResultSetting();
  18273. Util.extend(this, options);
  18274. this.CLASS_NAME = "SuperMap.TransportationAnalystParameter";
  18275. }
  18276. /**
  18277. * @function SuperMap.TransportationAnalystParameter.prototype.destroy
  18278. * @description 释放资源,将引用资源的属性置空。
  18279. */
  18280. destroy() {
  18281. var me = this;
  18282. me.barrierEdgeIDs = null;
  18283. me.barrierNodeIDs = null;
  18284. me.weightFieldName = null;
  18285. me.turnWeightField = null;
  18286. if (me.resultSetting) {
  18287. me.resultSetting.destroy();
  18288. me.resultSetting = null;
  18289. }
  18290. if (me.barrierPoints && me.barrierPoints.length) {
  18291. for (var i in me.barrierPoints) {
  18292. me.barrierPoints[i].destroy();
  18293. }
  18294. }
  18295. me.barrierPoints = null;
  18296. }
  18297. }
  18298. SuperMap.TransportationAnalystParameter = TransportationAnalystParameter;
  18299. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixParameters.js
  18300. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18301. * This program are made available under the terms of the Apache License, Version 2.0
  18302. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18303. /**
  18304. * @class SuperMap.ComputeWeightMatrixParameters
  18305. * @category iServer NetworkAnalyst WeightMatrix
  18306. * @classdesc 耗费矩阵分析参数类。根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  18307. * @param {Object} options - 参数。
  18308. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  18309. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 要计算耗费矩阵的点数组。
  18310. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  18311. */
  18312. class ComputeWeightMatrixParameters {
  18313. constructor(options) {
  18314. /**
  18315. * @member {boolean} [SuperMap.ComputeWeightMatrixParameters.prototype.isAnalyzeById=false]
  18316. * @description 是否通过节点 ID 指定路径分析的结点,即通过坐标点指定。
  18317. */
  18318. this.isAnalyzeById = false;
  18319. /**
  18320. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.ComputeWeightMatrixParameters.prototype.nodes
  18321. * @description 要计算耗费矩阵的点数组。
  18322. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = false 时,nodes 应为点的坐标数组;
  18323. * 当 {@link SuperMap.ComputeWeightMatrixParameters.isAnalyzeById} = true 时,nodes 应为点的 ID 数组。
  18324. */
  18325. this.nodes = null;
  18326. /**
  18327. * @member {SuperMap.TransportationAnalystParameter} SuperMap.ComputeWeightMatrixParameters.prototype.parameter
  18328. * @description 交通网络分析通用参数。
  18329. */
  18330. this.parameter = new TransportationAnalystParameter();
  18331. Util.extend(this, options);
  18332. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixParameters";
  18333. }
  18334. /**
  18335. * @function SuperMap.ComputeWeightMatrixParameters.prototype.destroy
  18336. * @description 释放资源,将引用资源的属性置空。
  18337. */
  18338. destroy() {
  18339. var me = this;
  18340. me.isAnalyzeById = null;
  18341. me.nodes = null;
  18342. if (me.parameter) {
  18343. me.parameter.destroy();
  18344. me.parameter = null;
  18345. }
  18346. }
  18347. }
  18348. SuperMap.ComputeWeightMatrixParameters = ComputeWeightMatrixParameters;
  18349. ;// CONCATENATED MODULE: ./src/common/iServer/ComputeWeightMatrixService.js
  18350. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18351. * This program are made available under the terms of the Apache License, Version 2.0
  18352. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18353. /**
  18354. * @class SuperMap.ComputeWeightMatrixService
  18355. * @category iServer NetworkAnalyst WeightMatrix
  18356. * @classdesc 耗费矩阵分析服务类。
  18357. * 耗费矩阵是根据交通网络分析参数中的耗费字段来计算一个二维数组,
  18358. * 用来存储指定的任意两点间的资源消耗。
  18359. * 耗费矩阵分析结果通过该类支持的事件的监听函数参数获取
  18360. * @extends {SuperMap.NetworkAnalystServiceBase}
  18361. * @example
  18362. * var mycomputeWeightMatrixService = new SuperMap.ComputeWeightMatrixService(url,{
  18363. * eventListeners: {
  18364. * "processCompleted": computeWeightMatrixCompleted,
  18365. * "processFailed": computeWeightMatrixnError
  18366. * }
  18367. * });
  18368. * @param {string} url - 耗费矩阵分析服务地址。请求服务的URL应为:
  18369. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  18370. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  18371. * @param {Object} options - 参数。
  18372. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  18373. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18374. * @param {Object} [options.headers] - 请求头。
  18375. */
  18376. class ComputeWeightMatrixService extends NetworkAnalystServiceBase {
  18377. constructor(url, options) {
  18378. super(url, options);
  18379. this.CLASS_NAME = "SuperMap.ComputeWeightMatrixService";
  18380. }
  18381. /**
  18382. * @function SuperMap.ComputeWeightMatrixService.prototype.destroy
  18383. * @override
  18384. */
  18385. destroy() {
  18386. super.destroy();
  18387. }
  18388. /**
  18389. * @function SuperMap.ComputeWeightMatrixService.prototype.processAsync
  18390. * @description 负责将客户端的查询参数传递到服务端。
  18391. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析参数类
  18392. */
  18393. processAsync(params) {
  18394. if (!(params instanceof ComputeWeightMatrixParameters)) {
  18395. return;
  18396. }
  18397. var me = this,
  18398. jsonObject;
  18399. me.url = Util.urlPathAppend(me.url, 'weightmatrix');
  18400. jsonObject = {
  18401. parameter: Util.toJSON(params.parameter),
  18402. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  18403. };
  18404. me.request({
  18405. method: "GET",
  18406. params: jsonObject,
  18407. scope: me,
  18408. success: me.serviceProcessCompleted,
  18409. failure: me.serviceProcessFailed
  18410. });
  18411. }
  18412. /**
  18413. * @function SuperMap.ComputeWeightMatrixService.prototype.getJson
  18414. * @description 将对象转化为JSON字符串。
  18415. * @param {boolean} isAnalyzeById - 是否通过id分析
  18416. * @param {Array.<SuperMap.ComputeWeightMatrixParameters>} params - 分析参数数组
  18417. * @returns {string} 转化后的JSON字符串。
  18418. */
  18419. getJson(isAnalyzeById, params) {
  18420. var jsonString = "[",
  18421. len = params ? params.length : 0;
  18422. if (isAnalyzeById === false) {
  18423. for (let i = 0; i < len; i++) {
  18424. if (i > 0) {
  18425. jsonString += ",";
  18426. }
  18427. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  18428. }
  18429. } else if (isAnalyzeById === true) {
  18430. for (let i = 0; i < len; i++) {
  18431. if (i > 0) {
  18432. jsonString += ",";
  18433. }
  18434. jsonString += params[i];
  18435. }
  18436. }
  18437. jsonString += ']';
  18438. return jsonString;
  18439. }
  18440. }
  18441. SuperMap.ComputeWeightMatrixService = ComputeWeightMatrixService;
  18442. ;// CONCATENATED MODULE: ./src/common/iServer/DataFlowService.js
  18443. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18444. * This program are made available under the terms of the Apache License, Version 2.0
  18445. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18446. /**
  18447. * @class SuperMap.DataFlowService
  18448. * @category iServer DataFlow
  18449. * @classdesc 数据流服务类
  18450. * @extends {SuperMap.CommonServiceBase}
  18451. * @param {string} url - 数据流服务地址
  18452. * @param {Object} options - 参数。
  18453. * @param {function} options.style - 设置数据加载样式。
  18454. * @param {function} [options.onEachFeature] - 设置每个数据加载popup等。
  18455. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  18456. * @param {Object} [options.excludeField] - -排除字段。
  18457. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  18458. * @param {Object} [options.headers] - 请求头。
  18459. */
  18460. class DataFlowService_DataFlowService extends CommonServiceBase {
  18461. constructor(url, options) {
  18462. options = options || {};
  18463. /*
  18464. * @constant EVENT_TYPES
  18465. * {Array.<string>}
  18466. * 此类支持的事件类型
  18467. */
  18468. options.EVENT_TYPES = ["broadcastSocketConnected", "broadcastSocketError", "broadcastFailed", "broadcastSucceeded", "subscribeSocketConnected", "subscribeSocketError", "messageSucceeded", "setFilterParamSucceeded"]
  18469. super(url, options);
  18470. /**
  18471. * @member {GeoJSONObject} SuperMap.DataFlowService.prototype.geometry
  18472. * @description 指定几何范围,该范围内的要素才能被订阅。
  18473. */
  18474. this.geometry = null;
  18475. /**
  18476. * @member {Object} SuperMap.DataFlowService.prototype.prjCoordSys
  18477. * @description 动态投影参数
  18478. */
  18479. this.prjCoordSys = null;
  18480. /**
  18481. * @member {Object} SuperMap.DataFlowService.prototype.excludeField
  18482. * @description 排除字段
  18483. */
  18484. this.excludeField = null;
  18485. Util.extend(this, options);
  18486. this.CLASS_NAME = "SuperMap.DataFlowService";
  18487. }
  18488. /**
  18489. * @function SuperMap.DataFlowService.prototype.initBroadcast
  18490. * @description 初始化广播
  18491. * @returns {SuperMap.DataFlowService}
  18492. */
  18493. initBroadcast() {
  18494. var me = this;
  18495. this.broadcastWebSocket = this._connect(Util.urlPathAppend(me.url, 'broadcast'));
  18496. this.broadcastWebSocket.onopen = function (e) {
  18497. me.broadcastWebSocket.isOpen = true;
  18498. e.eventType = 'broadcastSocketConnected';
  18499. me.events.triggerEvent('broadcastSocketConnected', e);
  18500. };
  18501. this.broadcastWebSocket.onclose = function (e) {
  18502. me.broadcastWebSocket.isOpen = false;
  18503. e.eventType = 'broadcastSocketConnected';
  18504. me.events.triggerEvent('broadcastSocketConnected', e);
  18505. };
  18506. this.broadcastWebSocket.onerror = function (e) {
  18507. e.eventType = 'broadcastSocketError';
  18508. me.events.triggerEvent('broadcastSocketError', e);
  18509. };
  18510. return this;
  18511. }
  18512. /**
  18513. * @function SuperMap.DataFlowService.prototype.broadcast
  18514. * @description 加载广播数据。
  18515. * @param {GeoJSONObject} geoJSONFeature - JSON 格式的要素数据。
  18516. */
  18517. broadcast(geoJSONFeature) {
  18518. if (!this.broadcastWebSocket||!this.broadcastWebSocket.isOpen) {
  18519. this.events.triggerEvent('broadcastFailed');
  18520. return;
  18521. }
  18522. this.broadcastWebSocket.send(JSON.stringify(geoJSONFeature));
  18523. this.events.triggerEvent('broadcastSucceeded');
  18524. }
  18525. /**
  18526. * @function SuperMap.DataFlowService.prototype.initSubscribe
  18527. * @description 初始化订阅数据
  18528. * @returns {this} this
  18529. */
  18530. initSubscribe() {
  18531. var me = this;
  18532. this.subscribeWebSocket = this._connect(Util.urlPathAppend(me.url, 'subscribe'));
  18533. this.subscribeWebSocket.onopen = function (e) {
  18534. me.subscribeWebSocket.send(me._getFilterParams());
  18535. e.eventType = 'subscribeSocketConnected';
  18536. me.events.triggerEvent('subscribeSocketConnected', e);
  18537. };
  18538. this.subscribeWebSocket.onerror = function (e) {
  18539. e.eventType = 'subscribeSocketError';
  18540. me.events.triggerEvent('subscribeSocketError', e);
  18541. };
  18542. this.subscribeWebSocket.onmessage = function (e) {
  18543. me._onMessage(e);
  18544. };
  18545. return this;
  18546. }
  18547. /**
  18548. * @function SuperMap.DataFlowService.prototype.setExcludeField
  18549. * @description 设置排除字段
  18550. * @param {Object} excludeField - 排除字段
  18551. * @returns {this} this
  18552. */
  18553. setExcludeField(excludeField) {
  18554. this.excludeField = excludeField;
  18555. this.subscribeWebSocket.send(this._getFilterParams());
  18556. return this;
  18557. }
  18558. /**
  18559. * @function SuperMap.DataFlowService.prototype.setGeometry
  18560. * @description 设置添加的几何要素数据
  18561. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  18562. * @returns {this} this
  18563. */
  18564. setGeometry(geometry) {
  18565. this.geometry = geometry;
  18566. this.subscribeWebSocket.send(this._getFilterParams());
  18567. return this;
  18568. }
  18569. /**
  18570. * @function SuperMap.DataFlowService.prototype.unSubscribe
  18571. * @description 结束订阅数据
  18572. */
  18573. unSubscribe() {
  18574. if (!this.subscribeWebSocket) {
  18575. return;
  18576. }
  18577. this.subscribeWebSocket.close();
  18578. this.subscribeWebSocket = null;
  18579. }
  18580. /**
  18581. * @function SuperMap.DataFlowService.prototype.unBroadcast
  18582. * @description 结束加载广播
  18583. */
  18584. unBroadcast() {
  18585. if (!this.broadcastWebSocket) {
  18586. return;
  18587. }
  18588. this.broadcastWebSocket.close();
  18589. this.broadcastWebSocket = null;
  18590. }
  18591. /**
  18592. * @function SuperMap.DataFlowService.prototype.destroy
  18593. * @override
  18594. */
  18595. destroy() {
  18596. CommonServiceBase.prototype.destroy.apply(this, arguments);
  18597. var me = this;
  18598. me.geometry = null;
  18599. me.prjCoordSys = null;
  18600. me.excludeField = null;
  18601. this.unBroadcast();
  18602. this.unSubscribe();
  18603. }
  18604. _getFilterParams() {
  18605. var filter = {
  18606. filterParam: {
  18607. prjCoordSys: this.prjCoordSys,
  18608. excludeField: this.excludeField,
  18609. geometry: this.geometry
  18610. }
  18611. };
  18612. return Util.toJSON(filter);
  18613. }
  18614. _onMessage(e) {
  18615. if (e.data && e.data.indexOf("filterParam") >= 0) {
  18616. var filterParam = JSON.parse(e.data);
  18617. e.filterParam = filterParam;
  18618. e.eventType = 'setFilterParamSucceeded';
  18619. this.events.triggerEvent('setFilterParamSucceeded', e);
  18620. return;
  18621. }
  18622. var feature = JSON.parse(e.data);
  18623. e.featureResult = feature;
  18624. e.eventType = 'messageSucceeded';
  18625. this.events.triggerEvent('messageSucceeded', e);
  18626. }
  18627. _connect(url) {
  18628. url = this._appendCredentials(url);
  18629. if ("WebSocket" in window) {
  18630. return new WebSocket(url);
  18631. } else if ("MozWebSocket" in window) {
  18632. var mozWebSocket = window.MozWebSocket;
  18633. return new mozWebSocket(url);
  18634. } else {
  18635. console.log("no WebSocket");
  18636. return null;
  18637. }
  18638. }
  18639. _appendCredentials(url) {
  18640. var token = SecurityManager.getToken(url);
  18641. if (token) {
  18642. url = Util.urlAppend(url, "token=" + token);
  18643. }
  18644. return url;
  18645. }
  18646. }
  18647. SuperMap.DataFlowService = DataFlowService_DataFlowService;
  18648. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetInfo.js
  18649. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18650. * This program are made available under the terms of the Apache License, Version 2.0
  18651. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18652. /**
  18653. * @class SuperMap.DatasetInfo
  18654. * @category iServer Data
  18655. * @classdesc 数据集信息类。
  18656. * @description 数据集一般为存储在一起的相关数据的集合;根据数据类型的不同,分为矢量数据集、栅格数据集(griddataset)和
  18657. * 影像数据集(image dataset),以及为了处理特定问题而设计的数据集,如拓扑数据集,网络数据集等。
  18658. * 数据集是 GIS 数据组织的最小单位。其中矢量数据集是由同种类型空间要素组成的集合,
  18659. * 所以也可以称为要素集。根据要素的空间特征的不同,矢量数据集又分为点数据集,
  18660. * 线数据集,面数据集等,各矢量数据集是空间特征和性质相同的数据组织起来的集合。
  18661. * 目前版本支持的数据集主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、
  18662. * 网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  18663. * @param {Object} options - 参数。
  18664. * @param {SuperMap.Bounds} [options.bounds] - 数据集范围,该字段只读。
  18665. * @param {string} [options.dataSourceName] - 数据源名称,该字段只读。
  18666. * @param {string} [options.description] - 数据集的描述信息。
  18667. * @param {string} [options.encodeType] - 数据集存储时的压缩编码方式,该字段只读。
  18668. * @param {boolean} [options.isReadOnly] - 数据集是否为只读。
  18669. * @param {string} options.name - 数据集名称,该字段必须且只读。
  18670. * @param {SuperMap.Projection} [options.prjCoordSys] - 数据集的投影信息。
  18671. * @param {string} [options.tableName] - 表名,该字段只读。
  18672. * @param {string} options.type - 数据集类型。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  18673. */
  18674. class DatasetInfo {
  18675. constructor(options) {
  18676. options = options || {};
  18677. /**
  18678. * @member {SuperMap.Bounds} [SuperMap.DatasetInfo.prototype.bounds]
  18679. * @description 数据集范围,该字段只读。
  18680. */
  18681. this.bounds = null;
  18682. /**
  18683. * @member {string} [SuperMap.DatasetInfo.prototype.dataSourceName]
  18684. * @description 数据源名称,该字段只读。
  18685. */
  18686. this.dataSourceName = null;
  18687. /**
  18688. * @member {string} [SuperMap.DatasetInfo.prototype.description]
  18689. * @description 数据集的描述信息。
  18690. */
  18691. this.description = null;
  18692. /**
  18693. * @member {string} [SuperMap.DatasetInfo.prototype.encodeType]
  18694. * @description 数据集存储时的压缩编码方式,该字段只读。
  18695. */
  18696. this.encodeType = null;
  18697. /**
  18698. * @member {boolean} [SuperMap.DatasetInfo.prototype.isReadOnly]
  18699. * @description 数据集是否为只读。
  18700. */
  18701. this.isReadOnly = null;
  18702. /**
  18703. * @member {string} SuperMap.DatasetInfo.prototype.name
  18704. * @description 数据集名称,该字段必须且只读。
  18705. */
  18706. this.name = null;
  18707. /**
  18708. * @member {SuperMap.Projection} [SuperMap.DatasetInfo.prototype.prjCoordSys]
  18709. * @description 数据集的投影信息。
  18710. */
  18711. this.prjCoordSys = null;
  18712. /**
  18713. * @member {string} [SuperMap.DatasetInfo.prototype.tableName]
  18714. * @description 表名,该字段只读。
  18715. */
  18716. this.tableName = null;
  18717. /**
  18718. * @member {string} SuperMap.DatasetInfo.prototype.type
  18719. * @description 数据集类型,该字段必设。主要有点数据集,线数据集,面数据集,文本数据集,复合数据集(CAD 数据集)、网络数据集,栅格数据集(grid dataset)和影像数据集(image dataset)。
  18720. */
  18721. this.type = null;
  18722. Util.extend(this, options);
  18723. var b = this.bounds;
  18724. if (b) {
  18725. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  18726. }
  18727. this.CLASS_NAME = "SuperMap.DatasetInfo";
  18728. }
  18729. /**
  18730. * @function SuperMap.DatasetInfo.prototype.destroy
  18731. * @description 释放资源,将引用资源的属性置空。
  18732. */
  18733. destroy() {
  18734. Util.reset(this);
  18735. }
  18736. /**
  18737. * @function SuperMap.DatasetInfo.prototype.toServerJSONObject
  18738. * @description 转换成对应的 JSON 格式对象。
  18739. * @returns {Object} JSON 对象。
  18740. */
  18741. toServerJSONObject() {
  18742. var dataObj = {};
  18743. dataObj = Util.copyAttributes(dataObj, this);
  18744. if (dataObj.bounds) {
  18745. if (dataObj.bounds.toServerJSONObject) {
  18746. dataObj.bounds = dataObj.bounds.toServerJSONObject();
  18747. }
  18748. }
  18749. return dataObj;
  18750. }
  18751. }
  18752. SuperMap.DatasetInfo = DatasetInfo;
  18753. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystParameters.js
  18754. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18755. * This program are made available under the terms of the Apache License, Version 2.0
  18756. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18757. /**
  18758. * @class SuperMap.OverlayAnalystParameters
  18759. * @category iServer SpatialAnalyst OverlayAnalyst
  18760. * @classdesc 叠加分析参数基类。数据集叠加分析参数和几何对象叠加分析参数均继承此基类。
  18761. * @param {Object} options - 参数。
  18762. */
  18763. class OverlayAnalystParameters {
  18764. constructor(options) {
  18765. /**
  18766. * @member {SuperMap.OverlayOperationType} [SuperMap.OverlayAnalystParameters.prototype.operation=SuperMap.OverlayOperationType.UNION]
  18767. * @description 指定叠加分析操作类型。
  18768. */
  18769. this.operation = OverlayOperationType.UNION;
  18770. if (options) {
  18771. Util.extend(this, options);
  18772. }
  18773. this.CLASS_NAME = "SuperMap.OverlayAnalystParameters";
  18774. }
  18775. /**
  18776. * @function SuperMap.OverlayAnalystParameters.prototype.destroy
  18777. * @description 释放资源,将引用资源的属性置空。
  18778. */
  18779. destroy() {
  18780. var me = this;
  18781. me.operation = null;
  18782. }
  18783. }
  18784. SuperMap.OverlayAnalystParameters = OverlayAnalystParameters;
  18785. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetOverlayAnalystParameters.js
  18786. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18787. * This program are made available under the terms of the Apache License, Version 2.0
  18788. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18789. /**
  18790. * @class SuperMap.DatasetOverlayAnalystParameters
  18791. * @category iServer SpatialAnalyst OverlayAnalyst
  18792. * @classdesc 数据集叠加分析参数类。
  18793. * @param {Object} options - 参数。
  18794. * @param {string} options.operateDataset - 叠加分析中操作数据集的名称。
  18795. * @param {string} options.sourceDataset - 叠加分析中源数据集的名称。
  18796. * @param {Array.<string>} [options.operateDatasetFields] - 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  18797. * @param {SuperMap.FilterParameter} [options.operateDatasetFilter] - 设置操作数据集中空间对象过滤条件。
  18798. * @param {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [options.operateRegions] - 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  18799. * @param {Array.<string>} [options.sourceDatasetFields] - 叠加分析中源数据集保留在结果数据集中的字段名列表。
  18800. * @param {SuperMap.FilterParameter} [options.sourceDatasetFilter] - 设置源数据集中空间对象过滤条件。
  18801. * @param {number} [options.tolerance=0] - 容限。
  18802. * @param {SuperMap.OverlayOperationType} options.operation - 叠加操作枚举值。
  18803. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  18804. * @extends {SuperMap.GetFeaturesParametersBase}
  18805. */
  18806. class DatasetOverlayAnalystParameters extends OverlayAnalystParameters {
  18807. constructor(options) {
  18808. super(options);
  18809. /**
  18810. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDataset
  18811. * @description 叠加分析中操作数据集的名称。
  18812. */
  18813. this.operateDataset = null;
  18814. /**
  18815. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFields]
  18816. * @description 叠加分析中操作数据集保留在结果数据集中的字段名列表。
  18817. */
  18818. this.operateDatasetFields = [];
  18819. /**
  18820. * @member {SuperMap.FilterParameter} SuperMap.DatasetOverlayAnalystParameters.prototype.operateDatasetFilter
  18821. * @description 设置操作数据集中空间对象过滤条件。
  18822. */
  18823. this.operateDatasetFilter = new FilterParameter();
  18824. /**
  18825. * @member {Array.<SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon>} [SuperMap.DatasetOverlayAnalystParameters.prototype.operateRegions]
  18826. * @description 操作面对象集合,表示与这些面对象进行叠加分析。与 operateDataset 参数互斥,冲突时以 operateDataset 为准。
  18827. */
  18828. this.operateRegions = [];
  18829. /**
  18830. * @member {string} SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDataset
  18831. * @description 叠加分析中源数据集的名称。
  18832. */
  18833. this.sourceDataset = null;
  18834. /**
  18835. * @member {Array.<string>} [SuperMap.DatasetOverlayAnalystParameters.prototype.sourceDatasetFields]
  18836. * @description 叠加分析中源数据集保留在结果数据集中的字段名列表。
  18837. */
  18838. this.sourceDatasetFields = [];
  18839. /**
  18840. * @member {SuperMap.FilterParameter} [SuperMap.DatasetOverlayAnalystParameters.prototype.filterQueryParameter]
  18841. * @description 设置源数据集中空间对象过滤条件。
  18842. */
  18843. this.sourceDatasetFilter = new FilterParameter();
  18844. /**
  18845. * @member {number} [SuperMap.DatasetOverlayAnalystParameters.prototype.tolerance=0]
  18846. * @description 容限。
  18847. */
  18848. this.tolerance = 0;
  18849. /**
  18850. * @member {SuperMap.DataReturnOption} [SuperMap.DatasetOverlayAnalystParameters.prototype.resultSetting]
  18851. * @description 结果返回设置类。
  18852. */
  18853. this.resultSetting = new DataReturnOption();
  18854. Util.extend(this, options);
  18855. this.CLASS_NAME = "SuperMap.DatasetOverlayAnalystParameters";
  18856. }
  18857. /**
  18858. * @function SuperMap.DatasetOverlayAnalystParameters.prototype.destroy
  18859. * @override
  18860. */
  18861. destroy() {
  18862. super.destroy();
  18863. var me = this;
  18864. me.operateDataset = null;
  18865. me.operateDatasetFields = null;
  18866. if (me.operateDatasetFilter) {
  18867. me.operateDatasetFilter.destroy();
  18868. me.operateDatasetFilter = null;
  18869. }
  18870. if (me.operateRegions) {
  18871. for (var i = 0, opRegions = me.operateRegions, len = opRegions.length; i < len; i++) {
  18872. opRegions[i].destroy();
  18873. }
  18874. me.operateRegions = null;
  18875. }
  18876. me.sourceDataset = null;
  18877. me.sourceDatasetFields = null;
  18878. if (me.sourceDatasetFilter) {
  18879. me.sourceDatasetFilter.destroy();
  18880. me.sourceDatasetFilter = null;
  18881. }
  18882. me.tolerance = null;
  18883. if (me.resultSetting) {
  18884. me.resultSetting.destroy();
  18885. me.resultSetting = null;
  18886. }
  18887. }
  18888. /**
  18889. * @function SuperMap.DatasetOverlayAnalystParameters.toObject
  18890. * @param {SuperMap.DatasetOverlayAnalystParameters} datasetOverlayAnalystParameters - 数据集叠加分析参数类。
  18891. * @param {SuperMap.DatasetOverlayAnalystParameters} tempObj - 数据集叠加分析参数对象。
  18892. * @description 将数据集叠加分析参数类转换为 JSON 对象。
  18893. * @returns {Object} JSON 对象。
  18894. */
  18895. static toObject(datasetOverlayAnalystParameters, tempObj) {
  18896. for (var name in datasetOverlayAnalystParameters) {
  18897. if (name === "sourceDataset") {
  18898. continue;
  18899. } else if (name === "operateRegions") {
  18900. tempObj.operateRegions = [];
  18901. var ors = datasetOverlayAnalystParameters.operateRegions;
  18902. for (var index in ors) {
  18903. if (ors.hasOwnProperty(index)) { //icl542
  18904. tempObj.operateRegions[index] = ServerGeometry.fromGeometry(ors[index]);
  18905. }
  18906. }
  18907. } else if (name === "resultSetting") {
  18908. tempObj.dataReturnOption = datasetOverlayAnalystParameters.resultSetting;
  18909. } else {
  18910. tempObj[name] = datasetOverlayAnalystParameters[name];
  18911. }
  18912. }
  18913. }
  18914. }
  18915. SuperMap.DatasetOverlayAnalystParameters = DatasetOverlayAnalystParameters;
  18916. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParametersSetting.js
  18917. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  18918. * This program are made available under the terms of the Apache License, Version 2.0
  18919. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  18920. /**
  18921. * @class SuperMap.SurfaceAnalystParametersSetting
  18922. * @category iServer SpatialAnalyst SurfaceAnalyst
  18923. * @classdesc 表面分析参数设置类。
  18924. * 通过该类可以设置表面分析提取等值线、提取等值面的一些参数,包括基准值、等值距、光滑度、光滑方法等。
  18925. * @param {Object} options - 参数。
  18926. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  18927. * @param {number} [options.datumValue=0] - 获取或设置表面分析中提取等值线、提取等值面的基准值。
  18928. * @param {Array.<number>} options.expectedZValues - 获取或设置期望分析结果的 Z 值集合。
  18929. * @param {number} [options.interval=0] - 获取或设置等值距。等值距是两条等值线之间的间隔值。
  18930. * @param {number} [options.resampleTolerance=0] - 获取或设置重采样容限。
  18931. * @param {SuperMap.SmoothMethod} [options.smoothMethod=SuperMap.SmoothMethod.BSPLINE] - 获取或设置光滑处理所使用的方法。
  18932. * @param {number} [options.smoothness=0] - 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  18933. */
  18934. class SurfaceAnalystParametersSetting {
  18935. constructor(options) {
  18936. /**
  18937. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.SurfaceAnalystParametersSetting.prototype.clipRegion]
  18938. * @description 获取或设置裁剪面对象,如果不需要对操作结果进行裁剪,可以使用 null 值取代该参数。
  18939. */
  18940. this.clipRegion = null;
  18941. /**
  18942. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.datumValue=0]
  18943. * @description 获取或设置表面分析中提取等值线、提取等值面的基准值。
  18944. * 基准值是作为一个生成等值线的初始起算值,并不一定是最小等值线的值。 例如,高程范围为 220 -1550 的 DEM 栅格数据,
  18945. * 如果设基准值为 0, 等值距为 50,则提取等值线时,以基准值 0 为起点,等值距 50 为间隔提取等值线,
  18946. * 因为给定高程的最小值是 220,所以,在给定范围内提取等值线的最小高程是 250。
  18947. * 提取等值线的结果是:最小等值线值为 250,最大等值线值为 1550。
  18948. */
  18949. this.datumValue = 0;
  18950. /**
  18951. * @member {Array.<number>} SuperMap.SurfaceAnalystParametersSetting.prototype.expectedZValues
  18952. * @description 获取或设置期望分析结果的 Z 值集合。
  18953. * Z 值集合存储一系列数值,该数值为待提取等值线的值。即仅高程值在 Z 值集合中的等值线会被提取。
  18954. */
  18955. this.expectedZValues = null;
  18956. /**
  18957. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.interval=0]
  18958. * @description 获取或设置等值距。等值距是两条等值线之间的间隔值。
  18959. */
  18960. this.interval = 0;
  18961. /**
  18962. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.resampleTolerance=0]
  18963. * @description 获取或设置重采样容限。
  18964. * 容限值越大,采样结果数据越简化。当分析结果出现交叉时,可通过调整重采样容限为较小的值来处理。
  18965. */
  18966. this.resampleTolerance = 0;
  18967. /**
  18968. * @member {SuperMap.SmoothMethod} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothMethod=SuperMap.SmoothMethod.BSPLINE]
  18969. * @description 获取或设置光滑处理所使用的方法。
  18970. */
  18971. this.smoothMethod = SmoothMethod.BSPLINE;
  18972. /**
  18973. * @member {number} [SuperMap.SurfaceAnalystParametersSetting.prototype.smoothness=0]
  18974. * @description 获取或设置表面分析中等值线或等值面的边界线的光滑度。
  18975. * 以为 0-5 为例,光滑度为 0 表示不进行光滑操作,值越大表示光滑度越高。
  18976. * 随着光滑度的增加,提取的等值线越光滑.当然光滑度越大,
  18977. * 计算所需的时间和占用的内存也就越大。而且,当等值距较小时,
  18978. * 光滑度太高会出现等值线相交的问题。
  18979. */
  18980. this.smoothness = 0;
  18981. if (options) {
  18982. Util.extend(this, options);
  18983. }
  18984. this.CLASS_NAME = "SuperMap.SurfaceAnalystParametersSetting";
  18985. }
  18986. /**
  18987. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.destroy
  18988. * @description 释放资源,将引用资源的属性置空。
  18989. */
  18990. destroy() {
  18991. var me = this;
  18992. if (me.clipRegion) {
  18993. me.clipRegion.destroy();
  18994. me.clipRegion = null;
  18995. }
  18996. me.datumValue = null;
  18997. me.expectedZValues = null;
  18998. me.interval = null;
  18999. me.resampleTolerance = null;
  19000. me.smoothMethod = null;
  19001. me.smoothness = null;
  19002. }
  19003. /**
  19004. * @function SuperMap.SurfaceAnalystParametersSetting.prototype.toJSON
  19005. * @description 将对象转化为 JSON 字符串。
  19006. * @returns {string} 对象 JSON 字符串。
  19007. */
  19008. toJSON() {
  19009. let json = "'datumValue':" + Util.toJSON(this.datumValue);
  19010. json += ",'interval':" + Util.toJSON(this.interval);
  19011. json += ",'resampleTolerance':" + Util.toJSON(this.resampleTolerance);
  19012. json += ",'smoothMethod':" + Util.toJSON(this.smoothMethod);
  19013. json += ",'smoothness':" + Util.toJSON(this.smoothness);
  19014. if (this.expectedZValues != null) {
  19015. json += "," + "'expectedZValues':" + Util.toJSON(this.expectedZValues);
  19016. }
  19017. if (this.clipRegion != null) {
  19018. var serverGeometry = this.clipRegion;
  19019. if (this.clipRegion instanceof Geometry && this.clipRegion.components) {
  19020. serverGeometry = ServerGeometry.fromGeometry(this.clipRegion)
  19021. }
  19022. json += ",'clipRegion':" + Util.toJSON(serverGeometry);
  19023. }
  19024. return "{" + json + "}";
  19025. }
  19026. }
  19027. SuperMap.SurfaceAnalystParametersSetting = SurfaceAnalystParametersSetting;
  19028. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystParameters.js
  19029. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19030. * This program are made available under the terms of the Apache License, Version 2.0
  19031. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19032. /**
  19033. * @class SuperMap.SurfaceAnalystParameters
  19034. * @category iServer SpatialAnalyst SurfaceAnalyst
  19035. * @classdesc 表面分析提取操作参数类。
  19036. * @description 通过该类可以为进行表面分析提供参数信息,包括表面分析的方法提取等值线、提取等值面和中间结果的分辨率,
  19037. * {@link SuperMap.DatasetSurfaceAnalystParameters} 和 {@link SuperMap.GeometrySurfaceAnalystParameters} 继承自该类。
  19038. * @param {Object} options - 参数。
  19039. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  19040. * @param {number} options.resolution - 指定中间结果(栅格数据集)的分辨率。
  19041. * @param {SuperMap.DataReturnOption} options.resultSetting - 结果返回设置类。
  19042. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  19043. */
  19044. class SurfaceAnalystParameters {
  19045. constructor(options) {
  19046. /**
  19047. * @member {number} SuperMap.SurfaceAnalystParameters.prototype.resolution
  19048. * @description 获取或设置指定中间结果(栅格数据集)的分辨率。
  19049. */
  19050. this.resolution = 0;
  19051. /**
  19052. * @member {SuperMap.SurfaceAnalystParametersSetting} SuperMap.SurfaceAnalystParameters.prototype.extractParameter
  19053. * @description 获取或设置表面分析参数。
  19054. * 在进行点数据集进行提取等值面分析时,暂时不支持 SurfaceAnalystParametersSetting 类中的 expectedZValues 字段。
  19055. */
  19056. this.extractParameter = new SurfaceAnalystParametersSetting();
  19057. /**
  19058. * @member {SuperMap.DataReturnOption} SuperMap.SurfaceAnalystParameters.prototype.resultSetting
  19059. * @description 结果返回设置类。
  19060. */
  19061. this.resultSetting = new DataReturnOption();
  19062. /**
  19063. * @member {SuperMap.SurfaceAnalystMethod} [SuperMap.SurfaceAnalystParameters.prototype.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE]
  19064. * @description 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  19065. */
  19066. this.surfaceAnalystMethod = SurfaceAnalystMethod.ISOLINE;
  19067. if (options) {
  19068. Util.extend(this, options);
  19069. }
  19070. this.CLASS_NAME = "SuperMap.SurfaceAnalystParameters";
  19071. }
  19072. /**
  19073. * @function SuperMap.SurfaceAnalystParameters.prototype.destroy
  19074. * @description 释放资源,将引用资源的属性置空。
  19075. */
  19076. destroy() {
  19077. var me = this;
  19078. me.resolution = null;
  19079. if (me.extractParameter) {
  19080. me.extractParameter.destroy();
  19081. me.extractParameter = null;
  19082. }
  19083. if (me.resultSetting) {
  19084. me.resultSetting.destroy();
  19085. me.resultSetting = null;
  19086. }
  19087. me.surfaceAnalystMethod = null;
  19088. }
  19089. }
  19090. SuperMap.SurfaceAnalystParameters = SurfaceAnalystParameters;
  19091. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetSurfaceAnalystParameters.js
  19092. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19093. * This program are made available under the terms of the Apache License, Version 2.0
  19094. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19095. /**
  19096. * @class SuperMap.DatasetSurfaceAnalystParameters
  19097. * @category iServer SpatialAnalyst SurfaceAnalyst
  19098. * @classdesc 数据集表面分析参数类。该类对数据集表面分析所用到的参数进行设置。
  19099. * @param {Object} options - 参数。
  19100. * @param {string} options.dataset - 要用来做数据集表面分析的数据源中数据集的名称。
  19101. * @param {string} options.zValueFieldName - 获取或设置用于提取操作的字段名称。
  19102. * @param {integer} options.resolution - 获取或设置指定中间结果(栅格数据集)的分辨率。
  19103. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 表面分析参数设置类。获取或设置表面分析参数。
  19104. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 获取或设置查询过滤条件参数。
  19105. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  19106. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod=SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  19107. * @extends {SuperMap.SurfaceAnalystParameters}
  19108. */
  19109. class DatasetSurfaceAnalystParameters extends SurfaceAnalystParameters {
  19110. constructor(options) {
  19111. super(options);
  19112. /**
  19113. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.dataset
  19114. * @description 要用来做数据集表面分析的数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Country@World。
  19115. */
  19116. this.dataset = null;
  19117. /**
  19118. * @member {SuperMap.FilterParameter} SuperMap.DatasetSurfaceAnalystParameters.prototype.filterQueryParameter
  19119. * @description 获取或设置查询过滤条件参数。
  19120. */
  19121. this.filterQueryParameter = new FilterParameter();
  19122. /**
  19123. * @member {string} SuperMap.DatasetSurfaceAnalystParameters.prototype.zValueFieldName
  19124. * @description 获取或设置用于提取操作的字段名称。提取等值线时,将使用该字段中的值,对点记录集中的点数据进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  19125. */
  19126. this.zValueFieldName = null;
  19127. if (options) {
  19128. Util.extend(this, options);
  19129. }
  19130. this.CLASS_NAME = "SuperMap.DatasetSurfaceAnalystParameters";
  19131. }
  19132. /**
  19133. * @function SuperMap.DatasetSurfaceAnalystParameters.prototype.destroy
  19134. * @override
  19135. */
  19136. destroy() {
  19137. super.destroy();
  19138. var me = this;
  19139. me.dataset = null;
  19140. if (me.filterQueryParameter) {
  19141. me.filterQueryParameter.destroy();
  19142. me.filterQueryParameter = null;
  19143. }
  19144. me.zValueFieldName = null;
  19145. }
  19146. /**
  19147. * @function SuperMap.DatasetSurfaceAnalystParameters.toObject
  19148. * @param {SuperMap.DatasetSurfaceAnalystParameters} datasetSurfaceAnalystParameters - 数据集表面分析参数类。
  19149. * @param {SuperMap.DatasetSurfaceAnalystParameters} tempObj - 数据集表面分析参数对象。
  19150. * @description 将数据集表面分析参数对象转换为 JSON 对象。
  19151. * @returns JSON 对象。
  19152. */
  19153. static toObject(datasetSurfaceAnalystParameters, tempObj) {
  19154. for (var name in datasetSurfaceAnalystParameters) {
  19155. if (name === "filterQueryParameter") {
  19156. tempObj.filterQueryParameter = datasetSurfaceAnalystParameters.filterQueryParameter;
  19157. }
  19158. if (name === "extractParameter") {
  19159. if (datasetSurfaceAnalystParameters.extractParameter.clipRegion instanceof Geometry && datasetSurfaceAnalystParameters.extractParameter.clipRegion.components) {
  19160. datasetSurfaceAnalystParameters.extractParameter.clipRegion = ServerGeometry.fromGeometry(datasetSurfaceAnalystParameters.extractParameter.clipRegion);
  19161. }
  19162. tempObj.extractParameter = datasetSurfaceAnalystParameters.extractParameter;
  19163. } else if (name === "dataset") {
  19164. continue;
  19165. } else if (name === "surfaceAnalystMethod") {
  19166. continue;
  19167. } else {
  19168. tempObj[name] = datasetSurfaceAnalystParameters[name];
  19169. }
  19170. }
  19171. }
  19172. }
  19173. SuperMap.DatasetSurfaceAnalystParameters = DatasetSurfaceAnalystParameters;
  19174. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystParameters.js
  19175. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19176. * This program are made available under the terms of the Apache License, Version 2.0
  19177. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19178. /**
  19179. * @class SuperMap.ThiessenAnalystParameters
  19180. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  19181. * @classdesc 泰森多边形分析参数基类。
  19182. * @param {Object} options - 参数。
  19183. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.clipRegion] - 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  19184. * @param {boolean} [options.createResultDataset=false] - 是否返回结果数据集。
  19185. * @param {string} [options.resultDatasetName] - 指定结果数据集名称。
  19186. * @param {string} [options.resultDatasourceName] - 指定结果数据集所在数据源,默认为当前数据源。
  19187. * @param {boolean} [options.returnResultRegion=true] - 是否返回分析得到的多边形面数组。
  19188. */
  19189. class ThiessenAnalystParameters {
  19190. constructor(options) {
  19191. if (!options) {
  19192. return;
  19193. }
  19194. /**
  19195. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.ThiessenAnalystParameters.prototype.clipRegion]
  19196. * @description 结果数据裁剪区域,可以为 null,表示不对结果进行裁剪。
  19197. */
  19198. this.clipRegion = null;
  19199. /**
  19200. * @member {boolean} [SuperMap.ThiessenAnalystParameters.prototype.createResultDataset=false]
  19201. * @description 是否返回结果数据集。如果为 true,则必须设置属性 resultDatasetName 和 resultDatasourceName。
  19202. */
  19203. this.createResultDataset = false;
  19204. /**
  19205. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasetName
  19206. * @description 指定结果数据集名称。
  19207. */
  19208. this.resultDatasetName = null;
  19209. /**
  19210. * @member {string} SuperMap.ThiessenAnalystParameters.prototype.resultDatasourceName
  19211. * @description 指定结果数据集所在数据源。
  19212. */
  19213. this.resultDatasourceName = null;
  19214. /**
  19215. * @member {boolean} SuperMap.ThiessenAnalystParameters.prototype.returnResultRegion
  19216. * @description 是否返回分析得到的多边形面数组。
  19217. */
  19218. this.returnResultRegion = true;
  19219. Util.extend(this, options);
  19220. this.CLASS_NAME = "SuperMap.ThiessenAnalystParameters";
  19221. }
  19222. /**
  19223. * @function SuperMap.ThiessenAnalystParameters.prototype.destroy
  19224. * @description 释放资源,将引用资源的属性置空。
  19225. */
  19226. destroy() {
  19227. var me = this;
  19228. if (me.clipRegion) {
  19229. me.clipRegion.destroy();
  19230. me.clipRegion = null;
  19231. }
  19232. me.createResultDataset = null;
  19233. me.resultDatasetName = null;
  19234. me.resultDatasourceName = null;
  19235. me.returnResultRegion = null;
  19236. }
  19237. }
  19238. SuperMap.ThiessenAnalystParameters = ThiessenAnalystParameters;
  19239. ;// CONCATENATED MODULE: ./src/common/iServer/DatasetThiessenAnalystParameters.js
  19240. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19241. * This program are made available under the terms of the Apache License, Version 2.0
  19242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19243. /**
  19244. * @class SuperMap.DatasetThiessenAnalystParameters
  19245. * @category iServer SpatialAnalyst ThiessenAnalyst
  19246. * @classdesc 数据集泰森多边形分析参数类。
  19247. * @param {Object} options - 参数。
  19248. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  19249. * @extends {SuperMap.ThiessenAnalystParameters}
  19250. */
  19251. class DatasetThiessenAnalystParameters extends ThiessenAnalystParameters {
  19252. constructor(options) {
  19253. super(options);
  19254. /**
  19255. * @member {SuperMap.FilterParameter} [SuperMap.DatasetThiessenAnalystParameters.prototype.filterQueryParameter]
  19256. * @description 过滤条件,对待分析数据集中的点进行过滤,即对数据集中的所有点进行分析。
  19257. * @example
  19258. * var filterQueryParameter = new SuperMap.FilterParameter({
  19259. * name: "Countries@World",
  19260. * attributeFilter: "SmID>100"
  19261. * });
  19262. */
  19263. this.filterQueryParameter = null;
  19264. /**
  19265. * @member {string} SuperMap.DatasetThiessenAnalystParameters.prototype.dataset
  19266. * @description 数据集名称待分析的数据集名称,请使用 "datasetName@datasourceName" 格式来表示。
  19267. */
  19268. this.dataset = null;
  19269. if (options) {
  19270. Util.extend(this, options);
  19271. }
  19272. this.CLASS_NAME = "SuperMap.DatasetThiessenAnalystParameters";
  19273. }
  19274. /**
  19275. * @function SuperMap.DatasetThiessenAnalystParameters.prototype.destroy
  19276. * @override
  19277. */
  19278. destroy() {
  19279. super.destroy();
  19280. var me = this;
  19281. if (me.filterQueryParameter) {
  19282. me.filterQueryParameter.destroy();
  19283. me.filterQueryParameter = null;
  19284. }
  19285. }
  19286. /**
  19287. * @function SuperMap.DatasetThiessenAnalystParameters.toObject
  19288. * @param {SuperMap.DatasetThiessenAnalystParameters} datasetThiessenAnalystParameters - 泰森多边形分析服务参数类。
  19289. * @param {SuperMap.DatasetThiessenAnalystParameters} tempObj - 泰森多边形分析服务参数对象。
  19290. * @description 将泰森多边形分析服务参数对象转换为 JSON 对象。
  19291. * @returns JSON 对象。
  19292. */
  19293. static toObject(datasetThiessenAnalystParameters, tempObj) {
  19294. for (var name in datasetThiessenAnalystParameters) {
  19295. if (name === "clipRegion") {
  19296. tempObj.clipRegion = ServerGeometry.fromGeometry(datasetThiessenAnalystParameters.clipRegion);
  19297. } else {
  19298. tempObj[name] = datasetThiessenAnalystParameters[name];
  19299. }
  19300. }
  19301. }
  19302. }
  19303. SuperMap.DatasetThiessenAnalystParameters = DatasetThiessenAnalystParameters;
  19304. ;// CONCATENATED MODULE: ./src/common/iServer/DensityKernelAnalystParameters.js
  19305. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19306. * This program are made available under the terms of the Apache License, Version 2.0
  19307. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19308. /**
  19309. * @class SuperMap.DensityKernelAnalystParameters
  19310. * @category iServer SpatialAnalyst DensityAnalyst
  19311. * @classdesc 核密度分析参数类。
  19312. * @param {Object} options - 参数。
  19313. * @param {string} options.dataset - 要用来做核密度分析数据源中数据集的名称。该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:BaseMap_P@Jingjin。
  19314. * @param {string} options.fieldName - 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  19315. * @param {string} options.resultGridName - 指定结果数据集名称。
  19316. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 核密度分析的范围,用于确定结果栅格数据集的范围。如果缺省,则默认为原数据集的范围。
  19317. * @param {number} [options.searchRadius] - 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  19318. * @param {number} [options.resultGridDatasetResolution] - 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  19319. * @param {string} [options.targetDatasource] - 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  19320. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  19321. */
  19322. class DensityKernelAnalystParameters {
  19323. constructor(options) {
  19324. /**
  19325. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.dataset
  19326. * @description 要用来做核密度分析数据源中数据集的名称。
  19327. * 该名称用形如 "数据集名称@数据源别名" 形式来表示,例如:Railway@Changchun。
  19328. * 注:核密度分析支持点数据集和线数据集。
  19329. */
  19330. this.dataset = null;
  19331. /**
  19332. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} [SuperMap.DensityKernelAnalystParameters.prototype.bounds]
  19333. * @description 核密度分析的范围,用于确定结果栅格数据集的范围。
  19334. * 如果缺省,则默认为原数据集的范围。
  19335. */
  19336. this.bounds = null;
  19337. /**
  19338. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.fieldName
  19339. * @description 用于进行核密度分析的测量值的字段名称,核密度分析不支持文本类型的字段。
  19340. */
  19341. this.fieldName = null;
  19342. /**
  19343. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.resultGridDatasetResolution]
  19344. * @description 密度分析结果栅格数据的分辨率,单位与当前数据集相同。默认值为当前数据集的长宽中的最小值除500。
  19345. */
  19346. this.resultGridDatasetResolution = null;
  19347. /**
  19348. * @member {number} [SuperMap.DensityKernelAnalystParameters.prototype.searchRadius]
  19349. * @description 栅格邻域内用于计算密度的查找半径,单位与当前数据集相同。默认值为当前数据集的长宽中的最大值除30。
  19350. */
  19351. this.searchRadius = null;
  19352. /**
  19353. * @member {string} [SuperMap.DensityKernelAnalystParameters.prototype.targetDatasource]
  19354. * @description 指定的存储结果数据集的数据源,默认为当前分析的数据集所在的数据源。
  19355. */
  19356. this.targetDatasource = null;
  19357. /**
  19358. * @member {string} SuperMap.DensityKernelAnalystParameters.prototype.resultGridName
  19359. * @description 指定结果数据集名称。
  19360. */
  19361. this.resultGridName = null;
  19362. /**
  19363. * @member {boolean} [SuperMap.DensityKernelAnalystParameters.prototype.deleteExistResultDataset=false]
  19364. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  19365. */
  19366. this.deleteExistResultDataset = false;
  19367. Util.extend(this, options);
  19368. this.CLASS_NAME = "SuperMap.DensityKernelAnalystParameters";
  19369. }
  19370. /**
  19371. * @function SuperMap.DensityKernelAnalystParameters.prototype.destroy
  19372. * @description 释放资源,将引用资源的属性置空。
  19373. */
  19374. destroy() {
  19375. var me = this;
  19376. me.dataset = null;
  19377. me.bounds = null;
  19378. me.fieldName = null;
  19379. me.resultGridDatasetResolution = null;
  19380. me.searchRadius = null;
  19381. me.targetDatasource = null;
  19382. me.resultGridName = null;
  19383. me.deleteExistResultDataset = null;
  19384. }
  19385. /**
  19386. * @function SuperMap.DensityKernelAnalystParameters.toObject
  19387. * @param {SuperMap.DensityKernelAnalystParameters} densityKernelAnalystParameters -核密度分析参数类。
  19388. * @param {SuperMap.DensityKernelAnalystParameters} tempObj - 核密度分析参数对象。
  19389. * @description 将核密度分析参数对象转换成 JSON 对象。
  19390. * @returns JSON 对象。
  19391. */
  19392. static toObject(densityKernelAnalystParameters, tempObj) {
  19393. for (var name in densityKernelAnalystParameters) {
  19394. if (name !== "dataset") {
  19395. tempObj[name] = densityKernelAnalystParameters[name];
  19396. }
  19397. }
  19398. }
  19399. }
  19400. SuperMap.DensityKernelAnalystParameters = DensityKernelAnalystParameters;
  19401. ;// CONCATENATED MODULE: ./src/common/iServer/DensityAnalystService.js
  19402. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19403. * This program are made available under the terms of the Apache License, Version 2.0
  19404. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19405. /**
  19406. * @class SuperMap.DensityAnalystService
  19407. * @category iServer SpatialAnalyst DensityAnalyst
  19408. * @classdesc
  19409. * 密度分析服务类,密度分析可计算每个输出栅格像元周围圆形邻域内输入的点或线对象的密度。
  19410. * 密度分析,在某种意义上来说,相当于在表面上将输入的点线对象的测量值散开来,将每个点或线对象的测量量分布在整个研究区域,并计算输出栅格中每个像元的密度值。目前提供1种密度分析:核密度分析(Kernel)。
  19411. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  19412. * @param {Object} options - 参数。</br>
  19413. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19414. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19415. * @param {Object} [options.headers] - 请求头。
  19416. * @extends {SuperMap.SpatialAnalystBase}
  19417. * @example 例如:
  19418. * var myDensityAnalystService = new SuperMap.DensityAnalystService(url);
  19419. * myDensityAnalystService.on({
  19420. * "processCompleted": processCompleted,
  19421. * "processFailed": processFailed
  19422. * }
  19423. * );
  19424. */
  19425. class DensityAnalystService extends SpatialAnalystBase {
  19426. constructor(url, options) {
  19427. super(url, options);
  19428. /**
  19429. * @member {string} SuperMap.DensityAnalystService.prototype.mode
  19430. * @description 密度分析类型。
  19431. */
  19432. this.mode = null;
  19433. if (options) {
  19434. Util.extend(this, options);
  19435. }
  19436. this.CLASS_NAME = "SuperMap.DensityAnalystService";
  19437. }
  19438. /**
  19439. * @function SuperMap.DensityAnalystService.prototype.destroy
  19440. * @description 释放资源,将引用资源的属性置空。
  19441. */
  19442. destroy() {
  19443. super.destroy();
  19444. this.mode = null;
  19445. }
  19446. /**
  19447. * @function SuperMap.DensityAnalystService.prototype.processAsync
  19448. * @description 负责将客户端的查询参数传递到服务端。
  19449. * @param {SuperMap.DensityKernelAnalystParameters} parameter - 核密度分析参数。
  19450. */
  19451. processAsync(parameter) {
  19452. var me = this;
  19453. var parameterObject = new Object();
  19454. if (parameter instanceof DensityKernelAnalystParameters) {
  19455. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/densityanalyst/kernel');
  19456. me.mode = "kernel";
  19457. }
  19458. DensityKernelAnalystParameters.toObject(parameter, parameterObject);
  19459. var jsonParameters = Util.toJSON(parameterObject);
  19460. me.url = Util.urlAppend(me.url, 'returnContent=true');
  19461. me.request({
  19462. method: "POST",
  19463. data: jsonParameters,
  19464. scope: me,
  19465. success: me.serviceProcessCompleted,
  19466. failure: me.serviceProcessFailed
  19467. });
  19468. }
  19469. }
  19470. SuperMap.DensityAnalystService = DensityAnalystService;
  19471. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesParameters.js
  19472. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19473. * This program are made available under the terms of the Apache License, Version 2.0
  19474. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19475. /**
  19476. * @class SuperMap.EditFeaturesParameters
  19477. * @category iServer Data Feature
  19478. * @classdesc 数据服务中数据集添加、修改、删除参数类。
  19479. * @category iServer Data
  19480. * @param {Object} options - 参数。
  19481. * @param {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} options.features - 当前需要创建或者是修改的要素集。
  19482. * @param {boolean} [options.returnContent=false] - 是返回创建要素的 ID 数组还是返回 featureResult 资源的 URI。
  19483. * @param {SuperMap.EditType} [options.editType=SuperMap.EditType.ADD] - POST 动作类型 (ADD、UPDATE、DELETE)。
  19484. * @param {Array.<string|integer>} [options.IDs] - 删除要素时的要素的 ID 数组。
  19485. */
  19486. class EditFeaturesParameters {
  19487. constructor(options) {
  19488. /**
  19489. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSourceName
  19490. * @description 当前需要创建或者是修改的要素的数据源。
  19491. */
  19492. this.dataSourceName = null;
  19493. /**
  19494. * @member {string} SuperMap.EditFeaturesParameters.prototype.dataSetName
  19495. * @description 当前需要创建或者是修改的要素的数据集。
  19496. */
  19497. this.dataSetName = null;
  19498. /**
  19499. * @member {Array.<SuperMap.Feature.Vector|GeoJSONObject|ol.feature>} SuperMap.EditFeaturesParameters.prototype.features
  19500. * @description 当前需要创建或者是修改的要素集。
  19501. */
  19502. this.features = null;
  19503. /**
  19504. * @member {SuperMap.EditType} [SuperMap.EditFeaturesParameters.prototype.editType=SuperMap.EditType.ADD]
  19505. * @description 要素集更新类型 (add、update、delete)。
  19506. */
  19507. this.editType = EditType.ADD;
  19508. /**
  19509. * @member {Array.<string|number>} [SuperMap.EditFeaturesParameters.prototype.IDs]
  19510. * @description 执行删除时要素集 ID 集合。
  19511. */
  19512. this.IDs = null;
  19513. /**
  19514. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.returnContent=false]
  19515. * @description 要素添加时,isUseBatch 不传或传为 false 的情况下有效。
  19516. * true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  19517. */
  19518. this.returnContent = false;
  19519. /**
  19520. * @member {boolean} [SuperMap.EditFeaturesParameters.prototype.isUseBatch=false]
  19521. * @description 是否使用批量添加要素功能,要素添加时有效。批量添加能够提高要素编辑效率。true 表示批量添加;false 表示不使用批量添加。
  19522. */
  19523. this.isUseBatch = false;
  19524. Util.extend(this, options);
  19525. this.CLASS_NAME = "SuperMap.EditFeaturesParameters";
  19526. }
  19527. /**
  19528. * @function SuperMap.EditFeaturesParameters.prototype.destroy
  19529. * @description 释放资源,将引用资源的属性置空。
  19530. */
  19531. destroy() {
  19532. var me = this;
  19533. me.dataSourceName = null;
  19534. me.dataSetName = null;
  19535. me.features = null;
  19536. me.editType = null;
  19537. me.IDs = null;
  19538. me.returnContent = null;
  19539. }
  19540. /**
  19541. * @function SuperMap.EditFeaturesParameters.prototype.toJsonParameters
  19542. * @description 将 EditFeaturesParameters 对象参数转换为 JSON 字符串。
  19543. * @param {SuperMap.EditFeaturesParameters} params - 地物编辑参数。
  19544. * @returns {string} JSON 字符串。
  19545. */
  19546. static toJsonParameters(params) {
  19547. var feature,
  19548. len,
  19549. features,
  19550. editType = params.editType;
  19551. if (editType === EditType.DELETE) {
  19552. if (params.IDs === null) {
  19553. return;
  19554. }
  19555. features = {ids: params.IDs};
  19556. } else {
  19557. features = [];
  19558. if (params.features) {
  19559. len = params.features.length;
  19560. for (var i = 0; i < len; i++) {
  19561. feature = params.features[i];
  19562. feature.geometry = ServerGeometry.fromGeometry(feature.geometry);
  19563. features.push(feature);
  19564. }
  19565. }
  19566. }
  19567. return Util.toJSON(features);
  19568. }
  19569. }
  19570. SuperMap.EditFeaturesParameters = EditFeaturesParameters;
  19571. ;// CONCATENATED MODULE: ./src/common/iServer/EditFeaturesService.js
  19572. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19573. * This program are made available under the terms of the Apache License, Version 2.0
  19574. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19575. /**
  19576. * @class SuperMap.EditFeaturesService
  19577. * @category iServer Data Feature
  19578. * @classdesc 数据服务中数据集添加、更新、删除服务类。
  19579. * @extends {SuperMap.CommonServiceBase}
  19580. * @param {string} url - 服务端的数据服务资源地址。请求数据服务中数据集编辑服务,URL 应为:</br>
  19581. * http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/datasources/name/{数据源名}/datasets/name/{数据集名} 。</br>
  19582. * 例如:http://localhost:8090/iserver/services/data-jingjin/rest/data/datasources/name/Jingjin/datasets/name/Landuse_R
  19583. * @param {Object} options - 参数。</br>
  19584. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  19585. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  19586. * @param {SuperMap.DataFormat} [format] -查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  19587. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19588. * @param {Object} [options.headers] - 请求头。
  19589. * @example
  19590. * var myService = new SuperMap.EditFeaturesService(url, {eventListeners: {
  19591. * "processCompleted": editFeatureCompleted,
  19592. * "processFailed": editFeatureError
  19593. * }
  19594. * };
  19595. *
  19596. */
  19597. class EditFeaturesService extends CommonServiceBase {
  19598. constructor(url, options) {
  19599. super(url, options);
  19600. /**
  19601. * @member {boolean} [SuperMap.EditFeaturesService.prototype.returnContent=false]
  19602. * @description要素添加时,isUseBatch 不传或传为 false 的情况下有效。true 表示直接返回新创建的要素的 ID 数组;false 表示返回创建的 featureResult 资源的 URI。
  19603. */
  19604. this.returnContent = false;
  19605. /**
  19606. * @member {boolean} [SuperMap.EditFeaturesService.prototype.isUseBatch=false]
  19607. * @description 是否使用批量添加要素功能,要素添加时有效。
  19608. * 批量添加能够提高要素编辑效率。
  19609. * true 表示批量添加;false 表示不使用批量添加。
  19610. */
  19611. this.isUseBatch = false;
  19612. if (options) {
  19613. Util.extend(this, options);
  19614. }
  19615. this.url = Util.urlPathAppend(this.url, 'features');
  19616. this.CLASS_NAME = "SuperMap.EditFeaturesService";
  19617. }
  19618. /**
  19619. * @function SuperMap.EditFeaturesService.prototype.destroy
  19620. * @override
  19621. */
  19622. destroy() {
  19623. super.destroy();
  19624. var me = this;
  19625. me.returnContent = null;
  19626. me.isUseBatch = null;
  19627. me.fromIndex = null;
  19628. me.toIndex = null;
  19629. }
  19630. /**
  19631. * @function SuperMap.EditFeaturesService.prototype.processAsync
  19632. * @description 负责将客户端的更新参数传递到服务端。
  19633. * @param {SuperMap.EditFeaturesParameters} params - 编辑要素参数。
  19634. */
  19635. processAsync(params) {
  19636. if (!(params instanceof EditFeaturesParameters)) {
  19637. return;
  19638. }
  19639. var me = this,
  19640. method = "POST",
  19641. ids = "",
  19642. editType = params.editType,
  19643. jsonParameters = null;
  19644. me.returnContent = params.returnContent;
  19645. me.isUseBatch = params.isUseBatch;
  19646. jsonParameters = EditFeaturesParameters.toJsonParameters(params);
  19647. if (editType === EditType.DELETE) {
  19648. ids = Util.toJSON(params.IDs);
  19649. me.url = Util.urlAppend(me.url, "ids=" + ids);
  19650. method = "DELETE";
  19651. jsonParameters = ids;
  19652. } else if (editType === EditType.UPDATE) {
  19653. method = "PUT";
  19654. } else {
  19655. if (me.isUseBatch) {
  19656. me.url = Util.urlAppend(me.url, `isUseBatch=${me.isUseBatch}`);
  19657. me.returnContent = false;
  19658. }
  19659. if (me.returnContent) {
  19660. me.url = Util.urlAppend(me.url, 'returnContent=true');
  19661. method = "POST";
  19662. }
  19663. }
  19664. me.request({
  19665. method: method,
  19666. data: jsonParameters,
  19667. scope: me,
  19668. success: me.serviceProcessCompleted,
  19669. failure: me.serviceProcessFailed
  19670. });
  19671. }
  19672. }
  19673. SuperMap.EditFeaturesService = EditFeaturesService;
  19674. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalyst3DParameters.js
  19675. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19676. * This program are made available under the terms of the Apache License, Version 2.0
  19677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19678. /**
  19679. * @class SuperMap.FacilityAnalyst3DParameters
  19680. * @category iServer FacilityAnalyst3D
  19681. * @classdesc 最近设施分析参数基类。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19682. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,
  19683. * 超过 10 分钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起
  19684. * 作用的障碍边、障碍点、转向表、耗费等属性在最近设施分析时同样可设置。
  19685. * @param {Object} options - 参数。
  19686. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19687. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19688. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19689. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19690. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19691. */
  19692. class FacilityAnalyst3DParameters {
  19693. constructor(options) {
  19694. /**
  19695. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.edgeID]
  19696. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19697. */
  19698. this.edgeID = null;
  19699. /**
  19700. * @member {number} [SuperMap.FacilityAnalyst3DParameters.prototype.nodeID]
  19701. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19702. */
  19703. this.nodeID = null;
  19704. /**
  19705. * @member {string} SuperMap.FacilityAnalyst3DParameters.prototype.weightName
  19706. * @description 指定的权值字段信息对象的名称。
  19707. */
  19708. this.weightName = null;
  19709. /**
  19710. * @member {boolean} [SuperMap.FacilityAnalyst3DParameters.prototype.isUncertainDirectionValid=false]
  19711. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19712. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找
  19713. */
  19714. this.isUncertainDirectionValid = false;
  19715. Util.extend(this, options);
  19716. this.CLASS_NAME = "SuperMap.FacilityAnalyst3DParameters";
  19717. }
  19718. /**
  19719. * @function SuperMap.FacilityAnalyst3DParameters.prototype.destroy
  19720. * @override
  19721. */
  19722. destroy() {
  19723. var me = this;
  19724. me.edgeID = null;
  19725. me.nodeID = null;
  19726. me.weightName = null;
  19727. me.isUncertainDirectionValid = null;
  19728. }
  19729. }
  19730. SuperMap.FacilityAnalyst3DParameters = FacilityAnalyst3DParameters;
  19731. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DParameters.js
  19732. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19733. * This program are made available under the terms of the Apache License, Version 2.0
  19734. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19735. /**
  19736. * @class SuperMap.FacilityAnalystSinks3DParameters
  19737. * @category iServer FacilityAnalyst3D Sinks
  19738. * @classdesc 最近设施分析参数类(汇查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19739. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分钟
  19740. * 能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍点、
  19741. * 转向表、耗费等属性在最近设施分析时同样可设置。
  19742. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19743. * @param {Object} options - 参数。
  19744. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19745. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19746. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19747. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19748. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19749. */
  19750. class FacilityAnalystSinks3DParameters extends FacilityAnalyst3DParameters {
  19751. constructor(options) {
  19752. super(options);
  19753. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DParameters";
  19754. }
  19755. /**
  19756. * @function SuperMap.FacilityAnalystSinks3DParameters.prototype.destroy
  19757. * @override
  19758. */
  19759. destroy() {
  19760. super.destroy();
  19761. }
  19762. }
  19763. SuperMap.FacilityAnalystSinks3DParameters = FacilityAnalystSinks3DParameters;
  19764. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSinks3DService.js
  19765. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19766. * This program are made available under the terms of the Apache License, Version 2.0
  19767. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19768. /**
  19769. * @class SuperMap.FacilityAnalystSinks3DService
  19770. * @category iServer FacilityAnalyst3D Sinks
  19771. * @classdesc 最近设施分析服务类(汇查找资源)<br>
  19772. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19773. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19774. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19775. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  19776. * @extends {SuperMap.CommonServiceBase}
  19777. * @example
  19778. * var myFacilityAnalystSinks3DService = new SuperMap.FacilityAnalystSinks3DService(url, {
  19779. * eventListeners: {
  19780. * "processCompleted": facilityAnalystSinks3DCompleted,
  19781. * "processFailed": facilityAnalystSinks3DError
  19782. * }
  19783. * });
  19784. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:<br>
  19785. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  19786. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。<br>
  19787. * @param {Object} options - 参数。<br>
  19788. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19789. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19790. * @param {Object} [options.headers] - 请求头。
  19791. */
  19792. class FacilityAnalystSinks3DService extends CommonServiceBase {
  19793. constructor(url, options) {
  19794. super(url, options);
  19795. this.CLASS_NAME = "SuperMap.FacilityAnalystSinks3DService";
  19796. }
  19797. /**
  19798. * @function SuperMap.FacilityAnalystSinks3DService.prototype.destroy
  19799. * @override
  19800. */
  19801. destroy() {
  19802. CommonServiceBase.prototype.destroy.apply(this, arguments);
  19803. }
  19804. /**
  19805. * @function SuperMap.FacilityAnalystSinks3DService.prototype.processAsync
  19806. * @description 负责将客户端的查询参数传递到服务端。
  19807. * @param {SuperMap.FacilityAnalystSinks3DParameters} params - 最近设施分析参数类(汇查找资源)
  19808. */
  19809. processAsync(params) {
  19810. if (!(params instanceof FacilityAnalystSinks3DParameters)) {
  19811. return;
  19812. }
  19813. var me = this, jsonObject;
  19814. me.url = Util.urlPathAppend(me.url, 'sinks');
  19815. jsonObject = {
  19816. edgeID: params.edgeID,
  19817. nodeID: params.nodeID,
  19818. weightName: params.weightName,
  19819. isUncertainDirectionValid: params.isUncertainDirectionValid
  19820. };
  19821. me.request({
  19822. method: "GET",
  19823. params: jsonObject,
  19824. scope: me,
  19825. success: me.serviceProcessCompleted,
  19826. failure: me.serviceProcessFailed
  19827. });
  19828. }
  19829. }
  19830. SuperMap.FacilityAnalystSinks3DService = FacilityAnalystSinks3DService;
  19831. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DParameters.js
  19832. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19833. * This program are made available under the terms of the Apache License, Version 2.0
  19834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19835. /**
  19836. * @class SuperMap.FacilityAnalystSources3DParameters
  19837. * @category iServer FacilityAnalyst3D Sources
  19838. * @classdesc 最近设施分析参数类(源查找资源)。最近设施分析是指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19839. * 设施点一般为学校、超市、加油站等服务设施;事件点为需要服务设施的事件位置。例如事件发生点是一起交通事故,要求查找在10分钟内能到达的最近医院,超过10分
  19840. * 钟能到达的都不予考虑。此例中,事故发生地即是一个事件点,周边的医院则是设施点。最近设施查找实际上也是一种路径分析,因此对路径分析起作用的障碍边、障碍
  19841. * 点、转向表、耗费等属性在最近设施分析时同样可设置。
  19842. * @extends {SuperMap.FacilityAnalyst3DParameters}
  19843. * @param {Object} options - 参数。
  19844. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  19845. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19846. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19847. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19848. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19849. */
  19850. class FacilityAnalystSources3DParameters extends FacilityAnalyst3DParameters {
  19851. constructor(options) {
  19852. super(options);
  19853. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DParameters";
  19854. }
  19855. /**
  19856. * @function SuperMap.FacilityAnalystSources3DParameters.prototype.destroy
  19857. * @override
  19858. */
  19859. destroy() {
  19860. super.destroy();
  19861. }
  19862. }
  19863. SuperMap.FacilityAnalystSources3DParameters = FacilityAnalystSources3DParameters;
  19864. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystSources3DService.js
  19865. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19866. * This program are made available under the terms of the Apache License, Version 2.0
  19867. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19868. /**
  19869. * @class SuperMap.FacilityAnalystSources3DService
  19870. * @category iServer FacilityAnalyst3D Sources
  19871. * @classdesc 最近设施分析服务类(源查找资源)
  19872. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  19873. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  19874. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  19875. * 最近设施分析结果通过该类支持的事件的监听函数参数获取。
  19876. * @extends {SuperMap.CommonServiceBase}
  19877. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19878. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19879. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  19880. * @param {Object} options - 参数。
  19881. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19882. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19883. * @param {Object} [options.headers] - 请求头。
  19884. */
  19885. class FacilityAnalystSources3DService extends CommonServiceBase {
  19886. constructor(url, options) {
  19887. super(url, options);
  19888. this.CLASS_NAME = "SuperMap.FacilityAnalystSources3DService";
  19889. }
  19890. /**
  19891. * @function SuperMap.FacilityAnalystSources3DService.prototype.destroy
  19892. * @override
  19893. */
  19894. destroy() {
  19895. super.destroy();
  19896. }
  19897. /**
  19898. * @function SuperMap.FacilityAnalystSources3DService.prototype.processAsync
  19899. * @description 负责将客户端的查询参数传递到服务端。
  19900. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找资源)
  19901. */
  19902. processAsync(params) {
  19903. if (!(params instanceof FacilityAnalystSources3DParameters)) {
  19904. return;
  19905. }
  19906. var me = this, jsonObject;
  19907. me.url = Util.urlPathAppend(me.url, 'sources');
  19908. jsonObject = {
  19909. edgeID: params.edgeID,
  19910. nodeID: params.nodeID,
  19911. weightName: params.weightName,
  19912. isUncertainDirectionValid: params.isUncertainDirectionValid
  19913. };
  19914. me.request({
  19915. method: "GET",
  19916. params: jsonObject,
  19917. scope: me,
  19918. success: me.serviceProcessCompleted,
  19919. failure: me.serviceProcessFailed
  19920. });
  19921. }
  19922. }
  19923. SuperMap.FacilityAnalystSources3DService = FacilityAnalystSources3DService;
  19924. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamParameters.js
  19925. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19926. * This program are made available under the terms of the Apache License, Version 2.0
  19927. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19928. /**
  19929. * @class SuperMap.FacilityAnalystStreamParameters
  19930. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  19931. * @classdesc 上游/下游关键设施查找资源参数类。
  19932. * @param {Object} options - 参数。
  19933. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  19934. * @param {number} options.queryType - 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  19935. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19936. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19937. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。
  19938. */
  19939. class FacilityAnalystStreamParameters {
  19940. constructor(options) {
  19941. /**
  19942. * @member {Array.<number>} [SuperMap.FacilityAnalystStreamParameters.prototype.sourceNodeIDs]
  19943. * @description 指定的设施点 ID 数组。
  19944. */
  19945. this.sourceNodeIDs = null;
  19946. /**
  19947. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.edgeID]
  19948. * @description 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  19949. */
  19950. this.edgeID = null;
  19951. /**
  19952. * @member {number} [SuperMap.FacilityAnalystStreamParameters.prototype.nodeID]
  19953. * @description 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  19954. */
  19955. this.nodeID = null;
  19956. /**
  19957. * @member {boolean} [SuperMap.FacilityAnalystStreamParameters.prototype.isUncertainDirectionValid=false]
  19958. * @description 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  19959. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  19960. */
  19961. this.isUncertainDirectionValid = false;
  19962. /**
  19963. * @member {number} SuperMap.FacilityAnalystStreamParameters.prototype.queryType
  19964. * @description 分析类型,只能是 0 (上游关键设施查询) 或者是 1(下游关键设施查询)。
  19965. */
  19966. this.queryType = null;
  19967. Util.extend(this, options);
  19968. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamParameters";
  19969. }
  19970. /**
  19971. * @function SuperMap.FacilityAnalystStreamParameters.prototype.destroy
  19972. * @description 释放资源,将引用资源的属性置空。
  19973. */
  19974. destroy() {
  19975. var me = this;
  19976. me.edgeID = null;
  19977. me.nodeID = null;
  19978. me.weightName = null;
  19979. me.isUncertainDirectionValid = null;
  19980. me.type = null;
  19981. }
  19982. }
  19983. SuperMap.FacilityAnalystStreamParameters = FacilityAnalystStreamParameters;
  19984. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystStreamService.js
  19985. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  19986. * This program are made available under the terms of the Apache License, Version 2.0
  19987. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  19988. /**
  19989. * @class SuperMap.FacilityAnalystStreamService
  19990. * @category iServer NetworkAnalyst UpstreamCriticalFacilities
  19991. * @classdesc 上游/下游 关键设施查找资源服务类;即查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  19992. * @extends SuperMap.NetworkAnalystServiceBase
  19993. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  19994. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  19995. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet";
  19996. * @param {Object} options - 参数。
  19997. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  19998. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  19999. * @param {Object} [options.headers] - 请求头。
  20000. */
  20001. class FacilityAnalystStreamService extends NetworkAnalystServiceBase {
  20002. constructor(url, options) {
  20003. super(url, options);
  20004. this.CLASS_NAME = "SuperMap.FacilityAnalystStreamService";
  20005. }
  20006. /**
  20007. * @function SuperMap.FacilityAnalystStreamService.prototype.destroy
  20008. * @override
  20009. */
  20010. destroy() {
  20011. super.destroy();
  20012. }
  20013. /**
  20014. * @function SuperMap.FacilityAnalystStreamService.prototype.processAsync
  20015. * @description 负责将客户端的查询参数传递到服务端。
  20016. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游关键设施查找资源参数类。
  20017. */
  20018. processAsync(params) {
  20019. if (!(params instanceof FacilityAnalystStreamParameters)) {
  20020. return;
  20021. }
  20022. var me = this,
  20023. jsonObject;
  20024. //URL 通过参数类型来判断是 上游 还是下游 查询
  20025. if (params.queryType === 0) {
  20026. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  20027. } else if (params.queryType === 1) {
  20028. me.url = Util.urlPathAppend(me.url, 'downstreamcirticalfaclilities');
  20029. } else {
  20030. return;
  20031. }
  20032. jsonObject = {
  20033. sourceNodeIDs: params.sourceNodeIDs,
  20034. isUncertainDirectionValid: params.isUncertainDirectionValid
  20035. };
  20036. if (params.edgeID !== null && params.nodeID !== null) {
  20037. return;
  20038. }
  20039. if (params.edgeID === null && params.nodeID === null) {
  20040. return;
  20041. }
  20042. if (params.edgeID !== null) {
  20043. jsonObject.edgeID = params.edgeID;
  20044. } else {
  20045. jsonObject.nodeID = params.nodeID;
  20046. }
  20047. me.request({
  20048. method: "GET",
  20049. params: jsonObject,
  20050. scope: me,
  20051. success: me.serviceProcessCompleted,
  20052. failure: me.serviceProcessFailed
  20053. });
  20054. }
  20055. }
  20056. SuperMap.FacilityAnalystStreamService = FacilityAnalystStreamService;
  20057. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DParameters.js
  20058. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20059. * This program are made available under the terms of the Apache License, Version 2.0
  20060. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20061. /**
  20062. * @class SuperMap.FacilityAnalystTracedown3DParameters
  20063. * @category iServer FacilityAnalyst3D TraceDownResult
  20064. * @classdesc 下游追踪资源参数类。
  20065. * @extends {SuperMap.FacilityAnalyst3DParameters}
  20066. * @param {Object} options - 参数。
  20067. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  20068. * @param {number} [options.edgeID] - 指定的弧段 ID,edgeID 与 nodeID 必须指定一个。
  20069. * @param {number} [options.nodeID] - 指定的结点 ID,edgeID 与 nodeID 必须指定一个。
  20070. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  20071. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  20072. */
  20073. class FacilityAnalystTracedown3DParameters extends FacilityAnalyst3DParameters {
  20074. constructor(options) {
  20075. super(options);
  20076. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DParameters";
  20077. }
  20078. /**
  20079. * @function SuperMap.FacilityAnalystTracedown3DParameters.prototype.destroy
  20080. * @override
  20081. */
  20082. destroy() {
  20083. super.destroy();
  20084. }
  20085. }
  20086. SuperMap.FacilityAnalystTracedown3DParameters = FacilityAnalystTracedown3DParameters;
  20087. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTracedown3DService.js
  20088. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20089. * This program are made available under the terms of the Apache License, Version 2.0
  20090. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20091. /**
  20092. * @class SuperMap.FacilityAnalystTracedown3DService
  20093. * @category iServer FacilityAnalyst3D TraceDownResult
  20094. * @classdesc 下游追踪资源服务类
  20095. * @extends {SuperMap.CommonServiceBase}
  20096. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20097. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20098. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20099. * @param {Object} options - 参数。
  20100. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20101. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20102. * @param {Object} [options.headers] - 请求头。
  20103. */
  20104. class FacilityAnalystTracedown3DService extends CommonServiceBase {
  20105. constructor(url, options) {
  20106. super(url, options);
  20107. this.CLASS_NAME = "SuperMap.FacilityAnalystTracedown3DService";
  20108. }
  20109. /**
  20110. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.destroy
  20111. * @override
  20112. */
  20113. destroy() {
  20114. super.destroy();
  20115. }
  20116. /**
  20117. * @function SuperMap.FacilityAnalystTracedown3DService.prototype.processAsync
  20118. * @description 负责将客户端的查询参数传递到服务端。
  20119. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源参数类。
  20120. */
  20121. processAsync(params) {
  20122. if (!(params instanceof FacilityAnalystTracedown3DParameters)) {
  20123. return;
  20124. }
  20125. var me = this, jsonObject;
  20126. me.url = Util.urlPathAppend(me.url, 'tracedownresult');
  20127. jsonObject = {
  20128. edgeID: params.edgeID,
  20129. nodeID: params.nodeID,
  20130. weightName: params.weightName,
  20131. isUncertainDirectionValid: params.isUncertainDirectionValid
  20132. };
  20133. me.request({
  20134. method: "GET",
  20135. params: jsonObject,
  20136. scope: me,
  20137. success: me.serviceProcessCompleted,
  20138. failure: me.serviceProcessFailed
  20139. });
  20140. }
  20141. }
  20142. SuperMap.FacilityAnalystTracedown3DService = FacilityAnalystTracedown3DService;
  20143. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DParameters.js
  20144. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20145. * This program are made available under the terms of the Apache License, Version 2.0
  20146. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20147. /**
  20148. * @class SuperMap.FacilityAnalystTraceup3DParameters
  20149. * @category iServer FacilityAnalyst3D TraceUpResult
  20150. * @classdesc 上游追踪资源参数类。
  20151. * @extends {SuperMap.FacilityAnalyst3DParameters}
  20152. * @param {Object} options - 参数。
  20153. * @param {string} options.weightName - 指定的权值字段信息对象的名称。
  20154. * @param {number} [options.edgeID] - 指定的弧段ID,edgeID 与 nodeID 必须指定一个。
  20155. * @param {number} [options.nodeID] - 指定的结点ID,edgeID 与 nodeID 必须指定一个。
  20156. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  20157. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  20158. */
  20159. class FacilityAnalystTraceup3DParameters extends FacilityAnalyst3DParameters {
  20160. constructor(options) {
  20161. super(options);
  20162. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DParameters";
  20163. }
  20164. /**
  20165. * @function SuperMap.FacilityAnalystTraceup3DParameters.prototype.destroy
  20166. * @override
  20167. */
  20168. destroy() {
  20169. super.destroy();
  20170. }
  20171. }
  20172. SuperMap.FacilityAnalystTraceup3DParameters = FacilityAnalystTraceup3DParameters;
  20173. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystTraceup3DService.js
  20174. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20175. * This program are made available under the terms of the Apache License, Version 2.0
  20176. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20177. /**
  20178. * @class SuperMap.FacilityAnalystTraceup3DService
  20179. * @category iServer FacilityAnalyst3D TraceUpResult
  20180. * @classdesc 上游追踪资源服务类
  20181. * @extends {SuperMap.CommonServiceBase}
  20182. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20183. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20184. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20185. * @param {Object} options - 参数。
  20186. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20187. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20188. * @param {Object} [options.headers] - 请求头。
  20189. */
  20190. class FacilityAnalystTraceup3DService extends CommonServiceBase {
  20191. /**
  20192. * @function SuperMap.FacilityAnalystTraceup3DService.constructor
  20193. * @description 上游追踪资源服务类构造函数。
  20194. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20195. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20196. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20197. * @param {Object} options - 参数。
  20198. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20199. */
  20200. constructor(url, options) {
  20201. super(url, options);
  20202. this.CLASS_NAME = "SuperMap.FacilityAnalystTraceup3DService";
  20203. }
  20204. /**
  20205. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.destroy
  20206. * @override
  20207. */
  20208. destroy() {
  20209. super.destroy();
  20210. }
  20211. /**
  20212. * @function SuperMap.FacilityAnalystTraceup3DService.prototype.processAsync
  20213. * @description 负责将客户端的查询参数传递到服务端。
  20214. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类
  20215. */
  20216. processAsync(params) {
  20217. if (!(params instanceof FacilityAnalystTraceup3DParameters)) {
  20218. return;
  20219. }
  20220. var me = this, jsonObject;
  20221. me.url = Util.urlPathAppend(me.url, 'traceupresult');
  20222. jsonObject = {
  20223. edgeID: params.edgeID,
  20224. nodeID: params.nodeID,
  20225. weightName: params.weightName,
  20226. isUncertainDirectionValid: params.isUncertainDirectionValid
  20227. };
  20228. me.request({
  20229. method: "GET",
  20230. params: jsonObject,
  20231. scope: me,
  20232. success: me.serviceProcessCompleted,
  20233. failure: me.serviceProcessFailed
  20234. });
  20235. }
  20236. }
  20237. SuperMap.FacilityAnalystTraceup3DService = FacilityAnalystTraceup3DService;
  20238. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DParameters.js
  20239. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20240. * This program are made available under the terms of the Apache License, Version 2.0
  20241. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20242. /**
  20243. * @class SuperMap.FacilityAnalystUpstream3DParameters
  20244. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  20245. * @classdesc 上游关键设施查找资源参数类。
  20246. * @extends {SuperMap.FacilityAnalyst3DParameters}
  20247. * @param {Object} options - 参数。
  20248. * @param {Array.<number>} options.sourceNodeIDs - 指定的设施点 ID 数组。
  20249. * @param {number} [options.edgeID] - 指定的弧段ID。edgeID 与 nodeID 必须指定一个。
  20250. * @param {number} [options.nodeID] - 指定的结点ID。edgeID 与 edgeID 必须指定一个。
  20251. * @param {boolean} [options.isUncertainDirectionValid=false] - 指定不确定流向是否有效。指定为 true,表示不确定流向有效,遇到不确定流向时分析继续进行;
  20252. * 指定为 false,表示不确定流向无效,遇到不确定流向将停止在该方向上继续查找。
  20253. */
  20254. class FacilityAnalystUpstream3DParameters extends FacilityAnalyst3DParameters {
  20255. constructor(options) {
  20256. super(options);
  20257. options = options || {};
  20258. this.sourceNodeIDs = null;
  20259. Util.extend(this, options);
  20260. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DParameters";
  20261. }
  20262. /**
  20263. * @function SuperMap.FacilityAnalystUpstream3DParameters.prototype.destroy
  20264. * @override
  20265. */
  20266. destroy() {
  20267. super.destroy();
  20268. this.sourceNodeIDs = null;
  20269. }
  20270. }
  20271. SuperMap.FacilityAnalystUpstream3DParameters = FacilityAnalystUpstream3DParameters;
  20272. ;// CONCATENATED MODULE: ./src/common/iServer/FacilityAnalystUpstream3DService.js
  20273. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20274. * This program are made available under the terms of the Apache License, Version 2.0
  20275. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20276. /**
  20277. * @class SuperMap.FacilityAnalystUpstream3DService
  20278. * @category iServer FacilityAnalyst3D UpstreamCriticalFacilities
  20279. * @classdesc 上游关键设施查找资源服务类
  20280. * @extends {SuperMap.CommonServiceBase}
  20281. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20282. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20283. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20284. * @param {Object} options - 参数。
  20285. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20286. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20287. * @param {Object} [options.headers] - 请求头。
  20288. */
  20289. class FacilityAnalystUpstream3DService extends CommonServiceBase {
  20290. constructor(url, options) {
  20291. super(url, options);
  20292. this.CLASS_NAME = "SuperMap.FacilityAnalystUpstream3DService";
  20293. }
  20294. /**
  20295. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.destroy
  20296. * @override
  20297. */
  20298. destroy() {
  20299. super.destroy();
  20300. }
  20301. /**
  20302. * @function SuperMap.FacilityAnalystUpstream3DService.prototype.processAsync
  20303. * @description 负责将客户端的查询参数传递到服务端。
  20304. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找资源参数类
  20305. */
  20306. processAsync(params) {
  20307. if (!(params instanceof FacilityAnalystUpstream3DParameters)) {
  20308. return;
  20309. }
  20310. var me = this, jsonObject;
  20311. me.url = Util.urlPathAppend(me.url, 'upstreamcirticalfaclilities');
  20312. jsonObject = {
  20313. sourceNodeIDs: params.sourceNodeIDs,
  20314. edgeID: params.edgeID,
  20315. nodeID: params.nodeID,
  20316. isUncertainDirectionValid: params.isUncertainDirectionValid
  20317. };
  20318. me.request({
  20319. method: "GET",
  20320. params: jsonObject,
  20321. scope: me,
  20322. success: me.serviceProcessCompleted,
  20323. failure: me.serviceProcessFailed
  20324. });
  20325. }
  20326. }
  20327. SuperMap.FacilityAnalystUpstream3DService = FacilityAnalystUpstream3DService;
  20328. ;// CONCATENATED MODULE: ./src/common/iServer/FilterAggParameter.js
  20329. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20330. * This program are made available under the terms of the Apache License, Version 2.0
  20331. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20332. /**
  20333. * @class SuperMap.FilterAggParameter
  20334. * @classdesc 过滤条件参数设置,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  20335. * @category iServer Data FeatureResults
  20336. * @param {Object} options - 初始化参数。
  20337. * @param {SuperMap.AggQueryBuilderParameter} options.filterParam - 过滤条件参数设置类。
  20338. * @param {SuperMap.AggregationType} [options.aggType=AggregationType.FILTER] - 聚合类型。
  20339. */
  20340. class FilterAggParameter extends AggregationParameter {
  20341. constructor(options) {
  20342. super(options);
  20343. /**
  20344. * @member {SuperMap.AggQueryBuilderParameter} SuperMap.FilterAggParameter.prototype.filterParam
  20345. * @description 过滤条件参数设置类。
  20346. */
  20347. this.filterParam = null;
  20348. /**
  20349. * @member {SuperMap.AggregationType} [SuperMap.FilterAggParameter.prototype.aggType=AggregationType.FILTER]
  20350. * @description 聚合类型。
  20351. */
  20352. this.aggType = AggregationType.FILTER;
  20353. this.CLASS_NAME = "SuperMap.FilterAggParameter";
  20354. Util.extend(this, options);
  20355. }
  20356. destroy() {
  20357. super.destroy();
  20358. var me = this;
  20359. if (me.filterParam) {
  20360. me.filterParam = null;
  20361. }
  20362. }
  20363. }
  20364. SuperMap.FilterAggParameter = FilterAggParameter;
  20365. ;// CONCATENATED MODULE: ./src/common/iServer/FieldParameters.js
  20366. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20367. * This program are made available under the terms of the Apache License, Version 2.0
  20368. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20369. /**
  20370. * @class SuperMap.FieldParameters
  20371. * @category iServer Data Field
  20372. * @classdesc 字段信息查询参数类。
  20373. * @param {Object} options - 参数。
  20374. * @param {string} options.datasource - 数据源名称。
  20375. * @param {string} options.dataset - 数据集名称。
  20376. */
  20377. class FieldParameters {
  20378. constructor(options) {
  20379. /**
  20380. * @member {string} SuperMap.FieldParameters.prototype.datasource
  20381. * @description 要查询的数据集所在的数据源名称。
  20382. */
  20383. this.datasource = null;
  20384. /**
  20385. * @member {string} SuperMap.FieldParameters.prototype.dataset
  20386. * @description 要查询的数据集名称。
  20387. */
  20388. this.dataset = null;
  20389. if (options) {
  20390. Util.extend(this, options);
  20391. }
  20392. this.CLASS_NAME = "SuperMap.FieldParameters";
  20393. }
  20394. /**
  20395. * @function SuperMap.FieldParameters.prototype.destroy
  20396. * @description 释放资源,将引用资源的属性置空。
  20397. */
  20398. destroy() {
  20399. var me = this;
  20400. me.datasource = null;
  20401. me.dataset = null;
  20402. }
  20403. }
  20404. SuperMap.FieldParameters = FieldParameters;
  20405. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticsParameters.js
  20406. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20407. * This program are made available under the terms of the Apache License, Version 2.0
  20408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20409. /**
  20410. * @class SuperMap.FieldStatisticsParameters
  20411. * @category iServer Data Field
  20412. * @classdesc 字段统计信息查询参数类。
  20413. * @param {Object} options - 参数。
  20414. * @param {string} options.datasource - 数据源名称。
  20415. * @param {string} options.dataset - 数据集名称。
  20416. * @param {string} options.fieldName - 字段名。
  20417. * @param {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} statisticMode - 字段统计方法类型。
  20418. * @extends {SuperMap.FieldParameters}
  20419. */
  20420. class FieldStatisticsParameters extends FieldParameters {
  20421. constructor(options) {
  20422. super(options);
  20423. /**
  20424. * @member {string} SuperMap.FieldStatisticsParameters.prototype.fieldName
  20425. * @description 字段名
  20426. */
  20427. this.fieldName = null;
  20428. /**
  20429. * @member {(string.<SuperMap.StatisticMode>|Array.<string.<SuperMap.StatisticMode>>)} SuperMap.FieldStatisticsParameters.prototype.statisticMode
  20430. * @description 字段统计方法类型
  20431. */
  20432. this.statisticMode = null;
  20433. if (options) {
  20434. Util.extend(this, options);
  20435. }
  20436. this.CLASS_NAME = "SuperMap.FieldStatisticsParameters";
  20437. }
  20438. /**
  20439. * @function SuperMap.FieldStatisticsParameters.prototype.destroy
  20440. * @description 释放资源,将引用资源的属性置空。
  20441. */
  20442. destroy() {
  20443. var me = this;
  20444. me.fieldName = null;
  20445. me.statisticMode = null;
  20446. }
  20447. }
  20448. SuperMap.FieldStatisticsParameters = FieldStatisticsParameters;
  20449. ;// CONCATENATED MODULE: ./src/common/iServer/FieldStatisticService.js
  20450. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20451. * This program are made available under the terms of the Apache License, Version 2.0
  20452. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20453. /**
  20454. * @class SuperMap.FieldStatisticService
  20455. * @category iServer Data Field
  20456. * @classdesc 字段查询统计服务类。用来完成对指定数据集指定字段的查询统计分析,即求平均值,最大值等。
  20457. * @extends {SuperMap.CommonServiceBase}
  20458. * @param {string} url - 服务的访问地址。如访问 World Map 服务,只需将 url 设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  20459. * @param {Object} options - 参数。
  20460. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  20461. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  20462. * @param {SuperMap.DataFormat} [options.format] - 查询结果返回格式,目前支持 iServerJSON 和GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  20463. * @param {string} options.datasource - 数据集所在的数据源名称。
  20464. * @param {string} options.dataset - 数据集名称。
  20465. * @param {string} options.field - 查询统计的目标字段名称。
  20466. * @param {SuperMap.StatisticMode} options.statisticMode - 字段查询统计的方法类型。
  20467. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20468. * @param {Object} [options.headers] - 请求头。
  20469. * @example
  20470. * var myService = new SuperMap.FieldStatisticService(url, {eventListeners: {
  20471. * "processCompleted": fieldStatisticCompleted,
  20472. * "processFailed": fieldStatisticError
  20473. * },
  20474. * datasource: "World",
  20475. * dataset: "Countries",
  20476. * field: "SmID",
  20477. * statisticMode: StatisticMode.AVERAGE
  20478. * };
  20479. */
  20480. class FieldStatisticService extends CommonServiceBase {
  20481. constructor(url, options) {
  20482. super(url, options);
  20483. /**
  20484. * @member {string} SuperMap.FieldStatisticService.prototype.datasource
  20485. * @description 数据集所在的数据源名称。
  20486. */
  20487. this.datasource = null;
  20488. /**
  20489. * @member {string} SuperMap.FieldStatisticService.prototype.dataset
  20490. * @description 数据集名称。
  20491. */
  20492. this.dataset = null;
  20493. /**
  20494. * @member {string} SuperMap.FieldStatisticService.prototype.field
  20495. * @description 查询统计的目标字段名称。
  20496. */
  20497. this.field = null;
  20498. /**
  20499. * @member {SuperMap.StatisticMode} SuperMap.FieldStatisticService.prototype.statisticMode
  20500. * @description 字段查询统计的方法类型。
  20501. */
  20502. this.statisticMode = null;
  20503. if (options) {
  20504. Util.extend(this, options);
  20505. }
  20506. this.CLASS_NAME = "SuperMap.FieldStatisticService";
  20507. }
  20508. /**
  20509. * @function SuperMap.FieldStatisticService.prototype.destroy
  20510. * @override
  20511. */
  20512. destroy() {
  20513. super.destroy();
  20514. var me = this;
  20515. me.datasource = null;
  20516. me.dataset = null;
  20517. me.field = null;
  20518. me.statisticMode = null;
  20519. }
  20520. /**
  20521. * @function SuperMap.FieldStatisticService.prototype.processAsync
  20522. * @description 执行服务,进行指定字段的查询统计。
  20523. */
  20524. processAsync() {
  20525. var me = this,
  20526. fieldStatisticURL = "datasources/" + me.datasource + "/datasets/" + me.dataset + "/fields/" + me.field + "/" + me.statisticMode;
  20527. me.url = Util.urlPathAppend(me.url, fieldStatisticURL);
  20528. me.request({
  20529. method: "GET",
  20530. data: null,
  20531. scope: me,
  20532. success: me.serviceProcessCompleted,
  20533. failure: me.serviceProcessFailed
  20534. });
  20535. }
  20536. }
  20537. SuperMap.FieldStatisticService = FieldStatisticService;
  20538. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesParameters.js
  20539. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20540. * This program are made available under the terms of the Apache License, Version 2.0
  20541. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20542. /**
  20543. * @class SuperMap.FindClosestFacilitiesParameters
  20544. * @category iServer NetworkAnalyst ClosestFacility
  20545. * @classdesc 最近设施分析参数类。
  20546. * @param {Object} options - 参数。
  20547. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} options.event - 事件点,一般为需要获得服务设施服务的事件位置。
  20548. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.facilities - 设施点集合,一般为提供服务的服务设施位置。
  20549. * @param {number} [options.expectFacilityCount=1] - 要查找的设施点数量。
  20550. * @param {boolean} [options.fromEvent=false] - 是否从事件点到设施点进行查找。
  20551. * @param {boolean} [options.isAnalyzeById=false] - 事件点和设施点是否通过节点 ID 号来指定。
  20552. * @param {number} [options.maxWeight=0] - 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  20553. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20554. */
  20555. class FindClosestFacilitiesParameters {
  20556. constructor(options) {
  20557. /**
  20558. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)} SuperMap.FindClosestFacilitiesParameters.prototype.event
  20559. * @description 事件点,一般为需要获得服务设施服务的事件位置。
  20560. * 可以通过两种方式赋予事件点:当该类中字段 isAnalyzeById = true 时,应输入事件点 ID 号;当 isAnalyzeById = false 时,应输入事件点坐标。
  20561. */
  20562. this.event = null;
  20563. /**
  20564. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.expectFacilityCount=1]
  20565. * @description 要查找的设施点数量。
  20566. */
  20567. this.expectFacilityCount = 1;
  20568. /**
  20569. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} [SuperMap.FindClosestFacilitiesParameters.prototype.facilities=false]
  20570. * @description 设施点集合,一般为提供服务的服务设施位置。
  20571. * 可以通过两种方式赋予设施点:当该类中字段 isAnalyzeById = true 时,应输入设施点 ID 号;当 isAnalyzeById = false 时,应输入设施点坐标。
  20572. */
  20573. this.facilities = null;
  20574. /**
  20575. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.fromEvent=false]
  20576. * @description 是否从事件点到设施点进行查找。最近设施分析主要是通过设施点和事件点之间最优的路线来分析在一定范围内哪个或哪些设施与事件点有最优路线的关系。
  20577. * 这个行走线路是通过网络图层进行网络分析算法计算出来的两点间的最优路线。由于存在从 A 点到 B 点与从 B 点到 A 点的耗费不一样的情况,因此起止点
  20578. * 不同可能会得到不同的最优路线。因此在进行最近设施分析之前,需要设置获取的最优路线的方向,即是以事件点作为起点到最近设施点的方向分析,还是以最
  20579. * 近设施点为起点到事件点的方向分析。如果需要以事件点作为起点到设施点方向进行查找,设置该字段值为 true;设置为 false,表示从设施点到事件点进行查找。
  20580. */
  20581. this.fromEvent = false;
  20582. /**
  20583. * @member {boolean} [SuperMap.FindClosestFacilitiesParameters.prototype.isAnalyzeById=false]
  20584. * @description 事件点和设施点是否通过节点 ID 号来指定,设置为 false,表示通过坐标点指定事件点和设施点。
  20585. */
  20586. this.isAnalyzeById = false;
  20587. /**
  20588. * @member {number} [SuperMap.FindClosestFacilitiesParameters.prototype.maxWeight=0]
  20589. * @description 查找半径。单位与该类中 parameter 字段(交通网络分析通用参数)中设置的耗费字段一致。
  20590. * 例如事件发生点是一起交通事故,要求查找在 10 分钟内能到达的最近医院,超过 10 分钟能到达的都不予考虑。
  20591. * 那么需要将网络分析参数中 parameter.weightFieldName 设置为表示时间的字段,然后设置查找范围的半径值为10。
  20592. */
  20593. this.maxWeight = 0;
  20594. /**
  20595. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindClosestFacilitiesParameters.prototype.parameter]
  20596. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  20597. * 它为 SuperMap.TransportationAnalystParameter 类型,虽然为可选参数,但是如果不设置其中的 resultSetting 字段,
  20598. * 则返回结果空间信息等都为空。
  20599. */
  20600. this.parameter = new TransportationAnalystParameter();
  20601. Util.extend(this, options);
  20602. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesParameters";
  20603. }
  20604. /**
  20605. * @function SuperMap.FindClosestFacilitiesParameters.prototype.destroy
  20606. * @description 释放资源,将引用资源的属性置空。
  20607. */
  20608. destroy() {
  20609. var me = this;
  20610. me.event = null;
  20611. me.expectFacilityCount = null;
  20612. me.facilities = null;
  20613. me.fromEvent = null;
  20614. me.isAnalyzeById = null;
  20615. me.maxWeight = null;
  20616. if (me.parameter) {
  20617. me.parameter.destroy();
  20618. me.parameter = null;
  20619. }
  20620. }
  20621. }
  20622. SuperMap.FindClosestFacilitiesParameters = FindClosestFacilitiesParameters;
  20623. ;// CONCATENATED MODULE: ./src/common/iServer/FindClosestFacilitiesService.js
  20624. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20625. * This program are made available under the terms of the Apache License, Version 2.0
  20626. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20627. /**
  20628. * @class SuperMap.FindClosestFacilitiesService
  20629. * @category iServer NetworkAnalyst ClosestFacility
  20630. * @classdesc 最近设施分析服务类。
  20631. * 最近设施分析是指在网络上给定一个事件点和一组设施点,
  20632. * 查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  20633. * 该类负责将客户端指定的最近设施分析参数传递给服务端,并接收服务端返回的结果数据。
  20634. * 最近设施分析结果通过该类支持的事件的监听函数参数获取
  20635. * @extends {SuperMap.NetworkAnalystServiceBase}
  20636. * @example
  20637. * var myfindClosestFacilitiesService = new SuperMap.FindClosestFacilitiesService(url, {
  20638. * eventListeners: {
  20639. * "processCompleted": findClosestFacilitiesCompleted,
  20640. * "processFailed": findClosestFacilitiesError
  20641. * }
  20642. * });
  20643. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20644. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20645. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20646. * @param {Object} options - 参数。
  20647. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20648. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20649. * @param {Object} [options.headers] - 请求头。
  20650. */
  20651. class FindClosestFacilitiesService extends NetworkAnalystServiceBase {
  20652. /*
  20653. * @function SuperMap.FindClosestFacilitiesService.prototype.constructor
  20654. * @description 最近设施分析服务类构造函数。
  20655. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  20656. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  20657. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  20658. * @param {Object} options - 选参数。<br>
  20659. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20660. */
  20661. constructor(url, options) {
  20662. super(url, options);
  20663. this.CLASS_NAME = "SuperMap.FindClosestFacilitiesService";
  20664. }
  20665. /**
  20666. * @function SuperMap.FindClosestFacilitiesService.prototype.destroy
  20667. * @override
  20668. */
  20669. destroy() {
  20670. super.destroy();
  20671. }
  20672. /**
  20673. * @function SuperMap.FindClosestFacilitiesService.prototype.processAsync
  20674. * @description 负责将客户端的查询参数传递到服务端。
  20675. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类
  20676. */
  20677. processAsync(params) {
  20678. if (!(params instanceof FindClosestFacilitiesParameters)) {
  20679. return;
  20680. }
  20681. var me = this,
  20682. jsonObject;
  20683. me.url = Util.urlPathAppend(me.url, 'closestfacility');
  20684. jsonObject = {
  20685. expectFacilityCount: params.expectFacilityCount,
  20686. fromEvent: params.fromEvent,
  20687. maxWeight: params.maxWeight,
  20688. parameter: Util.toJSON(params.parameter),
  20689. event: Util.toJSON(params.event),
  20690. facilities: me.getJson(params.isAnalyzeById, params.facilities)
  20691. };
  20692. me.request({
  20693. method: "GET",
  20694. params: jsonObject,
  20695. scope: me,
  20696. success: me.serviceProcessCompleted,
  20697. failure: me.serviceProcessFailed
  20698. });
  20699. }
  20700. /**
  20701. * @function SuperMap.FindClosestFacilitiesService.prototype.getJson
  20702. * @description 将对象转化为JSON字符串。
  20703. * @param {boolean} isAnalyzeById - 是否通过ID来分析
  20704. * @param {Array} params - 分析参数数组
  20705. * @returns {Object} 转化后的JSON字符串。
  20706. */
  20707. getJson(isAnalyzeById, params) {
  20708. var jsonString = "[",
  20709. len = params ? params.length : 0;
  20710. if (isAnalyzeById === false) {
  20711. for (let i = 0; i < len; i++) {
  20712. if (i > 0) {
  20713. jsonString += ",";
  20714. }
  20715. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  20716. }
  20717. } else if (isAnalyzeById === true) {
  20718. for (let i = 0; i < len; i++) {
  20719. if (i > 0) {
  20720. jsonString += ",";
  20721. }
  20722. jsonString += params[i];
  20723. }
  20724. }
  20725. jsonString += ']';
  20726. return jsonString;
  20727. }
  20728. /**
  20729. * @function SuperMap.FindClosestFacilitiesService.prototype.toGeoJSONResult
  20730. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20731. * @param {Object} result - 服务器返回的结果对象。
  20732. */
  20733. toGeoJSONResult(result) {
  20734. if (!result || !result.facilityPathList) {
  20735. return result;
  20736. }
  20737. var geoJSONFormat = new GeoJSON();
  20738. result.facilityPathList.map(function (path) {
  20739. if (path.route) {
  20740. path.route = geoJSONFormat.toGeoJSON(path.route);
  20741. }
  20742. if (path.pathGuideItems) {
  20743. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  20744. }
  20745. if (path.edgeFeatures) {
  20746. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  20747. }
  20748. if (path.nodeFeatures) {
  20749. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  20750. }
  20751. return path;
  20752. });
  20753. return result;
  20754. }
  20755. }
  20756. SuperMap.FindClosestFacilitiesService = FindClosestFacilitiesService;
  20757. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationParameters.js
  20758. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20759. * This program are made available under the terms of the Apache License, Version 2.0
  20760. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20761. /**
  20762. * @class SuperMap.FindLocationParameters
  20763. * @category iServer NetworkAnalyst Location
  20764. * @classdesc 选址分区分析参数类。
  20765. * @param {Object} options - 参数。
  20766. * @param {string} options.turnWeightField - 转向权值字段的名称。
  20767. * @param {string} options.weightName - 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  20768. * @param {Array.<SuperMap.SupplyCenter>} options.supplyCenters - 资源供给中心集合。
  20769. * @param {number} [options.expectedSupplyCenterCount=1] - 期望用于最终设施选址的资源供给中心数量。
  20770. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分配资源。
  20771. */
  20772. class FindLocationParameters {
  20773. constructor(options) {
  20774. /**
  20775. * @member {number} [SuperMap.FindLocationParameters.prototype.expectedSupplyCenterCount=1]
  20776. * @description 期望用于最终设施选址的资源供给中心数量。
  20777. * 当输入值为 0 时,最终设施选址的资源供给中心数量默认为覆盖分析区域内的所需最少的供给中心数。
  20778. */
  20779. this.expectedSupplyCenterCount = null;
  20780. /**
  20781. * @member {boolean} [SuperMap.FindLocationParameters.prototype.isFromCenter=false]
  20782. * @description 是否从中心点开始分配资源。
  20783. * 由于网路数据中的弧段具有正反阻力,即弧段的正向阻力值与其反向阻力值可能不同,
  20784. * 因此,在进行分析时,从资源供给中心开始分配资源到需求点与从需求点向资源供给中心分配这两种分配形式下,所得的分析结果会不同。
  20785. */
  20786. this.isFromCenter = false;
  20787. /**
  20788. * @member {Array.<SuperMap.SupplyCenter>} SuperMap.FindLocationParameters.prototype.supplyCenters
  20789. * @description 资源供给中心集合。
  20790. * 资源供给中心是提供资源和服务的设施,对应于网络结点,
  20791. * 资源供给中心的相关信息包括资源量、最大阻力值、资源供给中心类型,资源供给中心在网络中所处结点的 ID 等,以便在进行选址分区分析时使用。
  20792. */
  20793. this.supplyCenters = null;
  20794. /**
  20795. * @member {string} SuperMap.FindLocationParameters.prototype.turnWeightField
  20796. * @description 转向权值字段的名称。
  20797. */
  20798. this.turnWeightField = null;
  20799. /**
  20800. * @member {string} SuperMap.FindLocationParameters.prototype.weightName
  20801. * @description 阻力字段的名称,标识了进行网络分析时所使用的阻力字段。
  20802. */
  20803. this.weightName = null;
  20804. Util.extend(this, options);
  20805. this.CLASS_NAME = "SuperMap.FindLocationParameters";
  20806. }
  20807. /**
  20808. * @function SuperMap.FindLocationParameters.prototype.destroy
  20809. * @description 释放资源,将引用资源的属性置空。
  20810. */
  20811. destroy() {
  20812. var me = this;
  20813. me.expectedSupplyCenterCount = null;
  20814. me.isFromCenter = null;
  20815. me.turnWeightField = null;
  20816. me.weightName = null;
  20817. if (me.supplyCenters) {
  20818. for (var i = 0, supplyCenters = me.supplyCenters, len = supplyCenters.length; i < len; i++) {
  20819. supplyCenters[i].destroy();
  20820. }
  20821. me.supplyCenters = null;
  20822. }
  20823. }
  20824. }
  20825. SuperMap.FindLocationParameters = FindLocationParameters;
  20826. ;// CONCATENATED MODULE: ./src/common/iServer/FindLocationService.js
  20827. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20828. * This program are made available under the terms of the Apache License, Version 2.0
  20829. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20830. /**
  20831. * @class SuperMap.FindLocationService
  20832. * @category iServer NetworkAnalyst Location
  20833. * @classdesc 选址分区分析服务类。
  20834. * 选址分区分析是为了确定一个或多个待建设施的最佳或最优位置,使得设施可以用一种最经济有效的方式为需求方提供服务或者商品。
  20835. * 选址分区不仅仅是一个选址过程,还要将需求点的需求分配到相应的新建设施的服务区中,因此称之为选址与分区。
  20836. * 选址分区分析结果通过该类支持的事件的监听函数参数获取
  20837. * @extends {SuperMap.NetworkAnalystServiceBase}
  20838. * @example
  20839. * (start code)
  20840. * var findLocationService = new SuperMap.FindLocationService(url, {
  20841. * eventListeners: {
  20842. * "processCompleted": findLocationCompleted,
  20843. * "processFailed": findLocationError
  20844. * }
  20845. * });
  20846. * (end)
  20847. * @param {string} url - 服务的访问地址。
  20848. * 如 http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  20849. * @param {Object} options - 参数。
  20850. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  20851. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  20852. * @param {Object} [options.headers] - 请求头。
  20853. */
  20854. class FindLocationService extends NetworkAnalystServiceBase {
  20855. constructor(url, options) {
  20856. super(url, options);
  20857. this.CLASS_NAME = "SuperMap.FindLocationService";
  20858. }
  20859. /**
  20860. * @function SuperMap.FindLocationService.prototype.destroy
  20861. * @override
  20862. */
  20863. destroy() {
  20864. super.destroy();
  20865. }
  20866. /**
  20867. * @function SuperMap.FindLocationService.prototype.processAsync
  20868. * @description 负责将客户端的查询参数传递到服务端。
  20869. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类
  20870. */
  20871. processAsync(params) {
  20872. if (!(params instanceof FindLocationParameters)) {
  20873. return;
  20874. }
  20875. var me = this,
  20876. jsonObject;
  20877. me.url = Util.urlPathAppend(me.url, 'location');
  20878. jsonObject = {
  20879. isFromCenter: params.isFromCenter,
  20880. expectedSupplyCenterCount: params.expectedSupplyCenterCount,
  20881. weightName: params.weightName,
  20882. turnWeightField: params.turnWeightField,
  20883. returnEdgeFeature: true,
  20884. returnEdgeGeometry: true,
  20885. returnNodeFeature: true,
  20886. mapParameter: Util.toJSON(params.mapParameter),
  20887. supplyCenters: me.getCentersJson(params.supplyCenters)
  20888. };
  20889. me.request({
  20890. method: "GET",
  20891. params: jsonObject,
  20892. scope: me,
  20893. success: me.serviceProcessCompleted,
  20894. failure: me.serviceProcessFailed
  20895. });
  20896. }
  20897. /**
  20898. * @function SuperMap.FindLocationService.prototype.getCentersJson
  20899. * @description 将数组对象转化为JSON字符串。
  20900. * @param {Array} params - 需要转换的参数
  20901. * @returns {string} 转化后的JSON字符串。
  20902. */
  20903. getCentersJson(params) {
  20904. var json = "[",
  20905. len = params ? params.length : 0;
  20906. for (var i = 0; i < len; i++) {
  20907. if (i > 0) {
  20908. json += ",";
  20909. }
  20910. json += Util.toJSON(params[i]);
  20911. }
  20912. json += "]";
  20913. return json;
  20914. }
  20915. /**
  20916. * @function SuperMap.FindLocationService.prototype.toGeoJSONResult
  20917. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  20918. * @param {Object} result - 服务器返回的结果对象。
  20919. */
  20920. toGeoJSONResult(result) {
  20921. if (!result) {
  20922. return null;
  20923. }
  20924. var geoJSONFormat = new GeoJSON();
  20925. if (result.demandResults) {
  20926. result.demandResults = geoJSONFormat.toGeoJSON(result.demandResults);
  20927. }
  20928. if (result.supplyResults) {
  20929. result.supplyResults = geoJSONFormat.toGeoJSON(result.supplyResults);
  20930. }
  20931. return result;
  20932. }
  20933. }
  20934. SuperMap.FindLocationService = FindLocationService;
  20935. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsParameters.js
  20936. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  20937. * This program are made available under the terms of the Apache License, Version 2.0
  20938. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  20939. /**
  20940. * @class SuperMap.FindMTSPPathsParameters
  20941. * @category iServer NetworkAnalyst MTSPPath
  20942. * @classdesc 多旅行商分析参数类
  20943. * @param {Object} options - 参数。
  20944. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 配送中心集合。
  20945. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 配送目标集合。
  20946. * @param {boolean} [options.hasLeastTotalCost=false] - 配送模式是否为总花费最小方案。
  20947. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  20948. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  20949. */
  20950. class FindMTSPPathsParameters {
  20951. constructor(options) {
  20952. /**
  20953. * @member SuperMap.FindMTSPPathsParameters.prototype.centers - {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>}
  20954. * @description 配送中心集合。
  20955. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,centers 应为点的坐标数组;
  20956. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,centers 应为点的 ID 数组。
  20957. */
  20958. this.centers = null;
  20959. /**
  20960. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.hasLeastTotalCost=false]
  20961. * @description 配送模式是否为总花费最小方案。
  20962. * 若为 true,则按照总花费最小的模式进行配送,此时可能会出现某几个配送中心点配送的花费较多而其他配送中心点的花费很少的情况。
  20963. * 若为 false,则为局部最优,此方案会控制每个配送中心点的花费,使各个中心点花费相对平均,此时总花费不一定最小。
  20964. */
  20965. this.hasLeastTotalCost = false;
  20966. /**
  20967. * @member {boolean} [SuperMap.FindMTSPPathsParameters.prototype.isAnalyzeById=false]
  20968. * @description 是否通过节点 ID 号来指定配送中心点和配送目的点,即通过坐标点指定。
  20969. */
  20970. this.isAnalyzeById = false;
  20971. /**
  20972. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindMTSPPathsParameters.prototype.nodes
  20973. * @description 配送目标集合。
  20974. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  20975. * 当 SuperMap.FindMTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  20976. */
  20977. this.nodes = null;
  20978. /**
  20979. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindMTSPPathsParameters.prototype.parameter]
  20980. * @description 交通网络分析通用参数。
  20981. * 通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  20982. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting 字段,则返回结果空间信息等都为空。
  20983. */
  20984. this.parameter = new TransportationAnalystParameter();
  20985. Util.extend(this, options);
  20986. this.CLASS_NAME = "SuperMap.FindMTSPPathsParameters";
  20987. }
  20988. /**
  20989. * @function SuperMap.FindMTSPPathsParameters.prototype.destroy
  20990. * @description 释放资源,将引用资源的属性置空。
  20991. */
  20992. destroy() {
  20993. var me = this;
  20994. me.centers = null;
  20995. me.hasLeastTotalCost = null;
  20996. me.isAnalyzeById = null;
  20997. me.nodes = null;
  20998. me.maxWeight = null;
  20999. if (me.parameter) {
  21000. me.parameter.destroy();
  21001. me.parameter = null;
  21002. }
  21003. }
  21004. }
  21005. SuperMap.FindMTSPPathsParameters = FindMTSPPathsParameters;
  21006. ;// CONCATENATED MODULE: ./src/common/iServer/FindMTSPPathsService.js
  21007. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21008. * This program are made available under the terms of the Apache License, Version 2.0
  21009. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21010. /**
  21011. * @class SuperMap.FindMTSPPathsService
  21012. * @category iServer NetworkAnalyst MTSPPath
  21013. * @classdesc 多旅行商分析服务类
  21014. * 多旅行商分析也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。
  21015. * 查找经济有效的配送路径,并给出相应的行走路线。
  21016. * 物流配送功能就是解决如何合理分配配送次序和送货路线,使配送总花费达到最小或每个配送中心的花费达到最小。
  21017. * 该类负责将客户端指定的多旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  21018. * 多旅行商分析结果通过该类支持的事件的监听函数参数获取
  21019. * @extends {SuperMap.NetworkAnalystServiceBase}
  21020. * @example
  21021. * var myFindMTSPPathsService = new SuperMap.FindMTSPPathsService(url, {
  21022. * eventListeners: {
  21023. * "processCompleted": findMTSPPathsCompleted,
  21024. * "processFailed": findMTSPPathsError
  21025. * }
  21026. * });
  21027. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  21028. * http://{服务器地址}:{服务端口号}/iserver/services/网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  21029. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  21030. * @param {Object} options - 互服务时所需可选参数。如:
  21031. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21032. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21033. * @param {Object} [options.headers] - 请求头。
  21034. */
  21035. class FindMTSPPathsService extends NetworkAnalystServiceBase {
  21036. constructor(url, options) {
  21037. super(url, options);
  21038. this.CLASS_NAME = "SuperMap.FindMTSPPathsService";
  21039. }
  21040. /**
  21041. * @function SuperMap.FindMTSPPathsService.prototype.destroy
  21042. * @override
  21043. */
  21044. destroy() {
  21045. super.destroy();
  21046. }
  21047. /**
  21048. * @function SuperMap.FindMTSPPathsService..prototype.processAsync
  21049. * @description 负责将客户端的查询参数传递到服务端。
  21050. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类
  21051. */
  21052. processAsync(params) {
  21053. if (!(params instanceof FindMTSPPathsParameters)) {
  21054. return;
  21055. }
  21056. var me = this,
  21057. jsonObject,
  21058. //end = me.url.substr(me.url.length - 1, 1),
  21059. centers = me.getJson(params.isAnalyzeById, params.centers),
  21060. nodes = me.getJson(params.isAnalyzeById, params.nodes);
  21061. me.url = Util.urlPathAppend(me.url, 'mtsppath');
  21062. jsonObject = {
  21063. centers: centers,
  21064. nodes: nodes,
  21065. parameter: Util.toJSON(params.parameter),
  21066. hasLeastTotalCost: params.hasLeastTotalCost
  21067. };
  21068. me.request({
  21069. method: "GET",
  21070. params: jsonObject,
  21071. scope: me,
  21072. success: me.serviceProcessCompleted,
  21073. failure: me.serviceProcessFailed
  21074. });
  21075. }
  21076. /**
  21077. * @function SuperMap.FindMTSPPathsService.prototype.getJson
  21078. * @description 将对象转化为JSON字符串。
  21079. * @param {boolean} isAnalyzeById - 是否通过id分析
  21080. * @param {Array} params - 需要转换的数字
  21081. * @returns {Object} 转化后的JSON字符串。
  21082. */
  21083. getJson(isAnalyzeById, params) {
  21084. var jsonString = "[",
  21085. len = params ? params.length : 0;
  21086. if (isAnalyzeById === false) {
  21087. for (let i = 0; i < len; i++) {
  21088. if (i > 0) {
  21089. jsonString += ",";
  21090. }
  21091. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  21092. }
  21093. } else if (isAnalyzeById === true) {
  21094. for (let i = 0; i < len; i++) {
  21095. if (i > 0) {
  21096. jsonString += ",";
  21097. }
  21098. jsonString += params[i];
  21099. }
  21100. }
  21101. jsonString += ']';
  21102. return jsonString;
  21103. }
  21104. /**
  21105. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  21106. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  21107. * @param {Object} result - 服务器返回的结果对象。
  21108. */
  21109. toGeoJSONResult(result) {
  21110. if (!result || !result.pathList) {
  21111. return null;
  21112. }
  21113. var geoJSONFormat = new GeoJSON();
  21114. result.pathList.map(function (path) {
  21115. if (path.route) {
  21116. path.route = geoJSONFormat.toGeoJSON(path.route);
  21117. }
  21118. if (path.pathGuideItems) {
  21119. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  21120. }
  21121. if (path.edgeFeatures) {
  21122. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  21123. }
  21124. if (path.nodeFeatures) {
  21125. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  21126. }
  21127. return path;
  21128. });
  21129. return result;
  21130. }
  21131. }
  21132. SuperMap.FindMTSPPathsService = FindMTSPPathsService;
  21133. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathParameters.js
  21134. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21135. * This program are made available under the terms of the Apache License, Version 2.0
  21136. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21137. /**
  21138. * @class SuperMap.FindPathParameters
  21139. * @category iServer NetworkAnalyst Path
  21140. * @classdesc 最佳路径分析参数类。最佳路径是在网络数据集中指定一些结点,按照顺序访问结点从而求解起止点之间阻抗最小的路径。
  21141. * 例如如果要顺序访问 1、2、3、4 四个结点,则需要分别找到1、2结点间的最佳路径 R1—2,2、3 间的最佳路径 R2—3 和 3、4 结点间的最佳路径 R3—4,
  21142. * 顺序访问 1、2、3、4 四个结点的最佳路径就是 R = R1—2 + R2—3 + R3—4。
  21143. * 阻抗就是指从一点到另一点的耗费,在实际应用中我们可以将距离、时间、花费等作为阻抗条件。
  21144. * 阻抗最小也就可以理解为从一点到另一点距离最短、时间最少、花费最低等。当两点间距离最短时为最短路径,它是最佳路径问题的一个特例。
  21145. * 阻抗值通过 SuperMap.TransportationAnalystParameter.weightFieldName 设置。
  21146. * 计算最佳路径除了受阻抗影响外,还受转向字段的影响。转向值通过 {@link SuperMap.TransportationAnalystParameter.turnWeightField} 设置。
  21147. *
  21148. * @param {Object} options - 参数。
  21149. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.nodes - 最佳路径分析经过的结点或设施点数组。该字段至少包含两个点。
  21150. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  21151. * @param {boolean} [options.hasLeastEdgeCount=false] - 是否按照弧段数最少的进行最佳路径分析。
  21152. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  21153. */
  21154. class FindPathParameters {
  21155. constructor(options) {
  21156. /**
  21157. * @member {boolean} [SuperMap.FindPathParameters.prototype.isAnalyzeById=false]
  21158. * @description 是否通过节点 ID 指定路径分析的结点。
  21159. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  21160. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindPathParameters.nodes = [ID1,ID2,...];
  21161. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindPathParameters.nodes = [{x1,y1},{x2,y2},...] 。
  21162. */
  21163. this.isAnalyzeById = false;
  21164. /**
  21165. * @member {boolean} [SuperMap.FindPathParameters.prototype.hasLeastEdgeCount=false]
  21166. * @description 是否按照弧段数最少的进行最佳路径分析。
  21167. * true 表示按照弧段数最少进行分析,返回弧段数最少的路径中一个阻抗最小的最佳路径;
  21168. * false 表示直接返回阻抗最小的路径,而不考虑弧段的多少。
  21169. */
  21170. this.hasLeastEdgeCount = null;
  21171. /**
  21172. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindPathParameters.prototype.nodes
  21173. * @description 最佳路径分析经过的结点或设施点数组,必设字段。该字段至少包含两个点。
  21174. * 当 SuperMap.FindPathParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  21175. * 当 SuperMap.FindPathParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  21176. */
  21177. this.nodes = null;
  21178. /**
  21179. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindPathParameters.prototype.parameter
  21180. * @description 交通网络分析通用参数。
  21181. */
  21182. this.parameter = new TransportationAnalystParameter();
  21183. Util.extend(this, options);
  21184. this.CLASS_NAME = "SuperMap.FindPathParameters";
  21185. }
  21186. /**
  21187. * @function SuperMap.FindPathParameters.prototype.destroy
  21188. * @description 释放资源,将引用资源的属性置空。
  21189. */
  21190. destroy() {
  21191. var me = this;
  21192. me.isAnalyzeById = null;
  21193. me.hasLeastEdgeCount = null;
  21194. me.nodes = null;
  21195. if (me.parameter) {
  21196. me.parameter.destroy();
  21197. me.parameter = null;
  21198. }
  21199. }
  21200. }
  21201. SuperMap.FindPathParameters = FindPathParameters;
  21202. ;// CONCATENATED MODULE: ./src/common/iServer/FindPathService.js
  21203. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21204. * This program are made available under the terms of the Apache License, Version 2.0
  21205. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21206. /**
  21207. * @class SuperMap.FindPathService
  21208. * @category iServer NetworkAnalyst Path
  21209. * @classdesc 最佳路径分析服务类。
  21210. * 最佳路径是在网络数据集中指定一些节点,按照节点的选择顺序,
  21211. * 顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  21212. * 该类负责将客户端指定的最佳路径分析参数传递给服务端,并接收服务端返回的结果数据。
  21213. * 最佳路径分析结果通过该类支持的事件的监听函数参数获取
  21214. * @extends {SuperMap.NetworkAnalystServiceBase}
  21215. * @example
  21216. * var myFindPathService = new SuperMap.FindPathService(url, {
  21217. * eventListeners: {
  21218. * "processCompleted": findPathCompleted,
  21219. * "processFailed": findPathError
  21220. * }
  21221. * });
  21222. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  21223. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  21224. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  21225. * @param {Object} options - 参数。
  21226. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21227. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21228. * @param {Object} [options.headers] - 请求头。
  21229. */
  21230. class FindPathService extends NetworkAnalystServiceBase {
  21231. constructor(url, options) {
  21232. super(url, options);
  21233. this.CLASS_NAME = "SuperMap.FindPathService";
  21234. }
  21235. /**
  21236. * @function SuperMap.FindPathService.prototype.destroy
  21237. * @override
  21238. */
  21239. destroy() {
  21240. super.destroy();
  21241. }
  21242. /**
  21243. * @function SuperMap.FindPathService.prototype.processAsync
  21244. * @description 负责将客户端的查询参数传递到服务端。
  21245. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类
  21246. */
  21247. processAsync(params) {
  21248. if (!(params instanceof FindPathParameters)) {
  21249. return;
  21250. }
  21251. var me = this, jsonObject;
  21252. me.url = Util.urlPathAppend(me.url, 'path');
  21253. jsonObject = {
  21254. hasLeastEdgeCount: params.hasLeastEdgeCount,
  21255. parameter: Util.toJSON(params.parameter),
  21256. nodes: me.getJson(params.isAnalyzeById, params.nodes)
  21257. };
  21258. me.request({
  21259. method: "GET",
  21260. params: jsonObject,
  21261. scope: me,
  21262. success: me.serviceProcessCompleted,
  21263. failure: me.serviceProcessFailed
  21264. });
  21265. }
  21266. /**
  21267. * @function SuperMap.FindPathService.prototype.getJson
  21268. * @description 将对象转化为JSON字符串。
  21269. * @param {boolean} isAnalyzeById - 是否通过id分析
  21270. * @param {Array} params - 需要转换的数字
  21271. * @returns {Object} 转化后的JSON字符串。
  21272. */
  21273. getJson(isAnalyzeById, params) {
  21274. var jsonString = "[",
  21275. len = params ? params.length : 0;
  21276. if (isAnalyzeById === false) {
  21277. for (let i = 0; i < len; i++) {
  21278. if (i > 0) {
  21279. jsonString += ",";
  21280. }
  21281. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  21282. }
  21283. } else if (isAnalyzeById === true) {
  21284. for (let i = 0; i < len; i++) {
  21285. if (i > 0) {
  21286. jsonString += ",";
  21287. }
  21288. jsonString += params[i];
  21289. }
  21290. }
  21291. jsonString += ']';
  21292. return jsonString;
  21293. }
  21294. /**
  21295. * @function SuperMap.FindMTSPPathsService.prototype.toGeoJSONResult
  21296. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  21297. * @param {Object} result - 服务器返回的结果对象。
  21298. */
  21299. toGeoJSONResult(result) {
  21300. if (!result || !result.pathList || result.pathList.length < 1) {
  21301. return null;
  21302. }
  21303. var geoJSONFormat = new GeoJSON();
  21304. result.pathList.forEach(function (path) {
  21305. if (path.route) {
  21306. path.route = geoJSONFormat.toGeoJSON(path.route);
  21307. }
  21308. if (path.pathGuideItems) {
  21309. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  21310. }
  21311. if (path.edgeFeatures) {
  21312. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  21313. }
  21314. if (path.nodeFeatures) {
  21315. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  21316. }
  21317. });
  21318. return result;
  21319. }
  21320. }
  21321. SuperMap.FindPathService = FindPathService;
  21322. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasParameters.js
  21323. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21324. * This program are made available under the terms of the Apache License, Version 2.0
  21325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21326. /**
  21327. * @class SuperMap.FindServiceAreasParameters
  21328. * @category iServer NetworkAnalyst ServiceArea
  21329. * @classdesc 服务区分析参数类。
  21330. * 服务区分析是以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  21331. * 例如:计算某快餐店能够在30分钟内送达快餐的区域。
  21332. * @param {Object} options - 参数。
  21333. * @param {Array.<number>} options.weights - 每个服务站点提供服务的阻力半径,超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  21334. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} options.centers - 服务站点数组。
  21335. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 指定路径分析的结点。
  21336. * @param {boolean} [options.isCenterMutuallyExclusive=false] - 是否中心点互斥。
  21337. * @param {boolean} [options.isFromCenter=false] - 是否从中心点开始分析。
  21338. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  21339. */
  21340. class FindServiceAreasParameters {
  21341. constructor(options) {
  21342. /**
  21343. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isAnalyzeById=false]
  21344. * @description 是否通过节点 ID 指定路径分析的结点。
  21345. * 指定路径分析经过的结点或设施点有两种方式:输入结点 ID 号或直接输入点坐标。
  21346. * 当该字段为 true 时,表示通过结点 ID 指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [ID1,ID2,...];
  21347. * 反之表示通过结点坐标指定途经点,即 SuperMap.FindServiceAreasParameters.centers = [{x1,y1},{x2,y2},...]。
  21348. */
  21349. this.isAnalyzeById = false;
  21350. /**
  21351. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isCenterMutuallyExclusive=false]
  21352. * @description 是否中心点互斥,即按照中心点的距离进行判断是否要进行互斥处理。
  21353. * 若分析出的服务区有重叠的部分,则通过设置该参数进行互斥处理。
  21354. */
  21355. this.isCenterMutuallyExclusive = false;
  21356. /**
  21357. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindServiceAreasParameters.prototype.centers
  21358. * @description 服务站点数组。
  21359. * 当该类的 iSAnalyzeById = true 时,通过结点 ID 号指定服务站点;当 iSAnalyzeById = false 时,通过点坐标指定服务站点。
  21360. */
  21361. this.centers = null;
  21362. /**
  21363. * @member {boolean} [SuperMap.FindServiceAreasParameters.prototype.isFromCenter=false]
  21364. * @description 是否从中心点开始分析。
  21365. * 从中心点开始分析和不从中心点开始分析,体现了服务中心和需要该服务的需求地的关系模式。
  21366. * 从中心点开始分析,是一个服务中心向服务需求地提供服务;
  21367. * 而不从中心点开始分析,是一个服务需求地主动到服务中心获得服务。
  21368. */
  21369. this.isFromCenter = false;
  21370. /**
  21371. * APIProperty: weights
  21372. * @member {Array.<number>} SuperMap.FindServiceAreasParameters.prototype.weights
  21373. * @description 每个服务站点提供服务的阻力半径,即超过这个阻力半径的区域不予考虑,其单位与阻力字段一致。
  21374. * 该字段为一个数组,数组长度跟服务中心个数一致,按照索引顺序与站点一一对应,每个元素表示了在对每个服务中心进行服务区分析时,所用的服务半径。
  21375. */
  21376. this.weights = null;
  21377. /**
  21378. * @member {SuperMap.TransportationAnalystParameter} SuperMap.FindServiceAreasParameters.prototype.parameter
  21379. * @description 交通网络分析通用参数。
  21380. */
  21381. this.parameter = new TransportationAnalystParameter();
  21382. Util.extend(this, options);
  21383. this.CLASS_NAME = "SuperMap.FindServiceAreasParameters";
  21384. }
  21385. /**
  21386. * @function SuperMap.FindServiceAreasParameters.prototype.destroy
  21387. * @description 释放资源,将引用资源的属性置空。
  21388. */
  21389. destroy() {
  21390. var me = this;
  21391. me.isAnalyzeById = null;
  21392. me.isCenterMutuallyExclusive = null;
  21393. me.centers = null;
  21394. me.isFromCenter = null;
  21395. me.weights = null;
  21396. if (me.parameter) {
  21397. me.parameter.destroy();
  21398. me.parameter = null;
  21399. }
  21400. }
  21401. }
  21402. SuperMap.FindServiceAreasParameters = FindServiceAreasParameters;
  21403. ;// CONCATENATED MODULE: ./src/common/iServer/FindServiceAreasService.js
  21404. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21405. * This program are made available under the terms of the Apache License, Version 2.0
  21406. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21407. /**
  21408. * @class SuperMap.FindServiceAreasService
  21409. * @category iServer NetworkAnalyst ServiceArea
  21410. * @classdesc 服务区分析服务类。
  21411. * 服务区分析是以指定服务站点为中心,
  21412. * 在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  21413. * 该类负责将客户端指定的服务区分析参数传递给服务端,并接收服务端返回的结果数据。
  21414. * 服务区分析结果通过该类支持的事件的监听函数参数获取
  21415. * @extends {SuperMap.NetworkAnalystServiceBase}
  21416. * @example
  21417. * var myFindServiceAreasService = new SuperMap.FindServiceAreasService(url, {
  21418. * eventListeners: {
  21419. * "processCompleted": findServiceAreasCompleted,
  21420. * "processFailed": findServiceAreasError
  21421. * }
  21422. * });
  21423. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  21424. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  21425. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  21426. * @param {Object} options - 互服务时所需可选参数。如:
  21427. * @param {Object} options.eventListeners - 需要被注册的监听器对象
  21428. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21429. * @param {Object} [options.headers] - 请求头。
  21430. */
  21431. class FindServiceAreasService extends NetworkAnalystServiceBase {
  21432. constructor(url, options) {
  21433. super(url, options);
  21434. this.CLASS_NAME = "SuperMap.FindServiceAreasService";
  21435. }
  21436. /**
  21437. * @function SuperMap.FindServiceAreasService.prototype.destroy
  21438. * @override
  21439. */
  21440. destroy() {
  21441. super.destroy();
  21442. }
  21443. /**
  21444. * @function SuperMap.FindServiceAreasService.prototype.processAsync
  21445. * @description 负责将客户端的查询参数传递到服务端。
  21446. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类
  21447. */
  21448. processAsync(params) {
  21449. if (!(params instanceof FindServiceAreasParameters)) {
  21450. return;
  21451. }
  21452. var me = this, jsonObject;
  21453. me.url = Util.urlPathAppend(me.url, 'servicearea');
  21454. jsonObject = {
  21455. isFromCenter: params.isFromCenter,
  21456. isCenterMutuallyExclusive: params.isCenterMutuallyExclusive,
  21457. parameter: Util.toJSON(params.parameter),
  21458. centers: me.getJson(params.isAnalyzeById, params.centers),
  21459. weights: me.getJson(true, params.weights)
  21460. };
  21461. me.request({
  21462. method: "GET",
  21463. params: jsonObject,
  21464. scope: me,
  21465. success: me.serviceProcessCompleted,
  21466. failure: me.serviceProcessFailed
  21467. });
  21468. }
  21469. /**
  21470. * @function SuperMap.FindServiceAreasService.prototype.getJson
  21471. * @description 将对象转化为JSON字符串。
  21472. * @param {boolean} isAnalyzeById - 是否通过id分析
  21473. * @param {Array} params - 需要转换的数字
  21474. * @returns {Object} 转化后的JSON字符串。
  21475. */
  21476. getJson(isAnalyzeById, params) {
  21477. var jsonString = "[",
  21478. len = params ? params.length : 0;
  21479. if (isAnalyzeById === false) {
  21480. for (let i = 0; i < len; i++) {
  21481. if (i > 0) {
  21482. jsonString += ",";
  21483. }
  21484. jsonString += '{"x":' + params[i].x + ',"y":' + params[i].y + '}';
  21485. }
  21486. } else if (isAnalyzeById === true) {
  21487. for (let i = 0; i < len; i++) {
  21488. if (i > 0) {
  21489. jsonString += ",";
  21490. }
  21491. jsonString += params[i];
  21492. }
  21493. }
  21494. jsonString += ']';
  21495. return jsonString;
  21496. }
  21497. /**
  21498. * @function SuperMap.FindServiceAreasService.prototype.toGeoJSONResult
  21499. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  21500. * @param {Object} result - 服务器返回的结果对象。。
  21501. */
  21502. toGeoJSONResult(result) {
  21503. if (!result || !result.serviceAreaList) {
  21504. return result;
  21505. }
  21506. var geoJSONFormat = new GeoJSON();
  21507. result.serviceAreaList.map(function (serviceArea) {
  21508. if (serviceArea.serviceRegion) {
  21509. serviceArea.serviceRegion = geoJSONFormat.toGeoJSON(serviceArea.serviceRegion);
  21510. }
  21511. if (serviceArea.edgeFeatures) {
  21512. serviceArea.edgeFeatures = geoJSONFormat.toGeoJSON(serviceArea.edgeFeatures);
  21513. }
  21514. if (serviceArea.nodeFeatures) {
  21515. serviceArea.nodeFeatures = geoJSONFormat.toGeoJSON(serviceArea.nodeFeatures);
  21516. }
  21517. if (serviceArea.routes) {
  21518. serviceArea.routes = geoJSONFormat.toGeoJSON(serviceArea.routes);
  21519. }
  21520. return serviceArea;
  21521. });
  21522. return result;
  21523. }
  21524. }
  21525. SuperMap.FindServiceAreasService = FindServiceAreasService;
  21526. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsParameters.js
  21527. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21528. * This program are made available under the terms of the Apache License, Version 2.0
  21529. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21530. /**
  21531. * @class SuperMap.FindTSPPathsParameters
  21532. * @category iServer NetworkAnalyst TSPPath
  21533. * @classdesc 旅行商分析参数类。
  21534. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  21535. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  21536. * 旅行商分析和最佳路径分析都是在网络中寻找遍历所有站点的最经济的路径,区别是在遍历网络所有站点的过程中对结点访问顺序不同
  21537. * 最佳路径分析必须按照指定顺序对站点进行访问,而旅行商分析是无序的路径分析。
  21538. * @param {Object} options - 参数。
  21539. * @param {boolean} [options.endNodeAssigned=false] - 是否指定终止点,将指定的途经点的最后一个点作为终止点。true 表示指定终止点,则旅行商必须最后一个访问终止点。
  21540. * @param {boolean} [options.isAnalyzeById=false] - 是否通过节点 ID 号来指定配送中心点和配送目的点。
  21541. * @param {Array.<(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number)>} options.nodes - 配送目标集合。
  21542. * @param {SuperMap.TransportationAnalystParameter} [options.parameter] - 交通网络分析通用参数。
  21543. */
  21544. class FindTSPPathsParameters {
  21545. constructor(options) {
  21546. /**
  21547. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.endNodeAssigned=false]
  21548. * @description 是否指定终止点,将指定的途经点的最后一个点作为终止点。
  21549. * true 表示指定终止点,则旅行商必须最后一个访问终止点。
  21550. */
  21551. this.endNodeAssigned = false;
  21552. /**
  21553. * @member {boolean} [SuperMap.FindTSPPathsParameters.prototype.isAnalyzeById=false]
  21554. * @description 是否通过节点 ID 号来指定途经点。
  21555. */
  21556. this.isAnalyzeById = false;
  21557. /**
  21558. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point|number>} SuperMap.FindTSPPathsParameters.prototype.nodes
  21559. * @description 旅行商分析途经点数组。
  21560. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = false 时,nodes 应为点的坐标数组;
  21561. * 当 SuperMap.FindTSPPathsParameters.isAnalyzeById = true 时,nodes 应为点的 ID 数组。
  21562. */
  21563. this.nodes = null;
  21564. /**
  21565. * @member {SuperMap.TransportationAnalystParameter} [SuperMap.FindTSPPathsParameters.prototype.parameter]
  21566. * @description 交通网络分析通用参数。通过本类可以设置障碍边、障碍点、权值字段信息的名称标识、转向权值字段等信息。
  21567. * SuperMap.TransportationAnalystParameter 类型,它虽然为可选参数,但是如果不设置其中的 resultSetting
  21568. * 字段,则返回结果空间信息等都为空。
  21569. */
  21570. this.parameter = new TransportationAnalystParameter();
  21571. Util.extend(this, options);
  21572. this.CLASS_NAME = "SuperMap.FindTSPPathsParameters";
  21573. }
  21574. /**
  21575. * @function SuperMap.FindTSPPathsParameters.prototype.destroy
  21576. * @description 释放资源,将引用资源的属性置空。
  21577. */
  21578. destroy() {
  21579. var me = this;
  21580. me.endNodeAssigned = null;
  21581. me.isAnalyzeById = null;
  21582. me.nodes = null;
  21583. if (me.parameter) {
  21584. me.parameter.destroy();
  21585. me.parameter = null;
  21586. }
  21587. }
  21588. }
  21589. SuperMap.FindTSPPathsParameters = FindTSPPathsParameters;
  21590. ;// CONCATENATED MODULE: ./src/common/iServer/FindTSPPathsService.js
  21591. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21592. * This program are made available under the terms of the Apache License, Version 2.0
  21593. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21594. /**
  21595. * @class SuperMap.FindTSPPathsService
  21596. * @category iServer NetworkAnalyst TSPPath
  21597. * @classdesc 旅行商分析服务类
  21598. * 旅行商分析是路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  21599. * 旅行商分析也可以指定到达的终点,这时查找从起点能够遍历所有途经点最后到达终点,且花费最小的路径。
  21600. * 该类负责将客户端指定的旅行商分析参数传递给服务端,并接收服务端返回的结果数据。
  21601. * 旅行商分析结果通过该类支持的事件的监听函数参数获取
  21602. * @extends {SuperMap.NetworkAnalystServiceBase}
  21603. * @example
  21604. * (start code)
  21605. * var myFindTSPPathsService = new SuperMap.FindTSPPathsService(url, {
  21606. * eventListeners: {
  21607. * "processCompleted": findTSPPathsCompleted,
  21608. * "processFailed": findTSPPathsError
  21609. * }
  21610. * });
  21611. * (end)
  21612. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL应为:
  21613. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  21614. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  21615. * @param {Object} options - 参数。
  21616. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21617. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21618. * @param {Object} [options.headers] - 请求头。
  21619. */
  21620. class FindTSPPathsService extends NetworkAnalystServiceBase {
  21621. constructor(url, options) {
  21622. super(url, options);
  21623. this.CLASS_NAME = "SuperMap.FindTSPPathsService";
  21624. }
  21625. /**
  21626. * @function SuperMap.FindTSPPathsService.prototype.destroy
  21627. * @override
  21628. */
  21629. destroy() {
  21630. super.destroy();
  21631. }
  21632. /**
  21633. * @function SuperMap.FindTSPPathsService.prototype.processAsync
  21634. * @description 负责将客户端的查询参数传递到服务端。
  21635. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  21636. */
  21637. processAsync(params) {
  21638. if (!(params instanceof FindTSPPathsParameters)) {
  21639. return;
  21640. }
  21641. var me = this, jsonObject;
  21642. me.url = Util.urlPathAppend(me.url, 'tsppath');
  21643. jsonObject = {
  21644. parameter: SuperMap.Util.toJSON(params.parameter),
  21645. endNodeAssigned: params.endNodeAssigned,
  21646. nodes: me.getNodesJson(params)
  21647. };
  21648. me.request({
  21649. method: "GET",
  21650. params: jsonObject,
  21651. scope: me,
  21652. success: me.serviceProcessCompleted,
  21653. failure: me.serviceProcessFailed
  21654. });
  21655. }
  21656. /**
  21657. * @function SuperMap.FindTSPPathsService.prototype.getNodesJson
  21658. * @description 将节点对象转化为JSON字符串。
  21659. * @param {SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  21660. * @returns {string} 转化后的JSON字符串。
  21661. */
  21662. getNodesJson(params) {
  21663. var jsonParameters = "", nodesString, i, len, nodes;
  21664. if (params.isAnalyzeById === false) {
  21665. for (nodesString = "[", i = 0, nodes = params.nodes, len = nodes.length; i < len; i++) {
  21666. if (i > 0) {
  21667. nodesString += ",";
  21668. }
  21669. nodesString += '{"x":' + nodes[i].x + ',"y":' + nodes[i].y + '}';
  21670. }
  21671. nodesString += ']';
  21672. jsonParameters += nodesString;
  21673. } else if (params.isAnalyzeById === true) {
  21674. let nodeIDsString = "[", nodes = params.nodes, len = nodes.length;
  21675. for (let i = 0; i < len; i++) {
  21676. if (i > 0) {
  21677. nodeIDsString += ",";
  21678. }
  21679. nodeIDsString += nodes[i];
  21680. }
  21681. nodeIDsString += ']';
  21682. jsonParameters += nodeIDsString;
  21683. }
  21684. return jsonParameters;
  21685. }
  21686. /**
  21687. * @function SuperMap.FindTSPPathsService.prototype.toGeoJSONResult
  21688. * @description 将含有 geometry 的数据转换为 GeoJSON 格式。
  21689. * @param {Object} result - 服务器返回的结果对象。
  21690. */
  21691. toGeoJSONResult(result) {
  21692. if (!result || !result.tspPathList) {
  21693. return null;
  21694. }
  21695. var geoJSONFormat = new GeoJSON();
  21696. result.tspPathList.forEach(function (path) {
  21697. if (path.route) {
  21698. path.route = geoJSONFormat.toGeoJSON(path.route);
  21699. }
  21700. if (path.pathGuideItems) {
  21701. path.pathGuideItems = geoJSONFormat.toGeoJSON(path.pathGuideItems);
  21702. }
  21703. if (path.edgeFeatures) {
  21704. path.edgeFeatures = geoJSONFormat.toGeoJSON(path.edgeFeatures);
  21705. }
  21706. if (path.nodeFeatures) {
  21707. path.nodeFeatures = geoJSONFormat.toGeoJSON(path.nodeFeatures);
  21708. }
  21709. });
  21710. return result;
  21711. }
  21712. }
  21713. SuperMap.FindTSPPathsService = FindTSPPathsService;
  21714. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataParameters.js
  21715. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21716. * This program are made available under the terms of the Apache License, Version 2.0
  21717. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21718. /**
  21719. * @class SuperMap.GenerateSpatialDataParameters
  21720. * @category iServer SpatialAnalyst GenerateSpatialData
  21721. * @classdesc 动态分段操作参数类。通过该类可以为动态分段提供参数信息。
  21722. * @param {Object} options - 参数。
  21723. * @param {string} options.routeTable - 路由数据集。
  21724. * @param {string} options.routeIDField - 路由数据集的标识字段。
  21725. * @param {string} options.eventTable - 用于生成空间数据的事件表名。
  21726. * @param {SuperMap.DataReturnOption} options.dataReturnOption - 设置数据返回选项。
  21727. * @param {string} [options.attributeFilter] - 属性过滤条件。
  21728. * @param {string} options.eventRouteIDField - 用于生成空间数据的事件表的路由标识字段。
  21729. * @param {string} [options.measureField] - 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义。
  21730. * @param {string} [options.measureStartField] - 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  21731. * @param {string} [options.measureEndField] - 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  21732. * @param {string} [options.measureOffsetField] - 刻度偏移量字段。
  21733. * @param {string} [options.errorInfoField] - 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  21734. * @param {Array.<string>} [options.retainedFields] - 欲保留到结果空间数据中的字段集合(系统字段除外)。
  21735. */
  21736. class GenerateSpatialDataParameters {
  21737. constructor(options) {
  21738. /**
  21739. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeTable
  21740. * @description 路由数据集。
  21741. */
  21742. this.routeTable = null;
  21743. /**
  21744. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.routeIDField
  21745. * @description 路由数据集的标识字段。
  21746. */
  21747. this.routeIDField = null;
  21748. /**
  21749. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.attributeFilter]
  21750. * @description 属性过滤条件。
  21751. * 当 {@link SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption.dataReturnMode} 为 {@link DataReturnMode.DATASET_AND_RECORDSET} 或 {@link DataReturnMode.RECORDSET_ONLY} 时有效。
  21752. */
  21753. this.attributeFilter = null;
  21754. /**
  21755. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventTable
  21756. * @description 用于生成空间数据的事件表名。
  21757. */
  21758. this.eventTable = null;
  21759. /**
  21760. * @member {string} SuperMap.GenerateSpatialDataParameters.prototype.eventRouteIDField
  21761. * @description 用于生成空间数据的事件表的路由标识字段。
  21762. */
  21763. this.eventRouteIDField = null;
  21764. /**
  21765. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureField]
  21766. * @description 用于生成空间数据的事件表的刻度字段,只有当事件为点事件的时候该属性才有意义
  21767. */
  21768. this.measureField = null;
  21769. /**
  21770. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureStartField]
  21771. * @description 用于生成空间数据的事件表的起始刻度字段,只有当事件为线事件的时候该属性才有意义。
  21772. */
  21773. this.measureStartField = null;
  21774. /**
  21775. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureEndField]
  21776. * @description 用于生成空间数据的事件表的终止刻度字段,只有当事件为线事件的时候该属性才有意义。
  21777. */
  21778. this.measureEndField = null;
  21779. /**
  21780. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.measureOffsetField]
  21781. * @description 刻度偏移量字段。
  21782. */
  21783. this.measureOffsetField = null;
  21784. /**
  21785. * @member {string} [SuperMap.GenerateSpatialDataParameters.prototype.errorInfoField]
  21786. * @description 错误信息字段,直接写入原事件表,用于描述事件未能生成对应的点或线时的错误信息。
  21787. */
  21788. this.errorInfoField = null;
  21789. /**
  21790. * @member {Array.<string>} [SuperMap.GenerateSpatialDataParameters.prototype.retainedFields]
  21791. * @description 欲保留到结果空间数据中的字段集合(系统字段除外)。
  21792. * 生成空间数据时,无论是否指定保留字段,路由 ID 字段、刻度偏移量字段、刻度值字段(点事件为刻度字段,线事件是起始和终止刻度字段)都会保留到结果空间数据中;
  21793. * 如果没有指定 retainedFields 参数或者 retainedFields 参数数组长度为 0,则返回所有用户字段。
  21794. */
  21795. this.retainedFields = null;
  21796. /**
  21797. * @member {SuperMap.DataReturnOption} SuperMap.GenerateSpatialDataParameters.prototype.dataReturnOption
  21798. * @description 设置数据返回的选项。
  21799. */
  21800. this.dataReturnOption = null;
  21801. if (options) {
  21802. Util.extend(this, options);
  21803. }
  21804. this.CLASS_NAME = "SuperMap.GenerateSpatialDataParameters";
  21805. }
  21806. /**
  21807. * @function SuperMap.GenerateSpatialDataParameters.prototype.destroy
  21808. * @description 释放资源,将引用资源的属性置空。
  21809. */
  21810. destroy() {
  21811. var me = this;
  21812. if (me.routeTable) {
  21813. me.routeTable = null;
  21814. }
  21815. me.routeIDField = null;
  21816. me.attributeFilter = null;
  21817. me.eventTable = null;
  21818. me.eventRouteIDField = null;
  21819. me.measureField = null;
  21820. me.measureStartField = null;
  21821. me.measureEndField = null;
  21822. me.measureOffsetField = null;
  21823. me.errorInfoField = null;
  21824. if (me.dataReturnOption) {
  21825. me.dataReturnOption.destroy();
  21826. me.dataReturnOption = null;
  21827. }
  21828. }
  21829. }
  21830. SuperMap.GenerateSpatialDataParameters = GenerateSpatialDataParameters;
  21831. ;// CONCATENATED MODULE: ./src/common/iServer/GenerateSpatialDataService.js
  21832. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21833. * This program are made available under the terms of the Apache License, Version 2.0
  21834. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21835. /**
  21836. * @class SuperMap.GenerateSpatialDataService
  21837. * @category iServer SpatialAnalyst GenerateSpatialData
  21838. * @classdesc 动态分段分析服务类。该类负责将客户设置的动态分段分析服务参数传递给服务端,并接收服务端返回的动态分段分析结果数据。
  21839. * 获取的结果数据包括 originResult 、result 两种,其中,originResult 为服务端返回的用 JSON 对象表示的动态分段分析结果数据,result 为服务端返回的动态分段分析结果数据。
  21840. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  21841. * @param {Object} options - 参数。</br>
  21842. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  21843. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  21844. * @param {Object} [options.headers] - 请求头。
  21845. * @extends {SuperMap.SpatialAnalystBase}
  21846. * @example 实例化该类如下例所示:
  21847. * (start code)
  21848. * function GenerateSpatialData(){
  21849. *
  21850. * //配置数据返回选项(option)
  21851. * var option = new SuperMap.DataReturnOption({
  21852. * expectCount: 1000,
  21853. * dataset: "generateSpatialData",
  21854. * deleteExistResultDataset: true,
  21855. * dataReturnMode: SuperMap.DataReturnMode.DATASET_ONLY
  21856. * }),
  21857. * //配置动态分段参数(Parameters)
  21858. * parameters = new SuperMap.GenerateSpatialDataParameters({
  21859. * routeTable: "RouteDT_road@Changchun",
  21860. * routeIDField: "RouteID",
  21861. * eventTable: "LinearEventTabDT@Changchun",
  21862. * eventRouteIDField: "RouteID",
  21863. * measureField: "",
  21864. * measureStartField: "LineMeasureFrom",
  21865. * measureEndField: "LineMeasureTo",
  21866. * measureOffsetField: "",
  21867. * errorInfoField: "",
  21868. * retainedFields:[],
  21869. * dataReturnOption: option
  21870. * }),
  21871. * //配置动态分段iService
  21872. * iService = new SuperMap.GenerateSpatialDataService(Changchun_spatialanalyst, {
  21873. * eventListeners: {
  21874. * processCompleted: generateCompleted,
  21875. * processFailed: generateFailded
  21876. * }
  21877. * });
  21878. * //执行
  21879. * iService.processAsync(parameters);
  21880. * function Completed(generateSpatialDataEventArgs){//todo};
  21881. * function Error(generateSpatialDataEventArgs){//todo};
  21882. * (end)
  21883. */
  21884. class GenerateSpatialDataService extends SpatialAnalystBase {
  21885. constructor(url, options) {
  21886. super(url, options);
  21887. this.CLASS_NAME = "SuperMap.GenerateSpatialDataService";
  21888. }
  21889. /**
  21890. * @function SuperMap.GenerateSpatialDataService.prototype.destroy
  21891. * @override
  21892. */
  21893. destroy() {
  21894. super.destroy();
  21895. }
  21896. /**
  21897. * @function SuperMap.GenerateSpatialDataService.prototype.processAsync
  21898. * @description 负责将客户端的动态分段服务参数传递到服务端。
  21899. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  21900. */
  21901. processAsync(params) {
  21902. if (!(params instanceof GenerateSpatialDataParameters)) {
  21903. return;
  21904. }
  21905. var me = this,
  21906. jsonParameters;
  21907. jsonParameters = me.getJsonParameters(params);
  21908. me.request({
  21909. method: "POST",
  21910. data: jsonParameters,
  21911. scope: me,
  21912. success: me.serviceProcessCompleted,
  21913. failure: me.serviceProcessFailed
  21914. });
  21915. }
  21916. /**
  21917. * @function SuperMap.GenerateSpatialDataService.prototype.getJsonParameters
  21918. * @description 将参数转化为 JSON 字符串。
  21919. * @param {SuperMap.GenerateSpatialDataParameters} params - 动态分段操作参数类。
  21920. * @returns {string}转化后的JSON字符串。
  21921. */
  21922. getJsonParameters(params) {
  21923. var jsonParameters = "",
  21924. jsonStr = "datasets/" + params.routeTable + "/linearreferencing/generatespatialdata",
  21925. me = this;
  21926. me.url = Util.urlPathAppend(me.url, jsonStr);
  21927. me.url = Util.urlAppend(me.url, 'returnContent=true');
  21928. jsonParameters = Util.toJSON(params);
  21929. return jsonParameters;
  21930. }
  21931. }
  21932. SuperMap.GenerateSpatialDataService = GenerateSpatialDataService;
  21933. ;// CONCATENATED MODULE: ./src/common/iServer/GeoBoundingBoxQueryBuilderParameter.js
  21934. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21935. * This program are made available under the terms of the Apache License, Version 2.0
  21936. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21937. /**
  21938. * @class SuperMap.GeoBoundingBoxQueryBuilderParameter
  21939. * @classdesc bounds 查询参数设置类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21940. * @category iServer Data FeatureResults
  21941. * @param {Object} options - 参数。
  21942. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 查询范围。
  21943. * @param {SuperMap.AggregationQueryBuilderType} [options.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX] - 查询类型。
  21944. */
  21945. class GeoBoundingBoxQueryBuilderParameter extends AggQueryBuilderParameter {
  21946. constructor(options) {
  21947. super(options);
  21948. /**
  21949. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.bounds
  21950. * @description 查询范围。
  21951. */
  21952. this.bounds = null;
  21953. /**
  21954. * @member {SuperMap.AggregationQueryBuilderType} [SuperMap.GeoBoundingBoxQueryBuilderParameter.prototype.queryType=SuperMap.AggregationQueryBuilderType.GEO_BOUNDING_BOX]
  21955. * @description 查询类型。
  21956. */
  21957. this.queryType = AggregationQueryBuilderType.GEO_BOUNDING_BOX;
  21958. this.CLASS_NAME = "SuperMap.GeoBoundingBoxQueryBuilderParameter";
  21959. Util.extend(this, options);
  21960. }
  21961. destroy() {
  21962. super.destroy();
  21963. this.bounds = null;
  21964. this.queryType = null;
  21965. }
  21966. }
  21967. SuperMap.GeoBoundingBoxQueryBuilderParameter = GeoBoundingBoxQueryBuilderParameter
  21968. ;// CONCATENATED MODULE: ./src/common/iServer/GeoHashGridAggParameter.js
  21969. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  21970. * This program are made available under the terms of the Apache License, Version 2.0
  21971. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  21972. /**
  21973. * @class SuperMap.GeoHashGridAggParameter
  21974. * @classdesc 格网聚合查询参数类,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  21975. * @category iServer Data FeatureResults
  21976. * @param {Object} option - 初始化参数。
  21977. * @param {number} [option.precision=5] - 网格中数字的精度。
  21978. * @param {SuperMap.AggregationType} [option.aggType=SuperMap.AggregationType.GEOHASH_GRID] - 格网聚合类型。
  21979. */
  21980. class GeoHashGridAggParameter extends AggregationParameter {
  21981. constructor(option) {
  21982. super(option);
  21983. /**
  21984. * @member {number} [SuperMap.GeoHashGridAggParameter.prototype.precision=5]
  21985. * @description 网格中数字的精度。
  21986. */
  21987. this.precision = 5;
  21988. /**
  21989. * @member {SuperMap.AggregationType} [SuperMap.GeoHashGridAggParameter.prototype.aggType=SuperMap.AggregationType.GEOHASH_GRID]
  21990. * @description 格网聚合类型。
  21991. */
  21992. this.aggType = AggregationType.GEOHASH_GRID;
  21993. Util.extend(this, option);
  21994. this.CLASS_NAME = "SuperMap.GeoHashGridAggParameter";
  21995. }
  21996. destroy() {
  21997. super.destroy();
  21998. this.aggType = null;
  21999. }
  22000. /**
  22001. * @function SuperMap.GeoHashGridAggParameter.toJsonParameters
  22002. * @description 将对象转为 JSON 格式。
  22003. * @param param 转换对象。
  22004. * @returns {string|object}
  22005. */
  22006. static toJsonParameters(param) {
  22007. var parameters = {
  22008. aggName: param.aggName,
  22009. aggFieldName: param.aggFieldName,
  22010. aggType: param.aggType,
  22011. precision: param.precision
  22012. };
  22013. if (param.subAgg) {
  22014. parameters.subAgg = param.subAgg;
  22015. }
  22016. return Util.toJson(parameters);
  22017. }
  22018. }
  22019. SuperMap.GeoHashGridAggParameter = GeoHashGridAggParameter;
  22020. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryOverlayAnalystParameters.js
  22021. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22022. * This program are made available under the terms of the Apache License, Version 2.0
  22023. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22024. /**
  22025. * @class SuperMap.GeometryOverlayAnalystParameters
  22026. * @category iServer SpatialAnalyst OverlayAnalyst
  22027. * @classdesc
  22028. * 几何对象叠加分析参数类。对指定的某两个几何对象做叠加分析。通过该类可以指定要做叠加分析的几何对象、叠加操作类型。
  22029. * @param {Object} options - 参数。
  22030. * @param {Object} options.operateGeometry - 叠加分析的操作几何对象。 </br>
  22031. * 点类型可以是:{@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>
  22032. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link GeoJSONObject}。</br>
  22033. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link GeoJSONObject}。
  22034. * @param {Object} options.sourceGeometry - 叠加分析的源几何对象。
  22035. * @param {Array.<Object>} [options.operateGeometries] - 批量叠加分析的操作几何对象数组。
  22036. * @param {Array.<Object>} [options.sourceGeometries] -批量叠加分析的源几何对象数组。
  22037. * @param {SuperMap.OverlayOperationType} [options.operation] - 叠加操作枚举值。
  22038. * @extends {SuperMap.OverlayAnalystParameters}
  22039. */
  22040. class GeometryOverlayAnalystParameters extends OverlayAnalystParameters {
  22041. constructor(options) {
  22042. super(options);
  22043. if (options && options.operateGeometry) {
  22044. this.operateGeometry = options.operateGeometry;
  22045. }
  22046. if (options && options.sourceGeometry) {
  22047. this.sourceGeometry = options.sourceGeometry;
  22048. }
  22049. if (options && options.operateGeometries) {
  22050. this.operateGeometries = options.operateGeometries;
  22051. }
  22052. if (options && options.sourceGeometries) {
  22053. this.sourceGeometries = options.sourceGeometries;
  22054. }
  22055. if (options) {
  22056. Util.extend(this, options);
  22057. }
  22058. this.CLASS_NAME = "SuperMap.GeometryOverlayAnalystParameters";
  22059. }
  22060. /**
  22061. * @function SuperMap.GeometryOverlayAnalystParameters.prototype.destroy
  22062. * @override
  22063. */
  22064. destroy() {
  22065. super.destroy();
  22066. var me = this;
  22067. if (me.sourceGeometry) {
  22068. me.sourceGeometry.destroy();
  22069. me.sourceGeometry = null;
  22070. }
  22071. if (me.sourceGeometries) {
  22072. me.sourceGeometries.destroy();
  22073. me.sourceGeometries = null;
  22074. }
  22075. if (me.sourceGeometry) {
  22076. me.sourceGeometry.destroy();
  22077. me.sourceGeometry = null;
  22078. }
  22079. if (me.operateGeometries) {
  22080. me.operateGeometries.destroy();
  22081. me.operateGeometries = null;
  22082. }
  22083. }
  22084. /**
  22085. * @function SuperMap.GeometryOverlayAnalystParameters.toObject
  22086. * @param {SuperMap.GeometryOverlayAnalystParameters} geometryOverlayAnalystParameters - 几何对象叠加分析参数类。
  22087. * @param {SuperMap.GeometryOverlayAnalystParameters} tempObj - 几何对象叠加分析参数对象。
  22088. * @description 将几何对象叠加分析参数对象转换为 JSON 对象。
  22089. * @returns {Object} JSON 对象。
  22090. */
  22091. static toObject(geometryOverlayAnalystParameters, tempObj) {
  22092. for (var name in geometryOverlayAnalystParameters) {
  22093. if (name === "sourceGeometry") {
  22094. tempObj.sourceGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometry);
  22095. } else if (name === "sourceGeometries") {
  22096. var sourceGeometries = [];
  22097. for (var i = 0; i < geometryOverlayAnalystParameters.sourceGeometries.length; i++) {
  22098. sourceGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.sourceGeometries[i]));
  22099. }
  22100. tempObj.sourceGeometries = sourceGeometries;
  22101. } else if (name === "operateGeometry") {
  22102. tempObj.operateGeometry = ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometry);
  22103. } else if (name === "operateGeometries") {
  22104. var operateGeometries = [];
  22105. for (var j = 0; j < geometryOverlayAnalystParameters.operateGeometries.length; j++) {
  22106. operateGeometries.push(ServerGeometry.fromGeometry(geometryOverlayAnalystParameters.operateGeometries[j]));
  22107. }
  22108. tempObj.operateGeometries = operateGeometries;
  22109. } else {
  22110. tempObj[name] = geometryOverlayAnalystParameters[name];
  22111. }
  22112. }
  22113. }
  22114. }
  22115. SuperMap.GeometryOverlayAnalystParameters = GeometryOverlayAnalystParameters;
  22116. ;// CONCATENATED MODULE: ./src/common/iServer/GeometrySurfaceAnalystParameters.js
  22117. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22118. * This program are made available under the terms of the Apache License, Version 2.0
  22119. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22120. /**
  22121. * @class SuperMap.GeometrySurfaceAnalystParameters
  22122. * @category iServer SpatialAnalyst SurfaceAnalyst
  22123. * @classdesc 几何对象表面分析参数类。该类对几何对象表面分析所用到的参数进行设置。
  22124. * @param {Object} options - 参数。
  22125. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 表面分析的坐标点数组。
  22126. * @param {Array.<number>} options.zValues - 表面分析的坐标点的 Z 值数组。
  22127. * @param {number} [options.resolution] - 获取或设置指定中间结果(栅格数据集)的分辨率。
  22128. * @param {SuperMap.DataReturnOption} [options.resultSetting] - 结果返回设置类。
  22129. * @param {SuperMap.SurfaceAnalystParametersSetting} options.extractParameter - 获取或设置表面分析参数。
  22130. * @param {SuperMap.SurfaceAnalystMethod} [options.surfaceAnalystMethod = SuperMap.SurfaceAnalystMethod.ISOLINE] - 获取或设置表面分析的提取方法,提取等值线和提取等值面。
  22131. * @extends {SuperMap.SurfaceAnalystParameters}
  22132. */
  22133. class GeometrySurfaceAnalystParameters extends SurfaceAnalystParameters {
  22134. constructor(options) {
  22135. super(options);
  22136. /**
  22137. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometrySurfaceAnalystParameters.prototype.points
  22138. * @description 获取或设置用于表面分析的坐标点数组。
  22139. */
  22140. this.points = null;
  22141. /**
  22142. * @member {Array.<number>} SuperMap.GeometrySurfaceAnalystParameters.prototype.zValues
  22143. * @description 获取或设置用于提取操作的值。提取等值线时,将使用该数组中的值,
  22144. * 对几何对象中的坐标点数组进行插值分析,得到栅格数据集(中间结果),接着从栅格数据集提取等值线。
  22145. */
  22146. this.zValues = null;
  22147. if (options) {
  22148. Util.extend(this, options);
  22149. }
  22150. this.CLASS_NAME = "SuperMap.GeometrySurfaceAnalystParameters";
  22151. }
  22152. /**
  22153. * @function SuperMap.GeometrySurfaceAnalystParameters.prototype.destroy
  22154. * @override
  22155. */
  22156. destroy() {
  22157. super.destroy();
  22158. var me = this;
  22159. if (me.points) {
  22160. for (var i = 0, points = me.points, len = points.length; i < len; i++) {
  22161. points[i].destroy();
  22162. }
  22163. me.points = null;
  22164. }
  22165. me.zValues = null;
  22166. }
  22167. }
  22168. SuperMap.GeometrySurfaceAnalystParameters = GeometrySurfaceAnalystParameters;
  22169. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryThiessenAnalystParameters.js
  22170. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22171. * This program are made available under the terms of the Apache License, Version 2.0
  22172. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22173. /**
  22174. * @class SuperMap.GeometryThiessenAnalystParameters
  22175. * @constructs SuperMap.GeometryThiessenAnalystParameters
  22176. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  22177. * @classdesc 几何对象泰森多边形分析参数类。对指定的某个几何对象做泰森多边形分析。通过该类可以指定要做泰森多边形分析的几何对象、返回数据集名称等。
  22178. * @param {Object} options - 参数。
  22179. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} options.points - 使用点数组进行分析时使用的几何对象。
  22180. * @extends {SuperMap.ThiessenAnalystParameters}
  22181. */
  22182. class GeometryThiessenAnalystParameters extends ThiessenAnalystParameters {
  22183. constructor(options) {
  22184. super(options);
  22185. /**
  22186. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} SuperMap.GeometryThiessenAnalystParameters.prototype.points
  22187. * @description 使用点数组进行分析时使用的几何对象。
  22188. */
  22189. this.points = null;
  22190. if (options) {
  22191. Util.extend(this, options);
  22192. }
  22193. this.CLASS_NAME = "SuperMap.GeometryThiessenAnalystParameters";
  22194. }
  22195. /**
  22196. * @function SuperMap.GeometryThiessenAnalystParameters.prototype.destroy
  22197. * @override
  22198. */
  22199. destroy() {
  22200. super.destroy();
  22201. var me = this;
  22202. if (me.points) {
  22203. for (var i = me.points.length - 1; i >= 0; i--) {
  22204. me.points[i].destroy();
  22205. }
  22206. me.points = null;
  22207. }
  22208. }
  22209. /**
  22210. * @function SuperMap.GeometryThiessenAnalystParameters.toObject
  22211. * @param {SuperMap.GeometryThiessenAnalystParameters} geometryThiessenAnalystParameters - 几何对象泰森多边形分析参数类。
  22212. * @param {SuperMap.GeometryThiessenAnalystParameters} tempObj - 几何对象泰森多边形分析参数对象。
  22213. * @description 将几何对象泰森多边形分析参数对象转换为 JSON 对象。
  22214. * @returns {Object} JSON 对象。
  22215. */
  22216. static toObject(geometryThiessenAnalystParameters, tempObj) {
  22217. for (var name in geometryThiessenAnalystParameters) {
  22218. if (name === "clipRegion") {
  22219. tempObj.clipRegion = ServerGeometry.fromGeometry(geometryThiessenAnalystParameters.clipRegion);
  22220. } else {
  22221. tempObj[name] = geometryThiessenAnalystParameters[name];
  22222. }
  22223. }
  22224. }
  22225. }
  22226. SuperMap.GeometryThiessenAnalystParameters = GeometryThiessenAnalystParameters;
  22227. ;// CONCATENATED MODULE: ./src/common/iServer/GeoprocessingService.js
  22228. /**
  22229. * @class SuperMap.GeoprocessingService
  22230. * @category iServer GeoprocessingService
  22231. * @classdesc 地理处理服务接口的基类。
  22232. * @version 10.1.0
  22233. * @extends {SuperMap.CommonServiceBase}
  22234. * @param {string} url - 服务地址。
  22235. * @param {Object} options - 参数。
  22236. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  22237. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,iServer|iPortal|Online。
  22238. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22239. */
  22240. class GeoprocessingService_GeoprocessingService extends CommonServiceBase {
  22241. constructor(url, options) {
  22242. options = options || {};
  22243. options.EVENT_TYPES = ['processCompleted', 'processFailed', 'processRunning'];
  22244. super(url, options);
  22245. this.CLASS_NAME = 'SuperMap.GeoprocessingService';
  22246. this.headers = {};
  22247. this.crossOrigin = true;
  22248. }
  22249. /**
  22250. * @function SuperMap.GeoprocessingService.prototype.getTools
  22251. * @description 获取地理处理工具列表。
  22252. */
  22253. getTools() {
  22254. this._get(`${this.url}/list`);
  22255. }
  22256. /**
  22257. * @function SuperMap.GeoprocessingService.prototype.getTool
  22258. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  22259. * @param {string} identifier - 地理处理工具ID。
  22260. */
  22261. getTool(identifier) {
  22262. this._get(`${this.url}/${identifier}`);
  22263. }
  22264. /**
  22265. * @function SuperMap.GeoprocessingService.prototype.execute
  22266. * @description 同步执行地理处理工具。
  22267. * @param {string} identifier - 地理处理工具ID。
  22268. * @param {Object} parameter - 地理处理工具的输入参数。
  22269. * @param {Object} environment - 地理处理工具的环境参数。
  22270. */
  22271. execute(identifier, parameter, environment) {
  22272. parameter = parameter ? parameter : null;
  22273. environment = environment ? environment : null;
  22274. const executeParamter = { parameter, environment };
  22275. this._get(`${this.url}/${identifier}/execute`, executeParamter);
  22276. }
  22277. /**
  22278. * @function SuperMap.GeoprocessingService.prototype.submitJob
  22279. * @description 异步执行地理处理工具。
  22280. * @param {string} identifier - 地理处理工具ID。
  22281. * @param {Object} parameter - 地理处理工具的输入参数。
  22282. * @param {Object} environments - 地理处理工具的环境参数。
  22283. */
  22284. submitJob(identifier, parameter, environments) {
  22285. parameter = parameter ? parameter : null;
  22286. environments = environments ? environments : null;
  22287. const asyncParamter = { parameter: parameter, environments: environments };
  22288. this.request({
  22289. url: `${this.url}/${identifier}/jobs`,
  22290. headers: { 'Content-type': 'application/json' },
  22291. method: 'POST',
  22292. data: JSON.stringify(asyncParamter),
  22293. scope: this,
  22294. success: this.serviceProcessCompleted,
  22295. failure: this.serviceProcessFailed
  22296. });
  22297. }
  22298. /**
  22299. * @function SuperMap.GeoprocessingService.prototype.waitForJobCompletion
  22300. * @description 获取地理处理异步执行状态信息。
  22301. * @param {string} jobId - 地理处理任务ID。
  22302. * @param {string} identifier - 地理处理工具ID。
  22303. * @param {Object} options - 状态信息参数。
  22304. * @param {number} options.interval - 定时器时间间隔。
  22305. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  22306. */
  22307. waitForJobCompletion(jobId, identifier, options) {
  22308. const me = this;
  22309. const timer = setInterval(function () {
  22310. const serviceProcessCompleted = function (serverResult) {
  22311. const state = serverResult.state.runState;
  22312. if (options.statusCallback) {
  22313. options.statusCallback(state);
  22314. }
  22315. switch (state) {
  22316. case 'FINISHED':
  22317. clearInterval(timer);
  22318. me.events.triggerEvent('processCompleted', {
  22319. result: serverResult
  22320. });
  22321. break;
  22322. case 'FAILED':
  22323. clearInterval(timer);
  22324. me.events.triggerEvent('processFailed', {
  22325. result: serverResult
  22326. });
  22327. break;
  22328. case 'CANCELED':
  22329. clearInterval(timer);
  22330. me.events.triggerEvent('processFailed', {
  22331. result: serverResult
  22332. });
  22333. break;
  22334. }
  22335. };
  22336. me._get(`${me.url}/${identifier}/jobs/${jobId}`, null, serviceProcessCompleted);
  22337. }, options.interval);
  22338. }
  22339. /**
  22340. * @function SuperMap.GeoprocessingService.prototype.getJobInfo
  22341. * @description 获取地理处理任务的执行信息。
  22342. * @param {string} identifier - 地理处理工具ID。
  22343. * @param {string} jobId - 地理处理任务ID。
  22344. */
  22345. getJobInfo(identifier, jobId) {
  22346. this._get(`${this.url}/${identifier}/jobs/${jobId}`);
  22347. }
  22348. /**
  22349. * @function SuperMap.GeoprocessingService.prototype.cancelJob
  22350. * @description 取消地理处理任务的异步执行。
  22351. * @param {string} identifier - 地理处理工具ID。
  22352. * @param {string} jobId - 地理处理任务ID。
  22353. */
  22354. cancelJob(identifier, jobId) {
  22355. this._get(`${this.url}/${identifier}/jobs/${jobId}/cancel`);
  22356. }
  22357. /**
  22358. * @function SuperMap.GeoprocessingService.prototype.getJobs
  22359. * @description 获取地理处理服务任务列表。
  22360. * @param {string} identifier - 地理处理工具ID。(传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  22361. */
  22362. getJobs(identifier) {
  22363. let url = `${this.url}/jobs`;
  22364. if (identifier) {
  22365. url = `${this.url}/${identifier}/jobs`;
  22366. }
  22367. this._get(url);
  22368. }
  22369. /**
  22370. * @function SuperMap.GeoprocessingService.prototype.getResults
  22371. * @description 地理处理工具执行的结果等,支持结果过滤。
  22372. * @param {string} identifier - 地理处理工具ID。
  22373. * @param {string} jobId - 地理处理任务ID。
  22374. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  22375. */
  22376. getResults(identifier, jobId, filter) {
  22377. let url = `${this.url}/${identifier}/jobs/${jobId}/results`;
  22378. if (filter) {
  22379. url = `${url}/${filter}`;
  22380. }
  22381. this._get(url);
  22382. }
  22383. _get(url, paramter, serviceProcessCompleted, serviceProcessFailed) {
  22384. this.request({
  22385. url: url,
  22386. method: 'GET',
  22387. params: paramter,
  22388. headers: { 'Content-type': 'application/json' },
  22389. scope: this,
  22390. success: serviceProcessCompleted ? serviceProcessCompleted : this.serviceProcessCompleted,
  22391. failure: serviceProcessFailed ? serviceProcessFailed : this.serviceProcessFailed
  22392. });
  22393. }
  22394. }
  22395. SuperMap.GeoprocessingService = GeoprocessingService_GeoprocessingService;
  22396. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystParameters.js
  22397. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22398. * This program are made available under the terms of the Apache License, Version 2.0
  22399. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22400. /**
  22401. * @class SuperMap.GeoRelationAnalystParameters
  22402. * @category iServer SpatialAnalyst GeoRelationAnalyst
  22403. * @classdesc 空间关系分析服务参数类。使用该类可以为空间关系分析服务提供所需的参数信息。
  22404. * @param {Object} options - 参数。
  22405. * @param {SuperMap.FilterParameter} options.sourceFilter - 空间关系分析中的源数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  22406. * @param {SuperMap.FilterParameter} options.referenceFilter - 空间关系分析中的参考数据集查询参数。仅 name, ids, attributeFilter 和 fields 字段有效。
  22407. * @param {SuperMap.SpatialRelationType} options.spatialRelationType - 指定的空间关系类型。
  22408. * @param {boolean} [options.isBorderInside] - 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  22409. * @param {boolean} [options.returnFeature] - 是否返回 Feature 信息。
  22410. * @param {boolean} [options.returnGeoRelatedOnly=true] - 仅返回满足指定空间关系的空间对象。
  22411. * @param {number} [options.startRecord=0] - 分析结果起始记录位置。
  22412. * @param {number} [options.expectCount=500] - 空间关系分析期望返回结果记录数,如果实际不足500条结果则返回所有分析结果。
  22413. */
  22414. class GeoRelationAnalystParameters {
  22415. constructor(options) {
  22416. /**
  22417. * @member {string} SuperMap.GeoRelationAnalystParameters.prototype.dataset
  22418. * @description 源数据集名称。
  22419. */
  22420. this.dataset = null;
  22421. /**
  22422. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.sourceFilter
  22423. * @description 空间关系分析中的源数据集查询参数。仅 ids、attributeFilter 和 fields 字段有效。
  22424. */
  22425. this.sourceFilter = null;
  22426. /**
  22427. * @member {SuperMap.FilterParameter} SuperMap.GeoRelationAnalystParameters.prototype.referenceFilter
  22428. * @description 空间关系分析中的参考数据集查询参数。仅 name,ids,attributeFilter 和 fields 字段有效。
  22429. */
  22430. this.referenceFilter = null;
  22431. /**
  22432. * @member {SuperMap.SpatialRelationType} SuperMap.GeoRelationAnalystParameters.prototype.spatialRelationType
  22433. * @description 指定的空间关系类型。
  22434. */
  22435. this.spatialRelationType = null;
  22436. /**
  22437. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.isBorderInside]
  22438. * @description 边界处理方式,即位于面边线上的点是否被面包含。此参数仅用于空间关系为包含或被包含的情况。
  22439. */
  22440. this.isBorderInside = null;
  22441. /**
  22442. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnFeature]
  22443. * @description 是否返回 Feature 信息。
  22444. */
  22445. this.returnFeature = null;
  22446. /**
  22447. * @member {boolean} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=true]
  22448. * @description 是否仅返回满足指定空间关系的空间对象。
  22449. */
  22450. this.returnGeoRelatedOnly = null;
  22451. /**
  22452. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.returnGeoRelatedOnly=0]
  22453. * @description 分析结果起始记录位置。
  22454. */
  22455. this.startRecord = 0;
  22456. /**
  22457. * @member {number} [SuperMap.GeoRelationAnalystParameters.prototype.expectCount=500]
  22458. * @description 空间关系分析期望返回结果记录数,如果实际不足 500 条结果则返回所有分析结果。
  22459. */
  22460. this.expectCount = 500;
  22461. if (options) {
  22462. Util.extend(this, options);
  22463. }
  22464. this.CLASS_NAME = "SuperMap.GeoRelationAnalystParameters";
  22465. }
  22466. /**
  22467. * @function SuperMap.GeoRelationAnalystParameters.prototype.destroy
  22468. * @description 释放资源,将引用资源的属性置空。
  22469. */
  22470. destroy() {
  22471. var me = this;
  22472. if (me.sourceFilter) {
  22473. me.sourceFilter.destroy();
  22474. }
  22475. me.sourceFilter = null;
  22476. if (me.referenceFilter) {
  22477. me.referenceFilter.destroy();
  22478. }
  22479. me.referenceFilter = null;
  22480. me.dataset = null;
  22481. me.spatialRelationType = null;
  22482. me.isBorderInside = null;
  22483. me.returnFeature = null;
  22484. me.returnGeoRelatedOnly = null;
  22485. me.startRecord = null;
  22486. me.expectCount = null;
  22487. }
  22488. }
  22489. SuperMap.GeoRelationAnalystParameters = GeoRelationAnalystParameters;
  22490. ;// CONCATENATED MODULE: ./src/common/iServer/GeoRelationAnalystService.js
  22491. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22492. * This program are made available under the terms of the Apache License, Version 2.0
  22493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22494. /**
  22495. * @class SuperMap.GeoRelationAnalystService
  22496. * @category iServer SpatialAnalyst GeoRelationAnalyst
  22497. * @classdesc 空间关系分析服务类。该类负责将客户设置的空间关系分析服务参数传递给服务端,并接收服务端返回的空间关系分析结果数据。
  22498. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  22499. * @param {Object} options - 参数。</br>
  22500. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  22501. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22502. * @param {Object} [options.headers] - 请求头。
  22503. * @extends {SuperMap.SpatialAnalystBase}
  22504. * @example 实例化该类如下例所示:
  22505. * (start code)
  22506. * function datasetGeoRelationAnalystProcess() {
  22507. * var referenceFilter = new SuperMap.FilterParameter({
  22508. * name:"Frame_R@Changchun",
  22509. * attributeFilter:"SmID>0"});
  22510. * var sourceFilter = new SuperMap.FilterParameter({
  22511. * attributeFilter:"SmID>0"});
  22512. * //初始化服务类
  22513. * var datasetGeoRelationService = new SuperMap.GeoRelationAnalystService(
  22514. * "http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst/"),
  22515. * //构建参数类
  22516. * datasetGeoRelationParameters = new SuperMap.GeoRelationAnalystParameters({
  22517. * dataset: "Park@Changchun",
  22518. * startRecord: 0,
  22519. * expectCount: 20,
  22520. * sourceFilter: sourceFilter,
  22521. * referenceFilter: referenceFilter,
  22522. * spatialRelationType: SuperMap.SpatialRelationType.INTERSECT,
  22523. * isBorderInside: true,
  22524. * returnFeature: true,
  22525. * returnGeoRelatedOnly: true
  22526. * });
  22527. * datasetGeoRelationService.events.on({
  22528. * "processCompleted": datasetGeoRelationAnalystCompleted,
  22529. * "processFailed": datasetGeoRelationAnalystFailed});
  22530. * //执行
  22531. * datasetGeoRelationService.processAsync(datasetGeoRelationParameters);
  22532. * }
  22533. * function Completed(datasetGeoRelationAnalystCompleted){//todo};
  22534. * function Error(datasetGeoRelationAnalystFailed){//todo};
  22535. * (end)
  22536. *
  22537. */
  22538. class GeoRelationAnalystService extends SpatialAnalystBase {
  22539. constructor(url, options) {
  22540. super(url, options);
  22541. this.CLASS_NAME = "SuperMap.GeoRelationAnalystService";
  22542. }
  22543. /**
  22544. * @function SuperMap.GeoRelationAnalystService.prototype.destroy
  22545. * @override
  22546. */
  22547. destroy() {
  22548. super.destroy();
  22549. }
  22550. /**
  22551. * @function SuperMap.GeoRelationAnalystService.prototype.processAsync
  22552. * @description 负责将客户端的空间关系分析参数传递到服务端
  22553. * @param {SuperMap.GeoRelationAnalystParameters} parameter - 空间关系分析所需的参数信息。
  22554. */
  22555. processAsync(parameter) {
  22556. if (!(parameter instanceof GeoRelationAnalystParameters)) {
  22557. return;
  22558. }
  22559. var me = this;
  22560. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/georelation');
  22561. var jsonParameters = SuperMap.Util.toJSON(parameter);
  22562. me.url = Util.urlAppend(me.url, 'returnContent=true');
  22563. me.request({
  22564. method: "POST",
  22565. data: jsonParameters,
  22566. scope: me,
  22567. success: me.serviceProcessCompleted,
  22568. failure: me.serviceProcessFailed
  22569. });
  22570. }
  22571. }
  22572. SuperMap.GeoRelationAnalystService = GeoRelationAnalystService;
  22573. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesParametersBase.js
  22574. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22575. * This program are made available under the terms of the Apache License, Version 2.0
  22576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22577. /**
  22578. * @class SuperMap.GetFeaturesParametersBase
  22579. * @category iServer Data FeatureResults
  22580. * @classdesc 要素查询参数基类。
  22581. * @param {Object} options - 参数。
  22582. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22583. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22584. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22585. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22586. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22587. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22588. */
  22589. class GetFeaturesParametersBase {
  22590. constructor(options) {
  22591. /**
  22592. * @member {Array.<string>} SuperMap.GetFeaturesParametersBase.prototype.datasetName
  22593. * @description 数据集集合中的数据集名称列表。
  22594. */
  22595. this.datasetNames = null;
  22596. /**
  22597. * @member {string} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  22598. * @description 动态投影的目标坐标系对应的 EPSG Code,使用时需设置 returnContent 参数为 true。
  22599. */
  22600. this.targetEpsgCode = null;
  22601. /**
  22602. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.targetEpsgCode
  22603. * @description 动态投影的目标坐标系。使用时需设置 returnContent 参数为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22604. */
  22605. this.targetPrj = null;
  22606. /**
  22607. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnContent=true]
  22608. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  22609. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  22610. * 如果为 false,则返回的是查询结果资源的 URI。
  22611. */
  22612. this.returnContent = true;
  22613. /**
  22614. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.fromIndex=0]
  22615. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  22616. */
  22617. this.fromIndex = 0;
  22618. /**
  22619. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.toIndex=19]
  22620. * @description 查询结果的最大索引号。如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  22621. */
  22622. this.toIndex = 19;
  22623. /**
  22624. * @member {boolean} [SuperMap.GetFeaturesParametersBase.prototype.returnCountOnly=false]
  22625. * @description 只返回查询结果的总数。
  22626. */
  22627. this.returnCountOnly = false;
  22628. /**
  22629. * @member {number} [SuperMap.GetFeaturesParametersBase.prototype.maxFeatures=1000]
  22630. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  22631. */
  22632. this.maxFeatures = null;
  22633. /**
  22634. * @member {Object} SuperMap.GetFeaturesParametersBase.prototype.aggregations
  22635. * @description 聚合查询参数,该参数仅支持数据来源 Elasticsearch 服务的数据服务。
  22636. */
  22637. this.aggregations = null;
  22638. Util.extend(this, options);
  22639. this.CLASS_NAME = "SuperMap.GetFeaturesParametersBase";
  22640. }
  22641. /**
  22642. *
  22643. * @function SuperMap.GetFeaturesParametersBase.prototype.destroy
  22644. * @description 释放资源,将引用资源的属性置空。
  22645. */
  22646. destroy() {
  22647. var me = this;
  22648. me.datasetNames = null;
  22649. me.returnContent = null;
  22650. me.fromIndex = null;
  22651. me.toIndex = null;
  22652. me.maxFeatures = null;
  22653. me.targetEpsgCode = null;
  22654. me.targetPrj = null;
  22655. if (me.aggregation) {
  22656. me.aggregation = null;
  22657. }
  22658. }
  22659. }
  22660. SuperMap.GetFeaturesParametersBase = GetFeaturesParametersBase;
  22661. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsParameters.js
  22662. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22663. * This program are made available under the terms of the Apache License, Version 2.0
  22664. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22665. /**
  22666. * @class SuperMap.GetFeaturesByBoundsParameters
  22667. * @category iServer Data FeatureResults
  22668. * @classdesc 数据集范围查询参数类,该类用于设置数据集范围查询的相关参数。
  22669. * @param {Object} options - 参数。
  22670. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 用于查询的范围对象。
  22671. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  22672. * @param {string} [options.attributeFilter] - 范围查询属性过滤条件。
  22673. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22674. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  22675. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22676. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22677. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22678. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22679. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22680. * @extends {SuperMap.GetFeaturesParametersBase}
  22681. */
  22682. class GetFeaturesByBoundsParameters extends GetFeaturesParametersBase {
  22683. constructor(options) {
  22684. super(options);
  22685. /**
  22686. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.getFeatureMode
  22687. * @description 数据集查询模式。范围查询有 "BOUNDS","BOUNDS_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 BOUNDS_ATTRIBUTEFILTER 访问服务。
  22688. */
  22689. this.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS;
  22690. /**
  22691. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.GetFeaturesByBoundsParameters.prototype.bounds
  22692. * @description 用于查询的范围对象。
  22693. *
  22694. */
  22695. this.bounds = null;
  22696. /**
  22697. * @member {Array.<string>} SuperMap.GetFeaturesByBoundsParameters.prototype.fields
  22698. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  22699. */
  22700. this.fields = null;
  22701. /**
  22702. * @member {string} SuperMap.GetFeaturesByBoundsParameters.prototype.attributeFilter
  22703. * @description 范围查询属性过滤条件。
  22704. */
  22705. this.attributeFilter = null;
  22706. /**
  22707. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByBoundsParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  22708. * @description 空间查询模式常量。
  22709. */
  22710. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  22711. Util.extend(this, options);
  22712. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsParameters";
  22713. }
  22714. /**
  22715. * @function SuperMap.GetFeaturesByBoundsParameters.prototype.destroy
  22716. * @override
  22717. */
  22718. destroy() {
  22719. super.destroy();
  22720. var me = this;
  22721. if (me.bounds) {
  22722. me.bounds.destroy();
  22723. me.bounds = null;
  22724. }
  22725. if (me.fields) {
  22726. while (me.fields.length > 0) {
  22727. me.fields.pop();
  22728. }
  22729. me.fields = null;
  22730. }
  22731. me.attributeFilter = null;
  22732. me.spatialQueryMode = null;
  22733. me.getFeatureMode = null;
  22734. }
  22735. /**
  22736. * @function SuperMap.GetFeaturesByBoundsParameters.toJsonParameters
  22737. * @description 将 {@link SuperMap.GetFeaturesByBoundsParameters} 对象参数转换为 JSON 字符串。
  22738. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 范围查询参数。
  22739. * @returns {string} 转化后的 JSON 字符串。
  22740. *
  22741. */
  22742. static toJsonParameters(params) {
  22743. var filterParameter,
  22744. bounds,
  22745. parasByBounds;
  22746. bounds = {
  22747. "leftBottom": {"x": params.bounds.left, "y": params.bounds.bottom},
  22748. "rightTop": {"x": params.bounds.right, "y": params.bounds.top}
  22749. };
  22750. parasByBounds = {
  22751. datasetNames: params.datasetNames,
  22752. getFeatureMode: GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS,
  22753. bounds: bounds,
  22754. spatialQueryMode: params.spatialQueryMode
  22755. };
  22756. if (params.fields) {
  22757. filterParameter = new FilterParameter();
  22758. filterParameter.name = params.datasetNames;
  22759. filterParameter.fields = params.fields;
  22760. parasByBounds.queryParameter = filterParameter;
  22761. }
  22762. if (params.attributeFilter) {
  22763. parasByBounds.attributeFilter = params.attributeFilter;
  22764. parasByBounds.getFeatureMode = GetFeaturesByBoundsParameters.getFeatureMode.BOUNDS_ATTRIBUTEFILTER;
  22765. }
  22766. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  22767. parasByBounds.maxFeatures = params.maxFeatures;
  22768. }
  22769. if (params.targetEpsgCode) {
  22770. parasByBounds.targetEpsgCode = params.targetEpsgCode;
  22771. }
  22772. if (!params.targetEpsgCode && params.targetPrj) {
  22773. parasByBounds.targetPrj = params.targetPrj;
  22774. }
  22775. return Util.toJSON(parasByBounds);
  22776. }
  22777. }
  22778. GetFeaturesByBoundsParameters.getFeatureMode = {
  22779. "BOUNDS": "BOUNDS",
  22780. "BOUNDS_ATTRIBUTEFILTER": "BOUNDS_ATTRIBUTEFILTER"
  22781. };
  22782. SuperMap.GetFeaturesByBoundsParameters = GetFeaturesByBoundsParameters;
  22783. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesServiceBase.js
  22784. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22785. * This program are made available under the terms of the Apache License, Version 2.0
  22786. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22787. /**
  22788. * @class SuperMap.GetFeaturesServiceBase
  22789. * @category iServer Data FeatureResults
  22790. * @classdesc 数据服务中数据集查询服务基类。获取结果数据类型为 Object。包含 result 属性,result 的数据格式根据 format 参数决定为 GeoJSON 或者 iServerJSON。
  22791. * @extends SuperMap.CommonServiceBase
  22792. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  22793. * URL应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/
  22794. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22795. * @param {Object} options - 参数。
  22796. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22797. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22798. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22799. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22800. * @param {Object} [options.headers] - 请求头。
  22801. * @example
  22802. * var myService = new SuperMap.GetFeaturesServiceBase(url, {
  22803. * eventListeners: {
  22804. * "processCompleted": getFeatureCompleted,
  22805. * "processFailed": getFeatureError
  22806. * }
  22807. * });
  22808. */
  22809. class GetFeaturesServiceBase extends CommonServiceBase {
  22810. constructor(url, options) {
  22811. super(url, options);
  22812. options = options || {};
  22813. /**
  22814. * @member {boolean} [SuperMap.GetFeaturesServiceBase.prototype.returnContent=true]
  22815. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  22816. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  22817. * 如果为 false,则返回的是查询结果资源的 URI。
  22818. */
  22819. this.returnContent = true;
  22820. /**
  22821. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.fromIndex=0]
  22822. * @description 查询结果的最小索引号。如果该值大于查询结果的最大索引号,则查询结果为空。
  22823. */
  22824. this.fromIndex = 0;
  22825. /**
  22826. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.toIndex=19]
  22827. * @description 查询结果的最大索引号。
  22828. * 如果该值大于查询结果的最大索引号,则以查询结果的最大索引号为终止索引号。
  22829. */
  22830. this.toIndex = 19;
  22831. /**
  22832. * @member {number} [SuperMap.GetFeaturesServiceBase.prototype.maxFeatures=1000]
  22833. * @description 进行 SQL 查询时,用于设置服务端返回查询结果条目数量。
  22834. */
  22835. this.maxFeatures = null;
  22836. /**
  22837. * @member {string} [SuperMap.GetFeaturesServiceBase.prototype.format=SuperMap.DataFormat.GEOJSON]
  22838. * @description 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。
  22839. * 参数格式为 "ISERVER","GEOJSON"。
  22840. */
  22841. this.format = DataFormat.GEOJSON;
  22842. Util.extend(this, options);
  22843. this.url = Util.urlPathAppend(this.url, 'featureResults');
  22844. this.CLASS_NAME = "SuperMap.GetFeaturesServiceBase";
  22845. }
  22846. /**
  22847. * @function SuperMap.GetFeaturesServiceBase.prototype.destroy
  22848. * @description 释放资源,将引用资源的属性置空。
  22849. */
  22850. destroy() {
  22851. super.destroy();
  22852. var me = this;
  22853. me.returnContent = null;
  22854. me.fromIndex = null;
  22855. me.toIndex = null;
  22856. me.maxFeatures = null;
  22857. me.format = null;
  22858. }
  22859. /**
  22860. * @function SuperMap.GetFeaturesServiceBase.prototype.processAsync
  22861. * @description 将客户端的查询参数传递到服务端。
  22862. * @param {Object} params - 查询参数。
  22863. */
  22864. processAsync(params) {
  22865. if (!params) {
  22866. return;
  22867. }
  22868. var me = this,
  22869. jsonParameters = null,
  22870. firstPara = true;
  22871. me.returnContent = params.returnContent;
  22872. me.fromIndex = params.fromIndex;
  22873. me.toIndex = params.toIndex;
  22874. me.maxFeatures = params.maxFeatures;
  22875. if (me.returnContent) {
  22876. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  22877. firstPara = false;
  22878. }
  22879. var isValidNumber = me.fromIndex != null && me.toIndex != null && !isNaN(me.fromIndex) && !isNaN(me.toIndex);
  22880. if (isValidNumber && me.fromIndex >= 0 && me.toIndex >= 0 && !firstPara) {
  22881. me.url = Util.urlAppend(me.url, `fromIndex=${me.fromIndex}&toIndex=${me.toIndex}`);
  22882. }
  22883. if (params.returnCountOnly) {
  22884. me.url = Util.urlAppend(me.url, "&returnCountOnly=" + params.returnContent)
  22885. }
  22886. jsonParameters = me.getJsonParameters(params);
  22887. me.request({
  22888. method: "POST",
  22889. data: jsonParameters,
  22890. scope: me,
  22891. success: me.serviceProcessCompleted,
  22892. failure: me.serviceProcessFailed
  22893. });
  22894. }
  22895. /**
  22896. * @function SuperMap.GetFeaturesServiceBase.prototype.getFeatureComplete
  22897. * @description 查询完成,执行此方法。
  22898. * @param {Object} result - 服务器返回的结果对象。
  22899. */
  22900. serviceProcessCompleted(result) {
  22901. var me = this;
  22902. result = Util.transformResult(result);
  22903. if (me.format === DataFormat.GEOJSON && result.features) {
  22904. var geoJSONFormat = new GeoJSON();
  22905. result.features = geoJSONFormat.toGeoJSON(result.features);
  22906. }
  22907. me.events.triggerEvent("processCompleted", {result: result});
  22908. }
  22909. }
  22910. SuperMap.GetFeaturesServiceBase = GetFeaturesServiceBase;
  22911. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBoundsService.js
  22912. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22913. * This program are made available under the terms of the Apache License, Version 2.0
  22914. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22915. /**
  22916. * @class SuperMap.GetFeaturesByBoundsService
  22917. * @category iServer Data FeatureResults
  22918. * @classdesc 数据集范围查询服务类,查询与指定范围对象符合一定空间关系的矢量要素。
  22919. * @description 数据集范围查询服务类构造函数。
  22920. * @extends {SuperMap.GetFeaturesServiceBase}
  22921. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  22922. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  22923. * @param {Object} options - 参数。
  22924. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  22925. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  22926. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  22927. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  22928. * @param {Object} [options.headers] - 请求头。
  22929. * @example
  22930. * var myGetFeaturesByBoundsService = new SuperMa.GetFeaturesByBoundsService(url, {
  22931. * eventListeners: {
  22932. * "processCompleted": getFeatureCompleted,
  22933. * "processFailed": getFeatureError
  22934. * }
  22935. * });
  22936. * function getFeatureCompleted(object){//todo};
  22937. * function getFeatureError(object){//todo}
  22938. */
  22939. class GetFeaturesByBoundsService extends GetFeaturesServiceBase {
  22940. constructor(url, options) {
  22941. super(url, options);
  22942. this.CLASS_NAME = "SuperMap.GetFeaturesByBoundsService";
  22943. }
  22944. /**
  22945. * @function SuperMap.GetFeaturesByBoundsService.prototype.destroy
  22946. * @override
  22947. */
  22948. destroy() {
  22949. super.destroy();
  22950. }
  22951. /**
  22952. * @function SuperMap.GetFeaturesByBoundsService.prototype.getJsonParameters
  22953. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry,Bounds等)。
  22954. * @param params {SuperMap.GetFeaturesByBoundsParameters}
  22955. * @returns {string} 转化后的 JSON 字符串。
  22956. *
  22957. */
  22958. getJsonParameters(params) {
  22959. return GetFeaturesByBoundsParameters.toJsonParameters(params);
  22960. }
  22961. }
  22962. SuperMap.GetFeaturesByBoundsService = GetFeaturesByBoundsService;
  22963. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferParameters.js
  22964. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  22965. * This program are made available under the terms of the Apache License, Version 2.0
  22966. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  22967. /**
  22968. * @class SuperMap.GetFeaturesByBufferParameters
  22969. * @category iServer Data FeatureResults
  22970. * @classdesc 数据服务中数据集缓冲区查询参数类。
  22971. * @param {Object} options - 参数。
  22972. * @param {number} options.bufferDistance - buffer 距离,单位与所查询图层对应的数据集单位相同。
  22973. * @param {Object} options.geometry - 空间查询条件。</br>
  22974. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  22975. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  22976. * @param {string} [options.attributeFilter] - 属性查询条件。
  22977. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  22978. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  22979. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  22980. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  22981. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  22982. * @extends {SuperMap.GetFeaturesParametersBase}
  22983. */
  22984. class GetFeaturesByBufferParameters extends GetFeaturesParametersBase {
  22985. constructor(options) {
  22986. super(options);
  22987. /**
  22988. * @member {number} SuperMap.GetFeaturesByBufferParameters.prototype.bufferDistance
  22989. * @description buffer 距离,单位与所查询图层对应的数据集单位相同。
  22990. */
  22991. this.bufferDistance = null;
  22992. /**
  22993. * @member {string} SuperMap.GetFeaturesByBufferParameters.prototype.attributeFilter
  22994. * @description 属性查询条件。
  22995. */
  22996. this.attributeFilter = null;
  22997. /**
  22998. * @member {Object} SuperMap.GetFeaturesByBufferParameters.prototype.geometry
  22999. * @description 空间查询条件。 <br>
  23000. * 点类型可以是:{@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>
  23001. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  23002. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  23003. */
  23004. this.geometry = null;
  23005. /**
  23006. * @member {Array.<string>} SuperMap.GetFeaturesByBufferParameters.prototype.fields
  23007. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  23008. */
  23009. this.fields = null;
  23010. Util.extend(this, options);
  23011. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferParameters";
  23012. }
  23013. /**
  23014. * @function SuperMap.GetFeaturesByBufferParameters.prototype.destroy
  23015. * @override
  23016. */
  23017. destroy() {
  23018. super.destroy();
  23019. var me = this;
  23020. me.bufferDistance = null;
  23021. me.attributeFilter = null;
  23022. if (me.fields) {
  23023. while (me.fields.length > 0) {
  23024. me.fields.pop();
  23025. }
  23026. me.fields = null;
  23027. }
  23028. if (me.geometry) {
  23029. me.geometry.destroy();
  23030. me.geometry = null;
  23031. }
  23032. }
  23033. /**
  23034. * @function SuperMap.GetFeaturesByBufferParameters.toJsonParameters
  23035. * @description 将 SuperMap.GetFeaturesByBufferParameters 对象转换为 JSON 字符串。
  23036. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数对象。
  23037. * @returns {string} 转化后的 JSON 字符串。
  23038. */
  23039. static toJsonParameters(params) {
  23040. var filterParameter,
  23041. paramsBySql,
  23042. geometry;
  23043. geometry = ServerGeometry.fromGeometry(params.geometry);
  23044. paramsBySql = {
  23045. datasetNames: params.datasetNames,
  23046. getFeatureMode: "BUFFER",
  23047. bufferDistance: params.bufferDistance,
  23048. geometry: geometry
  23049. };
  23050. if (params.fields) {
  23051. filterParameter = new FilterParameter();
  23052. filterParameter.name = params.datasetNames;
  23053. filterParameter.fields = params.fields;
  23054. paramsBySql.queryParameter = filterParameter;
  23055. }
  23056. if (params.attributeFilter) {
  23057. paramsBySql.attributeFilter = params.attributeFilter;
  23058. paramsBySql.getFeatureMode = "BUFFER_ATTRIBUTEFILTER";
  23059. }
  23060. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  23061. paramsBySql.maxFeatures = params.maxFeatures;
  23062. }
  23063. if (params.targetEpsgCode) {
  23064. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  23065. }
  23066. if (!params.targetEpsgCode && params.targetPrj) {
  23067. paramsBySql.targetPrj = params.targetPrj;
  23068. }
  23069. return Util.toJSON(paramsBySql);
  23070. }
  23071. }
  23072. SuperMap.GetFeaturesByBufferParameters = GetFeaturesByBufferParameters;
  23073. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByBufferService.js
  23074. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23075. * This program are made available under the terms of the Apache License, Version 2.0
  23076. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23077. /**
  23078. * @class SuperMap.GetFeaturesByBufferService
  23079. * @category iServer Data FeatureResults
  23080. * @classdesc 数据服务中数据集缓冲区查询服务类。
  23081. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  23082. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;
  23083. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  23084. * @param {Object} options - 参数。
  23085. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  23086. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23087. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23088. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23089. * @param {Object} [options.headers] - 请求头。
  23090. * @extends {SuperMap.GetFeaturesServiceBase}
  23091. * @example
  23092. * var myGetFeaturesByBufferService = new SuperMap.GetFeaturesByBufferService(url, {
  23093. * eventListeners: {
  23094. * "processCompleted": GetFeaturesCompleted,
  23095. * "processFailed": GetFeaturesError
  23096. * }
  23097. * });
  23098. * function GetFeaturesCompleted(object){//todo};
  23099. * function GetFeaturesError(object){//todo};
  23100. */
  23101. class GetFeaturesByBufferService extends GetFeaturesServiceBase {
  23102. constructor(url, options) {
  23103. super(url, options);
  23104. this.CLASS_NAME = "SuperMap.GetFeaturesByBufferService";
  23105. }
  23106. /**
  23107. * @function SuperMap.GetFeaturesByBufferService.prototype.destroy
  23108. * @override
  23109. */
  23110. destroy() {
  23111. super.destroy();
  23112. }
  23113. /**
  23114. * @function SuperMap.GetFeaturesByBufferService.prototype.getJsonParameters
  23115. * @description 将查询参数转化为 JSON 字符串。在本类中重写此方法,可以实现不同种类的查询(IDs, SQL, Buffer, Geometry等)。
  23116. * @param {SuperMap.GetFeaturesByBufferParameters} params - 数据集缓冲区查询参数类。
  23117. * @returns {Object} 转化后的 JSON 字符串。
  23118. */
  23119. getJsonParameters(params) {
  23120. if (!(params instanceof GetFeaturesByBufferParameters)) {
  23121. return;
  23122. }
  23123. return SuperMap.GetFeaturesByBufferParameters.toJsonParameters(params);
  23124. }
  23125. }
  23126. SuperMap.GetFeaturesByBufferService = GetFeaturesByBufferService;
  23127. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryParameters.js
  23128. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23129. * This program are made available under the terms of the Apache License, Version 2.0
  23130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23131. /**
  23132. * @class SuperMap.GetFeaturesByGeometryParameters
  23133. * @category iServer Data FeatureResults
  23134. * @classdesc 数据集几何查询参数类。该类用于设置数据集几何查询的相关参数。
  23135. * @param {Object} options - 参数。
  23136. * @param {Object} options.geometry - 用于查询的几何对象。
  23137. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  23138. * @param {string} [options.attributeFilter] - 几何查询属性过滤条件。
  23139. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  23140. * @param {SuperMap.SpatialQueryMode} [options.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式常量。
  23141. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  23142. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  23143. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  23144. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  23145. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  23146. * @extends {SuperMap.GetFeaturesParametersBase}
  23147. */
  23148. class GetFeaturesByGeometryParameters extends GetFeaturesParametersBase {
  23149. constructor(options) {
  23150. super(options);
  23151. /**
  23152. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.getFeatureMode
  23153. * @description 数据集查询模式。几何查询有 "SPATIAL","SPATIAL_ATTRIBUTEFILTER" 两种,当用户设置 attributeFilter 时会自动切换到 SPATIAL_ATTRIBUTEFILTER 访问服务。
  23154. */
  23155. this.getFeatureMode = "SPATIAL";
  23156. /**
  23157. * @member {Object} SuperMap.GetFeaturesByGeometryParameters.prototype.geometry
  23158. * @description 用于查询的几何对象。 </br>
  23159. * 点类型可以是:{@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>
  23160. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。</br>
  23161. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  23162. */
  23163. this.geometry = null;
  23164. /**
  23165. * @member {Array.<string>} SuperMap.GetFeaturesByGeometryParameters.prototype.fields
  23166. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  23167. */
  23168. this.fields = null;
  23169. /**
  23170. * @member {string} SuperMap.GetFeaturesByGeometryParameters.prototype.attributeFilter
  23171. * @description 几何查询属性过滤条件。
  23172. */
  23173. this.attributeFilter = null;
  23174. /**
  23175. * @member {SuperMap.SpatialQueryMode} [SuperMap.GetFeaturesByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.CONTAIN]
  23176. * @description 空间查询模式常量。
  23177. */
  23178. this.spatialQueryMode = SpatialQueryMode.CONTAIN;
  23179. Util.extend(this, options);
  23180. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryParameters";
  23181. }
  23182. /**
  23183. * @function SuperMap.GetFeaturesByGeometryParameters.prototype.destroy
  23184. * @description 释放资源,将引用资源的属性置空。
  23185. */
  23186. destroy() {
  23187. super.destroy();
  23188. var me = this;
  23189. if (me.geometry) {
  23190. me.geometry.destroy();
  23191. me.geometry = null;
  23192. }
  23193. if (me.fields) {
  23194. while (me.fields.length > 0) {
  23195. me.fields.pop();
  23196. }
  23197. me.fields = null;
  23198. }
  23199. me.attributeFilter = null;
  23200. me.spatialQueryMode = null;
  23201. me.getFeatureMode = null;
  23202. }
  23203. /**
  23204. * @function SuperMap.GetFeaturesByGeometryParameters.toJsonParameters
  23205. * @description 将 SuperMap.GetFeaturesByGeometryParameters 对象参数转换为 JSON 字符串。
  23206. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询参数对象。
  23207. * @returns {string} 转化后的 JSON 字符串。
  23208. */
  23209. static toJsonParameters(params) {
  23210. var filterParameter,
  23211. geometry,
  23212. parasByGeometry;
  23213. geometry = ServerGeometry.fromGeometry(params.geometry);
  23214. parasByGeometry = {
  23215. datasetNames: params.datasetNames,
  23216. getFeatureMode: "SPATIAL",
  23217. geometry: geometry,
  23218. spatialQueryMode: params.spatialQueryMode
  23219. };
  23220. if (params.fields) {
  23221. filterParameter = new FilterParameter();
  23222. filterParameter.name = params.datasetNames;
  23223. filterParameter.fields = params.fields;
  23224. parasByGeometry.queryParameter = filterParameter;
  23225. }
  23226. if (params.attributeFilter) {
  23227. parasByGeometry.attributeFilter = params.attributeFilter;
  23228. parasByGeometry.getFeatureMode = "SPATIAL_ATTRIBUTEFILTER";
  23229. }
  23230. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  23231. parasByGeometry.maxFeatures = params.maxFeatures;
  23232. }
  23233. if (params.targetEpsgCode) {
  23234. parasByGeometry.targetEpsgCode = params.targetEpsgCode;
  23235. }
  23236. if (!params.targetEpsgCode && params.targetPrj) {
  23237. parasByGeometry.targetPrj = params.targetPrj;
  23238. }
  23239. return Util.toJSON(parasByGeometry);
  23240. }
  23241. }
  23242. SuperMap.GetFeaturesByGeometryParameters = GetFeaturesByGeometryParameters;
  23243. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByGeometryService.js
  23244. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23245. * This program are made available under the terms of the Apache License, Version 2.0
  23246. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23247. /**
  23248. * @class SuperMap.GetFeaturesByGeometryService
  23249. * @category iServer Data FeatureResults
  23250. * @classdesc 数据集几何查询服务类,查询与指定几何对象符合一定空间关系的矢量要素。
  23251. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  23252. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data;
  23253. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data"
  23254. * @param {Object} options - 参数。</br>
  23255. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  23256. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23257. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23258. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23259. * @param {Object} [options.headers] - 请求头。
  23260. * @extends {SuperMap.GetFeaturesServiceBase}
  23261. * @example
  23262. * var myService = new SuperMap.GetFeaturesByGeometryService(url, {
  23263. * eventListeners: {
  23264. * "processCompleted": getFeatureCompleted,
  23265. * "processFailed": getFeatureError
  23266. * }
  23267. * });
  23268. * function getFeatureCompleted(object){//todo};
  23269. * function getFeatureError(object){//todo}
  23270. */
  23271. class GetFeaturesByGeometryService extends GetFeaturesServiceBase {
  23272. constructor(url, options) {
  23273. super(url, options);
  23274. this.CLASS_NAME = "SuperMap.GetFeaturesByGeometryService";
  23275. }
  23276. /**
  23277. * @function SuperMap.GetFeaturesByGeometryService.prototype.destroy
  23278. * @override
  23279. */
  23280. destroy() {
  23281. super.destroy();
  23282. }
  23283. /**
  23284. * @function SuperMap.GetFeaturesByGeometryService.prototype.getJsonParameters
  23285. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 数据集几何查询参数类。
  23286. * @description 将查询参数转化为 JSON 字符串。
  23287. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  23288. * @returns {Object} 转化后的 JSON 字符串。
  23289. */
  23290. getJsonParameters(params) {
  23291. return GetFeaturesByGeometryParameters.toJsonParameters(params);
  23292. }
  23293. }
  23294. SuperMap.GetFeaturesByGeometryService = GetFeaturesByGeometryService;
  23295. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsParameters.js
  23296. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23297. * This program are made available under the terms of the Apache License, Version 2.0
  23298. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23299. /**
  23300. * @class SuperMap.GetFeaturesByIDsParameters
  23301. * @category iServer Data FeatureResults
  23302. * @classdesc ID查询参数类。
  23303. * @param {Object} options - 参数。
  23304. * @param {Array.<number>} options.IDs - 所要查询指定的元素 ID 信息。
  23305. * @param {Array.<string>} [options.fields] - 设置查询结果返回字段。默认返回所有字段。
  23306. * @param {Array.<string>} options.dataSetNames - 数据集集合中的数据集名称列表。
  23307. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  23308. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  23309. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  23310. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  23311. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  23312. * @extends {SuperMap.GetFeaturesParametersBase}
  23313. */
  23314. class GetFeaturesByIDsParameters extends GetFeaturesParametersBase {
  23315. constructor(options) {
  23316. super(options);
  23317. /**
  23318. * @member {string} SuperMap.GetFeaturesByIDsParameters.prototype.getFeatureMode
  23319. * @description 数据集查询模式。
  23320. */
  23321. this.getFeatureMode = "ID";
  23322. /**
  23323. * @member {Array.<number>} SuperMap.GetFeaturesByIDsParameters.prototype.IDs
  23324. * @description 所要查询指定的元素 ID 信息。
  23325. */
  23326. this.IDs = null;
  23327. /**
  23328. * @member {Array.<string>} SuperMap.GetFeaturesByIDsParameters.prototype.fields
  23329. * @description 设置查询结果返回字段。当指定了返回结果字段后,则 GetFeaturesResult 中的 features 的属性字段只包含所指定的字段。不设置即返回全部字段。
  23330. */
  23331. this.fields = null;
  23332. Util.extend(this, options);
  23333. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsParameters";
  23334. }
  23335. /**
  23336. * @function SuperMap.GetFeaturesByIDsParameters.prototype.destroy
  23337. * @override
  23338. */
  23339. destroy() {
  23340. super.destroy();
  23341. var me = this;
  23342. me.IDs = null;
  23343. me.getFeatureMode = null;
  23344. if (me.fields) {
  23345. while (me.fields.length > 0) {
  23346. me.fields.pop();
  23347. }
  23348. me.fields = null;
  23349. }
  23350. }
  23351. /**
  23352. * @function SuperMap.GetFeaturesByIDsParameters.toJsonParameters
  23353. * @description 将 SuperMap.GetFeaturesByIDsParameters 对象转换为 JSON 字符串。
  23354. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID 查询参数对象。
  23355. * @returns {string} 转化后的 JSON 字符串。
  23356. */
  23357. static toJsonParameters(params) {
  23358. var parasByIDs, filterParameter;
  23359. parasByIDs = {
  23360. datasetNames: params.datasetNames,
  23361. getFeatureMode: "ID",
  23362. ids: params.IDs
  23363. };
  23364. if (params.fields) {
  23365. filterParameter = new FilterParameter();
  23366. filterParameter.name = params.datasetNames;
  23367. filterParameter.fields = params.fields;
  23368. parasByIDs.queryParameter = filterParameter;
  23369. }
  23370. if (params.targetEpsgCode) {
  23371. parasByIDs.targetEpsgCode = params.targetEpsgCode;
  23372. }
  23373. if (!params.targetEpsgCode && params.targetPrj) {
  23374. parasByIDs.targetPrj = params.targetPrj;
  23375. }
  23376. return Util.toJSON(parasByIDs);
  23377. }
  23378. }
  23379. SuperMap.GetFeaturesByIDsParameters = GetFeaturesByIDsParameters;
  23380. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesByIDsService.js
  23381. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23382. * This program are made available under the terms of the Apache License, Version 2.0
  23383. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23384. /**
  23385. * @class SuperMap.GetFeaturesByIDsService
  23386. * @category iServer Data FeatureResults
  23387. * @classdesc 数据集ID查询服务类。在数据集集合中查找指定 ID 号对应的空间地物要素。
  23388. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务。
  23389. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  23390. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  23391. * @param {Object} options - 参数。</br>
  23392. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  23393. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23394. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23395. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23396. * @param {Object} [options.headers] - 请求头。
  23397. * @extends {SuperMap.GetFeaturesServiceBase}
  23398. * @example
  23399. * var myGetFeaturesByIDsService = new SuperMap.GetFeaturesByIDsService(url, {
  23400. * eventListeners: {
  23401. * "processCompleted": getFeatureCompleted,
  23402. * "processFailed": getFeatureError
  23403. * }
  23404. * });
  23405. * function getFeatureCompleted(object){//todo};
  23406. * function getFeatureError(object){//todo}
  23407. */
  23408. class GetFeaturesByIDsService extends GetFeaturesServiceBase {
  23409. constructor(url, options) {
  23410. super(url, options);
  23411. this.CLASS_NAME = "SuperMap.GetFeaturesByIDsService";
  23412. }
  23413. /**
  23414. * @function SuperMap.GetFeaturesByIDsService.prototype.destroy
  23415. * @override
  23416. */
  23417. destroy() {
  23418. super.destroy();
  23419. }
  23420. /**
  23421. * @function SuperMap.GetFeaturesByIDsService.prototype.getJsonParameters
  23422. * @description 将查询参数转化为 JSON 字符串。
  23423. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  23424. * @param {SuperMap.GetFeaturesByIDsParameters} params - ID查询参数类。
  23425. * @returns {string} 转化后的 JSON 字符串。
  23426. */
  23427. getJsonParameters(params) {
  23428. return GetFeaturesByIDsParameters.toJsonParameters(params);
  23429. }
  23430. }
  23431. SuperMap.GetFeaturesByIDsService = GetFeaturesByIDsService;
  23432. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLParameters.js
  23433. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23434. * This program are made available under the terms of the Apache License, Version 2.0
  23435. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23436. /**
  23437. * @class SuperMap.GetFeaturesBySQLParameters
  23438. * @category iServer Data FeatureResults
  23439. * @classdesc 数据服务中数据集 SQL 查询参数类。
  23440. * @param {Object} options - 参数。
  23441. * @param {SuperMap.FilterParameter} options.queryParameter - 查询过滤条件参数。
  23442. * @param {Array.<string>} options.datasetNames - 数据集集合中的数据集名称列表。
  23443. * @param {boolean} [options.returnContent=true] - 是否直接返回查询结果。
  23444. * @param {number} [options.fromIndex=0] - 查询结果的最小索引号。
  23445. * @param {number} [options.toIndex=19] - 查询结果的最大索引号。
  23446. * @param {string|number} [options.targetEpsgCode] - 动态投影的目标坐标系对应的 EPSG Code,使用此参数时,returnContent 参数需为 true。
  23447. * @param {Object} [options.targetPrj] - 动态投影的目标坐标系。使用此参数时,returnContent 参数需为 true。 如:prjCoordSys={"epsgCode":3857}。当同时设置 targetEpsgCode 参数时,此参数不生效。
  23448. * @extends {SuperMap.GetFeaturesParametersBase}
  23449. */
  23450. class GetFeaturesBySQLParameters extends GetFeaturesParametersBase {
  23451. constructor(options) {
  23452. super(options);
  23453. /**
  23454. * @member {string} SuperMap.GetFeaturesBySQLParameters.prototype.getFeatureMode
  23455. * @description 数据集查询模式。
  23456. */
  23457. this.getFeatureMode = "SQL";
  23458. /**
  23459. * @member {SuperMap.FilterParameter} SuperMap.GetFeaturesBySQLParameters.prototype.queryParameter
  23460. * @description 查询过滤条件参数类。
  23461. */
  23462. this.queryParameter = null;
  23463. Util.extend(this, options);
  23464. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLParameters";
  23465. }
  23466. /**
  23467. * @function SuperMap.GetFeaturesBySQLParameters.prototype.destroy
  23468. * @override
  23469. */
  23470. destroy() {
  23471. super.destroy();
  23472. var me = this;
  23473. me.getFeatureMode = null;
  23474. if (me.queryParameter) {
  23475. me.queryParameter.destroy();
  23476. me.queryParameter = null;
  23477. }
  23478. }
  23479. /**
  23480. * @function SuperMap.GetFeaturesBySQLParameters.prototype.toJsonParameters
  23481. * @description 将 SuperMap.GetFeaturesBySQLParameters 对象转换为 JSON 字符串。
  23482. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集 SQL 查询参数对象。
  23483. * @returns {string} 转化后的 JSON 字符串。
  23484. */
  23485. static toJsonParameters(params) {
  23486. var paramsBySql = {
  23487. datasetNames: params.datasetNames,
  23488. getFeatureMode: "SQL",
  23489. queryParameter: params.queryParameter
  23490. };
  23491. if (params.maxFeatures && !isNaN(params.maxFeatures)) {
  23492. paramsBySql.maxFeatures = params.maxFeatures;
  23493. }
  23494. if (params.aggregations) {
  23495. paramsBySql.aggregations = params.aggregations;
  23496. }
  23497. if (params.targetEpsgCode) {
  23498. paramsBySql.targetEpsgCode = params.targetEpsgCode;
  23499. }
  23500. if (!params.targetEpsgCode && params.targetPrj) {
  23501. paramsBySql.targetPrj = params.targetPrj;
  23502. }
  23503. return Util.toJSON(paramsBySql);
  23504. }
  23505. }
  23506. SuperMap.GetFeaturesBySQLParameters = GetFeaturesBySQLParameters;
  23507. ;// CONCATENATED MODULE: ./src/common/iServer/GetFeaturesBySQLService.js
  23508. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23509. * This program are made available under the terms of the Apache License, Version 2.0
  23510. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23511. /**
  23512. * @class SuperMap.GetFeaturesBySQLService
  23513. * @constructs SuperMap.GetFeaturesBySQLService
  23514. * @category iServer Data FeatureResults
  23515. * @classdesc 数据服务中数据集 SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  23516. * @param {string} url - 数据查询结果资源地址。请求数据服务中数据集查询服务,
  23517. * URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{数据服务名}/rest/data/;</br>
  23518. * 例如:"http://localhost:8090/iserver/services/data-jingjin/rest/data/"
  23519. * @param {Object} options - 参数。</br>
  23520. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  23521. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23522. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23523. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23524. * @param {Object} [options.headers] - 请求头。
  23525. * @extends {SuperMap.GetFeaturesServiceBase}
  23526. * @example
  23527. * var myGetFeaturesBySQLService = new SuperMap.GetFeaturesBySQLService(url, {
  23528. * eventListeners: {
  23529. * "processCompleted": GetFeaturesCompleted,
  23530. * "processFailed": GetFeaturesError
  23531. * }
  23532. * });
  23533. * function getFeaturesCompleted(object){//todo};
  23534. * function getFeaturesError(object){//todo};
  23535. *
  23536. */
  23537. class GetFeaturesBySQLService extends GetFeaturesServiceBase {
  23538. constructor(url, options) {
  23539. super(url, options);
  23540. this.CLASS_NAME = "SuperMap.GetFeaturesBySQLService";
  23541. }
  23542. /**
  23543. * @function SuperMap.GetFeaturesBySQLService.prototype.destroy
  23544. * @override
  23545. */
  23546. destroy() {
  23547. super.destroy();
  23548. }
  23549. /*
  23550. * @function SuperMap.GetFeaturesBySQLService.prototype.getJsonParameters
  23551. * @description 将查询参数转化为 JSON 字符串。
  23552. * 在本类中重写此方法,可以实现不同种类的查询(ID, SQL, Buffer, Geometry等)。
  23553. * @param {SuperMap.GetFeaturesBySQLParameters} params - 数据集SQL查询参数类。
  23554. * @returns {string} 转化后的 JSON 字符串。
  23555. */
  23556. getJsonParameters(params) {
  23557. return GetFeaturesBySQLParameters.toJsonParameters(params);
  23558. }
  23559. }
  23560. SuperMap.GetFeaturesBySQLService = GetFeaturesBySQLService;
  23561. ;// CONCATENATED MODULE: ./src/common/iServer/GetFieldsService.js
  23562. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23563. * This program are made available under the terms of the Apache License, Version 2.0
  23564. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23565. /**
  23566. * @class SuperMap.GetFieldsService
  23567. * @category iServer Data Field
  23568. * @classdesc 字段查询服务,支持查询指定数据集的中所有属性字段(field)的集合。
  23569. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/data-world/rest/data 即可。
  23570. * @param {Object} options - 参数。</br>
  23571. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  23572. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23573. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23574. * @param {string}options.datasource - 要查询的数据集所在的数据源名称。</br>
  23575. * @param {string}options.dataset - 要查询的数据集名称。</br>
  23576. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23577. * @param {Object} [options.headers] - 请求头。
  23578. * @extends {SuperMap.CommonServiceBase}
  23579. * @example
  23580. * var myService = new SuperMap.GetFieldsService(url, {eventListeners: {
  23581. * "processCompleted": getFieldsCompleted,
  23582. * "processFailed": getFieldsError
  23583. * },
  23584. * datasource: "World",
  23585. * dataset: "Countries"
  23586. * };
  23587. *
  23588. */
  23589. class GetFieldsService extends CommonServiceBase {
  23590. constructor(url, options) {
  23591. super(url, options);
  23592. /**
  23593. * @member {string} SuperMap.GetFieldsService.prototype.datasource
  23594. * @description 要查询的数据集所在的数据源名称。
  23595. */
  23596. this.datasource = null;
  23597. /**
  23598. * @member {string} SuperMap.GetFieldsService.prototype.dataset
  23599. * @description 要查询的数据集名称。
  23600. */
  23601. this.dataset = null;
  23602. if (options) {
  23603. Util.extend(this, options);
  23604. }
  23605. this.CLASS_NAME = "SuperMap.GetFieldsService";
  23606. }
  23607. /**
  23608. * @function SuperMap.GetFieldsService.prototype.destroy
  23609. * @override
  23610. */
  23611. destroy() {
  23612. super.destroy();
  23613. var me = this;
  23614. me.datasource = null;
  23615. me.dataset = null;
  23616. }
  23617. /**
  23618. * @function SuperMap.GetFieldsService.prototype.processAsync
  23619. * @description 执行服务,查询指定数据集的字段信息。
  23620. */
  23621. processAsync() {
  23622. var me = this;
  23623. me.url = Util.urlPathAppend(me.url,`datasources/${me.datasource}/datasets/${me.dataset}/fields`);
  23624. me.request({
  23625. method: "GET",
  23626. data: null,
  23627. scope: me,
  23628. success: me.serviceProcessCompleted,
  23629. failure: me.serviceProcessFailed
  23630. });
  23631. }
  23632. }
  23633. SuperMap.GetFieldsService = GetFieldsService;
  23634. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosParameters.js
  23635. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23636. * This program are made available under the terms of the Apache License, Version 2.0
  23637. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23638. /**
  23639. * @class SuperMap.GetGridCellInfosParameters
  23640. * @category iServer Data Grid
  23641. * @classdesc 数据服务栅格查询参数类。
  23642. * @param {Object} options - 参数。
  23643. * @param {string} options.datasetName - 数据集名称。
  23644. * @param {string} options.dataSourceName - 数据源名称。
  23645. * @param {number} options.X - 要查询的地理位置 X 轴。
  23646. * @param {number} options.Y - 要查询的地理位置 Y 轴。
  23647. */
  23648. class GetGridCellInfosParameters {
  23649. constructor(options) {
  23650. /**
  23651. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.datasetName
  23652. * @description 数据集名称。
  23653. */
  23654. this.datasetName = null;
  23655. /**
  23656. * @member {string} SuperMap.GetGridCellInfosParameters.prototype.dataSourceName
  23657. * @description 数据源名称。
  23658. */
  23659. this.dataSourceName = null;
  23660. /**
  23661. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.X
  23662. * @description 要查询的地理位置 X 轴。
  23663. */
  23664. this.X = null;
  23665. /**
  23666. * @member {number} SuperMap.GetGridCellInfosParameters.prototype.Y
  23667. * @description 要查询的地理位置 Y 轴。
  23668. */
  23669. this.Y = null;
  23670. Util.extend(this, options);
  23671. this.CLASS_NAME = "SuperMap.GetGridCellInfosParameters";
  23672. }
  23673. /**
  23674. * @function SuperMap.GetGridCellInfosParameters.prototype.destroy
  23675. * @description 释放资源,将引用的资源属性置空。
  23676. */
  23677. destroy() {
  23678. var me = this;
  23679. me.datasetName = null;
  23680. me.dataSourceName = null;
  23681. me.X = null;
  23682. me.Y = null;
  23683. }
  23684. }
  23685. SuperMap.GetGridCellInfosParameters = GetGridCellInfosParameters;
  23686. ;// CONCATENATED MODULE: ./src/common/iServer/GetGridCellInfosService.js
  23687. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23688. * This program are made available under the terms of the Apache License, Version 2.0
  23689. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23690. /**
  23691. * @class SuperMap.GetGridCellInfosService
  23692. * @category iServer Data Grid
  23693. * @classdesc 数据栅格查询服务,支持查询指定地理位置的栅格信息。
  23694. * @param {string} url - 查询服务地址。例如: http://localhost:8090/iserver/services/data-jingjin/rest/data
  23695. * @param {Object} options - 参数。</br>
  23696. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  23697. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  23698. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  23699. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  23700. * @param {Object} [options.headers] - 请求头。
  23701. * @extends {SuperMap.CommonServiceBase}
  23702. * @example
  23703. * var myService = new SuperMap.GetGridCellInfosService(url, {eventListeners: {
  23704. * "processCompleted": queryCompleted,
  23705. * "processFailed": queryError
  23706. * }
  23707. * });
  23708. *
  23709. */
  23710. class GetGridCellInfosService extends CommonServiceBase {
  23711. constructor(url, options) {
  23712. super(url, options);
  23713. /**
  23714. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetName
  23715. * @description 数据集名称。
  23716. */
  23717. this.datasetName = null;
  23718. /**
  23719. * @member {string} SuperMap.GetGridCellInfosService.prototype.dataSourceName
  23720. * @description 数据源名称。
  23721. */
  23722. this.dataSourceName = null;
  23723. /**
  23724. * @member {string} SuperMap.GetGridCellInfosService.prototype.datasetType
  23725. * @description 数据集类型。
  23726. */
  23727. this.datasetType = null;
  23728. /**
  23729. * @member {number} SuperMap.GetGridCellInfosService.prototype.X
  23730. * @description 要查询的地理位置X轴
  23731. */
  23732. this.X = null;
  23733. /**
  23734. * @member {number} SuperMap.GetGridCellInfosService.prototype.Y
  23735. * @description 要查询的地理位置Y轴
  23736. */
  23737. this.Y = null;
  23738. if (options) {
  23739. Util.extend(this, options);
  23740. }
  23741. this.CLASS_NAME = "SuperMap.GetGridCellInfosService";
  23742. }
  23743. /**
  23744. * @function SuperMap.GetGridCellInfosService.prototype.destroy
  23745. * @override
  23746. */
  23747. destroy() {
  23748. super.destroy();
  23749. var me = this;
  23750. me.X = null;
  23751. me.Y = null;
  23752. me.datasetName = null;
  23753. me.dataSourceName = null;
  23754. me.datasetType = null;
  23755. }
  23756. /**
  23757. * @function SuperMap.GetGridCellInfosService.prototype.processAsync
  23758. * @description 执行服务,查询数据集信息。
  23759. * @param {SuperMap.GetGridCellInfosParameters} params - 查询参数。
  23760. */
  23761. processAsync(params) {
  23762. if (!(params instanceof GetGridCellInfosParameters)) {
  23763. return;
  23764. }
  23765. Util.extend(this, params);
  23766. var me = this;
  23767. me.url = Util.urlPathAppend(me.url,`datasources/${me.dataSourceName}/datasets/${me.datasetName}`);
  23768. me.queryRequest(me.getDatasetInfoCompleted, me.getDatasetInfoFailed);
  23769. }
  23770. /**
  23771. * @function SuperMap.GetGridCellInfosService.prototype.queryRequest
  23772. * @description 执行服务,查询。
  23773. * @callback {function} successFun - 成功后执行的函数。
  23774. * @callback {function} failedFunc - 失败后执行的函数。
  23775. */
  23776. queryRequest(successFun, failedFunc) {
  23777. var me = this;
  23778. me.request({
  23779. method: "GET",
  23780. data: null,
  23781. scope: me,
  23782. success: successFun,
  23783. failure: failedFunc
  23784. });
  23785. }
  23786. /**
  23787. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoCompleted
  23788. * @description 数据集查询完成,执行此方法。
  23789. * @param {Object} result - 服务器返回的结果对象。
  23790. */
  23791. getDatasetInfoCompleted(result) {
  23792. var me = this;
  23793. result = Util.transformResult(result);
  23794. me.datasetType = result.datasetInfo.type;
  23795. me.queryGridInfos();
  23796. }
  23797. /**
  23798. * @function SuperMap.GetGridCellInfosService.prototype.queryGridInfos
  23799. * @description 执行服务,查询数据集栅格信息信息。
  23800. */
  23801. queryGridInfos() {
  23802. var me = this;
  23803. me.url = Util.urlPathAppend(me.url, me.datasetType == 'GRID' ? 'gridValue' : 'imageValue');
  23804. if (me.X != null && me.Y != null) {
  23805. me.url = Util.urlAppend(me.url, `x=${me.X}&y=${me.Y}`);
  23806. }
  23807. me.queryRequest(me.serviceProcessCompleted, me.serviceProcessFailed);
  23808. }
  23809. /**
  23810. * @function SuperMap.GetGridCellInfosService.prototype.getDatasetInfoFailed
  23811. * @description 数据集查询失败,执行此方法。
  23812. * @param {Object} result - 服务器返回的结果对象。
  23813. */
  23814. getDatasetInfoFailed(result) {
  23815. var me = this;
  23816. me.serviceProcessFailed(result);
  23817. }
  23818. }
  23819. SuperMap.GetGridCellInfosService = GetGridCellInfosService;
  23820. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeMemoryData.js
  23821. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23822. * This program are made available under the terms of the Apache License, Version 2.0
  23823. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23824. /**
  23825. * @class SuperMap.ThemeMemoryData
  23826. * @category iServer Map Theme
  23827. * @classdesc 专题图内存数据类。
  23828. * @param {Array} srcData - 原始值数组。
  23829. * @param {Array} targetData - 外部值数组。
  23830. */
  23831. class ThemeMemoryData {
  23832. constructor(srcData, targetData) {
  23833. /**
  23834. * @member {Array} SuperMap.ThemeMemoryData.prototype.srcData
  23835. * @description 原始值数组,该属性值将被 targetData 属性所指定的值替换掉,然后制作专题图,但数据库中的值并不会改变。
  23836. */
  23837. this.srcData = srcData;
  23838. /**
  23839. * @member {Array} SuperMap.ThemeMemoryData.prototype.targetData
  23840. * @description 外部值数组,即用于制作专题图的内存数据,设定该属性值后,会将 srcData 属性所指定的原始值替换掉制作专题图,但数据库中的值并不会改变。
  23841. */
  23842. this.targetData = targetData;
  23843. this.CLASS_NAME = "SuperMap.ThemeMemoryData";
  23844. }
  23845. /**
  23846. * @function SuperMap.ThemeMemoryData.prototype.destroy
  23847. * @description 释放资源,将引用资源的属性置空。
  23848. */
  23849. destroy() {
  23850. var me = this;
  23851. me.srcData = null;
  23852. me.targetData = null;
  23853. }
  23854. /**
  23855. * @function SuperMap.ThemeMemoryData.prototype.toJSON
  23856. * @description 将 SuperMap.ThemeMemoryData 对象转化为 JSON 字符串。
  23857. * @returns {string} 返回转换后的 JSON 字符串。
  23858. */
  23859. toJSON() {
  23860. if (this.srcData && this.targetData) {
  23861. var memoryDataStr = "";
  23862. var count = Math.min(this.srcData.length, this.targetData.length);
  23863. for (var i = 0; i < count; i++) {
  23864. memoryDataStr += "\'" + this.srcData[i] + "\':\'" + this.targetData[i] + "\',";
  23865. }
  23866. //去除多余的逗号
  23867. if (i > 0) {
  23868. memoryDataStr = memoryDataStr.substring(0, memoryDataStr.length - 1);
  23869. }
  23870. return "{" + memoryDataStr + "}";
  23871. } else {
  23872. return null;
  23873. }
  23874. }
  23875. }
  23876. SuperMap.ThemeMemoryData = ThemeMemoryData;
  23877. ;// CONCATENATED MODULE: ./src/common/iServer/Theme.js
  23878. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23879. * This program are made available under the terms of the Apache License, Version 2.0
  23880. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23881. /**
  23882. * @class SuperMap.Theme
  23883. * @category iServer Map Theme
  23884. * @classdesc 专题图基类。
  23885. * @param {string} type - 专题图类型。
  23886. * @param {Object} options - 参数。
  23887. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  23888. */
  23889. class Theme {
  23890. constructor(type, options) {
  23891. if (!type) {
  23892. return this;
  23893. }
  23894. /**
  23895. * @member {SuperMap.ThemeMemoryData} SuperMap.Theme.prototype.memoryData
  23896. * @description 专题图内存数据。<br>
  23897. * 用内存数据制作专题图的方式与表达式制作专题图的方式互斥,前者优先级较高。
  23898. * 第一个参数代表专题值,即数据集中用来做专题图的字段或表达式的值;第二个参数代表外部值。在制作专题图时,会用外部值代替专题值来制作相应的专题图。
  23899. */
  23900. this.memoryData = null;
  23901. /**
  23902. * @member {string} SuperMap.Theme.prototype.type
  23903. * @description 专题图类型。
  23904. */
  23905. this.type = type;
  23906. if (options) {
  23907. Util.extend(this, options);
  23908. }
  23909. this.CLASS_NAME = "SuperMap.Theme";
  23910. }
  23911. /**
  23912. * @function SuperMap.Theme.prototype.destroy
  23913. * @description 释放资源,将引用资源的属性置空。
  23914. */
  23915. destroy() {
  23916. var me = this;
  23917. if (me.memoryData) {
  23918. me.memoryData.destroy();
  23919. me.memoryData = null;
  23920. }
  23921. me.type = null;
  23922. }
  23923. /**
  23924. * @function SuperMap.Theme.prototype.toServerJSONObject
  23925. * @description 转换成对应的 JSON 格式对象。
  23926. * @returns {Object} 对应的 JSON 格式对象。
  23927. */
  23928. toServerJSONObject() {
  23929. //return 子类实现
  23930. return;
  23931. }
  23932. }
  23933. SuperMap.Theme = Theme;
  23934. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTextStyle.js
  23935. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  23936. * This program are made available under the terms of the Apache License, Version 2.0
  23937. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  23938. /**
  23939. * @class SuperMap.ServerTextStyle
  23940. * @category iServer Map Theme
  23941. * @classdesc 服务端文本风格类。
  23942. * @description 该类用于定义文本风格的相关属性。
  23943. * @param {Object} options - 参数。
  23944. * @param {SuperMap.TextAlignment} [options.align=SuperMap.TextAlignment.BASELINECENTER] - 文本的对齐方式。
  23945. * @param {SuperMap.ServerColor} [options.backColor] - 文本的背景色。默认 backColor = new ServerColor(255, 255, 255)。
  23946. * @param {SuperMap.ServerColor} [options.foreColor] - 文本的前景色。默认 foreColor = new ServerColor(0, 0, 0)。
  23947. * @param {boolean} [options.backOpaque=false] - 文本背景是否不透明。
  23948. * @param {boolean} [options.sizeFixed=true] - 文本大小是否固定。
  23949. * @param {number} [options.fontHeight=6] - 文本字体的高度。
  23950. * @param {number} [options.fontWidth=0] - 文本字体的宽度。
  23951. * @param {number} [options.fontWeight=400] - 文本字体的磅数。
  23952. * @param {string} [options.fontName='Times New Roman'] - 文本字体的名称。
  23953. * @param {boolean} [options.bold=false] - 文本是否为粗体字。
  23954. * @param {boolean} [options.italic=false] - 文本是否采用斜体。
  23955. * @param {number} [options.italicAngle=0] - 字体倾斜角度。
  23956. * @param {boolean} [options.shadow=false] - 文本是否有阴影。
  23957. * @param {boolean} [options.strikeout=false] - 文本字体是否加删除线。
  23958. * @param {boolean} [options.outline=false] - 是否以轮廓的方式来显示文本的背景。
  23959. * @param {number} [options.opaqueRate=0] - 注记文字的不透明度。
  23960. * @param {boolean} [options.underline=false] - 文本字体是否加下划线。
  23961. * @param {number} [options.rotation=0.0] - 文本旋转的角度。
  23962. */
  23963. class ServerTextStyle {
  23964. constructor(options) {
  23965. /**
  23966. * @member {SuperMap.TextAlignment} [SuperMap.ServerTextStyle.prototype.align= SuperMap.TextAlignment.BASELINECENTER]
  23967. * @description 文本的对齐方式。
  23968. */
  23969. this.align = TextAlignment.BASELINECENTER;
  23970. /**
  23971. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.backColor=(255, 255, 255)]
  23972. * @description 文本的背景色。
  23973. */
  23974. this.backColor = new ServerColor(255, 255, 255);
  23975. /**
  23976. * @member {SuperMap.ServerColor} [SuperMap.ServerTextStyle.prototype.foreColor=(0, 0, 0)]
  23977. * @description 文本的前景色。
  23978. */
  23979. this.foreColor = new ServerColor(0, 0, 0);
  23980. /**
  23981. * @member {boolean} [SuperMap.ServerTextStyle.prototype.backOpaque=false]
  23982. * @description 文本背景是否不透明。true 表示文本背景不透明。
  23983. */
  23984. this.backOpaque = false;
  23985. /**
  23986. * @member {boolean} [SuperMap.ServerTextStyle.prototype.sizeFixed=true]
  23987. * @description 文本大小是否固定。设置为 true,表示图片为固定像素大小,具体大小请参考 fontHeight。当设为 false 时,图片会随着地图缩放而缩放。
  23988. */
  23989. this.sizeFixed = true;
  23990. /**
  23991. * @member {number} [SuperMap.ServerTextStyle.prototype.fontHeight=6]
  23992. * @description 文本字体的高度,单位与 sizeFixed 有关,当 sizeFixed 为 False 时,即非固定文本大小时使用地图坐标单位,
  23993. * 如地理坐标系下的地图中单位为度;当 sizeFixed 为 True 时,单位为毫米(mm)。
  23994. */
  23995. this.fontHeight = 6;
  23996. /**
  23997. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWidth=0]
  23998. * @description 文本字体的宽度。字体的宽度以英文字符为标准,由于一个中文字符相当于两个英文字符。
  23999. */
  24000. this.fontWidth = 0;
  24001. /**
  24002. * @member {number} [SuperMap.ServerTextStyle.prototype.fontWeight=400]
  24003. * @description 文本字体的磅数。表示粗体的具体数值。取值范围为从0-900之间的整百数。
  24004. */
  24005. this.fontWeight = 400;
  24006. /**
  24007. * @member {string} [SuperMap.ServerTextStyle.prototype.fontName="Times New Roman"]
  24008. * @description 文本字体的名称。
  24009. */
  24010. this.fontName = "Times New Roman";
  24011. /**
  24012. * @member {boolean} [SuperMap.ServerTextStyle.prototype.bold=false]
  24013. * @description 文本是否为粗体字。true 表示为粗体。false 表示文本不是粗体字。
  24014. */
  24015. this.bold = false;
  24016. /**
  24017. * @member {boolean} [SuperMap.ServerTextStyle.prototype.italic=false]
  24018. * @description 文本是否采用斜体。true 表示采用斜体。
  24019. */
  24020. this.italic = false;
  24021. /**
  24022. * @member {number} [SuperMap.ServerTextStyle.prototype.italicAngle=0]
  24023. * @description 字体倾斜角度。正负度之间,以度为单位,精确到0.1度。当倾斜角度为0度,为系统默认的字体倾斜样式。
  24024. * 正负度是指以纵轴为起始零度线,其纵轴左侧为正,右侧为负。允许的最大角度为60,最小-60。大于60按照60处理,小于-60按照-60处理。目前只对标签专题图有效。
  24025. */
  24026. this.italicAngle = 0;
  24027. /**
  24028. * @member {boolean} [SuperMap.ServerTextStyle.prototype.shadow=false]
  24029. * @description 文本是否有阴影。true 表示给文本增加阴影。false 表示文本没有阴影。
  24030. */
  24031. this.shadow = false;
  24032. /**
  24033. * @member {boolean} [SuperMap.ServerTextStyle.prototype.strikeout=false]
  24034. * @description 文本字体是否加删除线。true 表示加删除线。false 表示文本字体不加删除线。
  24035. */
  24036. this.strikeout = false;
  24037. /**
  24038. * @member {boolean} [SuperMap.ServerTextStyle.prototype.outline=false]
  24039. * @description 是否以轮廓的方式来显示文本的背景。true 表示以轮廓的方式来显示文本的背景。false 表示不以轮廓的方式来显示文本的背景。
  24040. */
  24041. this.outline = false;
  24042. /**
  24043. * @member {number} [SuperMap.ServerTextStyle.prototype.opaqueRate=0]
  24044. * @description 注记文字的不透明度。不透明度的范围为0-100。0表示透明。
  24045. */
  24046. this.opaqueRate = 0;
  24047. /**
  24048. * @member {boolean} [SuperMap.ServerTextStyle.prototype.underline=false]
  24049. * @description 文本字体是否加下划线。true 表示加下划线。
  24050. */
  24051. this.underline = false;
  24052. /**
  24053. * @member {number} [SuperMap.ServerTextStyle.prototype.rotation=0.0]
  24054. * @description 文本旋转的角度。逆时针方向为正方向,单位为度,精确到0.1度。
  24055. */
  24056. this.rotation = 0.0;
  24057. if (options) {
  24058. Util.extend(this, options);
  24059. }
  24060. this.CLASS_NAME = "SuperMap.ServerTextStyle";
  24061. }
  24062. /**
  24063. * @function SuperMap.ServerTextStyle.prototype.destroy
  24064. * @description 释放资源,将引用资源的属性置空。
  24065. */
  24066. destroy() {
  24067. var me = this;
  24068. me.align = null;
  24069. if (me.backColor) {
  24070. me.backColor.destroy();
  24071. me.backColor = null;
  24072. }
  24073. if (me.foreColor) {
  24074. me.foreColor.destroy();
  24075. me.foreColor = null;
  24076. }
  24077. me.backOpaque = null;
  24078. me.sizeFixed = null;
  24079. me.fontHeight = null;
  24080. me.fontWidth = null;
  24081. me.fontWeight = null;
  24082. me.fontName = null;
  24083. me.bold = null;
  24084. me.italic = null;
  24085. me.italicAngle = null;
  24086. me.shadow = null;
  24087. me.strikeout = null;
  24088. me.outline = null;
  24089. me.opaqueRate = null;
  24090. me.underline = null;
  24091. me.rotation = null;
  24092. }
  24093. /**
  24094. * @function SuperMap.ServerTextStyle.fromObj
  24095. * @description 从传入对象获服务端文本风格类。
  24096. * @param {Object} obj - 传入对象
  24097. * @returns {SuperMap.ServerTextStyle} 返回服务端文本风格对象
  24098. */
  24099. static fromObj(obj) {
  24100. var res = new ServerTextStyle(obj);
  24101. Util.copy(res, obj);
  24102. res.backColor = ServerColor.fromJson(obj.backColor);
  24103. res.foreColor = ServerColor.fromJson(obj.foreColor);
  24104. return res;
  24105. }
  24106. }
  24107. SuperMap.ServerTextStyle = ServerTextStyle;
  24108. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelItem.js
  24109. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24110. * This program are made available under the terms of the Apache License, Version 2.0
  24111. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24112. /**
  24113. * @class SuperMap.ThemeLabelItem
  24114. * @category iServer Map Theme
  24115. * @classdesc 分段标签专题图的子项。
  24116. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,分段标签专题图允许用户通过 rangeExpression
  24117. * 字段指定用于分段的数值型字段,同一范围段内的标签具有相同的显示风格,其中每一个范围段就是一个专题图子项,
  24118. * 每一个子项都具有其名称、风格、起始值和终止值。注意:每个分段所表示的范围为 [Start, End)。例如:标签专题图的分段点有两个子项,
  24119. * 他们所代表的分段区间分别为[0,5),[5,10)。那么需要分别设置 SuperMap.ThemeLabelItem[0].start=0,
  24120. * SuperMap.ThemeLabelItem[0].end=5,SuperMap.ThemeLabelItem[1].start=5,SuperMap.ThemeLabelItem[1].end=10。
  24121. * @param {Object} options - 参数。
  24122. * @param {string} [options.caption] - 专题图子项的名称。
  24123. * @param {number} [options.end=0] - 标签专题图子项的终止值。
  24124. * @param {number} [options.start=0] - 标签专题图子项的分段起始值。
  24125. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  24126. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  24127. */
  24128. class ThemeLabelItem {
  24129. constructor(options) {
  24130. /**
  24131. * @member {string} [SuperMap.ThemeLabelItem.prototype.caption]
  24132. * @description 标签专题子项的标题。
  24133. */
  24134. this.caption = null;
  24135. /**
  24136. * @member {number} [SuperMap.ThemeLabelItem.prototype.end=0]
  24137. * @description 标签专题图子项的终止值。如果该子项是分段中最后一个子项,那么该终止值就是分段的最大值;
  24138. * 如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常。
  24139. */
  24140. this.end = 0;
  24141. /**
  24142. * @member {number} [SuperMap.ThemeLabelItem.prototype.start=0]
  24143. * @description 标签专题图子项的分段起始值。如果该子项是分段中第一项,那么该起始值就是分段的最小值;
  24144. * 如果该子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  24145. */
  24146. this.start = 0;
  24147. /**
  24148. * @member {boolean} [SuperMap.ThemeLabelItem.prototype.visible=true]
  24149. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  24150. */
  24151. this.visible = true;
  24152. /**
  24153. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelItem.prototype.style
  24154. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  24155. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  24156. */
  24157. this.style = new ServerTextStyle();
  24158. if (options) {
  24159. Util.extend(this, options);
  24160. }
  24161. this.CLASS_NAME = "SuperMap.ThemeLabelItem";
  24162. }
  24163. /**
  24164. * @function SuperMap.ThemeLabelItem.prototype.destroy
  24165. * @description 释放资源,将引用资源的属性置空。
  24166. */
  24167. destroy() {
  24168. var me = this;
  24169. me.caption = null;
  24170. me.end = null;
  24171. me.start = null;
  24172. if (me.style) {
  24173. me.style.destroy();
  24174. me.style = null;
  24175. }
  24176. me.visible = null;
  24177. }
  24178. /**
  24179. * @function SuperMap.ThemeLabelItem.fromObj
  24180. * @description 从传入对象获取分段标签专题图的子项类。
  24181. * @param {Object} obj - 传入对象。
  24182. * @returns {SuperMap.ThemeLabelItem} ThemeLabelItem 对象。
  24183. */
  24184. static fromObj(obj) {
  24185. if (!obj) {
  24186. return;
  24187. }
  24188. var t = new ThemeLabelItem();
  24189. Util.copy(t, obj);
  24190. return t;
  24191. }
  24192. }
  24193. SuperMap.ThemeLabelItem = ThemeLabelItem;
  24194. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUniqueItem.js
  24195. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24196. * This program are made available under the terms of the Apache License, Version 2.0
  24197. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24198. /**
  24199. * @class SuperMap.ThemeUniqueItem
  24200. * @category iServer Map Theme
  24201. * @classdesc 单值专题图子项类。
  24202. * @description 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,Name 字段代表
  24203. * 省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有 5 种不同值,则该行政区划图有 5 个专题图子项。
  24204. * @param {Object} options - 参数。
  24205. * @param {string} options.unique - 单值专题图子项的单值。
  24206. * @param {string} [options.caption] - 单值专题图子项的标题。
  24207. * @param {SuperMap.ServerStyle} [options.style] - 单值专题图子项的风格。
  24208. * @param {boolean} [options.visible=true] - 单值专题图子项是否可见。
  24209. */
  24210. class ThemeUniqueItem {
  24211. constructor(options) {
  24212. /**
  24213. * @member {string} [SuperMap.ThemeUniqueItem.prototype.caption]
  24214. * @description 单值专题图子项的标题。
  24215. */
  24216. this.caption = null;
  24217. /**
  24218. * @member {SuperMap.ServerStyle} [SuperMap.ThemeUniqueItem.prototype.style]
  24219. * @description 单值专题图子项的显示风格。
  24220. */
  24221. this.style = new ServerStyle();
  24222. /**
  24223. * @member {string} SuperMap.ThemeUniqueItem.prototype.unique
  24224. * @description 单值专题图子项的值,可以为数字、字符串等。
  24225. */
  24226. this.unique = null;
  24227. /**
  24228. * @member {boolean} [SuperMap.ThemeUniqueItem.prototype.visible=true]
  24229. * @description 单值专题图子项的可见性。
  24230. */
  24231. this.visible = true;
  24232. if (options) {
  24233. Util.extend(this, options);
  24234. }
  24235. this.CLASS_NAME = "SuperMap.ThemeUniqueItem";
  24236. }
  24237. /**
  24238. * @function SuperMap.ThemeUniqueItem.prototype.destroy
  24239. * @description 释放资源,将引用资源的属性置空。
  24240. */
  24241. destroy() {
  24242. var me = this;
  24243. me.caption = null;
  24244. me.unique = null;
  24245. if (me.style) {
  24246. me.style.destroy();
  24247. me.style = null;
  24248. }
  24249. me.visible = null;
  24250. }
  24251. /**
  24252. * @function SuperMap.ThemeUniqueItem.prototype.toServerJSONObject
  24253. * @description 转换成对应的 JSON 格式对象。
  24254. * @returns {Object} 对应的 JSON 格式对象。
  24255. */
  24256. toServerJSONObject() {
  24257. var obj = {};
  24258. obj = Util.copyAttributes(obj, this);
  24259. if (obj.style) {
  24260. if (obj.style.toServerJSONObject) {
  24261. obj.style = obj.style.toServerJSONObject();
  24262. }
  24263. }
  24264. return obj;
  24265. }
  24266. /**
  24267. * @function SuperMap.ThemeUniqueItem.fromObj
  24268. * @description 从传入对象获取单值专题图子项类。
  24269. * @param {Object} obj - 传入对象。
  24270. * @returns {SuperMap.ThemeUniqueItem} ThemeUniqueItem 对象。
  24271. */
  24272. static fromObj(obj) {
  24273. var res = new ThemeUniqueItem();
  24274. Util.copy(res, obj);
  24275. res.style = ServerStyle.fromJson(obj.style);
  24276. return res;
  24277. }
  24278. }
  24279. SuperMap.ThemeUniqueItem = ThemeUniqueItem;
  24280. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeFlow.js
  24281. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24282. * This program are made available under the terms of the Apache License, Version 2.0
  24283. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24284. /**
  24285. * @class SuperMap.ThemeFlow
  24286. * @category iServer Map Theme
  24287. * @classdesc 标签或符号流动显示和牵引线风格设置类。
  24288. * 通过该类可以设置专题图中符号是否流动显示、是否使用牵引线以及牵引线风格。
  24289. * @param {Object} options - 参数。
  24290. * @param {boolean} [options.flowEnabled=false] - 是否流动显示标签或符号。
  24291. * @param {boolean} [options.leaderLineDisplayed=false] - 是否显示标签或符号和它标注的对象之间的牵引线。
  24292. * @param {SuperMap.ServerStyle} [options.leaderLineStyle] - 标签或符号与其标注对象之间牵引线的风格。
  24293. */
  24294. class ThemeFlow {
  24295. constructor(options) {
  24296. /**
  24297. * @member {boolean} [SuperMap.ThemeFlow.prototype.flowEnabled=false]
  24298. * @description 是否流动显示标签或符号。<br>
  24299. * 对于标签专题图而言,对于跨越比较大的区域和线条状的几何对象,在一个地图窗口中不能完全显示的情况下,如果其标签位置比较固定,
  24300. * 在当前地图窗口中该对象的标签不可见,则需要通过平移地图来查看对象的标签信息。如果采用了流动显示的效果,在当前地图窗口中,对象即使是部分显示,
  24301. * 其标签也会显示在当前地图窗口中。当平移地图时,对象的标签会随之移动,以保证在当前地图窗口中部分或全部显示的对象其标签都可见,从而可以方便地查看各要素的标签信息。
  24302. */
  24303. this.flowEnabled = false;
  24304. /**
  24305. * @member {boolean} [SuperMap.ThemeFlow.prototype.leaderLineDisplayed=false]
  24306. * @description 是否显示标签或符号和它标注的对象之间的牵引线。false表示不显示标签或符号和它标注的对象之间的牵引线。<br>
  24307. * 只有当 flowEnabled 为 true 时,牵引线才起作用。在当标签流动显示时,其位置不固定,由于牵引线始终指向要素的内点,
  24308. * 因而通过牵引线显示功能可以找到流动的标签或符号实际对应的要素。或者渲染符号偏移它所指向的对象时,图与对象之间可以采用牵引线进行连接。
  24309. */
  24310. this.leaderLineDisplayed = false;
  24311. /**
  24312. * @member {SuperMap.ServerStyle} SuperMap.ThemeFlow.prototype.leaderLineStyle
  24313. * @description 标签或符号与其标注对象之间牵引线的风格。
  24314. */
  24315. this.leaderLineStyle = new ServerStyle();
  24316. if (options) {
  24317. Util.extend(this, options);
  24318. }
  24319. this.CLASS_NAME = "SuperMap.ThemeFlow";
  24320. }
  24321. /**
  24322. * @function SuperMap.ThemeFlow.prototype.destroy
  24323. * @description 释放资源,将引用资源的属性置空。
  24324. */
  24325. destroy() {
  24326. var me = this;
  24327. me.flowEnabled = null;
  24328. me.leaderLineDisplayed = null;
  24329. if (me.leaderLineStyle) {
  24330. me.leaderLineStyle.destroy();
  24331. me.leaderLineStyle = null;
  24332. }
  24333. }
  24334. /**
  24335. * @function SuperMap.ThemeFlow.fromObj
  24336. * @description 从传入对象获取标签或符号流动显示和牵引线风格设置类。
  24337. * @param {Object} obj - 传入对象。
  24338. * @returns {SuperMap.ThemeFlow} ThemeFlow 对象。
  24339. */
  24340. static fromObj(obj) {
  24341. if (!obj) {
  24342. return;
  24343. }
  24344. var res = new ThemeFlow();
  24345. Util.copy(res, obj);
  24346. res.leaderLineStyle = ServerStyle.fromJson(obj.leaderLineStyle);
  24347. return res;
  24348. }
  24349. }
  24350. SuperMap.ThemeFlow = ThemeFlow;
  24351. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeOffset.js
  24352. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24353. * This program are made available under the terms of the Apache License, Version 2.0
  24354. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24355. /**
  24356. * @class SuperMap.ThemeOffset
  24357. * @category iServer Map Theme
  24358. * @classdesc 专题图中文本或符号相对于要素内点的偏移量设置类。
  24359. * 通过该类可以设置专题图中标记文本或符号的偏移量以及偏移量是否随地图缩放而改变。
  24360. * @param {Object} options - 参数。
  24361. * @param {boolean} [options.offsetFixed=false] - 当前专题图是否固定标记文本或符号的偏移量。
  24362. * @param {string} [options.offsetX='0.0'] - 专题图中文本或符号相对于要素内点的水平偏移量。
  24363. * @param {string} [options.offsetY='0.0'] - 专题图中文本或符号相对于要素内点的垂直偏移量。
  24364. */
  24365. class ThemeOffset {
  24366. constructor(options) {
  24367. /**
  24368. * @member {boolean} [SuperMap.ThemeOffset.prototype.offsetFixed=false]
  24369. * @description 当前专题图是否固定标记文本或符号的偏移量。所谓固定偏移量,则文本或符号的偏移量不随地图的缩放而变化。
  24370. */
  24371. this.offsetFixed = false;
  24372. /**
  24373. * @member {string} [SuperMap.ThemeOffset.prototype.offsetX=0.0]
  24374. * @description 专题图中文本或符号相对于要素内点的水平偏移量。偏移量的单位为地图单位。
  24375. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么水平偏移量为2。
  24376. */
  24377. this.offsetX = "0.0";
  24378. /**
  24379. * @member {string} [SuperMap.ThemeOffset.prototype.offsetY=0.0]
  24380. * @description 专题图中文本或符号相对于要素内点的垂直偏移量。偏移量的单位为地图单位。
  24381. * 该偏移量的值为一个常量值或者字段表达式所表示的值,即如果字段表达式为 SmID,其中 SmID = 2,那么垂直偏移量为2。
  24382. */
  24383. this.offsetY = "0.0";
  24384. if (options) {
  24385. Util.extend(this, options);
  24386. }
  24387. this.CLASS_NAME = "SuperMap.ThemeOffset";
  24388. }
  24389. /**
  24390. * @function SuperMap.ThemeOffset.prototype.destroy
  24391. * @description 释放资源,将引用资源的属性置空。
  24392. */
  24393. destroy() {
  24394. var me = this;
  24395. me.offsetFixed = null;
  24396. me.offsetX = null;
  24397. me.offsetY = null;
  24398. }
  24399. /**
  24400. * @function SuperMap.ThemeOffset.fromObj
  24401. * @description 从传入对象获取专题图中文本或符号相对于要素内点的偏移量设置类。
  24402. * @param {Object} obj - 传入对象。
  24403. * @returns {SuperMap.ThemeOffset} ThemeOffset 对象。
  24404. */
  24405. static fromObj(obj) {
  24406. if (!obj) {
  24407. return;
  24408. }
  24409. var res = new ThemeOffset();
  24410. Util.copy(res, obj);
  24411. return res;
  24412. }
  24413. }
  24414. SuperMap.ThemeOffset = ThemeOffset;
  24415. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMixedTextStyle.js
  24416. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24417. * This program are made available under the terms of the Apache License, Version 2.0
  24418. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24419. /**
  24420. * @class SuperMap.LabelMixedTextStyle
  24421. * @category iServer Map Theme
  24422. * @classdesc 标签文本复合风格类
  24423. * @description 该类主要用于对标签专题图中标签的文本内容进行风格设置。通过该类用户可以使标签的文字显示不同的风格,比如文本 “喜马拉雅山”,通过本类可以将前三个字用红色显示,后两个字用蓝色显示。对同一文本设置不同的风格实质上是对文本的字符进行分段,同一分段内的字符具有相同的显示风格。对字符分段有两种方式,一种是利用分隔符对文本进行分段;另一种是根据分段索引值进行分段。<br>
  24424. * 1. 利用分隔符对文本进行分段: 比如文本 “5&109” 被分隔符 “&” 分为 “5” 和 “109” 两部分,
  24425. * 在显示时,“5” 和分隔符 “&” 使用同一个风格,字符串 “109” 使用相同的风格。<br>
  24426. * 2. 利用分段索引值进行分段: 文本中字符的索引值是以0开始的整数,比如文本 “珠穆朗玛峰”,
  24427. * 第一个字符(“珠”)的索引值为 0,第二个字符(“穆”)的索引值为 1,以此类推;当设置分段索引值为 1,3,4,9 时,
  24428. * 字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),可以看出索引号为 0 的字符(即“珠” )在第一个分段内,
  24429. * 索引号为 1,2 的字符(即“穆”、“朗”)位于第二个分段内,索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  24430. * @param {Object} options - 参数。
  24431. * @param {SuperMap.ServerTextStyle} [options.defaultStyle] - 默认的文本复合风格。
  24432. * @param {string} [options.separator] - 文本的分隔符。
  24433. * @param {boolean} [options.separatorEnabled=false] - 文本的分隔符是否有效。
  24434. * @param {Array.<number>} [options.splitIndexes] - 分段索引值,分段索引值用来对文本中的字符进行分段。
  24435. * @param {Array.<SuperMap.ServerTextStyle>} [options.styles] - 文本样式集合。
  24436. */
  24437. class LabelMixedTextStyle {
  24438. constructor(options) {
  24439. /**
  24440. * @member {SuperMap.ServerTextStyle} SuperMap.LabelMixedTextStyle.prototype.defaultStyle
  24441. * @description 默认的文本复合风格,即 SuperMap.ServerTextStyle 各字段的默认值。
  24442. */
  24443. this.defaultStyle = null;
  24444. /**
  24445. * @member {string} SuperMap.LabelMixedTextStyle.prototype.separator
  24446. * @description 文本的分隔符,分隔符的风格与前一个字符的风格一样。文本的分隔符是一个将文本分割开的符号,
  24447. * 比如文本 “5_109” 被 “_” 隔符为 “5” 和 “109” 两部分,假设有风格数组:style1、style2。
  24448. * 在显示时,“5” 和分隔符 “_” 使用 Style1 风格渲染,字符串 “109” 使用 Style2 的风格。
  24449. */
  24450. this.separator = null;
  24451. /**
  24452. * @member {boolean} [SuperMap.LabelMixedTextStyle.prototype.separatorEnabled=false]
  24453. * @description 文本的分隔符是否有效。分隔符有效时利用分隔符对文本进行分段;无效时根据文本中字符的位置进行分段。
  24454. * 分段后,同一分段内的字符具有相同的显示风格。
  24455. */
  24456. this.separatorEnabled = false;
  24457. /**
  24458. * @member {Array.<number>} SuperMap.LabelMixedTextStyle.prototype.splitIndexes
  24459. * @description 分段索引值,分段索引值用来对文本中的字符进行分段。
  24460. * 文本中字符的索引值是以 0 开始的整数,比如文本“珠穆朗玛峰”,第一个字符(“珠”)的索引值为0,第二个字符(“穆”)的索引值为 1,
  24461. * 以此类推;当设置分段索引值数组为 [1,3,4,9] 时,字符分段范围相应的就是 (-∞,1),[1,3),[3,4),[4,9),[9,+∞),
  24462. * 可以看出索引号为 0 的字符(即 “珠”)在第一个分段内,索引号为 1,2 的字符(即 “穆”、“朗”)位于第二个分段内,
  24463. * 索引号为 3 的字符(“玛”)在第三个分段内,索引号为 4 的字符(“峰”)在第四个分段内,其余分段中没有字符。
  24464. */
  24465. this.splitIndexes = null;
  24466. /**
  24467. * @member {Array.<SuperMap.ServerTextStyle>} SuperMap.LabelMixedTextStyle.prototype.styles
  24468. * @description 文本样式集合。文本样式集合中的样式根据索引与不同分段一一对应,
  24469. * 如果有分段没有风格对应则使用 defaultStyle。
  24470. */
  24471. this.styles = new ServerTextStyle();
  24472. if (options) {
  24473. Util.extend(this, options);
  24474. }
  24475. this.CLASS_NAME = "SuperMap.LabelMixedTextStyle"
  24476. }
  24477. /**
  24478. * @function SuperMap.LabelMixedTextStyle.prototype.destroy
  24479. * @description 释放资源,将引用资源的属性置空。
  24480. */
  24481. destroy() {
  24482. var me = this;
  24483. if (me.defaultStyle) {
  24484. me.defaultStyle.destroy();
  24485. me.defaultStyle = null;
  24486. }
  24487. me.separator = null;
  24488. me.separatorEnabled = null;
  24489. if (me.splitIndexes) {
  24490. me.splitIndexes = null;
  24491. }
  24492. if (me.styles) {
  24493. for (var i = 0, styles = me.styles, len = styles.length; i < len; i++) {
  24494. styles[i].destroy();
  24495. }
  24496. me.styles = null;
  24497. }
  24498. }
  24499. /**
  24500. * @function SuperMap.LabelMixedTextStyle.fromObj
  24501. * @description 从传入对象获取标签文本复合风格类。
  24502. * @param {Object} obj - 传入对象。
  24503. * @returns {SuperMap.LabelMixedTextStyle} 返回新的 LabelMixedTextStyle 对象。
  24504. */
  24505. static fromObj(obj) {
  24506. if (!obj) {
  24507. return;
  24508. }
  24509. var res = new LabelMixedTextStyle();
  24510. var stys = obj.styles;
  24511. Util.copy(res, obj);
  24512. res.defaultStyle = new ServerTextStyle(obj.defaultStyle);
  24513. if (stys) {
  24514. res.styles = [];
  24515. for (var i = 0, len = stys.length; i < len; i++) {
  24516. res.styles.push(new ServerTextStyle(stys[i]));
  24517. }
  24518. }
  24519. return res;
  24520. }
  24521. }
  24522. SuperMap.LabelMixedTextStyle = LabelMixedTextStyle;
  24523. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelText.js
  24524. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24525. * This program are made available under the terms of the Apache License, Version 2.0
  24526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24527. /**
  24528. * @class SuperMap.ThemeLabelText
  24529. * @category iServer Map Theme
  24530. * @classdesc 标签中文本风格类。
  24531. * 通过该类可以设置标签中的文本字体大小和显示风格。
  24532. * @param {Object} options - 参数。
  24533. * @param {number} [options.maxTextHeight=0] - 标签中文本的最大高度。
  24534. * @param {number} [options.maxTextWidth=0] - 标签中文本的最大宽度。
  24535. * @param {number} [options.minTextHeight=0] - 标签中文本的最小高度。
  24536. * @param {number} [options.minTextWidth=0] - 标签中文本的最小宽度。
  24537. * @param {SuperMap.ServerTextStyle} [options.uniformStyle] - 统一文本风格。
  24538. * @param {SuperMap.LabelMixedTextStyle} [options.uniformMixedStyle] - 标签专题图统一的文本复合风格。
  24539. */
  24540. class ThemeLabelText {
  24541. constructor(options) {
  24542. /**
  24543. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextHeight=0]
  24544. * @description 标签中文本的最大高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  24545. * 当放大后的文本高度超过最大高度之后就不再放大。高度单位为 0.1 毫米。
  24546. */
  24547. this.maxTextHeight = 0;
  24548. /**
  24549. * @member {number} [SuperMap.ThemeLabelText.prototype.maxTextWidth=0]
  24550. * @description 标签中文本的最大宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  24551. * 当放大后的文本宽度超过最大高度之后就不再放大。宽度单位为 0.1 毫米。
  24552. */
  24553. this.maxTextWidth = 0;
  24554. /**
  24555. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextHeight=0]
  24556. * @description 标签中文本的最小高度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  24557. * 当缩小后的文本高度小于最小高度之后就不再缩小。高度单位为 0.1 毫米。
  24558. */
  24559. this.minTextHeight = 0;
  24560. /**
  24561. * @member {number} [SuperMap.ThemeLabelText.prototype.minTextWidth=0]
  24562. * @description 标签中文本的最小宽度。当标签文本不固定大小时,即 SuperMap.ServerTextStyle.sizeFixed = false 有效,
  24563. * 当缩小后的文本宽度小于最小宽度之后就不再缩小。宽度单位为 0.1 毫米。
  24564. */
  24565. this.minTextWidth = 0;
  24566. /**
  24567. * @member {SuperMap.ServerTextStyle} [SuperMap.ThemeLabelText.prototype.uniformStyle]
  24568. * @description 统一文本风格。当标签专题图子项的个数大于等于1时,
  24569. * uniformStyle 不起作用,各标签的风格使用子项中设置的风格。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  24570. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  24571. */
  24572. this.uniformStyle = new ServerTextStyle();
  24573. /**
  24574. *@member {SuperMap.LabelMixedTextStyle} [SuperMap.ThemeLabelText.prototype.uniformMixedStyle]
  24575. *@description 标签专题图统一的文本复合风格。通过该类可以使同一个标
  24576. * 签中的文字使用多种风格显示。各种风格的优先级从高到低为:uniformMixedStyle(标签文本的复合风格),
  24577. * SuperMap.ThemeLabelItem.style(分段子项的文本风格),uniformStyle(统一文本风格)。
  24578. */
  24579. this.uniformMixedStyle = null;
  24580. if (options) {
  24581. Util.extend(this, options);
  24582. }
  24583. this.CLASS_NAME = "SuperMap.ThemeLabelText";
  24584. }
  24585. /**
  24586. * @function SuperMap.ThemeLabelText.prototype.destroy
  24587. * @description 释放资源,将引用资源的属性置空。
  24588. */
  24589. destroy() {
  24590. var me = this;
  24591. me.maxTextHeight = null;
  24592. me.maxTextWidth = null;
  24593. me.minTextHeight = null;
  24594. me.minTextWidth = null;
  24595. if (me.uniformStyle) {
  24596. me.uniformStyle.destroy();
  24597. me.uniformStyle = null;
  24598. }
  24599. if (me.uniformMixedStyle) {
  24600. me.uniformMixedStyle.destroy();
  24601. me.uniformMixedStyle = null;
  24602. }
  24603. }
  24604. /**
  24605. * @function SuperMap.ThemeLabelText.fromObj
  24606. * @description 从传入对象获取标签中文本风格类。
  24607. * @param {Object} obj - 传入对象。
  24608. * @returns {SuperMap.ThemeLabelText} ThemeLabelText 对象。
  24609. */
  24610. static fromObj(obj) {
  24611. if (!obj) {
  24612. return;
  24613. }
  24614. var res = new ThemeLabelText();
  24615. Util.copy(res, obj);
  24616. res.uniformStyle = ServerTextStyle.fromObj(obj.uniformStyle);
  24617. res.uniformMixedStyle = LabelMixedTextStyle.fromObj(obj.uniformMixedStyle);
  24618. return res;
  24619. }
  24620. }
  24621. SuperMap.ThemeLabelText = ThemeLabelText;
  24622. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelAlongLine.js
  24623. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24624. * This program are made available under the terms of the Apache License, Version 2.0
  24625. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24626. /**
  24627. * @class SuperMap.ThemeLabelAlongLine
  24628. * @category iServer Map Theme
  24629. * @classdesc 标签沿线标注样式类。
  24630. * @param {Object} options - 参数。
  24631. * @param {boolean} [options.isAlongLine=true] - 是否沿线显示文本。
  24632. * @param {SuperMap.AlongLineDirection} [options.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT] - 标签沿线标注方向。
  24633. * @param {boolean} [options.angleFixed=false] - 当沿线显示文本时,是否将文本角度固定。
  24634. * @param {boolean} [options.repeatedLabelAvoided=false] - 沿线循环标注时是否避免标签重复标注。
  24635. * @param {boolean} [options.repeatIntervalFixed=false] - 循环标注间隔是否固定。
  24636. * @param {number} [options.labelRepeatInterval=0] - 沿线且循环标注时循环标注的间隔。
  24637. */
  24638. class ThemeLabelAlongLine {
  24639. constructor(options) {
  24640. /**
  24641. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.isAlongLine=true]
  24642. * @description 是否沿线显示文本。true 表示沿线显示文本,false 表示正常显示文本。
  24643. */
  24644. this.isAlongLine = true;
  24645. /**
  24646. * @member {SuperMap.AlongLineDirection} [SuperMap.ThemeLabelAlongLine.prototype.alongLineDirection=SuperMap.AlongLineDirection.LB_TO_RT]
  24647. * @description 标签沿线标注方向。
  24648. */
  24649. this.alongLineDirection = AlongLineDirection.LB_TO_RT;
  24650. /**
  24651. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.angleFixed=false]
  24652. * @description 当沿线显示文本时,是否将文本角度固定。true 表示按固定文本角度显示文本,false 表示按照沿线角度显示文本。
  24653. * 如果固定角度,则所有标签均按所设置的文本风格中字体的旋转角度来显示,不考虑沿线标注的方向;
  24654. * 如果不固定角度,在显示标签时会同时考虑字体的旋转角度和沿线标注的方向。
  24655. */
  24656. this.angleFixed = false;
  24657. /**
  24658. * @member {boolean} SuperMap.ThemeLabelAlongLine.prototype.repeatedLabelAvoided
  24659. * @description 沿线循环标注时是否避免标签重复标注。
  24660. */
  24661. this.repeatedLabelAvoided = false;
  24662. /**
  24663. * @member {boolean} [SuperMap.ThemeLabelAlongLine.prototype.repeatIntervalFixed=false]
  24664. * @description 循环标注间隔是否固定。true 表示使用固定循环标注间隔,即使用逻辑坐标来显示循环标注间隔;
  24665. * false 表示循环标注间隔随地图的缩放而变化,即使用地理坐标来显示循环标注间隔。
  24666. */
  24667. this.repeatIntervalFixed = false;
  24668. /**
  24669. * @member {number} [SuperMap.ThemeLabelAlongLine.prototype.labelRepeatInterval=0]
  24670. * @description 沿线且循环标注时循环标注的间隔。长度的单位与地图的地理单位一致。只有设定 RepeatedLabelAvoided 为 true
  24671. * 的时候,labelRepeatInterval 属性才有效。
  24672. */
  24673. this.labelRepeatInterval = 0;
  24674. if (options) {
  24675. Util.extend(this, options);
  24676. }
  24677. this.CLASS_NAME = "SuperMap.ThemeLabelAlongLine";
  24678. }
  24679. /**
  24680. * @function SuperMap.ThemeLabelAlongLine.prototype.destroy
  24681. * @description 释放资源,将引用资源的属性置空。
  24682. */
  24683. destroy() {
  24684. var me = this;
  24685. me.isAlongLine = null;
  24686. me.alongLineDirection = null;
  24687. me.angleFixed = null;
  24688. me.repeatedLabelAvoided = null;
  24689. me.repeatIntervalFixed = null;
  24690. me.labelRepeatInterval = null;
  24691. }
  24692. /**
  24693. * @function SuperMap.ThemeLabelAlongLine.fromObj
  24694. * @description 从传入对象获取标签沿线标注样式类。
  24695. * @param {Object} obj - 传入对象。
  24696. * @returns {SuperMap.ThemeLabelAlongLine} ThemeLabelAlongLine 对象。
  24697. */
  24698. static fromObj(obj) {
  24699. if (!obj) {
  24700. return;
  24701. }
  24702. var t = new ThemeLabelAlongLine();
  24703. Util.copy(t, obj);
  24704. return t;
  24705. }
  24706. }
  24707. SuperMap.ThemeLabelAlongLine = ThemeLabelAlongLine;
  24708. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelBackground.js
  24709. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24710. * This program are made available under the terms of the Apache License, Version 2.0
  24711. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24712. /**
  24713. * @class SuperMap.ThemeLabelBackground
  24714. * @category iServer Map Theme
  24715. * @classdesc 标签背景风格类。通过该类可以设置标签的背景形状和风格。
  24716. * @param {Object} options - 参数。
  24717. * @param {SuperMap.LabelBackShape} [options.labelBackShape=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景风格。
  24718. * @param {SuperMap.ServerStyle} [options.backStyle=SuperMap.LabelBackShape.NONE] - 标签专题图中标签背景的形状枚举类。
  24719. */
  24720. class ThemeLabelBackground {
  24721. constructor(options) {
  24722. /**
  24723. * @member {SuperMap.LabelBackShape} [SuperMap.ThemeLabelBackground.prototype.labelBackShape=SuperMap.LabelBackShape.NONE]
  24724. * @description 标签专题图中标签背景风格。当背景形状
  24725. * labelBackShape 属性设为 NONE(即无背景形状) 时,backStyle 属性无效。
  24726. */
  24727. this.labelBackShape = LabelBackShape.NONE;
  24728. /**
  24729. * @member {SuperMap.ServerStyle} [SuperMap.ThemeLabelBackground.prototype.backStyle=SuperMap.LabelBackShape.NON]
  24730. * @description 标签专题图中标签背景的形状枚举类。背景类型可
  24731. * 以是矩形、圆角矩形、菱形、椭圆形、三角形和符号等,即不使用任何的形状作为标签的背景。
  24732. */
  24733. this.backStyle = new ServerStyle();
  24734. if (options) {
  24735. Util.extend(this, options);
  24736. }
  24737. this.CLASS_NAME = "SuperMap.ThemeLabelBackground";
  24738. }
  24739. /**
  24740. * @function SuperMap.ThemeLabelBackground.prototype.destroy
  24741. * @description 释放资源,将引用资源的属性置空。
  24742. */
  24743. destroy() {
  24744. var me = this;
  24745. me.labelBackShape = null;
  24746. if (me.backStyle) {
  24747. me.backStyle.destroy();
  24748. me.backStyle = null;
  24749. }
  24750. }
  24751. /**
  24752. * @function SuperMap.ThemeLabelBackground.fromObj
  24753. * @description 从传入对象获取标签背景风格类。
  24754. * @param {Object} obj - 传入对象。
  24755. * @returns {SuperMap.ThemeLabelBackground} ThemeLabelBackground 对象。
  24756. */
  24757. static fromObj(obj) {
  24758. if (!obj) {
  24759. return;
  24760. }
  24761. var t = new ThemeLabelBackground();
  24762. t.labelBackShape = obj.labelBackShape;
  24763. t.backStyle = ServerStyle.fromJson(obj.backStyle);
  24764. return t;
  24765. }
  24766. }
  24767. SuperMap.ThemeLabelBackground = ThemeLabelBackground;
  24768. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabel.js
  24769. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  24770. * This program are made available under the terms of the Apache License, Version 2.0
  24771. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  24772. /**
  24773. * @class SuperMap.ThemeLabel
  24774. * @category iServer Map Theme
  24775. * @classdesc 标签专题图类。
  24776. * @extends SuperMap.Theme
  24777. * @param {Object} options - 参数。
  24778. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 分段标签专题图的子项数组。
  24779. * @param {string} options.labelExpression - 标注字段表达式。
  24780. * @param {Array.<SuperMap.LabelMatrixCell>} options.matrixCells - 矩阵标签元素数组。
  24781. * @param {SuperMap.ThemeLabelAlongLine} [options.alongLine] - 标签沿线标注方向样式类。
  24782. * @param {SuperMap.ThemeLabelBackground} [options.background] - 标签专题图中标签的背景风格类。
  24783. * @param {SuperMap.ThemeFlow} [options.flow] - 标签专题图标签流动显示与牵引线设置类。
  24784. * @param {SuperMap.LabelOverLengthMode} [options.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  24785. * @param {number} [options.maxLabelLength=256] - 标签在每一行显示的最大长度。
  24786. * @param {number} [options.numericPrecision=0] - 通过该字段设置其显示的精度。
  24787. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24788. * @param {boolean} [options.overlapAvoided=true] - 是否允许以文本避让方式显示文本。
  24789. * @param {string} [options.rangeExpression] - 制作分段标签专题的分段字段或字段表达式。
  24790. * @param {boolean} [options.smallGeometryLabeled=false] - 是否显示长度大于被标注对象本身长度的标签。
  24791. * @param {SuperMap.ThemeLabelText} options.text - 标签中文本风格。
  24792. * @param {number} [options.textSpace=0] - 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24793. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  24794. */
  24795. class ThemeLabel extends Theme {
  24796. constructor(options) {
  24797. super("LABEL", options);
  24798. /**
  24799. * @member {SuperMap.ThemeLabelAlongLine} [SuperMap.ThemeLabel.prototype.alongLine]
  24800. * @description 标签沿线标注方向样式类。
  24801. * 在该类中可以设置标签是否沿线标注以及沿线标注的多种方式。沿线标注属性只适用于线数据集专题图。
  24802. */
  24803. this.alongLine = new ThemeLabelAlongLine();
  24804. /**
  24805. * @member {SuperMap.ThemeLabelBackground} [SuperMap.ThemeLabel.prototype.background]
  24806. * @description 标签专题图中标签的背景风格类。通过该字段可以设置标签的背景形状和风格。
  24807. */
  24808. this.background = new ThemeLabelBackground();
  24809. /**
  24810. * @member {SuperMap.ThemeFlow} [SuperMap.ThemeLabel.prototype.flow]
  24811. * @description 标签专题图标签流动显示与牵引线设置类。通过该字段可以设置标签是否流动显示和牵引线风格。
  24812. */
  24813. this.flow = new ThemeFlow();
  24814. /**
  24815. * @member {Array.<SuperMap.ThemeUniqueItem>} [SuperMap.ThemeLabel.prototype.items]
  24816. * @description 分段标签专题图的子项数组。分段标签专题图使用 rangeExpression
  24817. * 指定数字型的字段作为分段数据,items 中的每个子对象的 [start,end) 分段值必须来源于属性 rangeExpression 的字段值。每个子项拥有自己的风格。
  24818. */
  24819. this.items = null;
  24820. /**
  24821. * @member {Array.<SuperMap.ThemeLabelUniqueItem>} SuperMap.ThemeLabel.prototype.uniqueItems
  24822. * @description 单值标签专题图子项数组。单值标签专题图使用 uniqueExpression单值标签专题图子项集合。
  24823. */
  24824. this.uniqueItems = null;
  24825. /**
  24826. * @member {string} SuperMap.ThemeLabel.prototype.labelExpression
  24827. * @description 标注字段表达式。系统将 labelExpression 对应的字段或字段表达式的值以标签的形式显示在图层中。
  24828. */
  24829. this.labelExpression = null;
  24830. /**
  24831. * @member {SuperMap.LabelOverLengthMode} [SuperMap.ThemeLabel.prototype.labelOverLengthMode=SuperMap.LabelOverLengthMode.NONE] - 标签专题图中超长标签的处理模式枚举类。
  24832. * @description 对于标签的长度超过设置的标签最大长度 maxLabelLength 时称为超长标签。
  24833. */
  24834. this.labelOverLengthMode = LabelOverLengthMode.NONE;
  24835. /**
  24836. * @member {Array.<SuperMap.LabelMatrixCell>} SuperMap.ThemeLabel.prototype.matrixCells
  24837. * @description 矩阵标签元素数组,用于制作矩阵标签专题图。
  24838. * 数组中可以放置符号类型的矩阵标签元素和图片类型的矩阵标签元素。
  24839. */
  24840. this.matrixCells = null;
  24841. /**
  24842. * @member {number} [SuperMap.ThemeLabel.prototype.maxLabelLength=256]
  24843. * @description 标签在每一行显示的最大长度,一个中文为两个字符。
  24844. * 如果超过最大长度,可以采用两种方式来处理,一种是换行的模式进行显示,另一种是以省略号方式显示。单位为字符。
  24845. */
  24846. this.maxLabelLength = 256;
  24847. /**
  24848. * @member {number} [SuperMap.ThemeLabel.prototype.numericPrecision=0]
  24849. * @description 如果显示的标签内容为数字,通过该字段设置其显示的精度。例如标签对应的数字是8071.64529347,
  24850. * 如果该属性为0时,显示8071;为1时,显示8071.6;为3时,则是8071.645。
  24851. */
  24852. this.numericPrecision = 0;
  24853. /**
  24854. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeLabel.prototype.offset]
  24855. * @description 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  24856. */
  24857. this.offset = new ThemeOffset();
  24858. /**
  24859. * @member {boolean} [SuperMap.ThemeLabel.prototype.overlapAvoided=true]
  24860. * @description 是否允许以文本避让方式显示文本。true 表示自动避免文本叠盖。只针对该标签专题图层中的文本数据。
  24861. * 在标签重叠度很大的情况下,即使使用自动避让功能,可能也无法完全避免标签重叠现象。
  24862. */
  24863. this.overlapAvoided = true;
  24864. /**
  24865. * @member {string} SuperMap.ThemeLabel.prototype.rangeExpression
  24866. * @description 制作分段标签专题的分段字段或字段表达式。该表达式对应的字段(或者字段表达式)的值应该为数值型。
  24867. * 该字段与 items 分段子项联合使用,每个子项的起始值 [start,end)来源于 rangeExpression 字段值。
  24868. * 最后 labelExpression 指定的标签字段(标签专题图要显示的具体内容)会根据分段子项的风格进行分段显示。
  24869. */
  24870. this.rangeExpression = null;
  24871. /**
  24872. * @member {string} SuperMap.ThemeLabel.prototype.uniqueExpression
  24873. * @description 用于制作单值专题图的字段或字段表达式。
  24874. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。必须与labelExpression一起使用。
  24875. */
  24876. this.uniqueExpression = null;
  24877. /**
  24878. * @member {boolean} [SuperMap.ThemeLabel.prototype.smallGeometryLabeled=false]
  24879. * @description 是否显示长度大于被标注对象本身长度的标签。在标签的长度大于线或者面对象本身的长度时,
  24880. * 如果该值为 true,则标签文字会叠加在一起显示,为了清楚完整的显示该标签,
  24881. * 可以采用换行模式来显示标签,但必须保证每行的长度小于对象本身的长度。
  24882. */
  24883. this.smallGeometryLabeled = false;
  24884. /**
  24885. * @member {SuperMap.ThemeLabelText} SuperMap.ThemeLabel.prototype.text
  24886. * @description 标签中文本风格。
  24887. */
  24888. this.text = new ThemeLabelText();
  24889. /**
  24890. * @member {number} [SuperMap.ThemeLabel.prototype.textSpace=0]
  24891. * @description 沿线标注,相邻两个文字之间的间距,单位当前设置的字高。
  24892. */
  24893. this.textSpace = 0;
  24894. if (options) {
  24895. Util.extend(this, options);
  24896. }
  24897. this.CLASS_NAME = "SuperMap.ThemeLabel";
  24898. }
  24899. /**
  24900. * @function SuperMap.ThemeLabel.prototype.destroy
  24901. * @override
  24902. */
  24903. destroy() {
  24904. super.destroy();
  24905. var me = this;
  24906. me.alongLine = null;
  24907. if (me.background) {
  24908. me.background.destroy();
  24909. me.background = null;
  24910. }
  24911. me.flow = null;
  24912. if (me.items) {
  24913. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  24914. items[i].destroy();
  24915. }
  24916. me.items = null;
  24917. }
  24918. if (me.uniqueItems) {
  24919. for (var j = 0, uniqueItems = me.uniqueItems, uniqueLen = uniqueItems.length; j < uniqueLen; j++) {
  24920. uniqueItems[j].destory();
  24921. }
  24922. me.uniqueItems = null;
  24923. }
  24924. me.labelExpression = null;
  24925. me.labelOverLengthMode = null;
  24926. me.matrixCells = null;
  24927. me.maxLabelLength = null;
  24928. me.numericPrecision = null;
  24929. me.overlapAvoided = null;
  24930. me.rangeExpression = null;
  24931. me.uniqueExpression = null;
  24932. if (me.offset) {
  24933. me.offset.destroy();
  24934. me.offset = null;
  24935. }
  24936. me.overlapAvoided = null;
  24937. me.smallGeometryLabeled = null;
  24938. if (me.text) {
  24939. me.text.destroy();
  24940. me.text = null;
  24941. }
  24942. me.textSpace = null;
  24943. }
  24944. /**
  24945. * @function SuperMap.ThemeLabel.prototype.toJSON
  24946. * @description 将themeLabel对象转化为 JSON 字符串。
  24947. * @returns {string} 返回转换后的 JSON 字符串。
  24948. */
  24949. toJSON() {
  24950. return Util.toJSON(this.toServerJSONObject());
  24951. }
  24952. /**
  24953. * @function SuperMap.ThemeLabel.prototype.toServerJSONObject
  24954. * @description 转换成对应的 JSON 格式对象。
  24955. * @returns {Object} 对应的 JSON 格式对象。
  24956. */
  24957. toServerJSONObject() {
  24958. var obj = {};
  24959. obj.type = this.type;
  24960. obj.memoryData = this.memoryData;
  24961. if (this.alongLine) {
  24962. obj.alongLine = this.alongLine.isAlongLine;
  24963. obj.alongLineDirection = this.alongLine.alongLineDirection;
  24964. obj.angleFixed = this.alongLine.angleFixed;
  24965. obj.isLabelRepeated = this.alongLine.isLabelRepeated;
  24966. obj.labelRepeatInterval = this.alongLine.labelRepeatInterval;
  24967. obj.repeatedLabelAvoided = this.alongLine.repeatedLabelAvoided;
  24968. obj.repeatIntervalFixed = this.alongLine.repeatIntervalFixed;
  24969. }
  24970. if (this.offset) {
  24971. obj.offsetFixed = this.offset.offsetFixed;
  24972. obj.offsetX = this.offset.offsetX;
  24973. obj.offsetY = this.offset.offsetY;
  24974. }
  24975. if (this.flow) {
  24976. obj.flowEnabled = this.flow.flowEnabled;
  24977. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  24978. obj.leaderLineStyle = this.flow.leaderLineStyle;
  24979. }
  24980. if (this.text) {
  24981. obj.maxTextHeight = this.text.maxTextHeight;
  24982. obj.maxTextWidth = this.text.maxTextWidth;
  24983. obj.minTextHeight = this.text.minTextHeight;
  24984. obj.minTextWidth = this.text.minTextWidth;
  24985. obj.uniformStyle = this.text.uniformStyle;
  24986. obj.uniformMixedStyle = this.text.uniformMixedStyle;
  24987. }
  24988. if (this.background) {
  24989. obj.labelBackShape = this.background.labelBackShape;
  24990. obj.backStyle = this.background.backStyle;
  24991. }
  24992. obj.labelOverLengthMode = this.labelOverLengthMode;
  24993. obj.maxLabelLength = this.maxLabelLength;
  24994. obj.smallGeometryLabeled = this.smallGeometryLabeled;
  24995. obj.rangeExpression = this.rangeExpression;
  24996. obj.uniqueExpression = this.uniqueExpression;
  24997. obj.numericPrecision = this.numericPrecision;
  24998. obj.items = this.items;
  24999. obj.uniqueItems = this.uniqueItems;
  25000. obj.labelExpression = this.labelExpression;
  25001. obj.overlapAvoided = this.overlapAvoided;
  25002. obj.matrixCells = this.matrixCells;
  25003. obj.textSpace = this.textSpace;
  25004. return obj;
  25005. }
  25006. /**
  25007. * @function SuperMap.ThemeLabel.fromObj
  25008. * @description 从传入对象获取标签专题图类。
  25009. * @param {Object} obj - 传入对象。
  25010. * @returns {SuperMap.ThemeLabel} ThemeLabel 对象。
  25011. */
  25012. static fromObj(obj) {
  25013. if (!obj) {
  25014. return;
  25015. }
  25016. var lab = new ThemeLabel();
  25017. var itemsL = obj.items, itemsU = obj.uniqueItems, cells = obj.matrixCells;
  25018. obj.matrixCells = null;
  25019. Util.copy(lab, obj);
  25020. lab.alongLine = ThemeLabelAlongLine.fromObj(obj);
  25021. lab.background = ThemeLabelBackground.fromObj(obj);
  25022. lab.flow = new ThemeFlow({
  25023. flowEnabled: obj.flowEnabled,
  25024. leaderLineDisplayed: obj.leaderLineDisplayed,
  25025. leaderLineStyle: obj.leaderLineStyle
  25026. });
  25027. if (itemsL) {
  25028. lab.items = [];
  25029. for (var i = 0, len = itemsL.length; i < len; i++) {
  25030. lab.items.push(ThemeLabelItem.fromObj(itemsL[i]));
  25031. }
  25032. }
  25033. if (itemsU) {
  25034. lab.uniqueItems = [];
  25035. for (let j = 0, uniqueLen = itemsU.length; j < uniqueLen; j++) {
  25036. lab.uniqueItems.push(ThemeUniqueItem.fromObj(itemsU[j]));
  25037. }
  25038. }
  25039. if (cells) {
  25040. lab.matrixCells = [];
  25041. for (let i = 0, len = cells.length; i < len; i++) {
  25042. //TODO
  25043. //lab.matrixCells.push(SuperMap.LabelMatrixCell.fromObj(cells[i]));
  25044. }
  25045. }
  25046. lab.offset = ThemeOffset.fromObj(obj);
  25047. lab.text = ThemeLabelText.fromObj(obj);
  25048. return lab;
  25049. }
  25050. }
  25051. SuperMap.ThemeLabel = ThemeLabel;
  25052. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeUnique.js
  25053. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25054. * This program are made available under the terms of the Apache License, Version 2.0
  25055. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25056. /**
  25057. * @class SuperMap.ThemeUnique
  25058. * @category iServer Map Theme
  25059. * @classdesc 单值专题图。
  25060. * @description 单值专题图是利用不同的颜色或符号(线型、填充)表示图层中某一属性信息的不同属性值,属性值相同的要素具有相同的渲染风格。单值专题图多用于具有分类属性的地图上,
  25061. * 比如土壤类型分布图、土地利用图、行政区划图等。单值专题图着重表示现象质的差别,一般不表示数量的特征。尤其是有交叉或重叠现象时,此类不推荐使用,例如:民族分布区等。
  25062. * @extends {SuperMap.Theme}
  25063. * @param {Object} options - 参数。
  25064. * @param {Array.<SuperMap.ThemeUniqueItem>} options.items - 单值专题图子项类数组。
  25065. * @param {string} options.uniqueExpression - 用于制作单值专题图的字段或字段表达式。
  25066. * @param {SuperMap.ServerStyle} [options.defaultStyle] - 未参与单值专题图制作的对象的显示风格。
  25067. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  25068. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25069. */
  25070. class ThemeUnique extends Theme {
  25071. constructor(options) {
  25072. super("UNIQUE", options);
  25073. /**
  25074. * @member {SuperMap.ServerStyle} SuperMap.ThemeUnique.prototype.defaultStyle
  25075. * @description 未参与单值专题图制作的对象的显示风格。
  25076. * 通过单值专题图子项数组 (items)可以指定某些要素参与单值专题图制作,对于那些没有被包含的要素,即不参加单值专题表达的要素,使用该风格显示。
  25077. */
  25078. this.defaultStyle = new ServerStyle();
  25079. /**
  25080. * @member {Array.<SuperMap.ThemeUniqueItem>} SuperMap.ThemeUnique.prototype.items
  25081. * @description 单值专题图子项类数组。
  25082. * 单值专题图是将专题值相同的要素归为一类,为每一类设定一种渲染风格,其中每一类就是一个专题图子项。比如,利用单值专题图制作行政区划图,
  25083. * Name 字段代表省/直辖市名,该字段用来做专题变量,如果该字段的字段值总共有5种不同值,则该行政区划图有 5 个专题图子项。
  25084. */
  25085. this.items = null;
  25086. /**
  25087. * @member {string} SuperMap.ThemeUnique.prototype.uniqueExpression
  25088. * @description 用于制作单值专题图的字段或字段表达式。
  25089. * 该字段值的数据类型可以为数值型或字符型。如果设置字段表达式,只能是相同数据类型字段间的运算。
  25090. */
  25091. this.uniqueExpression = null;
  25092. /**
  25093. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeUnique.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  25094. * @description 渐变颜色枚举类。
  25095. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  25096. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色方案完成填充。
  25097. * 但如果为某几个子项的风格进行单独设置后(设置了 ThemeUniqueItem 或 ThemeRangeItem 类中Style属性),
  25098. * 该配色方案对于这几个子项将不起作用。
  25099. */
  25100. this.colorGradientType = ColorGradientType.YELLOW_RED;
  25101. if (options) {
  25102. Util.extend(this, options);
  25103. }
  25104. this.CLASS_NAME = "SuperMap.ThemeUnique";
  25105. }
  25106. /**
  25107. * @function SuperMap.ThemeUnique.prototype.destroy
  25108. * @override
  25109. */
  25110. destroy() {
  25111. super.destroy();
  25112. var me = this;
  25113. me.uniqueExpression = null;
  25114. me.colorGradientType = null;
  25115. if (me.items) {
  25116. if (me.items.length > 0) {
  25117. for (var item in me.items) {
  25118. me.items[item].destroy();
  25119. me.items[item] = null;
  25120. }
  25121. }
  25122. me.items = null;
  25123. }
  25124. if (me.defaultStyle) {
  25125. me.defaultStyle.destroy();
  25126. me.defaultStyle = null;
  25127. }
  25128. }
  25129. /**
  25130. * @function SuperMap.ThemeUnique.prototype.toServerJSONObject
  25131. * @description 转换成对应的 JSON 格式对象。
  25132. * @returns {Object} 对应的 JSON 格式对象。
  25133. */
  25134. toServerJSONObject() {
  25135. var obj = {};
  25136. obj = Util.copyAttributes(obj, this);
  25137. if (obj.defaultStyle) {
  25138. if (obj.defaultStyle.toServerJSONObject) {
  25139. obj.defaultStyle = obj.defaultStyle.toServerJSONObject();
  25140. }
  25141. }
  25142. if (obj.items) {
  25143. var items = [],
  25144. len = obj.items.length;
  25145. for (var i = 0; i < len; i++) {
  25146. items.push(obj.items[i].toServerJSONObject());
  25147. }
  25148. obj.items = items;
  25149. }
  25150. return obj;
  25151. }
  25152. /**
  25153. * @function SuperMap.ThemeUnique.fromObj
  25154. * @description 从传入对象获取单值专题图类。
  25155. * @param {Object} obj - 传入对象。
  25156. * @returns {SuperMap.ThemeUnique} ThemeUnique 对象。
  25157. */
  25158. static fromObj(obj) {
  25159. var res = new ThemeUnique();
  25160. var uItems = obj.items;
  25161. var len = uItems ? uItems.length : 0;
  25162. Util.extend(res, obj);
  25163. res.items = [];
  25164. res.defaultStyle = ServerStyle.fromJson(obj.defaultStyle);
  25165. for (var i = 0; i < len; i++) {
  25166. res.items.push(ThemeUniqueItem.fromObj(uItems[i]));
  25167. }
  25168. return res;
  25169. }
  25170. }
  25171. SuperMap.ThemeUnique = ThemeUnique;
  25172. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphAxes.js
  25173. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25174. * This program are made available under the terms of the Apache License, Version 2.0
  25175. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25176. /**
  25177. * @class SuperMap.ThemeGraphAxes
  25178. * @category iServer Map Theme
  25179. * @classdesc 统计专题图坐标轴样式类。
  25180. * @param {Object} options - 参数。
  25181. * @param {SuperMap.ServerColor} [options.axesColor=(0, 0, 0)] - 坐标轴颜色。
  25182. * @param {boolean} [options.axesDisplayed=false] - 是否显示坐标轴。
  25183. * @param {boolean} [options.axesGridDisplayed=false] - 是否在统计图坐标轴上显示网格。
  25184. * @param {boolean} [options.axesTextDisplayed=false] - 是否显示坐标轴的文本标注。
  25185. * @param {SuperMap.ServerTextStyle} [options.axesTextStyle] - 统计符号的最大最小尺寸。
  25186. */
  25187. class ThemeGraphAxes {
  25188. constructor(options) {
  25189. /**
  25190. * @member {SuperMap.ServerColor} [SuperMap.ThemeGraphAxes.prototype.axesColor=(0, 0, 0)]
  25191. * @description 坐标轴颜色。当 axesDisplayed = true 时有效。
  25192. */
  25193. this.axesColor = new ServerColor(0, 0, 0);
  25194. /**
  25195. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesDisplayed=false]
  25196. * @description 是否显示坐标轴。<br>
  25197. * 由于饼状图和环状图无坐标轴,故该属性以及所有与坐标轴设置相关的属性都不适用于它们。并且只有当该值为 true 时,其它设置坐标轴的属性才起作用。
  25198. */
  25199. this.axesDisplayed = false;
  25200. /**
  25201. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesGridDisplayed=false]
  25202. * @description 是否在统计图坐标轴上显示网格。
  25203. */
  25204. this.axesGridDisplayed = false;
  25205. /**
  25206. * @member {boolean} [SuperMap.ThemeGraphAxes.prototype.axesTextDisplayed=false]
  25207. * @description 是否显示坐标轴的文本标注。
  25208. */
  25209. this.axesTextDisplayed = false;
  25210. /**
  25211. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphAxes.prototype.axesTextStyle
  25212. * @description 坐标轴文本风格。当 axesTextDisplayed = true 时有效。
  25213. */
  25214. this.axesTextStyle = new ServerTextStyle();
  25215. if (options) {
  25216. Util.extend(this, options);
  25217. }
  25218. this.CLASS_NAME = "SuperMap.ThemeGraphAxes";
  25219. }
  25220. /**
  25221. * @function SuperMap.ThemeGraphAxes.prototype.destroy
  25222. * @description 释放资源,将引用资源的属性置空。
  25223. */
  25224. destroy() {
  25225. var me = this;
  25226. if (me.axesColor) {
  25227. me.axesColor.destroy();
  25228. me.axesColor = null;
  25229. }
  25230. me.axesDisplayed = null;
  25231. me.axesGridDisplayed = null;
  25232. me.axesTextDisplayed = null;
  25233. if (me.axesTextStyle) {
  25234. me.axesTextStyle.destroy();
  25235. me.axesTextStyle = null;
  25236. }
  25237. }
  25238. /**
  25239. * @function SuperMap.ThemeGraphAxes.fromObj
  25240. * @description 从传入对象获取统计专题图坐标轴样式类。
  25241. * @param {Object} obj - 传入对象。
  25242. * @returns {SuperMap.ThemeGraphAxes} ThemeGraphAxes 对象。
  25243. */
  25244. static fromObj(obj) {
  25245. if (!obj) {
  25246. return;
  25247. }
  25248. var res = new ThemeGraphAxes();
  25249. Util.copy(res, obj);
  25250. res.axesColor = ServerColor.fromJson(obj.axesColor);
  25251. res.axesTextStyle = ServerTextStyle.fromObj(obj.axesTextStyle);
  25252. return res;
  25253. }
  25254. }
  25255. SuperMap.ThemeGraphAxes = ThemeGraphAxes;
  25256. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphSize.js
  25257. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25258. * This program are made available under the terms of the Apache License, Version 2.0
  25259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25260. /**
  25261. * @class SuperMap.ThemeGraphSize
  25262. * @category iServer Map Theme
  25263. * @classdesc 统计专题图符号尺寸类。
  25264. * @param {Object} options - 参数。
  25265. * @param {number} [options.maxGraphSize=0] - 统计图中显示的最大图表尺寸基准值。
  25266. * @param {number} [options.minGraphSize=0] - 统计图中显示的最小图表尺寸基准值。
  25267. */
  25268. class ThemeGraphSize {
  25269. constructor(options) {
  25270. /**
  25271. * @member {number} [SuperMap.ThemeGraphSize.prototype.maxGraphSize=0]
  25272. * @description 获取或设置统计图中显示的最大图表尺寸基准值,单位为像素。
  25273. */
  25274. this.maxGraphSize = 0;
  25275. /**
  25276. * @member {number} [SuperMap.ThemeGraphSize.prototype.minGraphSize=0]
  25277. * @description 获取或设置统计图中显示的最小图表尺寸基准值,单位为像素。
  25278. */
  25279. this.minGraphSize = 0;
  25280. if (options) {
  25281. Util.extend(this, options);
  25282. }
  25283. this.CLASS_NAME = "SuperMap.ThemeGraphSize";
  25284. }
  25285. /**
  25286. * @function SuperMap.ThemeGraphSize.prototype.destroy
  25287. * @description 释放资源,将引用资源的属性置空。
  25288. */
  25289. destroy() {
  25290. var me = this;
  25291. me.maxGraphSize = null;
  25292. me.minGraphSize = null;
  25293. }
  25294. /**
  25295. * @function SuperMap.ThemeGraphSize.fromObj
  25296. * @description 从传入对象获统计专题图符号尺寸类。
  25297. * @param {Object} obj - 传入对象。
  25298. * @returns {SuperMap.ThemeGraphSize} ThemeGraphSize 对象。
  25299. */
  25300. static fromObj(obj) {
  25301. var res = new ThemeGraphSize();
  25302. Util.copy(res, obj);
  25303. return res;
  25304. }
  25305. }
  25306. SuperMap.ThemeGraphSize = ThemeGraphSize;
  25307. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphText.js
  25308. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25309. * This program are made available under the terms of the Apache License, Version 2.0
  25310. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25311. /**
  25312. * @class SuperMap.ThemeGraphText
  25313. * @category iServer Map Theme
  25314. * @classdesc 统计图文字标注风格类。
  25315. * @param {Object} options - 可选参数。
  25316. * @param {boolean} [options.graphTextDisplayed=false] - 是否显示统计图上的文字标注。
  25317. * @param {SuperMap.ThemeGraphTextFormat} [options.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION] - 统计专题图文本显示格式。
  25318. * @param {SuperMap.ServerTextStyle} [options.graphTextStyle] - 统计图上的文字标注风格。
  25319. */
  25320. class ThemeGraphText {
  25321. constructor(options) {
  25322. /**
  25323. * @member {boolean} [SuperMap.ThemeGraphText.prototype.graphTextDisplayed=false]
  25324. * @description 是否显示统计图上的文字标注。
  25325. */
  25326. this.graphTextDisplayed = false;
  25327. /**
  25328. * @member {SuperMap.ThemeGraphTextFormat} [SuperMap.ThemeGraphText.prototype.graphTextFormat=SuperMap.ThemeGraphTextFormat.CAPTION]
  25329. * @description 统计专题图文本显示格式。
  25330. * 文本显示格式包括百分数、真实数值、标题、标题+百分数、标题+真实数值。
  25331. */
  25332. this.graphTextFormat = ThemeGraphTextFormat.CAPTION;
  25333. /**
  25334. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeGraphText.prototype.graphTextStyle
  25335. * @description 统计图上的文字标注风格。
  25336. */
  25337. this.graphTextStyle = new ServerTextStyle();
  25338. if (options) {
  25339. Util.extend(this, options);
  25340. }
  25341. this.CLASS_NAME = "SuperMap.ThemeGraphText";
  25342. }
  25343. /**
  25344. * @function SuperMap.ThemeGraphText.prototype.destroy
  25345. * @description 释放资源,将引用资源的属性置空。
  25346. */
  25347. destroy() {
  25348. var me = this;
  25349. me.graphTextDisplayed = null;
  25350. me.graphTextFormat = null;
  25351. if (me.graphTextStyle) {
  25352. me.graphTextStyle.destroy();
  25353. me.graphTextStyle = null;
  25354. }
  25355. }
  25356. /**
  25357. * @function SuperMap.ThemeGraphText.fromObj
  25358. * @description 从传入对象获取统计图文字标注风格类。
  25359. * @param {Object} obj - 传入对象。
  25360. * @returns {SuperMap.ThemeGraphText} ThemeGraphText 对象。
  25361. */
  25362. static fromObj(obj) {
  25363. var res = new ThemeGraphText();
  25364. Util.copy(res, obj);
  25365. res.graphTextStyle = ServerTextStyle.fromObj(obj.graphTextStyle);
  25366. return res;
  25367. }
  25368. }
  25369. SuperMap.ThemeGraphText = ThemeGraphText;
  25370. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraphItem.js
  25371. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25372. * This program are made available under the terms of the Apache License, Version 2.0
  25373. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25374. /**
  25375. * @class SuperMap.ThemeGraphItem
  25376. * @category iServer Map Theme
  25377. * @classdesc 统计专题图子项类。
  25378. * @param {Object} options - 参数。
  25379. * @param {string} [options.caption] - 专题图子项的名称。
  25380. * @param {string} options.graphExpression - 统计专题图的专题变量。
  25381. * @param {Array.<number>} [options.memoryDoubleValues] - 内存数组方式制作专题图时的值数组。
  25382. * @param {SuperMap.ServerStyle} [options.uniformStyle] - 统计专题图子项的显示风格
  25383. */
  25384. class ThemeGraphItem {
  25385. constructor(options) {
  25386. /**
  25387. * @member {string} [SuperMap.ThemeGraphItem.prototype.caption]
  25388. * @description 专题图子项的名称。
  25389. */
  25390. this.caption = null;
  25391. /**
  25392. * @member {string} SuperMap.ThemeGraphItem.prototype.graphExpression
  25393. * @description 统计专题图的专题变量。专题变量可以是一个字段或字段表达式。字段必须为数值型;表达式只能为数值型的字段间的运算。
  25394. */
  25395. this.graphExpression = null;
  25396. /**
  25397. * @member {Array.<number>} [SuperMap.ThemeGraphItem.prototype.memoryDoubleValues]
  25398. * @description 内存数组方式制作专题图时的值数组。<br>
  25399. * 内存数组方式制作专题图时,只对 SmID 值在键数组({@link SuperMap.ThemeGraph.memoryKeys})中的记录制作专题图。
  25400. * 值数组的数值个数必须与键数组中数值的个数一致。 值数组中的值将代替原来的专题值来制作统计专题图。
  25401. * 比如:利用面积字段和周长字段(即有两个统计专题图子项 )作为专题变量制作统计专题图。
  25402. */
  25403. this.memoryDoubleValues = null;
  25404. /**
  25405. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraphItem.prototype.uniformStyle]
  25406. * @description 统计专题图子项的显示风格。
  25407. * 每一个统计专题图子项都对应一种显示风格。
  25408. */
  25409. this.uniformStyle = new ServerStyle();
  25410. if (options) {
  25411. Util.extend(this, options);
  25412. }
  25413. this.CLASS_NAME = "SuperMap.ThemeGraphItem";
  25414. }
  25415. /**
  25416. * @function SuperMap.ThemeGraphItem.prototype.destroy
  25417. * @description 释放资源,将引用资源的属性置空。
  25418. */
  25419. destroy() {
  25420. var me = this;
  25421. me.caption = null;
  25422. me.graphExpression = null;
  25423. me.memoryDoubleValues = null;
  25424. me.uniformStyle = null;
  25425. }
  25426. /**
  25427. * @function SuperMap.ThemeGraphItem.fromObj
  25428. * @description 从传入对象获取统计专题图子项类。
  25429. * @param {Object} obj - 传入对象。
  25430. * @returns {SuperMap.ThemeGraphItem} ThemeGraphItem 对象。
  25431. */
  25432. static fromObj(obj) {
  25433. if (!obj) {
  25434. return;
  25435. }
  25436. var res = new ThemeGraphItem();
  25437. Util.copy(res, obj);
  25438. res.uniformStyle = ServerStyle.fromJson(obj.uniformStyle);
  25439. return res;
  25440. }
  25441. }
  25442. SuperMap.ThemeGraphItem = ThemeGraphItem;
  25443. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraph.js
  25444. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25445. * This program are made available under the terms of the Apache License, Version 2.0
  25446. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25447. /**
  25448. * @class SuperMap.ThemeGraph
  25449. * @category iServer Map Theme
  25450. * @classdesc 统计专题图类。
  25451. * @extends {SuperMap.Theme}
  25452. * @param {Object} options - 参数。
  25453. * @param {Array.<SuperMap.ThemeGraphItem>} options.items - 统计专题图子项集合。
  25454. * @param {number} [options.barWidth=0] - 柱状专题图中每一个柱的宽度。
  25455. * @param {SuperMap.ThemeFlow} [options.flow] - 统计专题图流动显示与牵引线设置。
  25456. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 统计图中地理要素的值与图表尺寸间的映射关系。
  25457. * @param {SuperMap.ThemeGraphAxes} [options.graphAxes] - 统计图中坐标轴样式相关信息。
  25458. * @param {SuperMap.ThemeGraphSize} [options.graphSize=0] - 统计符号的最大最小尺寸。
  25459. * @param {boolean} [options.graphSizeFixed=false] - 缩放地图时统计图符号是否固定大小。
  25460. * @param {SuperMap.ThemeGraphText} [options.graphText] - 统计图上的文字是否可以见以及文字标注风格。
  25461. * @param {SuperMap.GraphAxesTextDisplayMode} [options.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE] - 统计专题图坐标轴文本显示模式。
  25462. * @param {SuperMap.ThemeGraphType} [options.graphType=SuperMap.ThemeGraphType.AREA] - 统计专题图类型。
  25463. * @param {Array.<number>} [options.memoryKeys] - 以内存数组方式制作专题图时的键数组。
  25464. * @param {boolean} [options.negativeDisplayed=false] - 专题图中是否显示属性为负值的数据。
  25465. * @param {SuperMap.ThemeOffset} [options.offset] - 统计图相对于要素内点的偏移量。
  25466. * @param {boolean} [options.overlapAvoided=true] - 统计图是否采用避让方式显示。
  25467. * @param {number} [options.roseAngle=0] - 统计图中玫瑰图或三维玫瑰图用于等分的角度。
  25468. * @param {number} [options.startAngle=0] - 饼状统计图扇形的起始角度。
  25469. */
  25470. class ThemeGraph extends Theme {
  25471. constructor(options) {
  25472. super("GRAPH", options);
  25473. /**
  25474. * @member {number} [SuperMap.ThemeGraph.prototype.barWidth=0]
  25475. * @description 柱状专题图中每一个柱的宽度。使用地图坐标单位。
  25476. * 只有选择的统计图类型为柱状图(柱状图、三维柱状图、堆叠柱状图、三维堆叠柱状图)时,此项才可设置。
  25477. */
  25478. this.barWidth = 0;
  25479. /**
  25480. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraph.prototype.flow
  25481. * @description 统计专题图流动显示与牵引线设置。
  25482. * 通过该字段可以设置统计符号是否流动显示和牵引线风格。
  25483. */
  25484. this.flow = new ThemeFlow();
  25485. /**
  25486. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraph.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  25487. * @description 统计图中地理要素的值与图表尺寸间的映射关系(常数、对数、平方根),即分级方式。
  25488. * 分级主要是为了减少制作统计专题图中数据大小之间的差异,使得统计图的视觉效果比较好,同时不同类别之间的比较也还是有意义的。
  25489. * 提供三种分级模式:常数、对数和平方根,对于有值为负数的字段,不可以采用对数和平方根的分级方式。不同的等级方式用于确定符号大小的数值是不相同的。
  25490. */
  25491. this.graduatedMode = GraduatedMode.CONSTANT;
  25492. /**
  25493. * @member {SuperMap.ThemeGraphAxes} SuperMap.ThemeGraph.prototype.graphAxes
  25494. * @description 用于设置统计图中坐标轴样式相关信息,如坐标轴颜色、是否显示、坐标文本样式等。
  25495. */
  25496. this.graphAxes = new ThemeGraphAxes();
  25497. /**
  25498. * @member {SuperMap.ThemeGraphSize} [SuperMap.ThemeGraph.prototype.graphSize=0]
  25499. * @description 用于设置统计符号的最大最小尺寸。
  25500. */
  25501. this.graphSize = new ThemeGraphSize();
  25502. /**
  25503. * @member {boolean} [SuperMap.ThemeGraph.prototype.graphSizeFixed=false]
  25504. * @description 缩放地图时统计图符号是否固定大小。即统计图符号将随地图缩放。
  25505. */
  25506. this.graphSizeFixed = false;
  25507. /**
  25508. * @member {SuperMap.ThemeGraphText} SuperMap.ThemeGraph.prototype.graphText
  25509. * @description 统计图上的文字是否可以见以及文字标注风格。
  25510. */
  25511. this.graphText = new ThemeGraphText();
  25512. /**
  25513. * @member {SuperMap.ThemeGraphType} [SuperMap.ThemeGraph.prototype.graphType=SuperMap.ThemeGraphType.AREA]
  25514. * @description 统计专题图类型。SuperMap 提供了多种类型的统计图,
  25515. * 分别为面积图、阶梯图、折线图、点状图、柱状图、三维柱状图、饼图、三维饼图、玫瑰图、三维玫瑰图、堆叠柱状图、三维堆叠柱状图、环状图。默认为面积图。
  25516. */
  25517. this.graphType = ThemeGraphType.AREA;
  25518. /**
  25519. * @member {SuperMap.GraphAxesTextDisplayMode} [SuperMap.ThemeGraph.prototype.graphAxesTextDisplayMode=SuperMap.GraphAxesTextDisplayMode.NONE]
  25520. * @description 统计专题图坐标轴文本显示模式。
  25521. */
  25522. this.graphAxesTextDisplayMode = GraphAxesTextDisplayMode.NONE;
  25523. /**
  25524. * @member {Array.<SuperMap.ThemeGraphItem>} SuperMap.ThemeGraph.prototype.items
  25525. * @description 统计专题图子项集合。
  25526. * 统计专题图可以基于多个变量,反映多种属性,即可以将多个专题变量的值绘制在一个统计图上。每一个专题变量对应的统计图即为一个专题图子项。
  25527. * 对于每个专题图子项可以为其设置标题、风格,甚至可以将该子项再制作成范围分段专题图。
  25528. */
  25529. this.items = null;
  25530. /**
  25531. * @member {Array.<number>} SuperMap.ThemeGraph.prototype.memoryKeys
  25532. * @description 以内存数组方式制作专题图时的键数组。
  25533. * 键数组内的数值代表 SmID 值,它与 SuperMap.ThemeGraphItem 类中的值数组(SuperMap.ThemeGraphItem.memoryDoubleValues)要关联起来应用。
  25534. * 键数组中数值的个数必须要与值数组的数值个数一致。值数组中的值将代替原来的专题值来制作统计专题图。
  25535. * 目前所有的专题图都支持以内存数组的方式制作专题图,但统计专题图与其他专题图指定内存数组的方式不同,
  25536. * 统计专题图使用 memoryKeys 指定内存数组,而其他专题图则使用 memoryData 来指定内存数组。
  25537. * @example
  25538. * memoryKeys 的使用方法如下:
  25539. * function addThemeGraph() {
  25540. * removeTheme();
  25541. * //创建统计专题图对象,SuperMap.ThemeGraph 必设 items。
  25542. * //专题图参数 ThemeParameters 必设 theme(即以设置好的分段专题图对象)、dataSourceName 和 datasetName
  25543. * var style1 = new SuperMap.ServerStyle({
  25544. * fillForeColor: new SuperMap.ServerColor(92,73,234),
  25545. * lineWidth: 0.1
  25546. * }),
  25547. * style2 = new SuperMap.ServerStyle({
  25548. * fillForeColor: new SuperMap.ServerColor(211,111,240),
  25549. * lineWidth: 0.1
  25550. * }),
  25551. * item1 = new SuperMap.ThemeGraphItem({
  25552. * memoryDoubleValues:[1.18,0.95,0.37,1.31,0.8,1.5],
  25553. * caption: "1992-1995人口增长率",
  25554. * graphExpression: "Pop_Rate95",
  25555. * uniformStyle: style1
  25556. * }),
  25557. * item2 = new SuperMap.ThemeGraphItem({
  25558. * //以内存数组方式制作专题图时的值数组
  25559. * memoryDoubleValues:[2.71,0,0.74,3.1,2.2,3.5],
  25560. * caption: "1995-1999人口增长率", //专题图子项的名称
  25561. * graphExpression: "Pop_Rate99", //统计专题图的专题变量
  25562. * uniformStyle: style2 //统计专题图子项的显示风格
  25563. * }),
  25564. * themeGraph = new SuperMap.ThemeGraph({
  25565. * //以内存数组方式制作专题图时的键数组,键数组内的数值代表 SmID 值
  25566. * memoryKeys:[1,2,4,8,10,12],
  25567. * items: new Array(item1,item2),
  25568. * barWidth: 0.03,
  25569. * //统计图中地理要素的值与图表尺寸间的映射关系为平方根
  25570. * graduatedMode: SuperMap.GraduatedMode.SQUAREROOT,
  25571. * //graphAxes用于设置统计图中坐标轴样式相关信息
  25572. * graphAxes: new SuperMap.ThemeGraphAxes({
  25573. * axesDisplayed: true
  25574. * }),
  25575. * graphSize: new SuperMap.ThemeGraphSize({
  25576. * maxGraphSize: 1,
  25577. * minGraphSize: 0.35
  25578. * }),
  25579. * //统计图上的文字是否可以见以及文字标注风格
  25580. * graphText: new SuperMap.ThemeGraphText({
  25581. * graphTextDisplayed: true,
  25582. * graphTextFormat: SuperMap.ThemeGraphTextFormat.VALUE,
  25583. * graphTextStyle: new SuperMap.ServerTextStyle({
  25584. * sizeFixed: true,
  25585. * fontHeight: 9,
  25586. * fontWidth: 5
  25587. * })
  25588. * }),
  25589. * //统计专题图类型为三维柱状图
  25590. * graphType: SuperMap.ThemeGraphType.BAR3D
  25591. * }),
  25592. * //专题图参数对象
  25593. * themeParameters = new SuperMap.ThemeParameters({
  25594. * themes: [themeGraph],
  25595. * dataSourceNames: ["Jingjin"],
  25596. * datasetNames: ["BaseMap_R"]
  25597. * }),
  25598. * //与服务端交互
  25599. * themeService=new SuperMap.ThemeService(url, {
  25600. * eventListeners: {
  25601. * "processCompleted": ThemeCompleted,
  25602. * "processFailed": themeFailed
  25603. * }
  25604. * });
  25605. * themeService.processAsync(themeParameters);
  25606. * }
  25607. */
  25608. this.memoryKeys = null;
  25609. /**
  25610. * @member {boolean} [SuperMap.ThemeGraph.prototype.negativeDisplayed=false]
  25611. * @description 专题图中是否显示属性为负值的数据。true 表示显示;falese 不显示。
  25612. */
  25613. this.negativeDisplayed = false;
  25614. /**
  25615. * @member {SuperMap.ThemeOffset} SuperMap.ThemeGraph.prototype.offset
  25616. * @description 用于设置统计图相对于要素内点的偏移量。
  25617. */
  25618. this.offset = new ThemeOffset();
  25619. /**
  25620. * @member {boolean} SuperMap.ThemeGraph.prototype.overlapAvoided
  25621. * @description 统计图是否采用避让方式显示。<br>
  25622. * 1.对数据集制作统计专题图:当统计图采用避让方式显示时,如果 overlapAvoided 为 true,则在统计图重叠度很大的情况下,
  25623. * 会出现无法完全避免统计图重叠的现象;如果 overlapAvoided 为 false,会过滤掉一些统计图,从而保证所有的统计图均不重叠。<br>
  25624. * 2.对数据集同时制作统计专题图和标签专题图:当统计图不显示子项文本时,标签专题图的标签即使和统计图重叠,两者也都可正常显示;
  25625. * 当统计图显示子项文本时,如果统计图中的子项文本和标签专题图中的标签不重叠,则两者均正常显示;如果重叠,则会过滤掉统计图的子项文本,只显示标签。
  25626. */
  25627. this.overlapAvoided = true;
  25628. /**
  25629. * @member {number} [SuperMap.ThemeGraph.prototype.roseAngle=0]
  25630. * @description 统计图中玫瑰图或三维玫瑰图用于等分的角度,默认为 0 度,精确到 0.1 度。在角度为0或者大于 360 度的情况下均使用 360 度来等分制作统计图的字段数。
  25631. */
  25632. this.roseAngle = 0;
  25633. /**
  25634. * @member {number} [SuperMap.ThemeGraph.prototype.startAngle=0]
  25635. * @description 饼状统计图扇形的起始角度。精确到 0.1 度,以水平方向为正向。只有选择的统计图类型为饼状图(饼图、三维饼图、玫瑰图、三维玫瑰图)时,此项才可设置。
  25636. */
  25637. this.startAngle = 0;
  25638. if (options) {
  25639. Util.extend(this, options);
  25640. }
  25641. this.CLASS_NAME = "SuperMap.ThemeGraph";
  25642. }
  25643. /**
  25644. * @function SuperMap.ThemeGraph.prototype.destroy
  25645. * @override
  25646. */
  25647. destroy() {
  25648. super.destroy();
  25649. var me = this;
  25650. me.barWidth = null;
  25651. if (me.flow) {
  25652. me.flow.destroy();
  25653. me.flow = null;
  25654. }
  25655. me.graduatedMode = null;
  25656. if (me.graphAxes) {
  25657. me.graphAxes.destroy();
  25658. me.graphAxes = null;
  25659. }
  25660. if (me.graphSize) {
  25661. me.graphSize.destroy();
  25662. me.graphSize = null;
  25663. }
  25664. me.graphSizeFixed = null;
  25665. if (me.graphText) {
  25666. me.graphText.destroy();
  25667. me.graphText = null;
  25668. }
  25669. me.graphType = null;
  25670. if (me.items) {
  25671. for (var i = 0, items = me.items, len = items.length; i < len; i++) {
  25672. items[i].destroy();
  25673. }
  25674. me.items = null;
  25675. }
  25676. me.memoryKeys = null;
  25677. me.negativeDisplayed = null;
  25678. if (me.offset) {
  25679. me.offset.destroy();
  25680. me.offset = null;
  25681. }
  25682. me.overlapAvoided = null;
  25683. me.roseAngle = null;
  25684. me.startAngle = null;
  25685. me.graphAxesTextDisplayMode = null;
  25686. }
  25687. /**
  25688. * @function SuperMap.ThemeGraph.prototype.toJSON
  25689. * @description 将 SuperMap.ThemeGraph 对象转化为 JSON 字符串。
  25690. * @returns {string} 返回转换后的 JSON 字符串。
  25691. */
  25692. toJSON() {
  25693. return Util.toJSON(this.toServerJSONObject());
  25694. }
  25695. /**
  25696. * @function SuperMap.ThemeGraph.prototype.toServerJSONObject
  25697. * @description 转换成对应的 JSON 格式对象。
  25698. * @returns {Object} 对应的 JSON 格式对象。
  25699. */
  25700. toServerJSONObject() {
  25701. var obj = {};
  25702. obj.type = this.type;
  25703. if (this.graphText) {
  25704. obj.graphTextDisplayed = this.graphText.graphTextDisplayed;
  25705. obj.graphTextFormat = this.graphText.graphTextFormat;
  25706. obj.graphTextStyle = this.graphText.graphTextStyle;
  25707. }
  25708. if (this.flow) {
  25709. obj.flowEnabled = this.flow.flowEnabled;
  25710. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  25711. obj.leaderLineStyle = this.flow.leaderLineStyle;
  25712. }
  25713. if (this.graphAxes) {
  25714. obj.axesColor = this.graphAxes.axesColor;
  25715. obj.axesDisplayed = this.graphAxes.axesDisplayed;
  25716. obj.axesGridDisplayed = this.graphAxes.axesGridDisplayed;
  25717. obj.axesTextDisplayed = this.graphAxes.axesTextDisplayed;
  25718. obj.axesTextStyle = this.graphAxes.axesTextStyle;
  25719. }
  25720. if (this.graphSize) {
  25721. obj.maxGraphSize = this.graphSize.maxGraphSize;
  25722. obj.minGraphSize = this.graphSize.minGraphSize;
  25723. }
  25724. if (this.offset) {
  25725. obj.offsetFixed = this.offset.offsetFixed;
  25726. obj.offsetX = this.offset.offsetX;
  25727. obj.offsetY = this.offset.offsetY;
  25728. }
  25729. obj.barWidth = this.barWidth;
  25730. obj.graduatedMode = this.graduatedMode;
  25731. obj.graphSizeFixed = this.graphSizeFixed;
  25732. obj.graphType = this.graphType;
  25733. obj.graphAxesTextDisplayMode = this.graphAxesTextDisplayMode;
  25734. obj.items = this.items;
  25735. obj.memoryKeys = this.memoryKeys;
  25736. obj.negativeDisplayed = this.negativeDisplayed;
  25737. obj.overlapAvoided = this.overlapAvoided;
  25738. obj.roseAngle = this.roseAngle;
  25739. obj.startAngle = this.startAngle;
  25740. return obj;
  25741. }
  25742. /**
  25743. * @function SuperMap.ThemeGraph.fromObj
  25744. * @description 从传入对象获取统计专题图类。
  25745. * @param {Object} obj - 传入对象。
  25746. * @returns {SuperMap.ThemeGraph} ThemeGraph 对象。
  25747. */
  25748. static fromObj(obj) {
  25749. var res = new ThemeGraph();
  25750. var itemsG = obj.items;
  25751. var len = itemsG ? itemsG.length : 0;
  25752. Util.copy(res, obj);
  25753. res.items = [];
  25754. res.flow = ThemeFlow.fromObj(obj);
  25755. res.graphAxes = ThemeGraphAxes.fromObj(obj);
  25756. res.graphSize = ThemeGraphSize.fromObj(obj);
  25757. res.graphText = ThemeGraphText.fromObj(obj);
  25758. res.offset = ThemeOffset.fromObj(obj);
  25759. for (var i = 0; i < len; i++) {
  25760. res.items.push(ThemeGraphItem.fromObj(itemsG[i]));
  25761. }
  25762. return res;
  25763. }
  25764. }
  25765. SuperMap.ThemeGraph = ThemeGraph;
  25766. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeDotDensity.js
  25767. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25768. * This program are made available under the terms of the Apache License, Version 2.0
  25769. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25770. /**
  25771. * @class SuperMap.ThemeDotDensity
  25772. * @category iServer Map Theme
  25773. * @classdesc 点密度专题图。
  25774. * @description 点密度专题图用一定大小、形状相同的点表示现象分布范围、数量特征和分布密度。点的多少和所代表的意义由地图的内容确定。
  25775. * 点密度专题图利用图层的某一数值属性信息(专题值)映射为不同等级,每一级别使用不同数量或表现为密度的点符号来表示。
  25776. * 该专题值在各个分区内的分布情况,体现不同区域的相对数量差异。多用于具有数量特征的地图上,
  25777. * 比如表示不同地区的粮食产量、GDP、人口等的分级,主要针对区域或面状的要素,因而,点密度专题图适用于面数据集。
  25778. * 注意:点密度专题图中点的分布是随机的,并不代表实际的分布位置。即使在相关设置完全相同的情况下,
  25779. * 每次制作出的专题图,点的数量相同,但点的位置都有差异。
  25780. * @extends {SuperMap.Theme}
  25781. * @param {Object} options - 参数。
  25782. * @param {string} options.dotExpression - 创建点密度专题图的字段或字段表达式。
  25783. * @param {SuperMap.ServerStyle} [options.style] - 点密度专题图中点的风格。
  25784. * @param {number} [options.value] - 专题图中每一个点所代表的数值。
  25785. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25786. */
  25787. class ThemeDotDensity extends Theme {
  25788. constructor(options) {
  25789. super("DOTDENSITY", options);
  25790. /**
  25791. * @member {string} SuperMap.ThemeDotDensity.prototype.dotExpression
  25792. * @description 创建点密度专题图的字段或字段表达式。点的数目或密集程度的来源。
  25793. */
  25794. this.dotExpression = null;
  25795. /**
  25796. * @member {SuperMap.ServerStyle} SuperMap.ThemeDotDensity.prototype.style
  25797. * @description 点密度专题图中点的风格。
  25798. */
  25799. this.style = new ServerStyle();
  25800. /**
  25801. * @member {number} SuperMap.ThemeDotDensity.prototype.value
  25802. * @description 专题图中每一个点所代表的数值。<br>
  25803. * 点值的确定与地图比例尺以及点的大小有关。地图比例尺越大,相应的图面范围也越大,
  25804. * 点相应就可以越多,此时点值就可以设置相对小一些。点形状越大,
  25805. * 点值相应就应该设置的小一些。点值过大或过小都是不合适的。
  25806. */
  25807. this.value = null;
  25808. if (options) {
  25809. Util.extend(this, options);
  25810. }
  25811. this.CLASS_NAME = "SuperMap.ThemeDotDensity";
  25812. }
  25813. /**
  25814. * @function SuperMap.ThemeDotDensity.prototype.destroy
  25815. * @description 释放资源,将引用资源的属性置空。
  25816. */
  25817. destroy() {
  25818. var me = this;
  25819. me.dotExpression = null;
  25820. me.value = null;
  25821. if (me.style) {
  25822. me.style.destroy();
  25823. me.style = null;
  25824. }
  25825. }
  25826. /**
  25827. * @function SuperMap.ThemeDotDensity.prototype.toServerJSONObject
  25828. * @description 转换成对应的 JSON 格式对象。
  25829. * @returns {Object} 对应的 JSON 格式对象。
  25830. */
  25831. toServerJSONObject() {
  25832. var obj = {};
  25833. obj = Util.copyAttributes(obj, this);
  25834. if (obj.style) {
  25835. if (obj.style.toServerJSONObject) {
  25836. obj.style = obj.style.toServerJSONObject();
  25837. }
  25838. }
  25839. return obj;
  25840. }
  25841. /**
  25842. * @function SuperMap.ThemeDotDensity.fromObj
  25843. * @description 从传入对象获取点密度专题图中点的风格。
  25844. * @param {Object} obj - 传入对象。
  25845. * @returns {SuperMap.ThemeDotDensity} ThemeDotDensity 对象。
  25846. */
  25847. static fromObj(obj) {
  25848. if (!obj) {
  25849. return;
  25850. }
  25851. var res = new ThemeDotDensity();
  25852. Util.copy(res, obj);
  25853. res.style = ServerStyle.fromJson(obj.style);
  25854. return res;
  25855. }
  25856. }
  25857. SuperMap.ThemeDotDensity = ThemeDotDensity;
  25858. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbolStyle.js
  25859. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25860. * This program are made available under the terms of the Apache License, Version 2.0
  25861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25862. /**
  25863. * @class SuperMap.ThemeGraduatedSymbolStyle
  25864. * @category iServer Map Theme
  25865. * @classdesc 等级符号专题图正负零值显示风格类。
  25866. * @param {Object} options - 参数。
  25867. * @param {boolean} [options.negativeDisplayed=false] - 是否显示负值。
  25868. * @param {SuperMap.ServerStyle} [options.negativeStyle] - 负值的等级符号风格。
  25869. * @param {SuperMap.ServerStyle} [options.positiveStyle] - 正值的等级符号风格。
  25870. * @param {boolean} [options.zeroDisplayed=false] - 是否显示 0 值。
  25871. * @param {SuperMap.ServerStyle} [options.zeroStyle] - 0 值的等级符号风格。
  25872. */
  25873. class ThemeGraduatedSymbolStyle {
  25874. constructor(options) {
  25875. /**
  25876. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeDisplayed=false]
  25877. * @description 是否显示负值。
  25878. */
  25879. this.negativeDisplayed = false;
  25880. /**
  25881. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.negativeStyle]
  25882. * @description 负值的等级符号风格。
  25883. */
  25884. this.negativeStyle = new ServerStyle();
  25885. /**
  25886. * @member {SuperMap.ServerStyle} [SuperMap.ThemeGraduatedSymbolStyle.prototype.positiveStyle]
  25887. * @description 正值的等级符号风格。
  25888. */
  25889. this.positiveStyle = new ServerStyle();
  25890. /**
  25891. * @member {boolean} [SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroDisplayed=false]
  25892. * @description 是否显示 0 值。
  25893. */
  25894. this.zeroDisplayed = false;
  25895. /**
  25896. * @member {SuperMap.ServerStyle} SuperMap.ThemeGraduatedSymbolStyle.prototype.zeroStyle
  25897. * @description 0 值的等级符号风格。
  25898. */
  25899. this.zeroStyle = new ServerStyle();
  25900. if (options) {
  25901. Util.extend(this, options);
  25902. }
  25903. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbolStyle";
  25904. }
  25905. /**
  25906. * @function SuperMap.ThemeGraduatedSymbolStyle.prototype.destroy
  25907. * @description 释放资源,将引用资源的属性置空。
  25908. */
  25909. destroy() {
  25910. var me = this;
  25911. me.negativeDisplayed = null;
  25912. me.negativeStyle = null;
  25913. me.positiveStyle = null;
  25914. me.zeroDisplayed = null;
  25915. me.zeroStyle = null;
  25916. }
  25917. /**
  25918. * @function SuperMap.ThemeGraduatedSymbolStyle.fromObj
  25919. * @description 从传入对象获取等级符号专题图正负零值显示风格类。
  25920. * @param {Object} obj - 传入对象。
  25921. * @returns {SuperMap.ThemeGraduatedSymbolStyle} ThemeGraduatedSymbolStyle 对象。
  25922. */
  25923. static fromObj(obj) {
  25924. if (!obj) {
  25925. return;
  25926. }
  25927. var res = new ThemeGraduatedSymbolStyle();
  25928. Util.copy(res, obj);
  25929. res.negativeStyle = ServerStyle.fromJson(obj.negativeStyle);
  25930. res.positiveStyle = ServerStyle.fromJson(obj.positiveStyle);
  25931. res.zeroStyle = ServerStyle.fromJson(obj.zeroStyle);
  25932. return res;
  25933. }
  25934. }
  25935. SuperMap.ThemeGraduatedSymbolStyle = ThemeGraduatedSymbolStyle;
  25936. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGraduatedSymbol.js
  25937. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  25938. * This program are made available under the terms of the Apache License, Version 2.0
  25939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  25940. /**
  25941. * @class SuperMap.ThemeGraduatedSymbol
  25942. * @category iServer Map Theme
  25943. * @classdesc 等级符号专题图。
  25944. * @extends {SuperMap.Theme}
  25945. * @param {Object} options - 参数。
  25946. * @param {SuperMap.ThemeGraduatedSymbolStyle} options.style - 用于设置等级符号图正负和零值显示风格。
  25947. * @param {string} options.expression - 等级符号专题图的字段或字段表达式。
  25948. * @param {number} [options.baseValue=0] - 等级符号专题图的基准值,单位同专题变量的单位。
  25949. * @param {SuperMap.ThemeFlow} [options.flow] - 等级符号专题图符号流动显示与牵引线设置类。
  25950. * @param {SuperMap.GraduatedMode} [options.graduatedMode=SuperMap.GraduatedMode.CONSTANT] - 等级符号专题图分级模式。
  25951. * @param {SuperMap.ThemeOffset} [options.offset] - 用于设置标签专题图中标记文本相对于要素内点的偏移量对象。
  25952. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  25953. */
  25954. class ThemeGraduatedSymbol extends Theme {
  25955. constructor(options) {
  25956. super("GRADUATEDSYMBOL", options);
  25957. /**
  25958. * @member {number} [SuperMap.ThemeGraduatedSymbol.prototype.baseValue=0]
  25959. * @description 等级符号专题图的基准值,单位同专题变量的单位。<br>
  25960. * 依据此值系统会自动根据分级方式计算其余值对应的符号大小,每个符号的显示大小等于
  25961. * ThemeValueSection.positiveStyle(或 zeroStyle,negativeStyle).markerSize * value / basevalue,
  25962. * 其中 value 是 expression 所指定字段对应的值经过分级计算之后的值。默认值为0,建议通过多次尝试设置该值才能达到较好的显示效果。
  25963. */
  25964. this.baseValue = 0;
  25965. /**
  25966. * @member {string} SuperMap.ThemeGraduatedSymbol.prototype.expression
  25967. * @description 用于创建等级符号专题图的字段或字段表达式,字段或字段表达式应为数值型。
  25968. */
  25969. this.expression = null;
  25970. /**
  25971. * @member {SuperMap.ThemeFlow} SuperMap.ThemeGraduatedSymbol.prototype.flow
  25972. * @description 等级符号专题图符号流动显示与牵引线设置类。<br>
  25973. * 通过该字段可以设置等级符号是否流动显示和牵引线风格。
  25974. */
  25975. this.flow = new ThemeFlow();
  25976. /**
  25977. * @member {SuperMap.GraduatedMode} [SuperMap.ThemeGraduatedSymbol.prototype.graduatedMode=SuperMap.GraduatedMode.CONSTANT]
  25978. * @description 等级符号专题图分级模式。<br>
  25979. * 分级主要是为了减少制作等级符号专题图中数据大小之间的差异。如果数据之间差距较大,则可以采用对数或者平方根的分级方式来进行,
  25980. * 这样就减少了数据之间的绝对大小的差异,使得等级符号图的视觉效果比较好,同时不同类别之间的比较也是有意义的。
  25981. * 有三种分级模式:常数、对数和平方根,对于有值为负数的字段,在用对数或平方根方式分级时,默认对负数取正。
  25982. * 不同的分级模式用于确定符号大小的数值是不相同的:常数按照字段的原始数据进行;对数则是对每条记录对应的专题变量取自然对数;
  25983. * 平方根则是对其取平方根,然后用最终得到的结果来确定其等级符号的大小。
  25984. */
  25985. this.graduatedMode = SuperMap.GraduatedMode.CONSTAN;
  25986. /**
  25987. * @member {SuperMap.ThemeOffset} [SuperMap.ThemeGraduatedSymbol.prototype.offset]
  25988. * @description 用于设置等级符号图相对于要素内点的偏移量。
  25989. */
  25990. this.offset = new ThemeOffset();
  25991. /**
  25992. * @member {SuperMap.ThemeGraduatedSymbolStyle} SuperMap.ThemeGraduatedSymbol.prototype.style
  25993. * @description 用于设置等级符号图正负和零值显示风格。
  25994. */
  25995. this.style = new ThemeGraduatedSymbolStyle();
  25996. if (options) {
  25997. Util.extend(this, options);
  25998. }
  25999. this.CLASS_NAME = "SuperMap.ThemeGraduatedSymbol";
  26000. }
  26001. /**
  26002. * @function SuperMap.ThemeGraduatedSymbol.prototype.destroy
  26003. * @description 释放资源,将引用资源的属性置空。
  26004. */
  26005. destroy() {
  26006. super.destroy();
  26007. var me = this;
  26008. me.expression = null;
  26009. if (me.flow) {
  26010. me.flow.destroy();
  26011. me.flow = null;
  26012. }
  26013. me.graduatedMode = GraduatedMode.CONSTANT;
  26014. if (me.offset) {
  26015. me.offset.destroy();
  26016. me.offset = null;
  26017. }
  26018. if (me.style) {
  26019. me.style.destroy();
  26020. me.style = null;
  26021. }
  26022. }
  26023. /**
  26024. * @function SuperMap.ThemeGraduatedSymbol.prototype.toJSON
  26025. * @description 将 themeLabel 对象转化为 JSON 字符串。
  26026. * @returns {string} 返回转换后的 JSON 字符串。
  26027. */
  26028. toJSON() {
  26029. return Util.toJSON(this.toServerJSONObject());
  26030. }
  26031. /**
  26032. * @function SuperMap.ThemeGraduatedSymbol.prototype.toServerJSONObject
  26033. * @description 转换成对应的 JSON 格式对象。
  26034. * @returns {Object} 对应的 JSON 格式对象。
  26035. */
  26036. toServerJSONObject() {
  26037. var obj = {};
  26038. obj.type = this.type;
  26039. obj.memoryData = this.memoryData;
  26040. obj.baseValue = this.baseValue;
  26041. obj.expression = this.expression;
  26042. obj.graduatedMode = this.graduatedMode;
  26043. if (this.flow) {
  26044. obj.flowEnabled = this.flow.flowEnabled;
  26045. obj.leaderLineDisplayed = this.flow.leaderLineDisplayed;
  26046. obj.leaderLineStyle = this.flow.leaderLineStyle;
  26047. }
  26048. if (this.offset) {
  26049. obj.offsetFixed = this.offset.offsetFixed;
  26050. obj.offsetX = this.offset.offsetX;
  26051. obj.offsetY = this.offset.offsetY;
  26052. }
  26053. if (this.style) {
  26054. obj.negativeStyle = this.style.negativeStyle;
  26055. obj.negativeDisplayed = this.style.negativeDisplayed;
  26056. obj.positiveStyle = this.style.positiveStyle;
  26057. obj.zeroDisplayed = this.style.zeroDisplayed;
  26058. obj.zeroStyle = this.style.zeroStyle;
  26059. }
  26060. return obj;
  26061. }
  26062. /**
  26063. * @function SuperMap.ThemeGraduatedSymbol.fromObj
  26064. * @description 从传入对象获取等级符号专题图。
  26065. * @param {Object} obj - 传入对象。
  26066. * @returns {SuperMap.ThemeGraduatedSymbol} 等级符号专题图对象。
  26067. */
  26068. static fromObj(obj) {
  26069. if (!obj) {
  26070. return;
  26071. }
  26072. var res = new SuperMap.ThemeGraduatedSymbol();
  26073. Util.copy(res, obj);
  26074. res.flow = ThemeFlow.fromObj(obj);
  26075. res.offset = ThemeOffset.fromObj(obj);
  26076. res.style = ThemeGraduatedSymbolStyle.fromObj(obj);
  26077. return res;
  26078. }
  26079. }
  26080. SuperMap.ThemeGraduatedSymbol = ThemeGraduatedSymbol;
  26081. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRangeItem.js
  26082. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26083. * This program are made available under the terms of the Apache License, Version 2.0
  26084. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26085. /**
  26086. * @class SuperMap.ThemeRangeItem
  26087. * @category iServer Map Theme
  26088. * @classdesc 范围分段专题图子项类。
  26089. * @description 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  26090. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为[start, end)。
  26091. * @param {Object} options - 参数。
  26092. * @param {string} [options.caption] - 分段专题图子项的标题。
  26093. * @param {number} [options.end=0] - 分段专题图子项的终止值。
  26094. * @param {number} [options.start=0] - 分段专题图子项的起始值。
  26095. * @param {SuperMap.ServerStyle} options.style - 分段专题图子项的风格。
  26096. * @param {boolean} [options.visible=true] - 分段专题图子项是否可见。
  26097. */
  26098. class ThemeRangeItem {
  26099. constructor(options) {
  26100. /**
  26101. * @member {string} [SuperMap.ThemeRangeItem.prototype.caption]
  26102. * @description 分段专题图子项的标题。
  26103. */
  26104. this.caption = null;
  26105. /**
  26106. * @member {number} [SuperMap.ThemeRangeItem.prototype.end=0]
  26107. * @description 分段专题图子项的终止值,即该段专题值范围的最大值。<br>
  26108. * 如果该子项是分段中最后一个子项,则该终止值应大于分段字段(ThemeRange 类的 rangeExpression 属性)的最大值,若该终止值小于分段字段最大值,
  26109. * 则剩余部分由内部随机定义其颜色;如果不是最后一项,该终止值必须与其下一子项的起始值相同,否则系统抛出异常;
  26110. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  26111. */
  26112. this.end = 0;
  26113. /**
  26114. * @member {number} [SuperMap.ThemeRangeItem.prototype.start=0]
  26115. * @description 分段专题图子项的起始值,即该段专题值范围的最小值。<br>
  26116. * 如果该子项是分段中第一个子项,那么该起始值就是分段的最小值;如果子项的序号大于等于 1 的时候,该起始值必须与前一子项的终止值相同,否则系统会抛出异常。
  26117. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按您设置的值对分段结果进行调整。
  26118. */
  26119. this.start = 0;
  26120. /**
  26121. * @member {SuperMap.ServerStyle} SuperMap.ThemeRangeItem.prototype.style
  26122. * @description 分段专题图子项的风格。
  26123. * 每一个分段专题图子项都对应一种显示风格。
  26124. */
  26125. this.style = new ServerStyle();
  26126. /**
  26127. * @member {boolean} [SuperMap.ThemeRangeItem.prototype.visible=true]
  26128. * @description 分段专题图子项是否可见。
  26129. */
  26130. this.visible = true;
  26131. if (options) {
  26132. Util.extend(this, options);
  26133. }
  26134. this.CLASS_NAME = "SuperMap.ThemeRangeItem";
  26135. }
  26136. /**
  26137. * @function SuperMap.ThemeRangeItem.prototype.destroy
  26138. * @description 释放资源,将引用资源的属性置空。
  26139. */
  26140. destroy() {
  26141. var me = this;
  26142. me.caption = null;
  26143. me.end = null;
  26144. me.start = null;
  26145. if (me.style) {
  26146. me.style.destroy();
  26147. me.style = null;
  26148. }
  26149. me.visible = null;
  26150. }
  26151. /**
  26152. * @function SuperMap.ThemeRangeItem.prototypetoServerJSONObject
  26153. * @description 转换成对应的 JSON 格式对象。
  26154. * @returns {Object} 对应的 JSON 格式对象。
  26155. */
  26156. toServerJSONObject() {
  26157. var obj = {};
  26158. obj = Util.copyAttributes(obj, this);
  26159. if (obj.style) {
  26160. if (obj.style.toServerJSONObject) {
  26161. obj.style = obj.style.toServerJSONObject();
  26162. }
  26163. }
  26164. return obj;
  26165. }
  26166. /**
  26167. * @function SuperMap.ThemeRangeItem.fromObj
  26168. * @description 从传入对象获取范围分段专题图子项类。
  26169. * @param {Object} obj - 传入对象。
  26170. * @returns {SuperMap.ThemeRangeItem} ThemeRangeItem 对象。
  26171. */
  26172. static fromObj(obj) {
  26173. if (!obj) {
  26174. return;
  26175. }
  26176. var res = new ThemeRangeItem();
  26177. Util.copy(res, obj);
  26178. res.style = ServerStyle.fromJson(obj.style);
  26179. return res;
  26180. }
  26181. }
  26182. SuperMap.ThemeRangeItem = ThemeRangeItem;
  26183. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeRange.js
  26184. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26185. * This program are made available under the terms of the Apache License, Version 2.0
  26186. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26187. /**
  26188. * @class SuperMap.ThemeRange
  26189. * @category iServer Map Theme
  26190. * @classdesc 范围分段专题图。
  26191. * @description 范围分段专题图是按照指定的分段方法(如:等距离分段法)对字段的属性值进行分段,使用不同的颜色或符号(线型、填充)表示不同范围段落的属性值在整体上的分布情况,体现区域的差异。
  26192. * 在分段专题图中,专题值按照某种分段方式被分成多个范围段,要素根据各自的专题值被分配到其中一个范围段中,在同一个范围段中的要素使用相同的颜色,填充,符号等风格进行显示。
  26193. * 分段专题图所基于的专题变量必须为数值型,分段专题图一般用来反映连续分布现象的数量或程度特征,如降水量的分布,土壤侵蚀强度的分布等。
  26194. * @extends {SuperMap.Theme}
  26195. * @param {Object} options - 参数。
  26196. * @param {Array.<SuperMap.ThemeRangeItem>} options.items - 分段专题图子项数组。
  26197. * @param {string} options.rangeExpression - 分段字段表达式。
  26198. * @param {number} options.rangeParameter - 分段参数。
  26199. * @param {number} options.rangeParameter - 分段参数。
  26200. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  26201. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  26202. * @param {SuperMap.ThemeMemoryData} [options.memoryData] - 专题图内存数据。
  26203. */
  26204. class ThemeRange extends Theme {
  26205. constructor(options) {
  26206. super("RANGE", options);
  26207. /**
  26208. * @member {string} SuperMap.ThemeRange.prototype.precision
  26209. * @description 精准度
  26210. */
  26211. this.precision = '1.0E-12';
  26212. /**
  26213. * @member {Array.<SuperMap.ThemeRangeItem>} SuperMap.ThemeRange.prototype.items
  26214. * @description 分段专题图子项数组。<br>
  26215. * 在分段专题图中,字段值按照某种分段模式被分成多个范围段,每个范围段即为一个子项,同一范围段的要素属于同一个分段专题图子项。
  26216. * 每个子项都有其分段起始值、终止值、名称和风格等。每个分段所表示的范围为 [start, end)。
  26217. * 如果设置了范围分段模式和分段数,则会自动计算每段的范围 [start, end),故无需设置 [start, end);当然可以设置,那么结果就会按照您设置的值对分段结果进行调整。
  26218. */
  26219. this.items = null;
  26220. /**
  26221. * @member {string} SuperMap.ThemeRange.prototype.rangeExpression
  26222. * @description 分段字段表达式。<br>
  26223. * 由于范围分段专题图基于各种分段方法根据一定的距离进行分段,因而范围分段专题图所基于的字段值的数据类型必须为数值型。对于字段表达式,只能为数值型的字段间的运算。
  26224. */
  26225. this.rangeExpression = null;
  26226. /**
  26227. * @member {SuperMap.RangeMode} [SuperMap.ThemeRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  26228. * @description 分段专题图的分段模式。<br>
  26229. * 在分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  26230. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  26231. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  26232. */
  26233. this.rangeMode = RangeMode.EQUALINTERVAL;
  26234. /**
  26235. * @member {number} SuperMap.ThemeRange.prototype.rangeParameter
  26236. * @description 分段参数。
  26237. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数;当分段模式为标准差分段法时,
  26238. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  26239. */
  26240. this.rangeParameter = 0;
  26241. /**
  26242. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  26243. * @description 渐变颜色枚举类。<br>
  26244. * 渐变色是由起始色根据一定算法逐渐过渡到终止色的一种混合型颜色。
  26245. * 该类作为单值专题图参数类、分段专题图参数类的属性,负责设置单值专题图、分段专题图的配色方案,在默认情况下专题图所有子项会根据这个配色
  26246. * 方案完成填*充。但如果为某几个子项的风格进行单独设置后(设置了 {@link SuperMap.ThemeUniqueItem} 或 {@link SuperMap.ThemeRangeItem} 类中Style属性),
  26247. * 该配色方案对于这几个子项将不起作用。
  26248. */
  26249. this.colorGradientType = ColorGradientType.YELLOW_RED;
  26250. if (options) {
  26251. Util.extend(this, options);
  26252. }
  26253. this.CLASS_NAME = "SuperMap.ThemeRange";
  26254. }
  26255. /**
  26256. * @function SuperMap.ThemeRange.prototype.destroy
  26257. * @override
  26258. */
  26259. destroy() {
  26260. super.destroy();
  26261. var me = this;
  26262. if (me.items) {
  26263. if (me.items.length > 0) {
  26264. for (var item in me.items) {
  26265. me.items[item].destroy();
  26266. me.items[item] = null;
  26267. }
  26268. }
  26269. me.items = null;
  26270. }
  26271. me.rangeExpression = null;
  26272. me.rangeMode = null;
  26273. me.rangeParameter = null;
  26274. me.colorGradientType = null;
  26275. }
  26276. /**
  26277. * @function SuperMap.ThemeRange.fromObj
  26278. * @description 从传入对象获取范围分段专题图类。
  26279. * @param {Object} obj - 传入对象。
  26280. * @returns {SuperMap.ThemeRange} ThemeRange 对象。
  26281. */
  26282. static fromObj(obj) {
  26283. if (!obj) {
  26284. return;
  26285. }
  26286. var res = new ThemeRange();
  26287. Util.copy(res, obj);
  26288. var itemsR = obj.items;
  26289. var len = itemsR ? itemsR.length : 0;
  26290. res.items = [];
  26291. for (var i = 0; i < len; i++) {
  26292. res.items.push(ThemeRangeItem.fromObj(itemsR[i]));
  26293. }
  26294. return res;
  26295. }
  26296. }
  26297. SuperMap.ThemeRange = ThemeRange;
  26298. ;// CONCATENATED MODULE: ./src/common/iServer/UGCLayer.js
  26299. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26300. * This program are made available under the terms of the Apache License, Version 2.0
  26301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26302. /**
  26303. * @class SuperMap.UGCLayer
  26304. * @category iServer Map Layer
  26305. * @classdesc UGC 图层类。
  26306. * @param {Object} options - 参数。
  26307. * @param {SuperMap.Bounds} options.bounds - 图层范围。
  26308. * @param {string} options.name - 图层的名称。
  26309. * @param {SuperMap.UGCLayerType} options.type - 图层类型
  26310. * @param {string} [options.caption] - 图层的标题。
  26311. * @param {string} [options.description] - 图层的描述信息。
  26312. * @param {boolean} [options.queryable] - 图层中的对象是否可以查询。
  26313. * @param {boolean} [options.subUGCLayers] - 是否允许图层的符号大小随图缩放。
  26314. * @param {boolean} [options.visible=false] - 地图对象在同一范围内时,是否重叠显示。
  26315. */
  26316. class UGCLayer {
  26317. constructor(options) {
  26318. options = options || {};
  26319. /**
  26320. * @member {SuperMap.Bounds} SuperMap.UGCLayer.prototype.bounds
  26321. * @description 图层范围。
  26322. */
  26323. this.bounds = null;
  26324. /**
  26325. * @member {string} [SuperMap.UGCLayer.prototype.caption]
  26326. * @description 图层的标题。默认情况下图层的标题与图层的名称一致。在图例、图层控制列表中显示的图层名称就是该图层的标题值。
  26327. */
  26328. this.caption = null;
  26329. /**
  26330. * @member {string} SuperMap.UGCLayer.prototype.description
  26331. * @description 图层的描述信息。
  26332. */
  26333. this.description = null;
  26334. /**
  26335. * @member {string} SuperMap.UGCLayer.prototype.name
  26336. * @description 图层的名称。图层的名称在图层所在的地图中唯一标识此图层。该属性区分大小写。
  26337. */
  26338. this.name = null;
  26339. /**
  26340. * @member {boolean} SuperMap.UGCLayer.prototype.queryable
  26341. * @description 图层中的对象是否可以查询。
  26342. */
  26343. this.queryable = null;
  26344. /**
  26345. * @member {Array} SuperMap.UGCLayer.prototype.subLayers
  26346. * @description 子图层集。
  26347. */
  26348. this.subLayers = null;
  26349. /**
  26350. * @member {SuperMap.UGCLayerType} SuperMap.UGCLayer.prototype.type
  26351. * @description 图层类型。
  26352. */
  26353. this.type = null;
  26354. /**
  26355. * @member {boolean} SuperMap.UGCLayer.prototype.visible
  26356. * @description 地图对象在同一范围内时,是否重叠显示。
  26357. */
  26358. this.visible = null;
  26359. Util.extend(this, options);
  26360. this.CLASS_NAME = "SuperMap.UGCLayer";
  26361. }
  26362. /**
  26363. * @function SuperMap.UGCLayer.prototype.destroy
  26364. * @description 释放资源,将引用资源的属性置空。
  26365. */
  26366. destroy() {
  26367. var me = this;
  26368. Util.reset(me);
  26369. }
  26370. /**
  26371. * @function SuperMap.UGCLayer.prototype.fromJson
  26372. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26373. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26374. */
  26375. fromJson(jsonObject) {
  26376. jsonObject = jsonObject ? jsonObject : {};
  26377. Util.extend(this, jsonObject);
  26378. var b = this.bounds;
  26379. if (b) {
  26380. this.bounds = new Bounds(b.leftBottom.x, b.leftBottom.y, b.rightTop.x, b.rightTop.y);
  26381. }
  26382. }
  26383. /**
  26384. * @function SuperMap.UGCLayer.prototype.toServerJSONObject
  26385. * @description 转换成对应的 JSON 格式对象。
  26386. * @returns {Object} 对应的 JSON 格式对象。
  26387. */
  26388. toServerJSONObject() {
  26389. var jsonObject = {};
  26390. jsonObject = Util.copyAttributes(jsonObject, this);
  26391. if (jsonObject.bounds) {
  26392. if (jsonObject.bounds.toServerJSONObject) {
  26393. jsonObject.bounds = jsonObject.bounds.toServerJSONObject();
  26394. }
  26395. }
  26396. return jsonObject;
  26397. }
  26398. }
  26399. SuperMap.UGCLayer = UGCLayer;
  26400. ;// CONCATENATED MODULE: ./src/common/iServer/OverlapDisplayedOptions.js
  26401. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26402. * This program are made available under the terms of the Apache License, Version 2.0
  26403. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26404. /**
  26405. * @class SuperMap.OverlapDisplayedOptions
  26406. * @category iServer Map Layer
  26407. * @classdesc 地图压盖过滤显示选项。
  26408. * @description 在文本或专题图元素显示较密集的区域,文本之间或专题元素之间会发生相互压盖的现象,
  26409. * 该类可以分别控制各种类型的对象的压盖显示情况,进而很好地处理地图中各种类型对象的压盖显示问题。
  26410. * @param {Object} options - 参数。
  26411. * @param {boolean} [options.allowPointOverlap=true] - 点和点压盖时是否显示压盖的点对象。
  26412. * @param {boolean} [options.allowPointWithTextDisplay=true] - 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  26413. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  26414. * @param {boolean} [options.allowTextOverlap=false] - 文本压盖时是否显示压盖的文本对象。
  26415. * @param {boolean} [options.allowTextAndPointOverlap=true] - 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  26416. * @param {boolean} [options.allowThemeGraduatedSymbolOverlap=false] - 等级符号元素压盖时是否显示压盖的等级符号元素。
  26417. * @param {boolean} [options.allowThemeGraphOverlap=false] - 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  26418. * @param {number} [options.horizontalOverlappedSpaceSize=0] - 两个对象之间的横向压盖间距,单位为 0.1 毫米,跟 verticalOverlappedSpaceSize 结合使用,
  26419. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  26420. * @param {number} [options.verticalOverlappedSpaceSize=0] - 两个对象之间的纵向压盖间距,单位为 0.1 毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  26421. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  26422. */
  26423. class OverlapDisplayedOptions {
  26424. constructor(options) {
  26425. options = options || {};
  26426. /**
  26427. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointOverlap=true]
  26428. * @description 点和点压盖时是否显示压盖的点对象。
  26429. */
  26430. this.allowPointOverlap = true;
  26431. /**
  26432. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowPointWithTextDisplay=true]
  26433. * @description 标签和相应普通图层上的点是否一起过滤显示,如果过滤显示,
  26434. * 只以图层集合中对应数据集的索引最小的图层的点风格来绘制点。
  26435. */
  26436. this.allowPointWithTextDisplay = true;
  26437. /**
  26438. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextOverlap=false]
  26439. * @description 文本压盖时是否显示压盖的文本对象。
  26440. */
  26441. this.allowTextOverlap = false;
  26442. /**
  26443. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowTextAndPointOverlap=true]
  26444. * @description 文本和点压盖时是否显示压盖的文本或点对象(此属性不处理文本之间的压盖和点之间的压盖)。
  26445. */
  26446. this.allowTextAndPointOverlap = true;
  26447. /**
  26448. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraduatedSymbolOverlap=false]
  26449. * @description 等级符号元素压盖时是否显示压盖的等级符号元素。
  26450. */
  26451. this.allowThemeGraduatedSymbolOverlap = false;
  26452. /**
  26453. * @member {boolean} [SuperMap.OverlapDisplayedOptions.prototype.allowThemeGraphOverlap=false]
  26454. * @description 统计专题图元素压盖时是否显示压盖的统计专题图元素。
  26455. */
  26456. this.allowThemeGraphOverlap = false;
  26457. /**
  26458. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.horizontalOverlappedSpaceSize=0]
  26459. * @description 两个对象之间的横向压盖间距,单位为0.1毫米,跟 verticalOverlappedSpaceSize 结合使用,
  26460. * 当两个对象的横向间距小于该值,且纵向间距小于 verticalOverlappedSpaceSize 时认为压盖。
  26461. */
  26462. this.horizontalOverlappedSpaceSize = 0;
  26463. /**
  26464. * @member {number} [SuperMap.OverlapDisplayedOptions.prototype.verticalOverlappedSpaceSize=0]
  26465. * @description 两个对象之间的纵向压盖间距,单位为0.1毫米,跟 horizontalOverlappedSpaceSize 结合使用,
  26466. * 当两个对象的纵向间距小于该值,且横向间距小于 horizontalOverlappedSpaceSize 时认为压盖。
  26467. */
  26468. this.verticalOverlappedSpaceSize = 0;
  26469. Util.extend(this, options);
  26470. this.ugcLayer = new UGCLayer(options);
  26471. this.CLASS_NAME = "SuperMap.OverlapDisplayedOptions";
  26472. }
  26473. /**
  26474. * @function SuperMap.OverlapDisplayedOptions.prototype.destroy
  26475. * @description 释放资源,将资源的属性置空。
  26476. */
  26477. destroy() {
  26478. Util.reset(this);
  26479. }
  26480. /**
  26481. * @function SuperMap.OverlapDisplayedOptions.prototype.fromJson
  26482. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26483. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26484. */
  26485. fromJson(jsonObject) {
  26486. this.ugcLayer.fromJson.apply(this, [jsonObject]);
  26487. }
  26488. /**
  26489. * @function SuperMap.OverlapDisplayedOptions.prototype.toServerJSONObject
  26490. * @description 转换成对应的 JSON 格式对象。
  26491. * @returns {Object} 对应的 JSON 格式对象。
  26492. */
  26493. toServerJSONObject() {
  26494. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  26495. return jsonObject;
  26496. }
  26497. /**
  26498. * @function SuperMap.OverlapDisplayedOptions.prototype.toString
  26499. * @description 转换成对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  26500. * @returns {string} 对应的 tileLayer 请求瓦片时 overlapDisplayedOptions 参数。
  26501. */
  26502. toString() {
  26503. var jsonObject = this.ugcLayer.toServerJSONObject.apply(this, arguments);
  26504. var str = "{";
  26505. for (var attr in jsonObject) {
  26506. if (jsonObject.hasOwnProperty(attr)) {
  26507. str += "'" + attr + "':" + jsonObject[attr] + ",";
  26508. }
  26509. }
  26510. str = str.substr(0, str.length - 1);
  26511. str += "}";
  26512. return str;
  26513. }
  26514. }
  26515. SuperMap.OverlapDisplayedOptions = OverlapDisplayedOptions;
  26516. ;// CONCATENATED MODULE: ./src/common/iServer/UGCMapLayer.js
  26517. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26518. * This program are made available under the terms of the Apache License, Version 2.0
  26519. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26520. /**
  26521. * @class SuperMap.UGCMapLayer
  26522. * @category iServer Map Layer
  26523. * @classdesc UGC 地图图层类。
  26524. * @extends {SuperMap.UGCLayer}
  26525. * @param {Object} options - 参数。
  26526. * @param {boolean} [options.completeLineSymbolDisplayed] - 是否显示完整线型。
  26527. * @param {number} [options.maxScale] - 地图最大比例尺。
  26528. * @param {number} [options.minScale] - 地图最小比例尺。
  26529. * @param {number} [options.minVisibleGeometrySize] - 几何对象的最小可见大小,以像素为单位。
  26530. * @param {number} [options.opaqueRate] - 图层的不透明度。
  26531. * @param {boolean} [options.symbolScalable] - 是否允许图层的符号大小随图缩放。
  26532. * @param {number} [options.symbolScale] - 图层的符号缩放基准比例尺。
  26533. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。
  26534. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 地图的压盖过滤显示选项,当overlapDisplayed 为 false 时有效。
  26535. */
  26536. class UGCMapLayer extends UGCLayer {
  26537. constructor(options) {
  26538. options = options || {};
  26539. super(options);
  26540. /**
  26541. * @member {boolean} SuperMap.UGCMapLayer.prototype.completeLineSymbolDisplayed
  26542. * @description 是否显示完整线型。
  26543. */
  26544. this.completeLineSymbolDisplayed = null;
  26545. /**
  26546. * @member {number} SuperMap.UGCMapLayer.prototype.maxScale
  26547. * @description 地图最大比例尺。
  26548. */
  26549. this.maxScale = null;
  26550. /**
  26551. * @member {number} SuperMap.UGCMapLayer.prototype.minScale
  26552. * @description 地图最小比例尺。
  26553. */
  26554. this.minScale = null;
  26555. /**
  26556. * @member {number} SuperMap.UGCMapLayer.prototype.minVisibleGeometrySize
  26557. * @description 几何对象的最小可见大小,以像素为单位。
  26558. */
  26559. this.minVisibleGeometrySize = null;
  26560. /**
  26561. * @member {number} SuperMap.UGCMapLayer.prototype.opaqueRate
  26562. * @description 图层的不透明度。
  26563. */
  26564. this.opaqueRate = null;
  26565. /**
  26566. * @member {boolean} SuperMap.UGCMapLayer.prototype.symbolScalable
  26567. * @description 是否允许图层的符号大小随图缩放。
  26568. */
  26569. this.symbolScalable = null;
  26570. /**
  26571. * @member {number} SuperMap.UGCMapLayer.prototype.symbolScale
  26572. * @description 图层的符号缩放基准比例尺。
  26573. */
  26574. this.symbolScale = null;
  26575. /**
  26576. * @member {boolean} [SuperMap.UGCMapLayer.prototype.overlapDisplayed=false]
  26577. * @description 地图对象在同一范围内时,是否重叠显示。
  26578. */
  26579. this.overlapDisplayed = null;
  26580. /**
  26581. * @member {SuperMap.OverlapDisplayedOptions} SuperMap.UGCMapLayer.prototype.overlapDisplayedOptions
  26582. * @description 地图的压盖过滤显示选项,当 overlapDisplayed 为 false 时有效。
  26583. */
  26584. this.overlapDisplayedOptions = null;
  26585. this.CLASS_NAME = "SuperMap.UGCMapLayer";
  26586. }
  26587. /**
  26588. * @function SuperMap.UGCMapLayer.prototype.destroy
  26589. * @override
  26590. */
  26591. destroy() {
  26592. super.destroy();
  26593. Util.reset(this);
  26594. }
  26595. /**
  26596. * @function SuperMap.UGCMapLayer.prototype.fromJson
  26597. * @description 将服务端 JSON 对象转换成当前客户端对象
  26598. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26599. */
  26600. fromJson(jsonObject) {
  26601. super.fromJson(jsonObject);
  26602. }
  26603. /**
  26604. * @function SuperMap.UGCMapLayer.prototype.toServerJSONObject
  26605. * @description 转换成对应的 JSON 格式对象。
  26606. * @returns {Object} 对应的 JSON 格式对象。
  26607. */
  26608. toServerJSONObject() {
  26609. return super.toServerJSONObject();
  26610. }
  26611. }
  26612. SuperMap.UGCMapLayer = UGCMapLayer;
  26613. ;// CONCATENATED MODULE: ./src/common/iServer/UGCSubLayer.js
  26614. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26615. * This program are made available under the terms of the Apache License, Version 2.0
  26616. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26617. /**
  26618. * @class SuperMap.UGCSubLayer
  26619. * @category iServer Map Layer
  26620. * @classdesc 地图服务图层属性信息类。影像图层(Image)、专题图层(ServerTheme)、栅格图层(Grid)、矢量图层(Vector)等图层均继承该类。
  26621. * @extends {SuperMap.UGCMapLayer}
  26622. * @param {Object} options - 参数。
  26623. * @param {SuperMap.DatasetInfo} options.datasetInfo - 数据集信息。
  26624. * @param {string} [options.displayFilter] - 图层显示过滤条件。
  26625. * @param {SuperMap.JoinItem} [options.joinItems] - 连接信息类。
  26626. * @param {string} [options.representationField] - 存储制图表达信息的字段。
  26627. * @param {SuperMap.LayerType} [options.ugcLayerType] - 图层类型。
  26628. */
  26629. class UGCSubLayer extends UGCMapLayer {
  26630. constructor(options) {
  26631. options = options || {};
  26632. super(options);
  26633. /**
  26634. * @member {SuperMap.DatasetInfo} SuperMap.UGCSubLayer.prototype.datasetInfo
  26635. * @description 数据集信息。
  26636. */
  26637. this.datasetInfo = null;
  26638. /**
  26639. * @member {string} SuperMap.UGCSubLayer.prototype.displayFilter
  26640. * @description 图层显示过滤条件。
  26641. */
  26642. this.displayFilter = null;
  26643. /**
  26644. * @member {SuperMap.JoinItem} SuperMap.UGCSubLayer.prototype.joinItems
  26645. * @description 连接信息类。
  26646. */
  26647. this.joinItems = null;
  26648. /**
  26649. * @member {string} SuperMap.UGCSubLayer.prototype.representationField
  26650. * @description 存储制图表达信息的字段。
  26651. */
  26652. this.representationField = null;
  26653. /**
  26654. * @member {SuperMap.LayerType} SuperMap.UGCSubLayer.prototype.ugcLayerType
  26655. * @description 图层类型。
  26656. */
  26657. this.ugcLayerType = null;
  26658. this.CLASS_NAME = "SuperMap.UGCSubLayer";
  26659. }
  26660. /**
  26661. * @function SuperMap.UGCSubLayer.prototype.fromJson
  26662. * @description 将服务端 JSON 对象转换成当前客户端对象
  26663. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26664. */
  26665. fromJson(jsonObject) {
  26666. super.fromJson(jsonObject);
  26667. if (this.datasetInfo) {
  26668. this.datasetInfo = new DatasetInfo(this.datasetInfo);
  26669. }
  26670. if (this.joinItems && this.joinItems.length) {
  26671. var newJoinItems = [];
  26672. for (var i = 0; i < this.joinItems.length; i++) {
  26673. newJoinItems[i] = new JoinItem(this.joinItems[i]);
  26674. }
  26675. this.joinItems = newJoinItems;
  26676. }
  26677. }
  26678. /**
  26679. * @function SuperMap.UGCSubLayer.prototype.destroy
  26680. * @override
  26681. */
  26682. destroy() {
  26683. super.destroy();
  26684. Util.reset(this);
  26685. }
  26686. /**
  26687. * @function SuperMap.UGCSubLayer.prototype.toServerJSONObject
  26688. * @description 转换成对应的 JSON 格式对象。
  26689. * @returns {Object} 对应的 JSON 格式对象。
  26690. */
  26691. toServerJSONObject() {
  26692. var jsonObject = super.toServerJSONObject();
  26693. if (jsonObject.joinItems) {
  26694. var joinItems = [];
  26695. for (var i = 0; i < jsonObject.joinItems.length; i++) {
  26696. if (jsonObject.joinItems[i].toServerJSONObject) {
  26697. joinItems[i] = jsonObject.joinItems[i].toServerJSONObject();
  26698. }
  26699. }
  26700. jsonObject.joinItems = joinItems;
  26701. }
  26702. if (jsonObject.datasetInfo) {
  26703. if (jsonObject.datasetInfo.toServerJSONObject) {
  26704. jsonObject.datasetInfo = jsonObject.datasetInfo.toServerJSONObject();
  26705. }
  26706. }
  26707. return jsonObject;
  26708. }
  26709. }
  26710. SuperMap.UGCSubLayer = UGCSubLayer;
  26711. ;// CONCATENATED MODULE: ./src/common/iServer/ServerTheme.js
  26712. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26713. * This program are made available under the terms of the Apache License, Version 2.0
  26714. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26715. /**
  26716. * @class SuperMap.ServerTheme
  26717. * @category iServer Map Theme
  26718. * @classdesc UGC 专题图图层类。
  26719. * @extends {SuperMap.UGCSubLayer}
  26720. * @param {SuperMap.Theme} theme - 专题图对象。
  26721. * @param {SuperMap.LonLat} themeElementPosition - 专题图元素位置。
  26722. */
  26723. class ServerTheme extends UGCSubLayer {
  26724. constructor(options) {
  26725. options = options || {};
  26726. super(options);
  26727. /**
  26728. * @member {SuperMap.Theme} SuperMap.ServerTheme.prototype.theme
  26729. * @description 专题图对象。
  26730. */
  26731. this.theme = null;
  26732. /**
  26733. * @member {SuperMap.LonLat} SuperMap.ServerTheme.prototype.themeElementPosition
  26734. * @description 专题图元素位置。
  26735. */
  26736. this.themeElementPosition = null;
  26737. this.CLASS_NAME = "SuperMap.ServerTheme";
  26738. }
  26739. /**
  26740. * @function SuperMap.ServerTheme.prototype.destroy
  26741. * @override
  26742. */
  26743. destroy() {
  26744. super.destroy();
  26745. Util.reset(this);
  26746. }
  26747. /**
  26748. * @function SuperMap.ServerTheme.prototype.fromJson
  26749. * @description 将服务端 JSON 对象转换成当前客户端对象
  26750. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26751. */
  26752. fromJson(jsonObject) {
  26753. super.fromJson(jsonObject);
  26754. var themeObj = this.theme;
  26755. var themeT = themeObj && themeObj.type;
  26756. switch (themeT) {
  26757. case 'LABEL':
  26758. this.theme = ThemeLabel.fromObj(themeObj);
  26759. break;
  26760. case 'UNIQUE':
  26761. this.theme = ThemeUnique.fromObj(themeObj);
  26762. break;
  26763. case 'GRAPH':
  26764. this.theme = ThemeGraph.fromObj(themeObj);
  26765. break;
  26766. case 'DOTDENSITY':
  26767. this.theme = ThemeDotDensity.fromObj(themeObj);
  26768. break;
  26769. case 'GRADUATEDSYMBOL':
  26770. this.theme = ThemeGraduatedSymbol.fromObj(themeObj);
  26771. break;
  26772. case 'RANGE':
  26773. this.theme = ThemeRange.fromObj(themeObj);
  26774. break;
  26775. default:
  26776. break;
  26777. }
  26778. if (this.themeElementPosition) {
  26779. //待测试
  26780. this.themeElementPosition = new LonLat(this.themeElementPosition.x, this.themeElementPosition.y);
  26781. }
  26782. }
  26783. /**
  26784. * @function SuperMap.ServerTheme.prototype.toServerJSONObject
  26785. * @description 转换成对应的 JSON 格式对象。
  26786. */
  26787. toServerJSONObject() {
  26788. //普通属性直接赋值
  26789. var jsonObject = super.toServerJSONObject();
  26790. if (jsonObject.themeElementPosition) {
  26791. if (jsonObject.themeElementPosition.toServerJSONObject) {
  26792. jsonObject.themeElementPosition = jsonObject.themeElementPosition.toServerJSONObject();
  26793. }
  26794. }
  26795. if (jsonObject.theme) {
  26796. if (jsonObject.theme.toServerJSONObject) {
  26797. jsonObject.theme = jsonObject.theme.toServerJSONObject();
  26798. }
  26799. }
  26800. return jsonObject;
  26801. }
  26802. }
  26803. SuperMap.ServerTheme = ServerTheme;
  26804. ;// CONCATENATED MODULE: ./src/common/iServer/Grid.js
  26805. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26806. * This program are made available under the terms of the Apache License, Version 2.0
  26807. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26808. /**
  26809. * @class SuperMap.Grid
  26810. * @category iServer Map Layer
  26811. * @classdesc UGC 栅格图层类。
  26812. * @extends {SuperMap.UGCSubLayer}
  26813. * @param {Object} options - 参数。
  26814. * @param {Array.<Object>} [options.colorDictionary] - 颜色对照表对象。
  26815. * @param {number} [options.brightness] - Grid 图层的亮度。
  26816. * @param {SuperMap.ColorGradientType} [options.colorGradientType] - 颜色渐变枚举。
  26817. * @param {SuperMap.ServerColor} [options.colors] - 颜色表对象。
  26818. * @param {number} [options.contrast] - Grid 图层的对比度。
  26819. * @param {SuperMap.GridType} [options.gridType] - 格网类型。
  26820. * @param {number} [options.horizontalSpacing] - 格网水平间隔大小。
  26821. * @param {boolean} [options.sizeFixed] - 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26822. * @param {SuperMap.ServerStyle} [options.solidStyle] - 格网实线的样式。
  26823. * @param {SuperMap.ServerColor} [options.specialColor] - 栅格数据集无值数据的颜色。
  26824. * @param {number} [options.specialValue] - 图层的特殊值。
  26825. * @param {boolean} [options.specialValueTransparent] - 图层的特殊值(specialValue)所处区域是否透明。
  26826. * @param {number} [options.verticalSpacing] - 格网垂直间隔大小。
  26827. */
  26828. class Grid extends UGCSubLayer {
  26829. constructor(options) {
  26830. options = options || {};
  26831. super(options);
  26832. /**
  26833. * @member {Array.<SuperMap.ColorDictionary>} SuperMap.Grid.prototype.colorDictionarys
  26834. * @description 颜色对照表对象。
  26835. */
  26836. this.colorDictionarys = null;
  26837. /**
  26838. * @member {number} SuperMap.Grid.prototype.brightness
  26839. * @description Grid 图层的亮度。
  26840. */
  26841. this.brightness = null;
  26842. /**
  26843. * @member {SuperMap.ColorGradientType} SuperMap.Grid.prototype.colorGradientType
  26844. * @description 渐变颜色枚举值。
  26845. */
  26846. this.colorGradientType = null;
  26847. /**
  26848. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.colors
  26849. * @description 颜色表对象。
  26850. */
  26851. this.colors = null;
  26852. /**
  26853. * @member {number} SuperMap.Grid.prototype.contrast
  26854. * @description Grid 图层的对比度。
  26855. */
  26856. this.contrast = null;
  26857. /**
  26858. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.dashStyle
  26859. * @description 栅格数据集特殊值数据的颜色。
  26860. */
  26861. this.dashStyle = null;
  26862. /**
  26863. * @member {SuperMap.GridType} SuperMap.Grid.prototype.gridType
  26864. * @description 格网类型。
  26865. */
  26866. this.gridType = null;
  26867. /**
  26868. * @member {number} SuperMap.Grid.prototype.horizontalSpacing
  26869. * @description 格网水平间隔大小。
  26870. */
  26871. this.horizontalSpacing = null;
  26872. /**
  26873. * @member {boolean} SuperMap.Grid.prototype.sizeFixed
  26874. * @description 格网是否固定大小,如果不固定大小,则格网随着地图缩放。
  26875. */
  26876. this.sizeFixed = null;
  26877. /**
  26878. * @member {SuperMap.ServerStyle} SuperMap.Grid.prototype.solidStyle
  26879. * @description 格网实线的样式。
  26880. */
  26881. this.solidStyle = null;
  26882. /**
  26883. * @member {SuperMap.ServerColor} SuperMap.Grid.prototype.specialColor
  26884. * @description 栅格数据集无值数据的颜色。
  26885. */
  26886. this.specialColor = null;
  26887. /**
  26888. * @member {number} SuperMap.Grid.prototype.specialValue
  26889. * @description 图层的特殊值。
  26890. */
  26891. this.specialValue = null;
  26892. /**
  26893. * @member {boolean} SuperMap.Grid.prototype.specialValueTransparent
  26894. * @description 图层的特殊值(specialValue)所处区域是否透明。
  26895. */
  26896. this.specialValueTransparent = null;
  26897. /**
  26898. * @member {number} SuperMap.Grid.prototype.verticalSpacing
  26899. * @description 格网垂直间隔大小。
  26900. */
  26901. this.verticalSpacing = null;
  26902. this.CLASS_NAME = "SuperMap.Grid";
  26903. }
  26904. /**
  26905. * @function SuperMap.Grid.prototype.destroy
  26906. * @description 释放资源,将引用资源的属性置空。
  26907. */
  26908. destroy() {
  26909. super.destroy();
  26910. Util.reset(this);
  26911. }
  26912. /**
  26913. * @function SuperMap.Grid.prototype.fromJson
  26914. * @description 将服务端 JSON 对象转换成当前客户端对象。
  26915. * @param {Object} jsonObject - 要转换的 JSON 对象。
  26916. */
  26917. fromJson(jsonObject) {
  26918. super.fromJson(jsonObject);
  26919. if (this.specialColor) {
  26920. this.specialColor = new ServerColor(this.specialColor.red,
  26921. this.specialColor.green,
  26922. this.specialColor.blue);
  26923. }
  26924. if (this.colors) {
  26925. var colors = [],
  26926. color;
  26927. for (var i in this.colors) {
  26928. color = this.colors[i];
  26929. colors.push(new ServerColor(color.red, color.green, color.blue));
  26930. }
  26931. this.colors = colors;
  26932. }
  26933. if (this.dashStyle) {
  26934. this.dashStyle = new ServerStyle(this.dashStyle);
  26935. }
  26936. if (this.solidStyle) {
  26937. this.solidStyle = new ServerStyle(this.solidStyle);
  26938. }
  26939. if (this.colorDictionary) {
  26940. var colorDics = [],
  26941. colorDic;
  26942. for (var key in this.colorDictionary) {
  26943. colorDic = this.colorDictionary[key];
  26944. colorDics.push(new ColorDictionary({elevation: key, color: colorDic}));
  26945. }
  26946. this.colorDictionarys = colorDics;
  26947. }
  26948. delete this.colorDictionary;
  26949. }
  26950. /**
  26951. * @function SuperMap.Grid.prototype.toServerJSONObject
  26952. * @description 转换成对应的 JSON 对象。
  26953. * @returns JSON 对象。
  26954. */
  26955. toServerJSONObject() {
  26956. var jsonObject = super.toServerJSONObject();
  26957. if (jsonObject.dashStyle) {
  26958. if (jsonObject.dashStyle.toServerJSONObject) {
  26959. jsonObject.dashStyle = jsonObject.dashStyle.toServerJSONObject();
  26960. }
  26961. }
  26962. if (jsonObject.solidStyle) {
  26963. if (jsonObject.solidStyle.toServerJSONObject) {
  26964. jsonObject.solidStyle = jsonObject.solidStyle.toServerJSONObject();
  26965. }
  26966. }
  26967. return jsonObject;
  26968. }
  26969. }
  26970. SuperMap.Grid = Grid;
  26971. ;// CONCATENATED MODULE: ./src/common/iServer/Image.js
  26972. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  26973. * This program are made available under the terms of the Apache License, Version 2.0
  26974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  26975. /**
  26976. * @class SuperMap.Image
  26977. * @category iServer Map Layer
  26978. * @classdesc UGC 影像图层类
  26979. * @extends {SuperMap.UGCSubLayer}
  26980. * @param {Object} options - 参数。
  26981. * @param {SuperMap.ColorSpaceType} [options.colorSpaceType] - 返回影像图层的色彩显示模式。
  26982. * @param {number} [options.brightness] - 影像图层的亮度。
  26983. * @param {Array.<number>} [options.displayBandIndexes] - 返回当前影像图层显示的波段索引。
  26984. * @param {number} [options.contrast] - 影像图层的对比度。
  26985. * @param {boolean} [options.transparent] - 是否背景透明。
  26986. * @param {SuperMap.ServerColor} [options.transparentColor] - 返回背景透明色。
  26987. * @param {number} [options.transparentColorTolerance] - 背景透明色容限。
  26988. */
  26989. class UGCImage extends UGCSubLayer {
  26990. constructor(options) {
  26991. options = options || {};
  26992. super(options);
  26993. /**
  26994. * @member {number} SuperMap.Image.prototype.brightness
  26995. * @description 影像图层的亮度。
  26996. */
  26997. this.brightness = null;
  26998. /**
  26999. * @member {SuperMap.ColorSpaceType} SuperMap.Image.prototype.colorSpaceType
  27000. * @description 返回影像图层的色彩显示模式。
  27001. */
  27002. this.colorSpaceType = null;
  27003. /**
  27004. * @member {number} SuperMap.Image.prototype.contrast
  27005. * @description 影像图层的对比度。
  27006. */
  27007. this.contrast = null;
  27008. /**
  27009. * @member {Array.<number>} SuperMap.Image.prototype.displayBandIndexes
  27010. * @description 返回当前影像图层显示的波段索引。
  27011. */
  27012. this.displayBandIndexes = null;
  27013. /**
  27014. * @member {boolean} SuperMap.Image.prototype.transparent
  27015. * @description 是否背景透明。
  27016. */
  27017. this.transparent = null;
  27018. /**
  27019. * @member {SuperMap.ServerColor} SuperMap.Image.prototype.transparentColor
  27020. * @description 返回背景透明色。
  27021. */
  27022. this.transparentColor = null;
  27023. /**
  27024. * @member {number} SuperMap.Image.prototype.transparentColorTolerance
  27025. * @description 背景透明色容限。
  27026. */
  27027. this.transparentColorTolerance = null;
  27028. this.CLASS_NAME = "SuperMap.Image";
  27029. }
  27030. /**
  27031. * @function SuperMap.Image.prototype.destroy
  27032. * @override
  27033. */
  27034. destroy() {
  27035. super.destroy();
  27036. Util.reset(this);
  27037. }
  27038. /**
  27039. * @function SuperMap.Image.prototype.fromJson
  27040. * @description 将服务端 JSON 对象转换成当前客户端对象。
  27041. * @param {Object} jsonObject - 要转换的 JSON 对象。
  27042. */
  27043. fromJson(jsonObject) {
  27044. super.fromJson(jsonObject);
  27045. if (this.transparentColor) {
  27046. this.transparentColor = new ServerColor(this.transparentColor.red,
  27047. this.transparentColor.green,
  27048. this.transparentColor.blue);
  27049. }
  27050. }
  27051. /**
  27052. * @function SuperMap.Image.prototype.toServerJSONObject
  27053. * @description 转换成对应的 JSON 格式对象。
  27054. */
  27055. toServerJSONObject() {
  27056. return super.toServerJSONObject();
  27057. }
  27058. }
  27059. SuperMap.Image = UGCImage;
  27060. ;// CONCATENATED MODULE: ./src/common/iServer/Vector.js
  27061. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27062. * This program are made available under the terms of the Apache License, Version 2.0
  27063. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27064. /**
  27065. * @class SuperMap.Vector
  27066. * @category iServer Map TileFeature
  27067. * @classdesc UGC 矢量图层类。
  27068. * @extends {SuperMap.UGCSubLayer}
  27069. * @param {Object} options - 参数。
  27070. * @param {SuperMap.ServerStyle} [options.style] - 矢量图层的风格。
  27071. */
  27072. class Vector_Vector extends UGCSubLayer {
  27073. constructor(options) {
  27074. options = options || {};
  27075. super(options);
  27076. /**
  27077. * @member {SuperMap.ServerStyle} SuperMap.Vector.prototype.style
  27078. * @description 矢量图层的风格。
  27079. */
  27080. this.style = null;
  27081. this.CLASS_NAME = "SuperMap.Vector";
  27082. }
  27083. /**
  27084. * @function SuperMap.Vector.prototype.destroy
  27085. * @override
  27086. */
  27087. destroy() {
  27088. super.destroy();
  27089. Util.reset(this);
  27090. }
  27091. /**
  27092. * @function SuperMap.Vector.prototype.fromJson
  27093. * @description 将服务端 JSON 对象转换成当前客户端对象。
  27094. * @param {Object} jsonObject - 要转换的 JSON 对象。
  27095. */
  27096. fromJson(jsonObject) {
  27097. super.fromJson(jsonObject);
  27098. var sty = this.style;
  27099. if (sty) {
  27100. this.style = new ServerStyle(sty);
  27101. }
  27102. }
  27103. /**
  27104. * @function SuperMap.Vector.prototype.toServerJSONObject
  27105. * @description 转换成对应的 JSON 格式对象。
  27106. * @returns {Object} 对应的 JSON 格式对象
  27107. */
  27108. toServerJSONObject() {
  27109. var jsonObject = SuperMap.toServerJSONObject();
  27110. if (jsonObject.style) {
  27111. if (jsonObject.style.toServerJSONObject) {
  27112. jsonObject.style = jsonObject.style.toServerJSONObject();
  27113. }
  27114. }
  27115. return jsonObject;
  27116. }
  27117. }
  27118. SuperMap.Vector = Vector_Vector;
  27119. ;// CONCATENATED MODULE: ./src/common/iServer/GetLayersInfoService.js
  27120. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27121. * This program are made available under the terms of the Apache License, Version 2.0
  27122. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27123. /**
  27124. * @class SuperMap.GetLayersInfoService
  27125. * @category iServer Map Layer
  27126. * @classdesc 获取图层信息服务类构造函数。
  27127. * @extends {SuperMap.CommonServiceBase}
  27128. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  27129. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  27130. * 如 http://localhost:8090/iserver/services/map-world/rest/maps/World 。
  27131. * 如果查询临时图层的信息,请指定完成的url,包含临时图层ID信息,如:
  27132. * http://localhost:8090/iserver/services/map-world/rest/maps/World/tempLayersSet/resourceID
  27133. * @param {Object} options - 参数。
  27134. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  27135. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  27136. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  27137. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27138. * @param {Object} [options.headers] - 请求头。
  27139. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  27140. */
  27141. class GetLayersInfoService extends CommonServiceBase {
  27142. constructor(url, options) {
  27143. super(url, options);
  27144. /**
  27145. * @member {boolean} SuperMap.GetLayersInfoService.prototype.isTempLayers
  27146. * @description 当前url对应的图层是否是临时图层。
  27147. */
  27148. this.isTempLayers = false;
  27149. if (options) {
  27150. Util.extend(this, options);
  27151. }
  27152. this.CLASS_NAME = "SuperMap.GetLayersInfoService";
  27153. }
  27154. /**
  27155. * @function SuperMap.GetLayersInfoService.prototype.destroy
  27156. * @override
  27157. */
  27158. destroy() {
  27159. super.destroy();
  27160. Util.reset(this);
  27161. }
  27162. /**
  27163. * @function SuperMap.GetLayersInfoService.prototype.processAsync
  27164. * @description 负责将客户端的更新参数传递到服务端。
  27165. */
  27166. processAsync() {
  27167. var me = this,
  27168. method = "GET";
  27169. if (!me.isTempLayers) {
  27170. me.url = Util.urlPathAppend(me.url, 'layers');
  27171. }
  27172. me.request({
  27173. method: method,
  27174. params: null,
  27175. scope: me,
  27176. success: me.serviceProcessCompleted,
  27177. failure: me.serviceProcessFailed
  27178. });
  27179. }
  27180. /**
  27181. * @function SuperMap.GetLayersInfoService.prototype.serviceProcessCompleted
  27182. * @description 编辑完成,执行此方法。
  27183. * @param {Object} result - 服务器返回的结果对象。
  27184. */
  27185. serviceProcessCompleted(result) {
  27186. var me = this, existRes, layers, len;
  27187. result = Util.transformResult(result);
  27188. existRes = !!result && result.length > 0;
  27189. layers = existRes ? result[0].subLayers.layers : null;
  27190. len = layers ? layers.length : 0;
  27191. me.handleLayers(len, layers);
  27192. me.events.triggerEvent("processCompleted", {result: result[0]});
  27193. }
  27194. /**
  27195. * TODO 专题图时候可能会用到
  27196. * @function SuperMap.GetLayersInfoService.prototype.handleLayers
  27197. * @description 处理 iServer 新增图层组数据 (subLayers.layers 中可能还会含有 subLayers.layers)
  27198. * @param {number} len - subLayers.layers的长度
  27199. * @param {Array.<number>} layers - subLayers.layers的长度数组
  27200. */
  27201. handleLayers(len, layers) {
  27202. var me = this, tempLayer;
  27203. if (len) {
  27204. for (var i = 0; i < len; i++) {
  27205. if (layers[i].subLayers && layers[i].subLayers.layers && layers[i].subLayers.layers.length > 0) {
  27206. me.handleLayers(layers[i].subLayers.layers.length, layers[i].subLayers.layers);
  27207. } else {
  27208. var type = layers[i].ugcLayerType;
  27209. switch (type) {
  27210. case 'THEME':
  27211. tempLayer = new ServerTheme();
  27212. tempLayer.fromJson(layers[i]);
  27213. layers[i] = tempLayer;
  27214. break;
  27215. case 'GRID':
  27216. tempLayer = new Grid();
  27217. tempLayer.fromJson(layers[i]);
  27218. layers[i] = tempLayer;
  27219. break;
  27220. case 'IMAGE':
  27221. tempLayer = new UGCImage();
  27222. tempLayer.fromJson(layers[i]);
  27223. layers[i] = tempLayer;
  27224. break;
  27225. case 'VECTOR':
  27226. tempLayer = new Vector_Vector();
  27227. tempLayer.fromJson(layers[i]);
  27228. layers[i] = tempLayer;
  27229. break;
  27230. default:
  27231. break;
  27232. }
  27233. }
  27234. }
  27235. }
  27236. }
  27237. }
  27238. SuperMap.GetLayersInfoService = GetLayersInfoService;
  27239. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystParameters.js
  27240. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27241. * This program are made available under the terms of the Apache License, Version 2.0
  27242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27243. /**
  27244. * @class SuperMap.InterpolationAnalystParameters
  27245. * @category iServer SpatialAnalyst InterpolationAnalyst
  27246. * @classdesc 插值分析参数类。
  27247. * @param {Object} options - 参数。
  27248. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  27249. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  27250. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  27251. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。
  27252. * @param {string} [options.dataset] - 用于做插值分析的数据源中数据集的名称。当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  27253. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  27254. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  27255. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  27256. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27257. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  27258. * @param {SuperMap.PixelFormat} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  27259. * @param {string} [options.InterpolationAnalystType="dataset"] - 插值分析类型("dataset" 或 "geometry")。
  27260. */
  27261. class InterpolationAnalystParameters {
  27262. constructor(options) {
  27263. if (!options) {
  27264. return;
  27265. }
  27266. /**
  27267. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.InterpolationAnalystParameters.prototype.bounds
  27268. * @description 插值分析的范围,用于确定结果栅格数据集的范围。
  27269. * 如果缺省,则默认为原数据集的范围。鉴于此插值方法为内插方法,原数据集的范围内的插值结果才相对有参考价值,
  27270. * 因此建议此参数不大于原数据集范围。
  27271. */
  27272. this.bounds = null;
  27273. /**
  27274. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.searchRadius=0]
  27275. * @description 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  27276. * 计算某个位置的Z 值时,会以该位置为圆心,以查找范围的值为半径,落在这个范围内的采样点都将参与运算。
  27277. * 该值需要根据待插值点数据的分布状况和点数据集范围进行设置。
  27278. */
  27279. this.searchRadius = 0;
  27280. /**
  27281. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.zValueFieldName
  27282. * @description 数据集插值分析中,用于指定进行插值分析的目标字段名,插值分析不支持文本类型的字段。
  27283. * 含义为每个插值点在插值过程中的权重,可以将所有点此字段值设置为 1,即所有点在整体插值中权重相同。
  27284. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此为必选参数。
  27285. */
  27286. this.zValueFieldName = null;
  27287. /**
  27288. * @member {number} [SuperMap.InterpolationAnalystParameters.prototype.zValueScale=1]
  27289. * @description 用于进行插值分析值的缩放比率。
  27290. * 参加插值分析的值将乘以该参数值后再进行插值,也就是对进行插值分析的值进行统一的扩大或缩小。
  27291. */
  27292. this.zValueScale = 1;
  27293. /**
  27294. * @member {number} SuperMap.InterpolationAnalystParameters.prototype.resolution
  27295. * @description 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27296. * 该值不能超过待分析数据集的范围边长。
  27297. * 且该值设置时,应该考虑点数据集范围大小来取值,一般为结果栅格行列值(即结果栅格数据集范围除以分辨率),在 500 以内可以较好地体现密度走势。
  27298. */
  27299. this.resolution = null;
  27300. /**
  27301. * @member {SuperMap.FilterParameter} [SuperMap.InterpolationAnalystParameters.prototype.filterQueryParameter]
  27302. * @description 过滤条件,对分析数据集中的点进行过滤,设置为 null 表示对数据集中的所有点进行分析。
  27303. */
  27304. this.filterQueryParameter = null;
  27305. /**
  27306. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasetName
  27307. * @description 插值分析结果数据集的名称。
  27308. */
  27309. this.outputDatasetName = null;
  27310. /**
  27311. * @member {string} SuperMap.InterpolationAnalystParameters.prototype.outputDatasourceName
  27312. * @description 插值分析结果数据源的名称。
  27313. */
  27314. this.outputDatasourceName = null;
  27315. /**
  27316. * @member {SuperMap.PixelFormat} [SuperMap.InterpolationAnalystParameters.prototype.pixelFormat]
  27317. * @description 指定结果栅格数据集存储的像素格式。支持存储的像素格式有 BIT16、BIT32、DOUBLE、SINGLE、UBIT1、UBIT4、UBIT8、UBIT24、UBIT32。
  27318. */
  27319. this.pixelFormat = null;
  27320. /**
  27321. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.dataset]
  27322. * @description 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。
  27323. * 当插值分析类型(InterpolationAnalystType)为 dataset 时,此参数为必选。
  27324. */
  27325. this.dataset = null;
  27326. /**
  27327. * @member {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [SuperMap.InterpolationAnalystParameters.prototype.inputPoints]
  27328. * @description 用于做插值分析的离散点(离散点包括Z值)集合。
  27329. * 当插值分析类型(InterpolationAnalystType)为 geometry 时,此参数为必设参数。
  27330. * 通过离散点直接进行插值分析不需要指定输入数据集inputDatasourceName,inputDatasetName以及zValueFieldName。
  27331. */
  27332. this.inputPoints = null;
  27333. /**
  27334. * @member {string} [SuperMap.InterpolationAnalystParameters.prototype.InterpolationAnalystType="dataset"]
  27335. * @description 插值分析类型。差值分析包括数据集插值分析和几何插值分析两类,
  27336. * "dataset" 表示对数据集进行插值分析,"geometry" 表示对离散点数组进行插值分析。
  27337. */
  27338. this.InterpolationAnalystType = "dataset";
  27339. /**
  27340. * @member {Object} SuperMap.InterpolationAnalystParameters.prototype.clipParam
  27341. * @description 对插值分析结果进行裁剪的参数。
  27342. */
  27343. this.clipParam = null;
  27344. Util.extend(this, options);
  27345. this.CLASS_NAME = "SuperMap.InterpolationAnalystParameters";
  27346. }
  27347. /**
  27348. * @function SuperMap.InterpolationAnalystParameters.prototype.destroy
  27349. * @description 释放资源,将引用资源的属性置空。
  27350. */
  27351. destroy() {
  27352. var me = this;
  27353. me.bounds = null;
  27354. me.searchRadius = null;
  27355. me.zValueFieldName = null;
  27356. me.zValueScale = null;
  27357. me.resolution = null;
  27358. me.filterQueryParameter = null;
  27359. me.outputDatasetName = null;
  27360. me.pixelFormat = null;
  27361. }
  27362. /**
  27363. * @function SuperMap.InterpolationAnalystParameters.toObject
  27364. * @param {SuperMap.InterpolationAnalystParameters} interpolationAnalystParameters - 插值分析参数类。
  27365. * @param {SuperMap.InterpolationAnalystParameters} tempObj - 插值分析参数对象。
  27366. * @description 将插值分析参数对象转换成 JSON 对象。
  27367. * @returns JSON 对象。
  27368. */
  27369. static toObject(interpolationAnalystParameters, tempObj) {
  27370. for (var name in interpolationAnalystParameters) {
  27371. if (name === "inputPoints" && interpolationAnalystParameters.InterpolationAnalystType === "geometry") {
  27372. var objs = [];
  27373. for (var i = 0; i < interpolationAnalystParameters.inputPoints.length; i++) {
  27374. var item = interpolationAnalystParameters.inputPoints[i];
  27375. var obj = {
  27376. x: item.x,
  27377. y: item.y,
  27378. z: item.tag
  27379. };
  27380. objs.push(obj);
  27381. }
  27382. tempObj[name] = objs;
  27383. } else {
  27384. tempObj[name] = interpolationAnalystParameters[name];
  27385. }
  27386. }
  27387. }
  27388. }
  27389. SuperMap.InterpolationAnalystParameters = InterpolationAnalystParameters;
  27390. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationRBFAnalystParameters.js
  27391. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27392. * This program are made available under the terms of the Apache License, Version 2.0
  27393. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27394. /**
  27395. * @class SuperMap.InterpolationRBFAnalystParameters
  27396. * @category iServer SpatialAnalyst InterpolationAnalyst
  27397. * @classdesc 样条插值(径向基函数插值法)分析参数类。
  27398. * @extends {SuperMap.InterpolationAnalystParameters}
  27399. * @param {Object} options - 参数。
  27400. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  27401. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  27402. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  27403. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  27404. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  27405. * @param {number} [options.smooth=0.1] - 光滑系数,该值表示插值函数曲线与点的逼近程度,值域为0到1。
  27406. * @param {number} [options.tension=40] - 张力系数,用于调整结果栅格数据表面的特性。
  27407. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置参与差值运算的点数。
  27408. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  27409. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  27410. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  27411. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  27412. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27413. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  27414. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  27415. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(InterpolationAnalystType)为 dataset 时。此参数为必选。
  27416. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。此参数为必选。
  27417. * @example
  27418. * var myInterpolationRBFAnalystParameters = new SuperMap.InterpolationRBFAnalystParameters({
  27419. * dataset:"SamplesP@Interpolation",
  27420. * smooth: 0.1,
  27421. * tension: 40,
  27422. * searchMode: "QUADTREE",
  27423. * maxPointCountForInterpolation: 20,
  27424. * maxPointCountInNode: 5,
  27425. * pixelFormat: "BIT16",
  27426. * zValueFieldName: "AVG_TMP",
  27427. * resolution: 3000,
  27428. * filterQueryParameter: {
  27429. * attributeFilter: ""
  27430. * },
  27431. * outputDatasetName: "myRBF"
  27432. * });
  27433. */
  27434. class InterpolationRBFAnalystParameters extends InterpolationAnalystParameters {
  27435. constructor(options) {
  27436. super(options);
  27437. /**
  27438. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.smooth=0.1]
  27439. * @description 光滑系数,值域为 0 到 1,常用取值如 0、0.001、0.01、0.1、和 0.5。
  27440. * 该值表示插值函数曲线与点的逼近程度,此数值越大,函数曲线与点的偏差越大,反之越小。
  27441. */
  27442. this.smooth = 0.1;
  27443. /**
  27444. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.tension=40]
  27445. * @description 张力系数,常用取值如 0、1、5 和 10。
  27446. * 用于调整结果栅格数据表面的特性,张力越大,插值时每个点对计算结果影响越小,反之越大。
  27447. */
  27448. this.tension = 40;
  27449. /**
  27450. * @member {SuperMap.SearchMode} SuperMap.InterpolationRBFAnalystParameters.prototype.searchMode
  27451. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  27452. * 具体如下:
  27453. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  27454. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  27455. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  27456. */
  27457. this.searchMode = null;
  27458. /**
  27459. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.expectedCount=12]
  27460. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  27461. */
  27462. this.expectedCount = 12;
  27463. /**
  27464. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountForInterpolation=200]
  27465. * @description 【块查找】方式下,最多参与插值的点数。
  27466. */
  27467. this.maxPointCountForInterpolation = 200;
  27468. /**
  27469. * @member {number} [SuperMap.InterpolationRBFAnalystParameters.prototype.maxPointCountInNode=50]
  27470. * @description 【块查找】方式下,单个块内最多参与运算点数。
  27471. */
  27472. this.maxPointCountInNode = 50;
  27473. if (options) {
  27474. Util.extend(this, options);
  27475. }
  27476. this.CLASS_NAME = "SuperMap.InterpolationRBFAnalystParameters";
  27477. }
  27478. /**
  27479. * @function SuperMap.InterpolationRBFAnalystParameters.prototype.destroy
  27480. * @description 释放资源,将引用资源的属性置空。
  27481. */
  27482. destroy() {
  27483. super.destroy();
  27484. var me = this;
  27485. me.smooth = null;
  27486. me.tension = null;
  27487. me.searchMode = null;
  27488. me.expectedCount = null;
  27489. me.maxPointCountForInterpolation = null;
  27490. me.maxPointCountInNode = null;
  27491. }
  27492. /**
  27493. * @function SuperMap.InterpolationRBFAnalystParameters.toObject
  27494. * @param {SuperMap.InterpolationRBFAnalystParameters} datasetInterpolationRBFAnalystParameters - 样条插值(径向基函数插值法)分析参数类
  27495. * @param {SuperMap.InterpolationRBFAnalystParameters} tempObj - 样条插值(径向基函数插值法)分析参数对象
  27496. * @description 将样条插值(径向基函数插值法)分析参数对象转换为 JSON 对象。
  27497. * @returns JSON 对象。
  27498. */
  27499. static toObject(datasetInterpolationRBFAnalystParameters, tempObj) {
  27500. for (var name in datasetInterpolationRBFAnalystParameters) {
  27501. tempObj[name] = datasetInterpolationRBFAnalystParameters[name];
  27502. }
  27503. }
  27504. }
  27505. SuperMap.InterpolationRBFAnalystParameters = InterpolationRBFAnalystParameters;
  27506. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationDensityAnalystParameters.js
  27507. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27508. * This program are made available under the terms of the Apache License, Version 2.0
  27509. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27510. /**
  27511. * @class SuperMap.InterpolationDensityAnalystParameters
  27512. * @category iServer SpatialAnalyst InterpolationAnalyst
  27513. * @classdesc 点密度差值分析参数类。
  27514. * @param {Object} options - 参数。
  27515. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  27516. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  27517. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  27518. * @param {number} [options.searchRadius=0] - 查找半径,即参与运算点的查找范围,与点数据集单位相同。
  27519. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型( SuperMap.InterpolationAnalystType)为 dataset 时。此为必选参数。
  27520. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  27521. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27522. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  27523. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  27524. * @param {string} [options.dataset] - 用来做插值分析的数据源中数据集的名称,该名称用形如 "数据集名称@数据源别名" 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  27525. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  27526. * @extends {SuperMap.InterpolationAnalystParameters}
  27527. * @example
  27528. * var myInterpolationDensityAnalystParameters = new SuperMap.InterpolationDensityAnalystParameters({
  27529. * dataset: "SamplesP@Interpolation",
  27530. * searchRadius: "100000",
  27531. * pixelFormat: "BIT16",
  27532. * zValueFieldName: "AVG_TMP",
  27533. * resolution: 3000,
  27534. * filterQueryParameter: {
  27535. * attributeFilter: ""
  27536. * },
  27537. * outputDatasetName: "myDensity"
  27538. * });
  27539. */
  27540. class InterpolationDensityAnalystParameters extends InterpolationAnalystParameters {
  27541. constructor(options) {
  27542. super(options);
  27543. if (options) {
  27544. Util.extend(this, options);
  27545. }
  27546. this.CLASS_NAME = "SuperMap.InterpolationDensityAnalystParameters";
  27547. }
  27548. /**
  27549. * @function SuperMap.InterpolationDensityAnalystParameters.prototype.destroy
  27550. * @description 释放资源,将引用资源的属性置空。
  27551. */
  27552. destroy() {
  27553. super.destroy();
  27554. }
  27555. }
  27556. SuperMap.InterpolationDensityAnalystParameters = InterpolationDensityAnalystParameters;
  27557. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationIDWAnalystParameters.js
  27558. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27559. * This program are made available under the terms of the Apache License, Version 2.0
  27560. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27561. /**
  27562. * @class SuperMap.InterpolationIDWAnalystParameters
  27563. * @category iServer SpatialAnalyst InterpolationAnalyst
  27564. * @classdesc 反距离加权插值(IDW)分析参数类。
  27565. * @param {Object} options - 参数。
  27566. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  27567. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  27568. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  27569. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  27570. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  27571. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  27572. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置查找半径,即参与运算点的查找范围,与点数据集单位相同。
  27573. * @param {number} [options.power=2] - 距离权重计算的幂次。
  27574. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  27575. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27576. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  27577. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  27578. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如”数据集名称@数据源别名”形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,必设参数。
  27579. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(SuperMap.InterpolationAnalystType)为 geometry 时,必设参数。
  27580. * @extends {SuperMap.InterpolationAnalystParameters}
  27581. * @example 例如:
  27582. * var myInterpolationIDWAnalystParameters = new SuperMap.InterpolationIDWAnalystParameters({
  27583. * dataset:"SamplesP@Interpolation",
  27584. * power: 2,
  27585. * searchMode: "KDTREE_FIXED_COUNT",
  27586. * expectedCount: 12,
  27587. * pixelFormat: "BIT16",
  27588. * zValueFieldName: "AVG_TMP",
  27589. * resolution: 3000,
  27590. * filterQueryParameter: {
  27591. * attributeFilter: ""
  27592. * },
  27593. * outputDatasetName: "myIDW"
  27594. * });
  27595. *
  27596. */
  27597. class InterpolationIDWAnalystParameters extends InterpolationAnalystParameters {
  27598. constructor(options) {
  27599. super(options);
  27600. /**
  27601. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.power=2]
  27602. * @description 距离权重计算的幂次。
  27603. * 该值决定了权值下降的速度,幂次越大,随距离的增大权值下降越快,距离预测点越远的点的权值也越小。
  27604. * 理论上,参数值必须大于0,但是0.5到3之间时运算结果更合理,因此推荐值为0.5~3。
  27605. */
  27606. this.power = 2;
  27607. /**
  27608. * @member {SuperMap.SearchMode} SuperMap.InterpolationIDWAnalystParameters.prototype.searchMode
  27609. * @description 插值运算时,查找参与运算点的方式,支持固定点数查找、定长查找。
  27610. * 具体如下:
  27611. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。
  27612. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。
  27613. */
  27614. this.searchMode = null;
  27615. /**
  27616. * @member {number} [SuperMap.InterpolationIDWAnalystParameters.prototype.expectedCount=12]
  27617. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数。
  27618. */
  27619. this.expectedCount = 12;
  27620. if (options) {
  27621. Util.extend(this, options);
  27622. }
  27623. this.CLASS_NAME = "SuperMap.InterpolationIDWAnalystParameters";
  27624. }
  27625. /**
  27626. * @function SuperMap.InterpolationIDWAnalystParameters.prototype.destroy
  27627. * @description 释放资源,将引用资源的属性置空。
  27628. */
  27629. destroy() {
  27630. super.destroy();
  27631. var me = this;
  27632. me.power = null;
  27633. me.searchMode = null;
  27634. me.expectedCount = null;
  27635. }
  27636. }
  27637. SuperMap.InterpolationIDWAnalystParameters = InterpolationIDWAnalystParameters;
  27638. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationKrigingAnalystParameters.js
  27639. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27640. * This program are made available under the terms of the Apache License, Version 2.0
  27641. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27642. /**
  27643. * @class SuperMap.InterpolationKrigingAnalystParameters
  27644. * @category iServer SpatialAnalyst InterpolationAnalyst
  27645. * @classdesc 克吕金插值分析参数类。
  27646. * @description 通过该类可以设置克吕金插值分析所需的参数。
  27647. * 克吕金(Kriging)法为地统计学上一种空间数据内插处理方法,主要的目的是利用各数据点间变异数(variance)的大小来推求某一未知点与各已知点的权重关系,
  27648. * 再由各数据点的值和其与未知点的权重关系推求未知点的值。Kriging 法最大的特色不仅是提供一个最小估计误差的预测值,并且可明确的指出误差值的大小。
  27649. * 一般而言,许多地质参数,如地形面,本身即具有连续性,故在一段距离内的任两点必有空间上的关系。反之,在一不规则面上的两点若相距甚远,
  27650. * 则在统计意义上可视为互为独立 (stastically indepedent)。这种随距离而改变的空间上连续性,可用半变异图 (semivariogram) 来表现。
  27651. * 因此,若想由已知的散乱点来推求某一未知点的值,则可利用半变异图推求各已知点与未知点的空间关系,即以下四个参数。
  27652. * 然后,由此空间参数推求半变异数,由各数据点间的半变异数可推求未知点与已知点间的权重关系,进而推求出未知点的值。<br>
  27653. *
  27654. * · 块金值(nugget):当采样点间距为0时,理论上半变异函数值为0,但时间上两采样点非常接近时半变异函数值并不为0,即产生了上图所示的块金效应,
  27655. * 对应的半变异函数值为块金值。块金值可能由于测量误差或者空间变异产生。<br>
  27656. *
  27657. * · 基台值(sill):随着采样点间距的不断增大,半变异函数的值趋向一个稳定的常数,该常数成为基台值。到达基台值后,半变异函数的值不再随采样点间距而改变,
  27658. * 即大于此间距的采样点不再具有空间相关性。<br>
  27659. *
  27660. * · 偏基台值:基台值与块金值的差值。<br>
  27661. *
  27662. * · 自相关阈值(range):也称变程,是半变异函数值达到基台值时,采样点的间距。超过自相关阈值的采样点不再具有空间相关性,将不对预测结果产生影响。<br>
  27663. *
  27664. * 由上述可知,半变异函数是克吕金插值的关键,因此选择合适的半变异函数模型非常重要,SuperMap 提供了以下三种半变异函数模型:<br>
  27665. *
  27666. * · 指数型(EXPONENTIAL):适用于空间相关关系随样本间距的增加成指数递减的情况,其空间自相关关系在样本间距的无穷远处完全消失。<br>
  27667. *
  27668. * · 球型(SPHERICAL):适用于空间自相关关系随样本间距的增加而逐渐减少,直到超出一定的距离时空间自相关关系消失的情况。<br>
  27669. *
  27670. * · 高斯型(GAUSSIAN):适用于半变异函数值渐进地逼近基台值的情况。<br>
  27671. *
  27672. * 半变异函数中,有一个关键参数即插值的字段值的期望(平均值),由于对于此参数的不同处理方法而衍生出了不同的 Kriging 方法。SuperMap的差值功能基于以下三种常用 Kriging 算法:<br>
  27673. *
  27674. * 1. 简单克吕金(Simple Kriging):该方法假定用于插值的字段值的期望(平均值)已知的某一常数。<br>
  27675. *
  27676. * 2. 普通克吕金(Kriging):该方法假定用于插值的字段值的期望(平均值)未知且恒定。它利用一定的数学函数,通过对给定的空间点进行拟合来估算单元格的值,<br>
  27677. * 生成格网数据集。它不仅可以生成一个表面,还可以给出预测结果的精度或者确定性的度量。因此,此方法计算精度较高,常用于地学领域。
  27678. *
  27679. * 3. 泛克吕金(Universal Kriging):该方法假定用于插值的字段值的期望(平均值)是未知的变量。在样点数据中存在某种主导趋势且该趋势可以通过某一个确定<br>
  27680. * 的函数或者多项式进行拟合的情况下,适用泛克吕金插值法。
  27681. *
  27682. * 克吕金法的优点是以空间统计学作为其坚实的理论基础,物理含义明确;不但能估计测定参数的空间变异分布,而且还可以估算参数的方差分布。克吕金法的缺点是计算步骤较烦琐,
  27683. * 计算量大,且变异函数有时需要根据经验人为选定。
  27684. * @param {Object} options - 参数。
  27685. * @param {string} options.type - 克吕金插值的类型。
  27686. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 插值分析的范围,用于确定结果栅格数据集的范围。
  27687. * @param {string} options.searchMode - 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。
  27688. * @param {string} options.outputDatasetName - 插值分析结果数据集的名称。
  27689. * @param {string} options.outputDatasourceName - 插值分析结果数据源的名称。
  27690. * @param {string} [options.zValueFieldName] - 存储用于进行插值分析的字段名称,插值分析不支持文本类型的字段。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时,此为必选参数。
  27691. * @param {number} [options.mean] - 【简单克吕金】类型下,插值字段的平均值。
  27692. * @param {number} [options.angle=0] - 克吕金算法中旋转角度值。
  27693. * @param {number} [options.nugget=0] - 克吕金算法中块金效应值。
  27694. * @param {number} [options.range=0] - 克吕金算法中自相关阈值,单位与原数据集单位相同。
  27695. * @param {number} [options.sill=0] - 克吕金算法中基台值。
  27696. * @param {string} [options.variogramMode="SPHERICAL"] - 克吕金插值时的半变函数类型。
  27697. * @param {string} [options.exponent='exp1'] - 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数,可选值为 exp1、exp2。
  27698. * @param {number} [options.expectedCount=12] - 【固定点数查找】方式下,设置待查找的点数;【定长查找】方式下,设置查找的最小点数。
  27699. * @param {number} [options.searchRadius=0] - 【定长查找】方式下,设置参与运算点的查找范围。
  27700. * @param {number} [options.maxPointCountForInterpolation=200] - 【块查找】方式下,设置最多参与插值的点数。
  27701. * @param {number} [options.maxPointCountInNode=50] - 【块查找】方式下,设置单个块内最多参与运算点数。
  27702. * @param {number} [options.zValueScale=1] - 用于进行插值分析值的缩放比率。
  27703. * @param {number} [options.resolution] - 插值结果栅格数据集的分辨率,即一个像元所代表的实地距离,与点数据集单位相同。
  27704. * @param {SuperMap.FilterParameter} [options.filterQueryParameter] - 属性过滤条件。
  27705. * @param {string} [options.pixelFormat] - 指定结果栅格数据集存储的像素格式。
  27706. * @param {string} [options.dataset] - 要用来做插值分析的数据源中数据集的名称。该名称用形如 ”数据集名称@数据源别名” 形式来表示。当插值分析类型(SuperMap.InterpolationAnalystType)为 dataset 时。
  27707. * @param {Array.<SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point>} [options.inputPoints] - 用于做插值分析的离散点集合。当插值分析类型(InterpolationAnalystType)为 geometry 时。
  27708. * @extends {SuperMap.InterpolationAnalystParameters}
  27709. * @example 例如:
  27710. * var myInterpolationKrigingAnalystParameters = new SuperMap.InterpolationKrigingAnalystParameters({
  27711. * dataset:"SamplesP@Interpolation",
  27712. * type: "KRIGING",
  27713. * angle: 0,
  27714. * mean: 5,
  27715. * nugget: 30,
  27716. * range: 50,
  27717. * sill: 300,
  27718. * variogramMode: "EXPONENTIAL",
  27719. * searchMode: "QUADTREE",
  27720. * maxPointCountForInterpolation: 20,
  27721. * maxPointCountInNode: 5,
  27722. * pixelFormat: "BIT16",
  27723. * zValueFieldName: "AVG_TMP",
  27724. * resolution: 30000,
  27725. * filterQueryParameter: {
  27726. * attributeFilter: ""
  27727. * },
  27728. * outputDatasetName: "myKriging"
  27729. * });
  27730. *
  27731. */
  27732. class InterpolationKrigingAnalystParameters extends InterpolationAnalystParameters {
  27733. constructor(options) {
  27734. super(options);
  27735. /**
  27736. * @member {SuperMap.InterpolationAlgorithmType} SuperMap.InterpolationKrigingAnalystParameters.prototype.type
  27737. * @description 克吕金插值的类型。
  27738. * 具体如下:<br>
  27739. * {KRIGING} 普通克吕金插值法。
  27740. * {SimpleKriging} 简单克吕金插值法。
  27741. * {UniversalKriging} 泛克吕金插值法。
  27742. */
  27743. this.type = null;
  27744. /**
  27745. * @member {number} SuperMap.InterpolationKrigingAnalystParameters.prototype.mean
  27746. * @description 【简单克吕金】方式下,插值字段的平均值。
  27747. * 即采样点插值字段值总和除以采样点数目。
  27748. */
  27749. this.mean = null;
  27750. /**
  27751. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.angle=0]
  27752. * @description 克吕金算法中旋转角度值。
  27753. * 此角度值指示了每个查找邻域相对于水平方向逆时针旋转的角度。
  27754. */
  27755. this.angle = 0;
  27756. /**
  27757. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.nugget=0]
  27758. * @description 克吕金算法中块金效应值。
  27759. */
  27760. this.nugget = 0;
  27761. /**
  27762. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.range=0]
  27763. * @description 克吕金算法中自相关阈值,单位与原数据集单位相同。
  27764. */
  27765. this.range = 0;
  27766. /**
  27767. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.sill=0]
  27768. * @description 克吕金算法中基台值。
  27769. */
  27770. this.sill = 0;
  27771. /**
  27772. * @member {SuperMap.VariogramMode} [SuperMap.InterpolationKrigingAnalystParameters.prototype.variogramMode=SuperMap.VariogramMode.SPHERICAL]
  27773. * @description 克吕金插值时的半变函数类型。
  27774. * 用户所选择的半变函数类型会影响未知点的预测,特别是曲线在原点处的不同形状有重要意义。
  27775. * 曲线在原点处越陡,则较近领域对该预测值的影响就越大,因此输出表面就会越不光滑。
  27776. */
  27777. this.variogramMode = VariogramMode.SPHERICAL;
  27778. /**
  27779. * @member {SuperMap.Exponent} [SuperMap.InterpolationKrigingAnalystParameters.prototype.exponent=SuperMap.Exponent.EXP1]
  27780. * @description 【泛克吕金】类型下,用于插值的样点数据中趋势面方程的阶数。
  27781. */
  27782. this.exponent = Exponent.EXP1;
  27783. /**
  27784. * @member {SuperMap.SearchMode} SuperMap.InterpolationKrigingAnalystParameters.prototype.searchMode
  27785. * @description 插值运算时,查找参与运算点的方式,有固定点数查找、定长查找、块查找。必设参数。
  27786. * 简单克吕金和泛克吕金不支持块查找。
  27787. * 具体如下:<br>
  27788. * {KDTREE_FIXED_COUNT} 使用 KDTREE 的固定点数方式查找参与内插分析的点。<br>
  27789. * {KDTREE_FIXED_RADIUS} 使用 KDTREE 的定长方式查找参与内插分析的点。<br>
  27790. * {QUADTREE} 使用 QUADTREE 方式查找参与内插分析的点(块查找)。
  27791. */
  27792. this.searchMode = null;
  27793. /**
  27794. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.expectedCount=12]
  27795. * @description 【固定点数查找】方式下,设置待查找的点数,即参与差值运算的点数,默认值为12。
  27796. * 【定长查找】方式下,设置查找的最小点数,默认值为12。
  27797. */
  27798. this.expectedCount = 12;
  27799. /**
  27800. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=200]
  27801. * @description 【块查找】方式下,最多参与插值的点数。
  27802. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  27803. */
  27804. this.maxPointCountForInterpolation = 200;
  27805. /**
  27806. * @member {number} [SuperMap.InterpolationKrigingAnalystParameters.prototype.maxPointCountForInterpolation=50]
  27807. * @description 【块查找】方式下,设置单个块内最多参与运算点数。
  27808. * 仅用于普通克吕金插值,简单克吕金和泛克吕金不支持块查找。
  27809. */
  27810. this.maxPointCountInNode = 50;
  27811. if (options) {
  27812. Util.extend(this, options);
  27813. }
  27814. this.CLASS_NAME = "SuperMap.InterpolationKrigingAnalystParameters";
  27815. }
  27816. /**
  27817. * @function SuperMap.InterpolationKrigingAnalystParameters.prototype.destroy
  27818. * @description 释放资源,将引用资源的属性置空。
  27819. */
  27820. destroy() {
  27821. super.destroy();
  27822. var me = this;
  27823. me.type = null;
  27824. me.mean = null;
  27825. me.angle = null;
  27826. me.nugget = null;
  27827. me.range = null;
  27828. me.sill = null;
  27829. me.variogramMode = null;
  27830. me.exponent = null;
  27831. me.searchMode = null;
  27832. me.expectedCount = null;
  27833. me.maxPointCountForInterpolation = null;
  27834. me.maxPointCountInNode = null;
  27835. }
  27836. }
  27837. SuperMap.InterpolationKrigingAnalystParameters = InterpolationKrigingAnalystParameters;
  27838. ;// CONCATENATED MODULE: ./src/common/iServer/InterpolationAnalystService.js
  27839. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27840. * This program are made available under the terms of the Apache License, Version 2.0
  27841. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27842. /**
  27843. * @class SuperMap.InterpolationAnalystService
  27844. * @category iServer SpatialAnalyst InterpolationAnalyst
  27845. * @classdesc 插值分析服务类。
  27846. * 插值分析可以将有限的采样点数据,通过插值算法对采样点周围的数值情况进行预测,可以掌握研究区域内数据的总体分布状况,从而使采样的离散点不仅仅反映其所在位置的数值情况,
  27847. * 还可以反映区域的数值分布。目前SuperMap iServer的插值功能提供从点数据集插值得到栅格数据集的功能,支持以下常用的内插方法,
  27848. * 包括:反距离加权插值、克吕金(Kriging)插值法、样条(径向基函数,Radial Basis Function)插值、点密度插值。
  27849. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  27850. * @param {Object} options - 参数。</br>
  27851. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  27852. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  27853. * @param {Object} [options.headers] - 请求头。
  27854. * @extends {SuperMap.SpatialAnalystBase}
  27855. * @example 例如:
  27856. * (start code)
  27857. * var myTInterpolationAnalystService = new SuperMap.InterpolationAnalystService(url);
  27858. * myTInterpolationAnalystService.events.on({
  27859. * "processCompleted": processCompleted,
  27860. * "processFailed": processFailed
  27861. * }
  27862. * );
  27863. * (end)
  27864. *
  27865. */
  27866. class InterpolationAnalystService extends SpatialAnalystBase {
  27867. constructor(url, options) {
  27868. super(url, options);
  27869. /**
  27870. * @member {string} SuperMap.InterpolationAnalystService.prototype.mode
  27871. * @description 插值分析类型。
  27872. */
  27873. this.mode = null;
  27874. if (options) {
  27875. Util.extend(this, options);
  27876. }
  27877. }
  27878. /**
  27879. * @function SuperMap.InterpolationAnalystService.prototype.destroy
  27880. * @description 释放资源,将引用资源的属性置空。
  27881. */
  27882. destroy() {
  27883. super.destroy();
  27884. this.mode = null;
  27885. this.CLASS_NAME = "SuperMap.InterpolationAnalystService";
  27886. }
  27887. /**
  27888. * @function SuperMap.InterpolationAnalystService.prototype.processAsync
  27889. * @description 负责将客户端的查询参数传递到服务端。
  27890. * @param {SuperMap.InterpolationAnalystParameters} parameter - 插值分析参数类。
  27891. */
  27892. processAsync(parameter) {
  27893. var parameterObject = {};
  27894. var me = this;
  27895. if (parameter instanceof InterpolationDensityAnalystParameters) {
  27896. me.mode = 'Density';
  27897. if (parameter.InterpolationAnalystType === 'geometry') {
  27898. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/density');
  27899. } else {
  27900. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/density');
  27901. }
  27902. } else if (parameter instanceof InterpolationIDWAnalystParameters) {
  27903. me.mode = 'IDW';
  27904. if (parameter.InterpolationAnalystType === 'geometry') {
  27905. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/idw');
  27906. } else {
  27907. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/idw');
  27908. }
  27909. } else if (parameter instanceof InterpolationRBFAnalystParameters) {
  27910. me.mode = 'RBF';
  27911. if (parameter.InterpolationAnalystType === 'geometry') {
  27912. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/rbf');
  27913. } else {
  27914. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/rbf');
  27915. }
  27916. } else if (parameter instanceof InterpolationKrigingAnalystParameters) {
  27917. me.mode = 'Kriging';
  27918. if (parameter.InterpolationAnalystType === 'geometry') {
  27919. me.url = Util.urlPathAppend(me.url, 'geometry/interpolation/kriging');
  27920. } else {
  27921. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/interpolation/kriging');
  27922. }
  27923. }
  27924. InterpolationAnalystParameters.toObject(parameter, parameterObject);
  27925. var jsonParameters = Util.toJSON(parameterObject);
  27926. me.url = Util.urlAppend(me.url, 'returnContent=true');
  27927. me.request({
  27928. method: "POST",
  27929. data: jsonParameters,
  27930. scope: me,
  27931. success: me.serviceProcessCompleted,
  27932. failure: me.serviceProcessFailed
  27933. });
  27934. }
  27935. }
  27936. SuperMap.InterpolationAnalystService = InterpolationAnalystService;
  27937. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  27938. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  27939. * This program are made available under the terms of the Apache License, Version 2.0
  27940. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  27941. /**
  27942. * @class SuperMap.KernelDensityJobParameter
  27943. * @category iServer ProcessingService DensityAnalyst
  27944. * @classdesc 密度分析任务参数类。
  27945. * @param {Object} options - 参数。
  27946. * @param {string} options.datasetName - 数据集名。
  27947. * @param {string} options.fields - 权重索引。
  27948. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  27949. * @param {number} [options.resolution=80] - 分辨率。
  27950. * @param {number} [options.method=0] - 分析方法。
  27951. * @param {number} [options.meshType=0] - 分析类型。
  27952. * @param {number} [options.radius=300] - 分析的影响半径。
  27953. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  27954. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  27955. */
  27956. class KernelDensityJobParameter {
  27957. constructor(options) {
  27958. if (!options) {
  27959. return;
  27960. }
  27961. /**
  27962. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  27963. * @description 数据集名。
  27964. */
  27965. this.datasetName = "";
  27966. /**
  27967. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  27968. * @description 分析范围。
  27969. */
  27970. this.query = "";
  27971. /**
  27972. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  27973. * @description 网格大小。
  27974. */
  27975. this.resolution = 80;
  27976. /**
  27977. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  27978. * @description 分析方法。
  27979. */
  27980. this.method = 0;
  27981. /**
  27982. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  27983. * @description 分析类型。
  27984. */
  27985. this.meshType = 0;
  27986. /**
  27987. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  27988. * @description 权重索引。
  27989. */
  27990. this.fields = "";
  27991. /**
  27992. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  27993. * @description 分析的影响半径。
  27994. */
  27995. this.radius = 300;
  27996. /**
  27997. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  27998. * @description 网格大小单位。
  27999. */
  28000. this.meshSizeUnit = AnalystSizeUnit.METER;
  28001. /**
  28002. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  28003. * @description 搜索半径单位。
  28004. */
  28005. this.radiusUnit = AnalystSizeUnit.METER;
  28006. /**
  28007. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  28008. * @description 面积单位。
  28009. */
  28010. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  28011. /**
  28012. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  28013. * @description 输出参数设置类
  28014. */
  28015. this.output = null;
  28016. /**
  28017. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  28018. * @description 分析后结果可视化的参数类。
  28019. */
  28020. this.mappingParameters = null;
  28021. Util.extend(this, options);
  28022. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  28023. }
  28024. /**
  28025. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  28026. * @description 释放资源,将引用资源的属性置空。
  28027. */
  28028. destroy() {
  28029. this.datasetName = null;
  28030. this.query = null;
  28031. this.resolution = null;
  28032. this.method = null;
  28033. this.radius = null;
  28034. this.meshType = null;
  28035. this.fields = null;
  28036. this.meshSizeUnit = null;
  28037. this.radiusUnit = null;
  28038. this.areaUnit = null;
  28039. if (this.output instanceof OutputSetting) {
  28040. this.output.destroy();
  28041. this.output = null;
  28042. }
  28043. if (this.mappingParameters instanceof MappingParameters) {
  28044. this.mappingParameters.destroy();
  28045. this.mappingParameters = null;
  28046. }
  28047. }
  28048. /**
  28049. * @function SuperMap.KernelDensityJobParameter.toObject
  28050. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  28051. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  28052. * @description 将密度分析任务参数对象转换为 JSON 对象。
  28053. * @returns JSON 对象。
  28054. */
  28055. static toObject(kernelDensityJobParameter, tempObj) {
  28056. for (var name in kernelDensityJobParameter) {
  28057. if (name === "datasetName") {
  28058. tempObj['input'] = tempObj['input'] || {};
  28059. tempObj['input'][name] = kernelDensityJobParameter[name];
  28060. continue;
  28061. }
  28062. if (name === "output") {
  28063. tempObj['output'] = tempObj['output'] || {};
  28064. tempObj['output'] = kernelDensityJobParameter[name];
  28065. continue;
  28066. }
  28067. tempObj['analyst'] = tempObj['analyst'] || {};
  28068. if (name === 'query' && kernelDensityJobParameter[name]) {
  28069. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  28070. } else {
  28071. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  28072. }
  28073. if (name === 'mappingParameters') {
  28074. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  28075. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  28076. }
  28077. }
  28078. }
  28079. }
  28080. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  28081. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  28082. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28083. * This program are made available under the terms of the Apache License, Version 2.0
  28084. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28085. /**
  28086. * @class SuperMap.KernelDensityJobsService
  28087. * @category iServer ProcessingService DensityAnalyst
  28088. * @classdesc 核密度分析服务类
  28089. * @extends {SuperMap.ProcessingServiceBase}
  28090. * @param {string} url -核密度分析服务地址。
  28091. * @param {Object} options - 交互服务时所需可选参数。
  28092. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28093. * @param {Object} [options.headers] - 请求头。
  28094. */
  28095. class KernelDensityJobsService extends ProcessingServiceBase {
  28096. constructor(url, options) {
  28097. super(url, options);
  28098. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
  28099. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  28100. }
  28101. /**
  28102. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  28103. * @override
  28104. */
  28105. destroy() {
  28106. super.destroy();
  28107. }
  28108. /**
  28109. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  28110. * @description 获取核密度分析任务
  28111. */
  28112. getKernelDensityJobs() {
  28113. super.getJobs(this.url);
  28114. }
  28115. /**
  28116. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  28117. * @description 获取指定id的核密度分析服务
  28118. * @param {string} id - 指定要获取数据的id
  28119. */
  28120. getKernelDensityJob(id) {
  28121. super.getJobs(Util.urlPathAppend(this.url, id));
  28122. }
  28123. /**
  28124. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  28125. * @description 新建核密度分析服务
  28126. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  28127. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  28128. */
  28129. addKernelDensityJob(params, seconds) {
  28130. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  28131. }
  28132. }
  28133. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  28134. ;// CONCATENATED MODULE: ./src/common/iServer/LabelMatrixCell.js
  28135. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28136. * This program are made available under the terms of the Apache License, Version 2.0
  28137. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28138. /**
  28139. * @class SuperMap.LabelMatrixCell
  28140. * @category iServer Map Theme
  28141. * @classdesc 矩阵标签元素抽象类。
  28142. * @description 该类可以包含 n*n 个矩阵标签元素,矩阵标签元素的类型可以是图片,符号,标签专题图等。
  28143. * 符号类型的矩阵标签元素类、图片类型的矩阵标签元素类和专题图类型的矩阵标签元素类均继承自该类。
  28144. */
  28145. class LabelMatrixCell {
  28146. constructor() {
  28147. this.CLASS_NAME = "LabelMatrixCell";
  28148. }
  28149. }
  28150. SuperMap.LabelMatrixCell = LabelMatrixCell;
  28151. ;// CONCATENATED MODULE: ./src/common/iServer/LabelImageCell.js
  28152. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28153. * This program are made available under the terms of the Apache License, Version 2.0
  28154. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28155. /**
  28156. * @class SuperMap.LabelImageCell
  28157. * @category iServer Map Theme
  28158. * @classdesc 图片类型的矩阵标签元素类。
  28159. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  28160. * 矩阵标签专题图是标签专题图(ThemeLabel)的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  28161. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  28162. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  28163. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 是一个二维数组,
  28164. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  28165. * @extends {SuperMap.LabelMatrixCell}
  28166. * @param {Object} options - 参数。
  28167. * @param {number} [options.height=0] - 设置图片的高度,单位为毫米。
  28168. * @param {string} [options.pathField] - 设置矩阵标签元素所使用图片的路径。
  28169. * @param {number} [options.rotation=0.0] - 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  28170. * @param {number} [options.width=0] - 设置图片的宽度,单位为毫米。
  28171. * @param {boolean} [options.sizeFixed=false] - 是否固定图片的大小。
  28172. */
  28173. class LabelImageCell extends LabelMatrixCell {
  28174. constructor(options) {
  28175. super(options);
  28176. /**
  28177. * @member {number} SuperMap.LabelImageCell.prototype.height
  28178. * @description 设置图片的高度,单位为毫米。
  28179. */
  28180. this.height = 0;
  28181. /**
  28182. * @member {string} SuperMap.LabelImageCell.prototype.pathField
  28183. * @description 设置矩阵标签元素所使用的图片路径对应的字段名。
  28184. */
  28185. this.pathField = null;
  28186. /**
  28187. * @member {number} [SuperMap.LabelImageCell.prototype.rotation=0.0]
  28188. * @description 图片的旋转角度。逆时针方向为正方向,单位为度,精确到0.1度。
  28189. */
  28190. this.rotation = 0.0;
  28191. /**
  28192. * @member {number} SuperMap.LabelImageCell.prototype.width
  28193. * @description 设置图片的宽度,单位为毫米。
  28194. */
  28195. this.width = 0;
  28196. /**
  28197. * @member {boolean} [SuperMap.LabelImageCell.prototype.sizeFixed=false]
  28198. * @description 是否固定图片的大小。
  28199. */
  28200. this.sizeFixed = false;
  28201. /**
  28202. * @member {string} SuperMap.LabelImageCell.prototype.type
  28203. * @description 制作矩阵专题图时是必须的。
  28204. */
  28205. this.type = "IMAGE";
  28206. if (options) {
  28207. Util.extend(this, options);
  28208. }
  28209. this.CLASS_NAME = "SuperMap.LabelImageCell";
  28210. }
  28211. /**
  28212. * @function SuperMap.LabelImageCell.prototype.destroy
  28213. * @description 释放资源,将引用资源的属性置空。
  28214. */
  28215. destroy() {
  28216. var me = this;
  28217. me.height = null;
  28218. me.pathField = null;
  28219. me.rotation = null;
  28220. me.width = null;
  28221. me.sizeFixed = null;
  28222. }
  28223. }
  28224. SuperMap.LabelImageCell = LabelImageCell;
  28225. ;// CONCATENATED MODULE: ./src/common/iServer/LabelSymbolCell.js
  28226. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28227. * This program are made available under the terms of the Apache License, Version 2.0
  28228. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28229. /**
  28230. * @class SuperMap.LabelSymbolCell
  28231. * @category iServer Map Theme
  28232. * @classdesc 符号类型的矩阵标签元素类。
  28233. * @description 该类继承自 {@link SuperMap.LabelMatrixCell}类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  28234. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  28235. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  28236. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  28237. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  28238. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  28239. * @extends {SuperMap.LabelMatrixCell}
  28240. * @param {Object} options - 参数。
  28241. * @param {SuperMap.ServerStyle} options.style - 获取或设置符号样式。
  28242. * @param {string} options.symbolIDField - 符号 ID 或符号 ID 所对应的字段名称。
  28243. */
  28244. class LabelSymbolCell extends LabelMatrixCell {
  28245. constructor(options) {
  28246. super(options);
  28247. /**
  28248. * @member {SuperMap.ServerStyle} SuperMap.LabelSymbolCell.prototype.style
  28249. * @description 获取或设置符号样式—— {@link SuperMap.ServerStyle} 对象,包括符号大小({@link SuperMap.ServerStyle.markerSize})
  28250. * 和符号旋转({@link SuperMap.ServerStyle.markerAngle})角度,其中用于设置符号 ID 的属性({@link SuperMap.ServerStyle.markerSymbolID})在此处不起作用。
  28251. */
  28252. this.style = new ServerStyle();
  28253. /**
  28254. * @member {string} SuperMap.LabelSymbolCell.prototype.symbolIDField
  28255. * @description 获取或设置符号 ID 或符号 ID 所对应的字段名称。
  28256. */
  28257. this.symbolIDField = null;
  28258. /**
  28259. * @member {string} SuperMap.LabelSymbolCell.prototype.type
  28260. * @description 制作矩阵专题图时是必须的。
  28261. */
  28262. this.type = "SYMBOL";
  28263. if (options) {
  28264. Util.extend(this, options);
  28265. }
  28266. this.CLASS_NAME = "SuperMap.LabelSymbolCell";
  28267. }
  28268. /**
  28269. * @function SuperMap.LabelSymbolCell.prototype.destroy
  28270. * @description 释放资源,将引用资源的属性置空。
  28271. */
  28272. destroy() {
  28273. var me = this;
  28274. if (me.style) {
  28275. me.style.destroy();
  28276. me.style = null;
  28277. }
  28278. me.symbolIDField = null;
  28279. }
  28280. }
  28281. SuperMap.LabelSymbolCell = LabelSymbolCell;
  28282. ;// CONCATENATED MODULE: ./src/common/iServer/LabelThemeCell.js
  28283. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28284. * This program are made available under the terms of the Apache License, Version 2.0
  28285. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28286. /**
  28287. * @class SuperMap.LabelThemeCell
  28288. * @category iServer Map Theme
  28289. * @classdesc 专题图类型的矩阵标签元素类。
  28290. * @description 该类继承自 {@link SuperMap.LabelMatrixCell} 类,主要对矩阵标签中的专题图类型的矩阵标签元素进行设置。
  28291. * 矩阵标签专题图是标签专题图({@link SuperMap.ThemeLabel})的一种,其中矩阵标签中的填充元素又可分为图片类型({@link SuperMap.LabelImageCell})、
  28292. * 符号类型({@link SuperMap.LabelSymbolCell})、专题图类型({@link SuperMap.LabelThemeCell})三种,该类是这三种类型的矩阵标签元素其中的一种,
  28293. * 用于定义符号类型的矩阵标签,如符号 ID 字段名称(符号 ID 与 SuperMap 桌面产品中点、线、面符号的 ID 对应) 、大小等。
  28294. * 用户在实现矩阵标签专题图时只需将定义好的矩阵标签元素赋值予 {@link SuperMap.ThemeLabel.matrixCells} 属性即可。matrixCells 属是一个二维数组,
  28295. * 每一维可以是任意类型的矩阵标签元素组成的数组(也可是单个标签元素组成的数组,即数组中只有一个元素)。
  28296. * @extends {SuperMap.LabelMatrixCell}
  28297. * @param {Object} options -参数。
  28298. * @param {SuperMap.ThemeLabel} options.themeLabel - 使用专题图对象作为矩阵标签的一个元素。
  28299. */
  28300. class LabelThemeCell extends LabelMatrixCell {
  28301. constructor(options) {
  28302. super(options);
  28303. /**
  28304. * @member {SuperMap.ThemeLabel} SuperMap.LabelThemeCell.prototype.themeLabel
  28305. * @description 使用专题图对象作为矩阵标签的一个元素。
  28306. */
  28307. this.themeLabel = new ThemeLabel();
  28308. /**
  28309. * @member {string} SuperMap.LabelThemeCell.prototype.type
  28310. * @description 制作矩阵专题图时是必须的。
  28311. */
  28312. this.type = "THEME";
  28313. if (options) {
  28314. Util.extend(this, options);
  28315. }
  28316. this.CLASS_NAME = " SuperMap.LabelThemeCell";
  28317. }
  28318. /**
  28319. * @function SuperMap.LabelThemeCell.prototype.destroy
  28320. * @description 释放资源,将引用资源的属性置空。
  28321. */
  28322. destroy() {
  28323. var me = this;
  28324. if (me.themeLabel) {
  28325. me.themeLabel.destroy();
  28326. me.themeLabel = null;
  28327. }
  28328. }
  28329. }
  28330. SuperMap.LabelThemeCell = LabelThemeCell;
  28331. ;// CONCATENATED MODULE: ./src/common/iServer/LayerStatus.js
  28332. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28333. * This program are made available under the terms of the Apache License, Version 2.0
  28334. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28335. /**
  28336. * @class SuperMap.LayerStatus
  28337. * @category iServer Map Theme
  28338. * @classdesc 子图层显示参数类。
  28339. * @description 该类存储了各个子图层的名字和是否可见的状态。
  28340. * @param {Object} options - 参数。
  28341. * @param {string} options.layerName - 获取或设置图层名称。
  28342. * @param {boolean} [options.isVisible=true] - 获取或设置图层是否可见,true 表示可见。
  28343. * @param {string} [options.displayFilter] - 图层显示 SQL 过滤条件。
  28344. */
  28345. class LayerStatus {
  28346. constructor(options) {
  28347. /**
  28348. * @member {string} SuperMap.LayerStatus.prototype.layerName
  28349. * @description 获取或设置图层名称。
  28350. */
  28351. this.layerName = null;
  28352. /**
  28353. * @member {boolean} SuperMap.LayerStatus.prototype.isVisible
  28354. * @description 获取或设置图层是否可见,true 表示可见。
  28355. */
  28356. this.isVisible = null;
  28357. /**
  28358. * @member {string} [SuperMap.LayerStatus.prototype.displayFilter]
  28359. * @description 图层显示 SQL 过滤条件,如 layerStatus.displayFilter = "smid < 10",表示仅显示 smid 值小于 10 的对象。
  28360. */
  28361. this.displayFilter = null;
  28362. /**
  28363. * @member {Object} [SuperMap.LayerStatus.prototype.fieldValuesDisplayFilter]
  28364. * @property {Array.<number>} values - 要过滤的值。
  28365. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  28366. * @property {string} fieldValuesDisplayMode - 目前有两个 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  28367. */
  28368. this.fieldValuesDisplayFilter = null;
  28369. if (options) {
  28370. Util.extend(this, options);
  28371. }
  28372. this.CLASS_NAME = "SuperMap.LayerStatus";
  28373. }
  28374. /**
  28375. * @function SuperMap.LayerStatus.prototype.destroy
  28376. * @description 释放资源,将引用资源的属性置空。
  28377. */
  28378. destroy() {
  28379. var me = this;
  28380. me.layerName = null;
  28381. me.isVisible = null;
  28382. me.displayFilter = null;
  28383. }
  28384. /**
  28385. * @function SuperMap.LayerStatus.prototype.toJSON
  28386. * @description 生成对应的 JSON。
  28387. * @returns {Object} 对应的 JSON。
  28388. */
  28389. toJSON() {
  28390. var json = '{';
  28391. json += '"type":"UGC",';
  28392. var v = [];
  28393. if (this.layerName) {
  28394. v.push('"name":"' + this.layerName + '"');
  28395. v.push('"visible":' + this.isVisible);
  28396. }
  28397. if (this.displayFilter) {
  28398. v.push('"displayFilter":"' + this.displayFilter + '"');
  28399. }
  28400. if (this.minScale || this.minScale == 0) {
  28401. v.push('"minScale":' + this.minScale);
  28402. }
  28403. if (this.maxScale || this.maxScale == 0) {
  28404. v.push('"maxScale":' + this.maxScale);
  28405. }
  28406. if (this.fieldValuesDisplayFilter) {
  28407. v.push('"fieldValuesDisplayFilter":' + Util.toJSON(this.fieldValuesDisplayFilter));
  28408. }
  28409. json += v;
  28410. json += '}';
  28411. return json;
  28412. }
  28413. }
  28414. SuperMap.LayerStatus = LayerStatus;
  28415. ;// CONCATENATED MODULE: ./src/common/iServer/MapService.js
  28416. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28417. * This program are made available under the terms of the Apache License, Version 2.0
  28418. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28419. /**
  28420. * @class SuperMap.MapService
  28421. * @category iServer Map
  28422. * @classdesc 地图信息服务类。
  28423. * @extends {SuperMap.CommonServiceBase}
  28424. * @example
  28425. * var myMapService = new SuperMap.MapService(url, {
  28426. * eventListeners:{
  28427. * "processCompleted": MapServiceCompleted,
  28428. * "processFailed": MapServiceFailed
  28429. * }
  28430. * });
  28431. *
  28432. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  28433. * @param {Object} options - 参数。
  28434. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  28435. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28436. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28437. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28438. * @param {Object} [options.headers] - 请求头。
  28439. */
  28440. class MapService_MapService extends CommonServiceBase {
  28441. constructor(url, options) {
  28442. super(url, options);
  28443. /**
  28444. * @member {string} SuperMap.MapService.prototype.projection
  28445. * @description 根据投影参数获取地图状态信息。如"EPSG:4326"
  28446. */
  28447. this.projection = null;
  28448. this.CLASS_NAME = "SuperMap.MapService";
  28449. if (options) {
  28450. Util.extend(this, options);
  28451. }
  28452. var me = this;
  28453. if (me.projection) {
  28454. var arr = me.projection.split(":");
  28455. if (arr instanceof Array) {
  28456. if (arr.length === 2) {
  28457. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[1]}"}`)}`)
  28458. }
  28459. if (arr.length === 1) {
  28460. me.url = Util.urlAppend(me.url,`prjCoordSys=${encodeURIComponent(`{\"epsgCode\":"${arr[0]}"}`)}`)
  28461. }
  28462. }
  28463. }
  28464. }
  28465. /**
  28466. * @function destroy
  28467. * @description 释放资源,将引用的资源属性置空。
  28468. */
  28469. destroy() {
  28470. super.destroy();
  28471. var me = this;
  28472. if (me.events) {
  28473. me.events.un(me.eventListeners);
  28474. me.events.listeners = null;
  28475. me.events.destroy();
  28476. me.events = null;
  28477. me.eventListeners = null;
  28478. }
  28479. }
  28480. /**
  28481. * @function SuperMap.MapService.prototype.processAsync
  28482. * @description 负责将客户端的设置的参数传递到服务端,与服务端完成异步通讯。
  28483. */
  28484. processAsync() {
  28485. var me = this;
  28486. me.request({
  28487. method: "GET",
  28488. scope: me,
  28489. success: me.serviceProcessCompleted,
  28490. failure: me.serviceProcessFailed
  28491. });
  28492. }
  28493. /*
  28494. * Method: getMapStatusCompleted
  28495. * 获取地图状态完成,执行此方法。
  28496. *
  28497. * Parameters:
  28498. * {Object} result - 服务器返回的结果对象。
  28499. */
  28500. serviceProcessCompleted(result) {
  28501. var me = this;
  28502. result = Util.transformResult(result);
  28503. var codeStatus = (result.code >= 200 && result.code < 300) || result.code == 0 || result.code === 304;
  28504. var isCodeValid = result.code && codeStatus;
  28505. if (!result.code || isCodeValid) {
  28506. me.events && me.events.triggerEvent("processCompleted", {result: result});
  28507. } else {
  28508. ////在没有token是返回的是200,但是其实是没有权限,所以这里也应该是触发失败事件
  28509. me.events.triggerEvent("processFailed", {error: result});
  28510. }
  28511. }
  28512. }
  28513. SuperMap.MapService = MapService_MapService;
  28514. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisParameters.js
  28515. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28516. * This program are made available under the terms of the Apache License, Version 2.0
  28517. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28518. /**
  28519. * @class SuperMap.MathExpressionAnalysisParameters
  28520. * @category iServer SpatialAnalyst GridMathAnalyst
  28521. * @classdesc 栅格代数运算参数类。
  28522. * @param {Object} options - 参数。
  28523. * @param {string} options.dataset - 要用来做栅格代数运算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:BaseMap_P@Jingjin。
  28524. * @param {string} options.resultGridName - 指定结果数据集名称。
  28525. * @param {string} options.expression - 指定的栅格运算表达式。如:[DatasourceAlias1.Raster1]*2-10。
  28526. * @param {string} options.targetDatasource - 指定存储结果数据集的数据源。
  28527. * @param {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [options.extractRegion] - 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  28528. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  28529. * @param {boolean} [options.isZip=false] - 是否对结果数据集进行压缩处理。
  28530. * @param {boolean} [options.ignoreNoValue=false] - 是否忽略无值栅格数据。true 表示忽略无值数据,即无值栅格不参与运算。
  28531. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  28532. */
  28533. class MathExpressionAnalysisParameters {
  28534. constructor(options) {
  28535. if (!options) {
  28536. return;
  28537. }
  28538. /**
  28539. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.dataset
  28540. * @description 要用来做栅格代数运算数据源中数据集的名称。
  28541. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  28542. *
  28543. */
  28544. this.dataset = null;
  28545. /**
  28546. * @member {(SuperMap.Geometry.Polygon|L.Polygon|ol.geom.Polygon)} [SuperMap.MathExpressionAnalysisParameters.prototype.extractRegion]
  28547. * @description 栅格代数运算的范围,指定数据集中参与栅格代数运算的区域。
  28548. * 如果缺省,则计算全部区域,如果参与运算的数据集范围不一致,将使用所有数据集的范围的交集作为计算区域 。
  28549. */
  28550. this.extractRegion = null;
  28551. /**
  28552. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.expression
  28553. * @description 指定的栅格运算表达式。如:"[DatasourceAlias1.Raster1]*2-10"。
  28554. */
  28555. this.expression = null;
  28556. /**
  28557. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.isZip=false]
  28558. * @description 是否对结果数据集进行压缩处理。
  28559. */
  28560. this.isZip = false;
  28561. /**
  28562. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.ignoreNoValue=false]
  28563. * @description 是否忽略无值栅格数据。
  28564. */
  28565. this.ignoreNoValue = false;
  28566. /**
  28567. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.targetDatasource
  28568. * @description 指定存储结果数据集的数据源。
  28569. */
  28570. this.targetDatasource = null;
  28571. /**
  28572. * @member {string} SuperMap.MathExpressionAnalysisParameters.prototype.resultGridName
  28573. * @description 指定结果数据集名称。
  28574. */
  28575. this.resultGridName = null;
  28576. /**
  28577. * @member {boolean} [SuperMap.MathExpressionAnalysisParameters.prototype.deleteExistResultDataset=false]
  28578. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  28579. */
  28580. this.deleteExistResultDataset = false;
  28581. Util.extend(this, options);
  28582. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisParameters"
  28583. }
  28584. /**
  28585. * @function SuperMap.MathExpressionAnalysisParameters.prototype.destroy
  28586. * @description 释放资源,将引用资源的属性置空。
  28587. */
  28588. destroy() {
  28589. var me = this;
  28590. me.dataset = null;
  28591. me.bounds = null;
  28592. me.expression = null;
  28593. me.isZip = true;
  28594. me.ignoreNoValue = true;
  28595. me.targetDatasource = null;
  28596. me.resultGridName = null;
  28597. me.deleteExistResultDataset = null;
  28598. }
  28599. /**
  28600. * @function SuperMap.MathExpressionAnalysisParameters.toObject
  28601. * @param {Object} mathExpressionAnalysisParameters - 栅格代数运算参数。
  28602. * @param {Object} tempObj - 目标对象。
  28603. * @description 生成栅格代数运算对象。
  28604. */
  28605. static toObject(mathExpressionAnalysisParameters, tempObj) {
  28606. for (var name in mathExpressionAnalysisParameters) {
  28607. if (name !== "dataset") {
  28608. tempObj[name] = mathExpressionAnalysisParameters[name];
  28609. }
  28610. if (name === "extractRegion") {
  28611. if (mathExpressionAnalysisParameters[name]) {
  28612. var bs = mathExpressionAnalysisParameters[name].components[0].components;
  28613. var region = {},
  28614. points = [],
  28615. type = "REGION";
  28616. var len = bs.length;
  28617. for (var i = 0; i < len - 1; i++) {
  28618. var poi = {};
  28619. poi["x"] = bs[i].x;
  28620. poi["y"] = bs[i].y;
  28621. points.push(poi);
  28622. }
  28623. region["points"] = points;
  28624. region["type"] = type;
  28625. tempObj[name] = region;
  28626. }
  28627. }
  28628. }
  28629. }
  28630. }
  28631. SuperMap.MathExpressionAnalysisParameters = MathExpressionAnalysisParameters;
  28632. ;// CONCATENATED MODULE: ./src/common/iServer/MathExpressionAnalysisService.js
  28633. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28634. * This program are made available under the terms of the Apache License, Version 2.0
  28635. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28636. /**
  28637. * @class SuperMap.MathExpressionAnalysisService
  28638. * @category iServer SpatialAnalyst GridMathAnalyst
  28639. * @classdesc 栅格代数运算服务类。
  28640. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  28641. * @param {Object} options - 参数。</br>
  28642. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28643. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28644. * @param {Object} [options.headers] - 请求头。
  28645. * @extends {SuperMap.SpatialAnalystBase}
  28646. * @example 例如:
  28647. * (start code)
  28648. * var myMathExpressionAnalysisService = new SuperMap.MathExpressionAnalysisService(url);
  28649. * myMathExpressionAnalysisService.on({
  28650. * "processCompleted": processCompleted,
  28651. * "processFailed": processFailed
  28652. * }
  28653. * );
  28654. * (end)
  28655. *
  28656. */
  28657. class MathExpressionAnalysisService extends SpatialAnalystBase {
  28658. constructor(url, options) {
  28659. super(url, options);
  28660. this.CLASS_NAME = "SuperMap.MathExpressionAnalysisService";
  28661. }
  28662. /**
  28663. * @override
  28664. */
  28665. destroy() {
  28666. super.destroy();
  28667. }
  28668. /**
  28669. * @function SuperMap.MathExpressionAnalysisService.prototype.processAsync
  28670. * @description 负责将客户端的查询参数传递到服务端。
  28671. * @param {SuperMap.MathExpressionAnalysisParameters} parameter - 栅格代数运算参数类。
  28672. */
  28673. processAsync(parameter) {
  28674. var me = this;
  28675. var parameterObject = {};
  28676. if (parameter instanceof MathExpressionAnalysisParameters) {
  28677. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/mathanalyst');
  28678. }
  28679. MathExpressionAnalysisParameters.toObject(parameter, parameterObject);
  28680. var jsonParameters = Util.toJSON(parameterObject);
  28681. me.url = Util.urlAppend(me.url, 'returnContent=true');
  28682. me.request({
  28683. method: "POST",
  28684. data: jsonParameters,
  28685. scope: me,
  28686. success: me.serviceProcessCompleted,
  28687. failure: me.serviceProcessFailed
  28688. });
  28689. }
  28690. }
  28691. SuperMap.MathExpressionAnalysisService = MathExpressionAnalysisService;
  28692. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureParameters.js
  28693. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28694. * This program are made available under the terms of the Apache License, Version 2.0
  28695. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28696. /**
  28697. * @class SuperMap.MeasureParameters
  28698. * @category iServer Map Measure
  28699. * @classdesc 量算参数类。
  28700. * @param {Object} geometry - 要量算的几何对象。
  28701. * @param {Object} options - 参数。
  28702. * @param {SuperMap.Unit} [options.unit=SuperMap.Unit.METER] - 量算单位。
  28703. * @param {string} [options.prjCoordSys] - 用来指定该量算操作所使用的投影。
  28704. * @param {string} [options.distanceMode="Geodesic"] - 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  28705. */
  28706. class MeasureParameters {
  28707. constructor(geometry, options) {
  28708. if (!geometry) {
  28709. return;
  28710. }
  28711. /**
  28712. * @member {Object} SuperMap.MeasureParameters.prototype.geometry
  28713. * @description 要量算的几何对象。<br>
  28714. * 点类型可以是:{@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>
  28715. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  28716. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  28717. */
  28718. this.geometry = geometry;
  28719. /**
  28720. * @member {SuperMap.Unit} [SuperMap.MeasureParameters.prototype.unit=SuperMap.Unit.METER]
  28721. * @description 量算单位。即量算结果以米为单位。
  28722. */
  28723. this.unit = REST_Unit.METER;
  28724. /**
  28725. * @member {string} [SuperMap.MeasureParameters.prototype.prjCoordSys]
  28726. * @description 用来指定该量算操作所使用的投影。
  28727. */
  28728. this.prjCoordSys = null;
  28729. /**
  28730. * @member {string} [SuperMap.MeasureParameters.prototype.distanceMode="Geodesic"]
  28731. * @description 用来指定量算的方式为按球面长度 'Geodesic' 或者平面长度 'Planar' 来计算。
  28732. * @example
  28733. * var param = new SuperMap.MeasureParameters(getmetry,{distanceMode:'Planar'});
  28734. */
  28735. this.distanceMode = null;
  28736. if (options) {
  28737. Util.extend(this, options);
  28738. }
  28739. this.CLASS_NAME = "SuperMap.MeasureParameters";
  28740. }
  28741. /**
  28742. * @function SuperMap.MeasureParameters.prototype.destroy
  28743. * @description 释放资源,将引用资源的属性置空。
  28744. */
  28745. destroy() {
  28746. var me = this;
  28747. me.geometry = null;
  28748. me.unit = null;
  28749. me.prjCoordSys = null;
  28750. }
  28751. }
  28752. SuperMap.MeasureParameters = MeasureParameters;
  28753. ;// CONCATENATED MODULE: ./src/common/iServer/MeasureService.js
  28754. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28755. * This program are made available under the terms of the Apache License, Version 2.0
  28756. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28757. /**
  28758. * @class SuperMap.MeasureService
  28759. * @category iServer Map Measure
  28760. * @classdesc 量算服务类。
  28761. * 该类负责将量算参数传递到服务端,并获取服务端返回的量算结果。
  28762. * @extends {SuperMap.CommonServiceBase}
  28763. * @example
  28764. * var myMeasuerService = new SuperMap.MeasureService(url, {
  28765. * measureMode: SuperMap.MeasureMode.DISTANCE,
  28766. * eventListeners:{
  28767. * "processCompleted": measureCompleted
  28768. * }
  28769. * });
  28770. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  28771. * @param {Object} options - 参数。
  28772. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  28773. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  28774. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  28775. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28776. * @param {Object} [options.headers] - 请求头。
  28777. * @param {MeasureMode} options.measureMode - 量算模式,包括距离量算模式和面积量算模式。
  28778. */
  28779. class MeasureService_MeasureService extends CommonServiceBase {
  28780. constructor(url, options) {
  28781. super(url, options);
  28782. /**
  28783. * @member {SuperMap.MeasureMode} [SuperMap.MeasureService.prototype.measureMode=MeasureMode.DISTANCE]
  28784. * @description 量算模式,包括距离量算模式和面积量算模式。
  28785. */
  28786. this.measureMode = MeasureMode.DISTANCE;
  28787. if (options) {
  28788. Util.extend(this, options);
  28789. }
  28790. this.CLASS_NAME = "SuperMap.MeasureService";
  28791. }
  28792. /**
  28793. * @override
  28794. */
  28795. destroy() {
  28796. super.destroy();
  28797. var me = this;
  28798. me.measureMode = null;
  28799. }
  28800. /**
  28801. * @function SuperMap.MeasureService.prototype.processAsync
  28802. * @description 负责将客户端的量算参数传递到服务端。
  28803. * @param {SuperMap.MeasureParameters} params - 量算参数。
  28804. */
  28805. processAsync(params) {
  28806. if (!(params instanceof MeasureParameters)) {
  28807. return;
  28808. }
  28809. var me = this,
  28810. geometry = params.geometry,
  28811. pointsCount = 0,
  28812. point2ds = null;
  28813. if (!geometry) {
  28814. return;
  28815. }
  28816. me.url = Util.urlPathAppend(me.url, me.measureMode === MeasureMode.AREA ? 'area' : 'distance');
  28817. var serverGeometry = ServerGeometry.fromGeometry(geometry);
  28818. if (!serverGeometry) {
  28819. return;
  28820. }
  28821. pointsCount = serverGeometry.parts[0];
  28822. point2ds = serverGeometry.points.splice(0, pointsCount);
  28823. var prjCoordSysTemp, prjCodeTemp, paramsTemp;
  28824. if (params.prjCoordSys) {
  28825. if (typeof (params.prjCoordSys) === "object") {
  28826. prjCodeTemp = params.prjCoordSys.projCode;
  28827. prjCoordSysTemp = '{"epsgCode"' + prjCodeTemp.substring(prjCodeTemp.indexOf(":"), prjCodeTemp.length) + "}";
  28828. } else if (typeof (params.prjCoordSys) === "string") {
  28829. prjCoordSysTemp = '{"epsgCode"' + params.prjCoordSys.substring(params.prjCoordSys.indexOf(":"), params.prjCoordSys.length) + "}";
  28830. }
  28831. paramsTemp = {
  28832. "point2Ds": Util.toJSON(point2ds),
  28833. "unit": params.unit,
  28834. "prjCoordSys": prjCoordSysTemp
  28835. };
  28836. } else {
  28837. paramsTemp = {"point2Ds": Util.toJSON(point2ds), "unit": params.unit};
  28838. }
  28839. me.request({
  28840. method: "GET",
  28841. params: paramsTemp,
  28842. scope: me,
  28843. success: me.serviceProcessCompleted,
  28844. failure: me.serviceProcessFailed
  28845. });
  28846. }
  28847. }
  28848. SuperMap.MeasureService = MeasureService_MeasureService;
  28849. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayAnalystService.js
  28850. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28851. * This program are made available under the terms of the Apache License, Version 2.0
  28852. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28853. /**
  28854. * @class SuperMap.OverlayAnalystService
  28855. * @category iServer SpatialAnalyst OverlayAnalyst
  28856. * @classdesc 叠加分析服务类。
  28857. * 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  28858. * 叠加分析结果通过该类支持的事件的监听函数参数获取
  28859. * @param {string} url - 服务的访问地址。如http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  28860. * @param {Object} options - 参数。</br>
  28861. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  28862. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  28863. * @param {Object} [options.headers] - 请求头。
  28864. * @extends {SuperMap.CommonServiceBase}
  28865. * @example 例如:
  28866. * (start code)
  28867. * var myOverlayAnalystService = new SuperMap.OverlayAnalystService(url, {
  28868. * eventListeners: {
  28869. * "processCompleted": OverlayCompleted,
  28870. * "processFailed": OverlayFailed
  28871. * }
  28872. * });
  28873. * (end)
  28874. */
  28875. class OverlayAnalystService extends SpatialAnalystBase {
  28876. constructor(url, options) {
  28877. super(url, options);
  28878. /**
  28879. * @member {string} SuperMap.OverlayAnalystService.prototype.mode
  28880. * @description 叠加分析类型
  28881. */
  28882. this.mode = null;
  28883. if (options) {
  28884. Util.extend(this, options);
  28885. }
  28886. this.CLASS_NAME = "SuperMap.OverlayAnalystService";
  28887. }
  28888. /**
  28889. * @override
  28890. */
  28891. destroy() {
  28892. super.destroy();
  28893. this.mode = null;
  28894. }
  28895. /**
  28896. * @function SuperMap.OverlayAnalystService.prototype.processAsync
  28897. * @description 负责将客户端的查询参数传递到服务端。
  28898. * @param {SuperMap.OverlayAnalystParameters} parameter - 叠加分析参数类。
  28899. */
  28900. processAsync(parameter) {
  28901. var parameterObject = {};
  28902. var me = this;
  28903. if (parameter instanceof DatasetOverlayAnalystParameters) {
  28904. me.mode = "datasets";
  28905. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.sourceDataset + '/overlay');
  28906. DatasetOverlayAnalystParameters.toObject(parameter, parameterObject);
  28907. } else if (parameter instanceof GeometryOverlayAnalystParameters) {
  28908. me.mode = "geometry";
  28909. //支持传入多个几何要素进行叠加分析
  28910. if(parameter.operateGeometries && parameter.sourceGeometries){
  28911. me.url = Util.urlPathAppend(me.url, 'geometry/overlay/batch');
  28912. me.url = Util.urlAppend(me.url, 'ignoreAnalystParam=true');
  28913. }else {
  28914. me.url = Util.urlPathAppend(me.url, 'geometry/overlay');
  28915. }
  28916. GeometryOverlayAnalystParameters.toObject(parameter, parameterObject);
  28917. }
  28918. me.url = Util.urlAppend(me.url, 'returnContent=true');
  28919. var jsonParameters = Util.toJSON(parameterObject);
  28920. me.request({
  28921. method: "POST",
  28922. data: jsonParameters,
  28923. scope: me,
  28924. success: me.serviceProcessCompleted,
  28925. failure: me.serviceProcessFailed
  28926. });
  28927. }
  28928. }
  28929. SuperMap.OverlayAnalystService = OverlayAnalystService;
  28930. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  28931. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  28932. * This program are made available under the terms of the Apache License, Version 2.0
  28933. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  28934. /**
  28935. * @class SuperMap.OverlayGeoJobParameter
  28936. * @category iServer ProcessingService OverlayAnalyst
  28937. * @classdesc 叠加分析任务参数类。
  28938. * @param {Object} options - 参数。
  28939. * @param {string} options.datasetName - 数据集名。
  28940. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  28941. * @param {string} options.srcFields - 输入数据需要保留的字段。
  28942. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  28943. * @param {string} [options.mode] - 叠加分析模式。
  28944. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  28945. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  28946. */
  28947. class OverlayGeoJobParameter {
  28948. constructor(options) {
  28949. if (!options) {
  28950. return;
  28951. }
  28952. /**
  28953. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  28954. * @description 数据集名。
  28955. */
  28956. this.datasetName = "";
  28957. /**
  28958. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  28959. * @description 叠加对象所在的数据集名称。
  28960. */
  28961. this.datasetOverlay = "";
  28962. /**
  28963. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  28964. * @description 叠加分析模式。
  28965. */
  28966. this.mode = "";
  28967. /**
  28968. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  28969. * @description 输入数据需要保留的字段。
  28970. */
  28971. this.srcFields = "";
  28972. /**
  28973. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  28974. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  28975. */
  28976. this.overlayFields = "";
  28977. /**
  28978. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  28979. * @description 输出参数设置类。
  28980. */
  28981. this.output = null;
  28982. /**
  28983. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  28984. * @description 分析后结果可视化的参数类。
  28985. */
  28986. this.mappingParameters = null;
  28987. Util.extend(this, options);
  28988. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  28989. }
  28990. /**
  28991. * @function SuperMap.OverlayGeoJobParameter.destroy
  28992. * @override
  28993. */
  28994. destroy() {
  28995. this.datasetName = null;
  28996. this.datasetOverlay = null;
  28997. this.mode = null;
  28998. this.srcFields = null;
  28999. this.overlayFields = null;
  29000. if (this.output instanceof OutputSetting) {
  29001. this.output.destroy();
  29002. this.output = null;
  29003. }
  29004. if (this.mappingParameters instanceof MappingParameters) {
  29005. this.mappingParameters.destroy();
  29006. this.mappingParameters = null;
  29007. }
  29008. }
  29009. /**
  29010. * @function SuperMap.OverlayGeoJobParameter.toObject
  29011. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  29012. * @param {Object} tempObj - 目标对象。
  29013. * @description 生成点聚合分析任务对象。
  29014. */
  29015. static toObject(OverlayGeoJobParameter, tempObj) {
  29016. for (var name in OverlayGeoJobParameter) {
  29017. if (name == "datasetName") {
  29018. tempObj['input'] = tempObj['input'] || {};
  29019. tempObj['input'][name] = OverlayGeoJobParameter[name];
  29020. continue;
  29021. }
  29022. if (name === "output") {
  29023. tempObj['output'] = tempObj['output'] || {};
  29024. tempObj['output'] = OverlayGeoJobParameter[name];
  29025. continue;
  29026. }
  29027. tempObj['analyst'] = tempObj['analyst'] || {};
  29028. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  29029. if(name === 'mappingParameters'){
  29030. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  29031. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  29032. }
  29033. }
  29034. }
  29035. }
  29036. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  29037. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  29038. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29039. * This program are made available under the terms of the Apache License, Version 2.0
  29040. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29041. /**
  29042. * @class SuperMap.OverlayGeoJobsService
  29043. * @category iServer ProcessingService OverlayAnalyst
  29044. * @classdesc 叠加分析任务类。
  29045. * @param {string} url - 叠加分析任务地址。
  29046. * @param {Object} options - 参数。
  29047. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  29048. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29049. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  29050. * @param {number} options.index - 服务访问地址在数组中的位置。
  29051. * @param {number} options.length - 服务访问地址数组长度。
  29052. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29053. * @param {Object} [options.headers] - 请求头。
  29054. */
  29055. class OverlayGeoJobsService extends ProcessingServiceBase {
  29056. constructor(url, options) {
  29057. super(url, options);
  29058. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  29059. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  29060. }
  29061. /**
  29062. * @override
  29063. */
  29064. destroy() {
  29065. super.destroy();
  29066. }
  29067. /**
  29068. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  29069. * @description 获取叠加分析任务
  29070. */
  29071. getOverlayGeoJobs() {
  29072. super.getJobs(this.url);
  29073. }
  29074. /**
  29075. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  29076. * @description 获取指定id的叠加分析任务
  29077. * @param {string} id - 指定要获取数据的id
  29078. */
  29079. getOverlayGeoJob(id) {
  29080. super.getJobs(Util.urlPathAppend(this.url, id));
  29081. }
  29082. /**
  29083. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  29084. * @description 新建点叠加析服务
  29085. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  29086. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  29087. */
  29088. addOverlayGeoJob(params, seconds) {
  29089. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  29090. }
  29091. }
  29092. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  29093. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsParameters.js
  29094. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29095. * This program are made available under the terms of the Apache License, Version 2.0
  29096. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29097. /**
  29098. * @class SuperMap.QueryByBoundsParameters
  29099. * @category iServer Map QueryResults
  29100. * @classdesc Bounds 查询参数类。该类用于设置 Bounds 查询的相关参数。
  29101. * @extends {SuperMap.QueryParameters}
  29102. * @param {Object} options - 参数。
  29103. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} options.bounds - 指定的查询范围。
  29104. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  29105. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  29106. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  29107. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  29108. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  29109. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  29110. * @param {number} [options.startRecord=0] - 查询起始记录号。
  29111. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  29112. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  29113. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29114. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  29115. */
  29116. class QueryByBoundsParameters extends QueryParameters {
  29117. constructor(options) {
  29118. if (!options) {
  29119. return;
  29120. }
  29121. super(options);
  29122. /**
  29123. * @member {boolean} [SuperMap.QueryByBoundsParameters.prototype.returnContent=true]
  29124. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29125. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  29126. * 为 false,则返回的是查询结果资源的 URI。
  29127. */
  29128. this.returnContent = true;
  29129. /**
  29130. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.QueryByBoundsParameters.prototype.bounds
  29131. * @description 指定的查询范围。
  29132. */
  29133. this.bounds = null;
  29134. Util.extend(this, options);
  29135. this.CLASS_NAME = "SuperMap.QueryByBoundsParameters";
  29136. }
  29137. /**
  29138. * @function SuperMap.QueryByBoundsParameters.prototype.destroy
  29139. * @description 释放资源,将引用资源的属性置空。
  29140. */
  29141. destroy() {
  29142. super.destroy();
  29143. var me = this;
  29144. me.returnContent = null;
  29145. if (me.bounds) {
  29146. me.bounds = null;
  29147. }
  29148. }
  29149. }
  29150. SuperMap.QueryByBoundsParameters = QueryByBoundsParameters;
  29151. ;// CONCATENATED MODULE: ./src/common/iServer/QueryService.js
  29152. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29153. * This program are made available under the terms of the Apache License, Version 2.0
  29154. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29155. /**
  29156. * @class SuperMap.QueryService
  29157. * @category iServer Map QueryResults
  29158. * @classdesc 查询服务基类。
  29159. * @extends {SuperMap.CommonServiceBase}
  29160. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29161. * @param {Object} options - 参数。
  29162. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29163. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29164. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29165. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29166. * @param {Object} [options.headers] - 请求头。
  29167. * @example
  29168. * var myService = new SuperMap.QueryService(url, {
  29169. * eventListeners: {
  29170. * "processCompleted": queryCompleted,
  29171. * "processFailed": queryError
  29172. * }
  29173. * };
  29174. */
  29175. class QueryService extends CommonServiceBase {
  29176. /**
  29177. * @function SuperMap.QueryService.prototype.constructor
  29178. * @description 查询服务基类构造函数。
  29179. * @param {string} url - 服务地址。请求地图查询服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  29180. * @param {Object} options -参数。
  29181. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29182. */
  29183. constructor(url, options) {
  29184. super(url, options);
  29185. /**
  29186. * @member {boolean} SuperMap.QueryService.prototype.returnContent
  29187. * @description 是否立即返回新创建资源的表述还是返回新资源的URI。
  29188. */
  29189. this.returnContent = false;
  29190. /**
  29191. * @member {string} SuperMap.QueryService.prototype.format
  29192. * @description 查询结果返回格式,目前支持iServerJSON 和GeoJSON两种格式。参数格式为"ISERVER","GEOJSON"。
  29193. */
  29194. this.format = DataFormat.GEOJSON;
  29195. this.returnFeatureWithFieldCaption = false;
  29196. if (options) {
  29197. Util.extend(this, options);
  29198. }
  29199. this.CLASS_NAME = "SuperMap.QueryService";
  29200. if (!this.url) {
  29201. return;
  29202. }
  29203. if (options && options.format) {
  29204. this.format = options.format.toUpperCase();
  29205. }
  29206. this.url = Util.urlPathAppend(this.url,'queryResults');
  29207. }
  29208. /**
  29209. * @function SuperMap.QueryService.prototype.destroy
  29210. * @description 释放资源,将引用资源的属性置空。
  29211. */
  29212. destroy() {
  29213. super.destroy();
  29214. var me = this;
  29215. me.returnContent = null;
  29216. me.format = null;
  29217. }
  29218. /**
  29219. * @function SuperMap.QueryService.prototype.processAsync
  29220. * @description 负责将客户端的查询参数传递到服务端。
  29221. * @param {SuperMap.QueryParameters} params - 查询参数。
  29222. */
  29223. processAsync(params) {
  29224. if (!(params instanceof QueryParameters)) {
  29225. return;
  29226. }
  29227. var me = this,
  29228. returnCustomResult = null,
  29229. jsonParameters = null;
  29230. me.returnContent = params.returnContent;
  29231. jsonParameters = me.getJsonParameters(params);
  29232. if (me.returnContent) {
  29233. me.url = Util.urlAppend(me.url, 'returnContent=' + me.returnContent);
  29234. } else {
  29235. //仅供三维使用 获取高亮图片的bounds
  29236. returnCustomResult = params.returnCustomResult;
  29237. if (returnCustomResult) {
  29238. me.url = Util.urlAppend(me.url, 'returnCustomResult=' + returnCustomResult);
  29239. }
  29240. }
  29241. me.returnFeatureWithFieldCaption = params.returnFeatureWithFieldCaption;
  29242. me.request({
  29243. method: "POST",
  29244. data: jsonParameters,
  29245. scope: me,
  29246. success: me.serviceProcessCompleted,
  29247. failure: me.serviceProcessFailed
  29248. });
  29249. }
  29250. /**
  29251. * @function SuperMap.QueryService.prototype.serviceProcessCompleted
  29252. * @description 查询完成,执行此方法。
  29253. * @param {Object} result - 服务器返回的结果对象。
  29254. */
  29255. serviceProcessCompleted(result) {
  29256. var me = this;
  29257. result = Util.transformResult(result);
  29258. var geoJSONFormat = new GeoJSON();
  29259. if (result && result.recordsets) {
  29260. for (var i = 0, recordsets = result.recordsets, len = recordsets.length; i < len; i++) {
  29261. if (recordsets[i].features) {
  29262. if (me.returnFeatureWithFieldCaption === true) {
  29263. recordsets[i].features.map((feature) => {
  29264. feature.fieldNames = recordsets[i].fieldCaptions;
  29265. return feature;
  29266. })
  29267. }
  29268. if (me.format === DataFormat.GEOJSON) {
  29269. recordsets[i].features = geoJSONFormat.toGeoJSON(recordsets[i].features);
  29270. }
  29271. }
  29272. }
  29273. }
  29274. me.events.triggerEvent("processCompleted", {
  29275. result: result
  29276. });
  29277. }
  29278. /**
  29279. * @function SuperMap.QueryService.prototype.getQueryParameters
  29280. * @description 将 JSON 对象表示的查询参数转化为 QueryParameters 对象。
  29281. * @param {Object} params - JSON 字符串表示的查询参数。
  29282. * @returns {SuperMap.QueryParameters} 返回转化后的 QueryParameters 对象。
  29283. */
  29284. getQueryParameters(params) {
  29285. return new QueryParameters({
  29286. customParams: params.customParams,
  29287. expectCount: params.expectCount,
  29288. networkType: params.networkType,
  29289. queryOption: params.queryOption,
  29290. queryParams: params.queryParams,
  29291. startRecord: params.startRecord,
  29292. prjCoordSys: params.prjCoordSys,
  29293. holdTime: params.holdTime
  29294. });
  29295. }
  29296. }
  29297. SuperMap.QueryService = QueryService;
  29298. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByBoundsService.js
  29299. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29300. * This program are made available under the terms of the Apache License, Version 2.0
  29301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29302. /**
  29303. * @class SuperMap.QueryByBoundsService
  29304. * @category iServer Map QueryResults
  29305. * @classdesc Bounds 查询服务类。
  29306. * @augments {SuperMap.QueryService}
  29307. * @example
  29308. * (start end)
  29309. * var myQueryByBoundsService = new SuperMap.QueryByBoundsService(url, {
  29310. * eventListeners: {
  29311. * "processCompleted": queryCompleted,
  29312. * "processFailed": queryError
  29313. * }
  29314. * });
  29315. * function queryCompleted(object){//todo};
  29316. * function queryError(object){//todo};
  29317. * (end)
  29318. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29319. * @param {Object} options - 参数。<br>
  29320. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。<br>
  29321. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29322. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29323. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29324. * @param {Object} [options.headers] - 请求头。
  29325. */
  29326. class QueryByBoundsService extends QueryService {
  29327. constructor(url, options) {
  29328. super(url, options);
  29329. this.CLASS_NAME = "SuperMap.QueryByBoundsService";
  29330. }
  29331. /**
  29332. * @override
  29333. */
  29334. destroy() {
  29335. super.destroy();
  29336. }
  29337. /**
  29338. * @function SuperMap.QueryByBoundsService.prototype.getJsonParameters
  29339. * @description 将查询参数转化为 JSON 字符串。
  29340. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds 等)。
  29341. * @param {SuperMap.QueryByBoundsParameters} params - Bounds 查询参数。
  29342. * @returns {Object} 转化后的 JSON 字符串。
  29343. */
  29344. getJsonParameters(params) {
  29345. if (!(params instanceof QueryByBoundsParameters)) {
  29346. return null;
  29347. }
  29348. var me = this,
  29349. jsonParameters = "",
  29350. qp = null,
  29351. bounds = params.bounds;
  29352. qp = me.getQueryParameters(params);
  29353. jsonParameters += "'queryMode':'BoundsQuery','queryParameters':";
  29354. jsonParameters += Util.toJSON(qp);
  29355. jsonParameters += ",'bounds': {'rightTop':{'y':" + bounds.top + ",'x':" +
  29356. bounds.right + "},'leftBottom':{'y':" + bounds.bottom + ",'x':" + bounds.left + "}}";
  29357. jsonParameters = "{" + jsonParameters + "}";
  29358. return jsonParameters;
  29359. }
  29360. }
  29361. SuperMap.QueryByBoundsService = QueryByBoundsService;
  29362. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceParameters.js
  29363. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29364. * This program are made available under the terms of the Apache License, Version 2.0
  29365. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29366. /**
  29367. * @class SuperMap.QueryByDistanceParameters
  29368. * @category iServer Map QueryResults
  29369. * @classdesc Distance 查询参数类。
  29370. * 该类用于设置 Distance 查询的相关参数。
  29371. * @extends {SuperMap.QueryParameters}
  29372. * @param {Object} options - 参数。
  29373. * @param {Object} options.geometry - 用于查询的几何对象。
  29374. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  29375. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  29376. * @param {Object} [options.prjCoordSys] -自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  29377. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  29378. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  29379. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.QueryOption.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  29380. * @param {number} [options.startRecord=0] - 查询起始记录号。
  29381. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  29382. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  29383. * @param {number} [options.distance=0] - 查询距离。
  29384. * @param {boolean} [options.isNearest=false] - 是否为最近距离查询。
  29385. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29386. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  29387. */
  29388. class QueryByDistanceParameters extends QueryParameters {
  29389. constructor(options) {
  29390. if (!options) {
  29391. return;
  29392. }
  29393. super(options);
  29394. /**
  29395. * @member {number} [SuperMap.QueryByDistanceParameters.prototype.distance=0]
  29396. * @description 查询距离,单位与所查询图层对应的数据集单位相同。
  29397. * 当查找最近地物时,该属性无效。
  29398. */
  29399. this.distance = 0;
  29400. /**
  29401. * @member SuperMap.QueryByDistanceParameters.prototype.geometry
  29402. * @description 用于查询的地理对象。<br>
  29403. * 点类型可以是:{@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>
  29404. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  29405. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  29406. */
  29407. this.geometry = null;
  29408. /**
  29409. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.isNearest=false]
  29410. * @description 是否为最近距离查询。<br>
  29411. * 建议该属性与 expectCount(继承自 {@link SuperMap.QueryParameters})属性联合使用。
  29412. * 当该属性为 true 时,即表示查找最近地物,如果查询结果数大于期望返回的结果记录数(expectCount),
  29413. * 则查找结果为查询总记录中距离中心最近的 expectCount 个地物。
  29414. * 当该属性为不为 true 时,如果查询结果数大于期望返回的结果记录数(expectCount),
  29415. * 则查找结果为从查询总记录中随机抽取的 expectCount 个地物。
  29416. * 目前查询结果不支持按远近距离排序。
  29417. */
  29418. this.isNearest = null;
  29419. /**
  29420. * @member {boolean} [SuperMap.QueryByDistanceParameters.prototype.returnContent=true]
  29421. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29422. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  29423. * 为 false,则返回的是查询结果资源的 URI。
  29424. */
  29425. this.returnContent = true;
  29426. Util.extend(this, options);
  29427. this.CLASS_NAME = "SuperMap.QueryByDistanceParameters";
  29428. }
  29429. /**
  29430. * @function SuperMap.QueryByDistanceParameters.prototype.destroy
  29431. * @description 释放资源,将引用资源的属性置空。
  29432. */
  29433. destroy() {
  29434. super.destroy();
  29435. var me = this;
  29436. me.returnContent = null;
  29437. me.distance = null;
  29438. me.isNearest = null;
  29439. if (me.geometry) {
  29440. me.geometry.destroy();
  29441. me.geometry = null;
  29442. }
  29443. }
  29444. }
  29445. SuperMap.QueryByDistanceParameters = QueryByDistanceParameters;
  29446. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByDistanceService.js
  29447. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29448. * This program are made available under the terms of the Apache License, Version 2.0
  29449. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29450. /**
  29451. * @class SuperMap.QueryByDistanceService
  29452. * @category iServer Map QueryResults
  29453. * @classdesc Distance查询服务类。
  29454. * @extends {SuperMap.QueryService}
  29455. * @example
  29456. * var myQueryByDistService = new SuperMap.QueryByDistanceService(url, {
  29457. * eventListeners: {
  29458. * "processCompleted": queryCompleted,
  29459. * "processFailed": queryError
  29460. * }
  29461. * });
  29462. * function queryCompleted(object){//todo};
  29463. * function queryError(object){//todo};
  29464. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29465. * @param {Object} options - 参数。
  29466. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29467. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29468. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29469. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29470. * @param {Object} [options.headers] - 请求头。
  29471. */
  29472. class QueryByDistanceService extends QueryService {
  29473. constructor(url, options) {
  29474. super(url, options);
  29475. this.CLASS_NAME = "SuperMap.QueryByDistanceService";
  29476. }
  29477. /**
  29478. * @override
  29479. */
  29480. destroy() {
  29481. super.destroy();
  29482. }
  29483. /**
  29484. * @function SuperMap.QueryByDistanceService.prototype.getJsonParameters
  29485. * @description 将查询参数转化为 JSON 字符串。
  29486. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  29487. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询参数类。
  29488. * @returns {Object} 转化后的 JSON 字符串。
  29489. */
  29490. getJsonParameters(params) {
  29491. if (!(params instanceof QueryByDistanceParameters)) {
  29492. return;
  29493. }
  29494. var me = this,
  29495. jsonParameters = "",
  29496. qp = me.getQueryParameters(params);
  29497. var sg = ServerGeometry.fromGeometry(params.geometry);
  29498. jsonParameters += params.isNearest ? "'queryMode':'FindNearest','queryParameters':" : "'queryMode':'DistanceQuery','queryParameters':";
  29499. jsonParameters += Util.toJSON(qp);
  29500. jsonParameters += ",'geometry':" + Util.toJSON(sg) + ",'distance':" + params.distance;
  29501. jsonParameters = "{" + jsonParameters + "}";
  29502. return jsonParameters;
  29503. }
  29504. }
  29505. SuperMap.QueryByDistanceService = QueryByDistanceService;
  29506. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryParameters.js
  29507. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29508. * This program are made available under the terms of the Apache License, Version 2.0
  29509. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29510. /**
  29511. * @class SuperMap.QueryByGeometryParameters
  29512. * @category iServer Map QueryResults
  29513. * @classdesc Geometry 查询参数类。
  29514. * 该类用于设置 Geometry查询的相关参数。
  29515. * @extends {SuperMap.QueryParameters}
  29516. * @param {Object} options - 参数。
  29517. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  29518. * @param {Object} options.geometry - 用于查询的几何对象。
  29519. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  29520. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  29521. * @param {Object} [options.prjCoordSys] -自定义参数,供SuperMap Online提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  29522. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  29523. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  29524. * @param {boolean} [options.returnCustomResult=false] -仅供三维使用。
  29525. * @param {number} [options.startRecord=0] - 查询起始记录号。
  29526. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  29527. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29528. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  29529. * @param {SuperMap.SpatialQueryMode} [spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT] - 空间查询模式。
  29530. */
  29531. class QueryByGeometryParameters extends QueryParameters {
  29532. constructor(options) {
  29533. if (!options) {
  29534. return;
  29535. }
  29536. super(options);
  29537. /**
  29538. * @member {boolean} [SuperMap.QueryByGeometryParameters.prototype.returnContent=true]
  29539. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。<br>
  29540. * 如果为 true,则直接返回新创建资源,即查询结果的表述。<br>
  29541. * 为 false,则返回的是查询结果资源的 URI。
  29542. */
  29543. this.returnContent = true;
  29544. /**
  29545. * @member {Object} SuperMap.QueryByGeometryParameters.prototype.geometry
  29546. * @description 用于查询的几何对象。<br>
  29547. * 点类型可以是:{@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>
  29548. * 线类型可以是:{@link SuperMap.Geometry.LineString}|{@link SuperMap.Geometry.LinearRing}|{@link L.Polyline}|{@link L.GeoJSON}|{@link ol.geom.LineString}|{@link ol.format.GeoJSON}。<br>
  29549. * 面类型可以是:{@link SuperMap.Geometry.Polygon}|{@link L.Polygon}|{@link L.GeoJSON}|{@link ol.geom.Polygon}|{@link ol.format.GeoJSON}。
  29550. */
  29551. this.geometry = null;
  29552. /**
  29553. * @member {SuperMap.SpatialQueryMode} [SuperMap.QueryByGeometryParameters.prototype.spatialQueryMode=SuperMap.SpatialQueryMode.INTERSECT]
  29554. * @description 空间查询模式。
  29555. */
  29556. this.spatialQueryMode = SpatialQueryMode.INTERSECT;
  29557. Util.extend(this, options);
  29558. this.CLASS_NAME = "SuperMap.QueryByGeometryParameters";
  29559. }
  29560. /**
  29561. * @function SuperMap.QueryByGeometryParameters.prototype.destroy
  29562. * @description 释放资源,将引用资源的属性置空。
  29563. */
  29564. destroy() {
  29565. super.destroy();
  29566. var me = this;
  29567. me.returnContent = null;
  29568. me.geometry = null;
  29569. me.spatialQueryMode = null;
  29570. }
  29571. }
  29572. SuperMap.QueryByGeometryParameters = QueryByGeometryParameters;
  29573. ;// CONCATENATED MODULE: ./src/common/iServer/QueryByGeometryService.js
  29574. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29575. * This program are made available under the terms of the Apache License, Version 2.0
  29576. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29577. /**
  29578. * @class SuperMap.QueryByGeometryService
  29579. * @category iServer Map QueryResults
  29580. * @classdesc Geometry查询服务类。
  29581. * @extends {SuperMap.QueryService}
  29582. * @example
  29583. * var myQueryByGeometryService = new SuperMap.QueryByGeometryService(url, {
  29584. * eventListeners: {
  29585. * "processCompleted": queryCompleted,
  29586. * "processFailed": queryError
  29587. * }
  29588. * });
  29589. * function queryCompleted(object){//todo};
  29590. * function queryError(object){//todo};
  29591. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  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 QueryByGeometryService extends QueryService {
  29600. /**
  29601. * @function SuperMap.QueryByGeometryService.prototype.constructor
  29602. * @description Geometry 查询服务类构造函数。
  29603. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29604. * @param {Object} options - 参数。
  29605. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29606. */
  29607. constructor(url, options) {
  29608. super(url, options);
  29609. this.CLASS_NAME = "SuperMap.QueryByGeometryService";
  29610. }
  29611. /**
  29612. * @override
  29613. */
  29614. destroy() {
  29615. super.destroy();
  29616. }
  29617. /**
  29618. * @function SuperMap.QueryByGeometryService.prototype.getJsonParameters
  29619. * @description 将查询参数转化为 JSON 字符串。
  29620. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  29621. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询参数类。
  29622. * @returns {Object} 转化后的 JSON 字符串。
  29623. */
  29624. getJsonParameters(params) {
  29625. if (!(params instanceof QueryByGeometryParameters)) {
  29626. return;
  29627. }
  29628. var me = this,
  29629. jsonParameters = "",
  29630. qp = null,
  29631. geometry = params.geometry,
  29632. sg = ServerGeometry.fromGeometry(geometry);
  29633. qp = me.getQueryParameters(params);
  29634. jsonParameters += "'queryMode':'SpatialQuery','queryParameters':";
  29635. jsonParameters += Util.toJSON(qp) + ",'geometry':" + Util.toJSON(sg)
  29636. + ",'spatialQueryMode':" + Util.toJSON(params.spatialQueryMode);
  29637. jsonParameters = "{" + jsonParameters + "}";
  29638. return jsonParameters;
  29639. }
  29640. }
  29641. SuperMap.QueryByGeometryService = QueryByGeometryService;
  29642. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLParameters.js
  29643. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29644. * This program are made available under the terms of the Apache License, Version 2.0
  29645. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29646. /**
  29647. * @class SuperMap.QueryBySQLParameters
  29648. * @category iServer Map QueryResults
  29649. * @classdesc SQL 查询参数类。
  29650. * 该类用于设置 SQL 查询的相关参数。
  29651. * @extends {SuperMap.QueryParameters}
  29652. * @param {Object} options - 参数。
  29653. * @param {Array.<SuperMap.FilterParameter>} options.queryParams - 查询过滤条件参数数组。
  29654. * @param {string} [options.customParams] - 自定义参数,供扩展使用。
  29655. * @param {Object} [options.prjCoordSys] - 自定义参数,供 SuperMap Online 提供的动态投影查询扩展使用。如 {"epsgCode":3857}。
  29656. * @param {number} [options.expectCount=100000] - 期望返回结果记录个数。
  29657. * @param {SuperMap.GeometryType} [options.networkType=SuperMap.GeometryType.LINE] - 网络数据集对应的查询类型。
  29658. * @param {SuperMap.QueryOption} [options.queryOption=SuperMap.ATTRIBUTEANDGEOMETRY] - 查询结果类型枚举类。
  29659. * @param {number} [options.startRecord=0] - 查询起始记录号。
  29660. * @param {number} [options.holdTime=10] - 资源在服务端保存的时间,单位为分钟。
  29661. * @param {boolean} [options.returnCustomResult=false] - 仅供三维使用。
  29662. * @param {boolean} [options.returnContent=true] - 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29663. * @param {boolean} [options.returnFeatureWithFieldCaption = false] - 返回的查询结果要素字段标识是否为字段别名。为 false 时,返回的是字段名;为 true 时,返回的是字段别名。
  29664. */
  29665. class QueryBySQLParameters extends QueryParameters {
  29666. constructor(options) {
  29667. if (!options) {
  29668. return;
  29669. }
  29670. super(options);
  29671. /**
  29672. * @member {boolean} [SuperMap.QueryBySQLParameters.prototype.returnContent=true]
  29673. * @description 是否立即返回新创建资源的表述还是返回新资源的 URI。
  29674. * 如果为 true,则直接返回新创建资源,即查询结果的表述。
  29675. * 为 false,则返回的是查询结果资源的 URI。
  29676. */
  29677. this.returnContent = true;
  29678. Util.extend(this, options);
  29679. this.CLASS_NAME = "SuperMap.QueryBySQLParameters";
  29680. }
  29681. /**
  29682. * @function SuperMap.QueryBySQLParameters.prototype.destroy
  29683. * @description 释放资源,将引用资源的属性置空。
  29684. */
  29685. destroy() {
  29686. super.destroy();
  29687. var me = this;
  29688. me.returnContent = null;
  29689. }
  29690. }
  29691. SuperMap.QueryBySQLParameters = QueryBySQLParameters;
  29692. ;// CONCATENATED MODULE: ./src/common/iServer/QueryBySQLService.js
  29693. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29694. * This program are made available under the terms of the Apache License, Version 2.0
  29695. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29696. /**
  29697. * @class SuperMap.QueryBySQLService
  29698. * @category iServer Map QueryResults
  29699. * @classdesc SQL 查询服务类。在一个或多个指定的图层上查询符合 SQL 条件的空间地物信息。
  29700. * @extends {SuperMap.QueryService}
  29701. * @example
  29702. * var queryParam = new SuperMap.FilterParameter({
  29703. * name: "Countries@World.1",
  29704. * attributeFilter: "Pop_1994>1000000000 and SmArea>900"
  29705. * });
  29706. * var queryBySQLParams = new SuperMap.QueryBySQLParameters({
  29707. * queryParams: [queryParam]
  29708. * });
  29709. * var myQueryBySQLService = new SuperMap.QueryBySQLService(url, {eventListeners: {
  29710. * "processCompleted": queryCompleted,
  29711. * "processFailed": queryError
  29712. * }
  29713. * });
  29714. * queryBySQLService.processAsync(queryBySQLParams);
  29715. * function queryCompleted(object){//todo};
  29716. * function queryError(object){//todo};
  29717. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29718. * @param {Object} options - 参数。
  29719. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  29720. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  29721. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  29722. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29723. * @param {Object} [options.headers] - 请求头。
  29724. */
  29725. class QueryBySQLService extends QueryService {
  29726. /**
  29727. * @function SuperMap.QueryBySQLService.prototype.constructor
  29728. * @description SQL 查询服务类构造函数。
  29729. * @param {string} url - 服务的访问地址。如访问World Map服务,只需将url设为: http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 即可。
  29730. * @param {Object} options - 参数。
  29731. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29732. */
  29733. constructor(url, options) {
  29734. super(url, options);
  29735. this.CLASS_NAME = "SuperMap.QueryBySQLService";
  29736. }
  29737. /**
  29738. * @override
  29739. */
  29740. destroy() {
  29741. super.destroy();
  29742. }
  29743. /**
  29744. * @function SuperMap.QueryBySQLService.prototype.getJsonParameters
  29745. * @description 将查询参数转化为 JSON 字符串。
  29746. * 在本类中重写此方法,可以实现不同种类的查询(sql, geometry, distance, bounds等)。
  29747. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询参数类。
  29748. * @returns {Object} 转化后的 JSON 字符串。
  29749. */
  29750. getJsonParameters(params) {
  29751. if (!(params instanceof QueryBySQLParameters)) {
  29752. return;
  29753. }
  29754. var me = this,
  29755. jsonParameters = "",
  29756. qp = null;
  29757. qp = me.getQueryParameters(params);
  29758. jsonParameters += "'queryMode':'SqlQuery','queryParameters':";
  29759. jsonParameters += Util.toJSON(qp);
  29760. jsonParameters = "{" + jsonParameters + "}";
  29761. return jsonParameters;
  29762. }
  29763. }
  29764. SuperMap.QueryBySQLService = QueryBySQLService;
  29765. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureParameters.js
  29766. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29767. * This program are made available under the terms of the Apache License, Version 2.0
  29768. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29769. /**
  29770. * @class SuperMap.RouteCalculateMeasureParameters
  29771. * @category iServer SpatialAnalyst RouteCalculateMeasure
  29772. * @classdesc 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  29773. * @param {Object} options - 参数。
  29774. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  29775. * @param {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} options.point - 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  29776. * @param {float} [options.tolerance] - 容限值。
  29777. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。
  29778. */
  29779. class RouteCalculateMeasureParameters {
  29780. constructor(options) {
  29781. if (!options) {
  29782. return this;
  29783. }
  29784. /**
  29785. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteCalculateMeasureParameters.prototype.sourceRoute
  29786. * @description 路由对象。该对象可以是用户自己生成或在数据源中查询得到的符合标准的路由对象。
  29787. */
  29788. this.sourceRoute = null;
  29789. /**
  29790. * @member {(SuperMap.Geometry.Point|L.LatLng|L.Point|ol.geom.Point)} SuperMap.RouteCalculateMeasureParameters.prototype.point
  29791. * @description 二维地理坐标点对象,包含 x,y 坐标值属性的对象。
  29792. */
  29793. this.point = null;
  29794. /**
  29795. * @member {float} [SuperMap.RouteCalculateMeasureParameters.prototype.tolerance]
  29796. * @description 容限值。
  29797. */
  29798. this.tolerance = null;
  29799. /**
  29800. * @member {boolean} [SuperMap.RouteCalculateMeasureParameters.prototype.isIgnoreGap=false]
  29801. * @description 是否忽略子对象之间的距离。
  29802. */
  29803. this.isIgnoreGap = false;
  29804. Util.extend(this, options);
  29805. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureParameters";
  29806. }
  29807. /**
  29808. * @function SuperMap.RouteCalculateMeasureParameters.prototype.destroy
  29809. * @description 释放资源,将引用资源的属性置空。
  29810. */
  29811. destroy() {
  29812. var me = this;
  29813. me.sourceRoute = null;
  29814. me.point = null;
  29815. if (me.tolerance) {
  29816. me.tolerance = null;
  29817. }
  29818. if (me.isIgnoreGap) {
  29819. me.isIgnoreGap = false;
  29820. }
  29821. }
  29822. }
  29823. SuperMap.RouteCalculateMeasureParameters = RouteCalculateMeasureParameters;
  29824. ;// CONCATENATED MODULE: ./src/common/iServer/RouteCalculateMeasureService.js
  29825. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29826. * This program are made available under the terms of the Apache License, Version 2.0
  29827. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29828. /**
  29829. * @class SuperMap.RouteCalculateMeasureService
  29830. * @category iServer SpatialAnalyst RouteCalculateMeasure
  29831. * @classdesc 基于路由对象计算指定点 M 值操作的服务类。
  29832. * 该类负责将客户设置的计算指定点的 M 值参数传递给服务端,并接收服务端返回的
  29833. * 指定点的 M 值。通过该类支持的事件的监听函数参数获取。
  29834. * @extends {SuperMap.SpatialAnalystBase}
  29835. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  29836. * @param {Object} options - 参数。
  29837. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  29838. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  29839. * @param {Object} [options.headers] - 请求头。
  29840. * @example 实例化该类如下例所示:
  29841. * (start code)
  29842. * var parameters = new SuperMap.RouteCalculateMeasureParameters({
  29843. * "sourceRoute":{
  29844. * "type":"LINEM",
  29845. * "parts":[4],
  29846. * "points":[
  29847. * {
  29848. * "measure":0,
  29849. * "y":-6674.466867067764,
  29850. * "x":3817.3527876130133
  29851. * },
  29852. * {
  29853. * "measure":199.57954019411724,
  29854. * "y":-6670.830929417594,
  29855. * "x":3617.806369901496
  29856. * },
  29857. * {
  29858. * "measure":609.3656478634477,
  29859. * "y":-6877.837541432356,
  29860. * "x":3264.1498746678444
  29861. * },
  29862. * {
  29863. * "measure":936.0174126282958,
  29864. * "y":-7038.687780615184,
  29865. * "x":2979.846206068903
  29866. * }
  29867. * ]
  29868. * },
  29869. * "tolerance":1,
  29870. * "point":{
  29871. * "x":3330.7754269417,
  29872. * "y":-6838.8394457216
  29873. * },
  29874. * "isIgnoreGap":false
  29875. * });
  29876. *
  29877. * var routeCalculateMeasureService = new SuperMap.RouteCalculateMeasureService(spatialAnalystURL, {
  29878. * eventListeners:{
  29879. * processCompleted:calculateCompleted,
  29880. * processFailed:calculateFailded
  29881. * }
  29882. * );
  29883. * routeCalculateMeasureService.processAsync(parameters);
  29884. *
  29885. * //执行
  29886. * function calculateCompleted(){todo}
  29887. * function calculateFailded(){todo}
  29888. * (end)
  29889. *
  29890. */
  29891. class RouteCalculateMeasureService extends SpatialAnalystBase {
  29892. constructor(url, options) {
  29893. super(url, options);
  29894. this.CLASS_NAME = "SuperMap.RouteCalculateMeasureService";
  29895. }
  29896. /**
  29897. * @override
  29898. */
  29899. destroy() {
  29900. super.destroy();
  29901. }
  29902. /**
  29903. * @function SuperMap.RouteCalculateMeasureService.prototype.processAsync
  29904. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  29905. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  29906. */
  29907. processAsync(params) {
  29908. if (!(params instanceof RouteCalculateMeasureParameters)) {
  29909. return;
  29910. }
  29911. var me = this, jsonParameters;
  29912. jsonParameters = me.getJsonParameters(params);
  29913. me.request({
  29914. method: "POST",
  29915. data: jsonParameters,
  29916. scope: me,
  29917. success: me.serviceProcessCompleted,
  29918. failure: me.serviceProcessFailed
  29919. });
  29920. }
  29921. /**
  29922. * @function SuperMap.RouteCalculateMeasureService.prototype.getJsonParameters
  29923. * @description 将参数转化为 JSON 字符串。
  29924. * @param {SuperMap.RouteCalculateMeasureParameters} params - 基于路由对象计算指定点 M 值操作的参数类。
  29925. * @returns {Object} 转化后的 JSON 字符串。
  29926. */
  29927. getJsonParameters(params) {
  29928. var jsonParameters, jsonStr = "geometry/calculatemeasure", me = this;
  29929. me.url = Util.urlPathAppend(me.url, jsonStr);
  29930. me.url = Util.urlAppend(me.url, 'returnContent=true');
  29931. jsonParameters = Util.toJSON(params);
  29932. return jsonParameters;
  29933. }
  29934. }
  29935. SuperMap.RouteCalculateMeasureService = RouteCalculateMeasureService;
  29936. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorParameters.js
  29937. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  29938. * This program are made available under the terms of the Apache License, Version 2.0
  29939. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  29940. /**
  29941. * @class SuperMap.RouteLocatorParameters
  29942. * @category iServer SpatialAnalyst RouteLocator
  29943. * @classdesc 路由对象定位空间对象的参数类。
  29944. * 参数有两种方式,分别为 Geometry 和 Dataset 两种,前者需要指定 sourceRoute 对象作为参数,后者需要 dataset,routeIDField,routeID 三个参数
  29945. * 如果用户两种参数均设置,优先选择 Dataset 方式。
  29946. * @param {Object} options - 参数。
  29947. * @param {(SuperMap.Route|L.Polyline|ol.geom.LineString)} options.sourceRoute - 路由对象。
  29948. * @param {float} options.measure - 定位点的 M 值。只当路由对象定位点时有意义。
  29949. * @param {string} [options.type] - 类型:点 or 线。
  29950. * @param {float} [options.offset=0] - 定位点偏移量。只当路由对象定位点时有意义。
  29951. * @param {boolean} [options.isIgnoreGap=false] - 是否忽略子对象之间的距离。即不忽略子对象之间的距离。
  29952. * @param {float} [options.startMeasure] - 定位线的起始 M 值。只当路由对象定位线时有意义。
  29953. * @param {float} [options.endMeasure] - 定位线的终止 M 值。只当路由对象定位线时有意义。
  29954. */
  29955. class RouteLocatorParameters {
  29956. constructor(options) {
  29957. if (!options) {
  29958. return this;
  29959. }
  29960. /**
  29961. * @member {(SuperMap.Route|L.Polyline|ol.geom.LineString)} SuperMap.RouteLocatorParameters.prototype.sourceRoute
  29962. * @description 路由对象。
  29963. */
  29964. this.sourceRoute = null;
  29965. /**
  29966. * @member {string} SuperMap.RouteLocatorParameters.prototype.dataset
  29967. * @description 要用来做缓冲区分析的数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示。
  29968. */
  29969. this.dataset = null;
  29970. /**
  29971. * @member {string} SuperMap.RouteLocatorParameters.prototype.routeIDField
  29972. * @description 路由对象所在的字段名称。
  29973. *
  29974. */
  29975. this.routeIDField = null;
  29976. /**
  29977. * @member {number} SuperMap.RouteLocatorParameters.prototype.routeID
  29978. * @description 路由对象标识。
  29979. *
  29980. */
  29981. this.routeID = null;
  29982. /**
  29983. * @member {string} [SuperMap.RouteLocatorParameters.prototype.type]
  29984. * @description 类型:点 or 线。
  29985. * 可选值为:
  29986. * LINE :根据起始 M 值及终止 M 值定位线对象。
  29987. * POINT : 根据 M 值定位点对象。
  29988. */
  29989. this.type = null;
  29990. /**
  29991. * @member {float} SuperMap.RouteLocatorParameters.prototype.measure
  29992. * @description 定位点的 M 值。只当路由对象定位点时有意义。
  29993. */
  29994. this.measure = null;
  29995. /**
  29996. * @member {float} [SuperMap.RouteLocatorParameters.prototype.offset=0]
  29997. * @description 定位点偏移量。只当路由对象定位点时有意义。
  29998. */
  29999. this.offset = 0;
  30000. /**
  30001. * @member {boolean} [SuperMap.RouteLocatorParameters.prototype.isIgnoreGap=false]
  30002. * @description 是否忽略子对象之间的距离。
  30003. */
  30004. this.isIgnoreGap = false;
  30005. /**
  30006. * @member {float} [SuperMap.RouteLocatorParameters.prototype.startMeasure]
  30007. * @description 定位线的起始 M 值。只当路由对象定位线时有意义。
  30008. */
  30009. this.startMeasure = null;
  30010. /**
  30011. * @member {float} [SuperMap.RouteLocatorParameters.prototype.endMeasure]
  30012. * @description 定位线的终止 M 值。只当路由对象定位线时有意义。
  30013. */
  30014. this.endMeasure = null;
  30015. var routeFromClient = options.sourceRoute;
  30016. var routeHandle = {};
  30017. if (routeFromClient && routeFromClient instanceof Geometry && routeFromClient.components) {
  30018. routeHandle.type = routeFromClient.type;
  30019. routeHandle.parts = routeFromClient.parts;
  30020. var parts = [];
  30021. for (var i = 0, len = routeFromClient.components.length; i < len; i++) {
  30022. parts = parts.concat(routeFromClient.components[i].components);
  30023. }
  30024. routeHandle.points = parts;
  30025. options.sourceRoute = routeHandle;
  30026. }
  30027. Util.extend(this, options);
  30028. this.CLASS_NAME = "SuperMap.RouteLocatorParameters";
  30029. }
  30030. /**
  30031. * @function SuperMap.RouteLocatorParameters.prototype.destroy
  30032. * @description 释放资源,将引用资源的属性置空。
  30033. */
  30034. destroy() {
  30035. var me = this;
  30036. me.sourceRoute = null;
  30037. me.type = null;
  30038. me.measure = null;
  30039. me.offset = 0;
  30040. me.isIgnoreGap = false;
  30041. me.startMeasure = null;
  30042. me.endMeasure = null;
  30043. me.dataset = null;
  30044. me.routeID = null;
  30045. me.routeIDField = null;
  30046. }
  30047. }
  30048. SuperMap.RouteLocatorParameters = RouteLocatorParameters;
  30049. ;// CONCATENATED MODULE: ./src/common/iServer/RouteLocatorService.js
  30050. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30051. * This program are made available under the terms of the Apache License, Version 2.0
  30052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30053. /**
  30054. * @class SuperMap.RouteLocatorService
  30055. * @category iServer SpatialAnalyst RouteLocator
  30056. * @classdesc 路由对象定位空间对象的服务类。
  30057. * @extends {SuperMap.SpatialAnalystBase}
  30058. * @param {string} url -服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  30059. * @param {Object} options - 参数。</br>
  30060. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30061. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30062. * @param {Object} [options.headers] - 请求头。
  30063. * @example 实例化该类如下例所示:
  30064. * (start code)
  30065. * var routeLocatorParameters_point = new SuperMap.RouteLocatorParameters({
  30066. * "sourceRoute":{
  30067. * "type":"LINEM",
  30068. * "parts":[4],
  30069. * "points":[
  30070. * {
  30071. * "measure":0,
  30072. * "y":-6674.466867067764,
  30073. * "x":3817.3527876130133
  30074. * },
  30075. * {
  30076. * "measure":199.57954019411724,
  30077. * "y":-6670.830929417594,
  30078. * "x":3617.806369901496
  30079. * },
  30080. * {
  30081. * "measure":609.3656478634477,
  30082. * "y":-6877.837541432356,
  30083. * "x":3264.1498746678444
  30084. * },
  30085. * {
  30086. * "measure":936.0174126282958,
  30087. * "y":-7038.687780615184,
  30088. * "x":2979.846206068903
  30089. * }
  30090. * ]
  30091. * },
  30092. * "type":"POINT",
  30093. * "measure":10,
  30094. * "offset":3,
  30095. * "isIgnoreGap":true
  30096. * });
  30097. * var routeLocatorService = new SuperMap.RouteLocatorService(spatialAnalystURL, {
  30098. * eventListeners:{
  30099. * processCompleted:routeLocatorCompleted,
  30100. * processFailed:routeLocatorFailded
  30101. * }
  30102. * );
  30103. * routeLocatorService.processAsync(routeLocatorParameters_point);
  30104. *
  30105. * //执行
  30106. * function routeLocatorCompleted(){todo}
  30107. * function routeLocatorFailded(){todo}
  30108. * (end)
  30109. *
  30110. */
  30111. class RouteLocatorService extends SpatialAnalystBase {
  30112. constructor(url, options) {
  30113. super(url, options);
  30114. this.CLASS_NAME = "SuperMap.RouteLocatorService";
  30115. }
  30116. /**
  30117. * @override
  30118. */
  30119. destroy() {
  30120. super.destroy();
  30121. }
  30122. /**
  30123. * @function SuperMap.RouteLocatorService.prototype.processAsync
  30124. * @description 负责将客户端的基于路由对象计算指定点 M 值操作的参数传递到服务端。
  30125. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  30126. */
  30127. processAsync(params) {
  30128. if (!(params instanceof RouteLocatorParameters)) {
  30129. return;
  30130. }
  30131. var me = this, jsonParameters;
  30132. jsonParameters = me.getJsonParameters(params);
  30133. me.request({
  30134. method: "POST",
  30135. data: jsonParameters,
  30136. scope: me,
  30137. success: me.serviceProcessCompleted,
  30138. failure: me.serviceProcessFailed
  30139. });
  30140. }
  30141. /**
  30142. * @function SuperMap.RouteLocatorService.prototype.processAsync
  30143. * @description 将参数转化为 JSON 字符串。
  30144. * @param {SuperMap.RouteLocatorParameters} params - 路由对象定位空间对象的参数类。
  30145. * @returns {Object} 转化后的JSON字符串。
  30146. */
  30147. getJsonParameters(params) {
  30148. var jsonParameters, jsonStr = "geometry/routelocator", me = this;
  30149. if (params.dataset) {
  30150. jsonStr = "datasets/" + params.dataset + "/linearreferencing/routelocator";
  30151. params.sourceRoute = null;
  30152. }
  30153. me.url = Util.urlPathAppend(me.url, jsonStr);
  30154. me.url = Util.urlAppend(me.url, 'returnContent=true');
  30155. jsonParameters = Util.toJSON(params);
  30156. return jsonParameters;
  30157. }
  30158. }
  30159. SuperMap.RouteLocatorService = RouteLocatorService;
  30160. ;// CONCATENATED MODULE: ./src/common/iServer/ServerFeature.js
  30161. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30162. * This program are made available under the terms of the Apache License, Version 2.0
  30163. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30164. /**
  30165. * @class SuperMap.ServerFeature
  30166. * @category iServer
  30167. * @classdesc 服务端矢量要素类。该类描述了服务端返回的矢量要素的相关信息,包括字段和几何信息。
  30168. * @param {Object} options - 参数。
  30169. * @param {SuperMap.ServerGeometry} geometry - 矢量要素的几何信息。
  30170. * @param {Array.<string>} [options.fieldNames] - 矢量要素的属性字段名集合。
  30171. * @param {Array.<string>} [options.fieldValues] - 矢量要素的属性字段值集合。
  30172. */
  30173. class ServerFeature {
  30174. constructor(options) {
  30175. /**
  30176. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldNames]
  30177. * @description 矢量要素的属性字段名集合。
  30178. */
  30179. this.fieldNames = null;
  30180. /**
  30181. * @member {Array.<string>} [SuperMap.ServerFeature.prototype.fieldValues]
  30182. * @description 矢量要素的属性字段值集合。
  30183. */
  30184. this.fieldValues = null;
  30185. /**
  30186. * @member {SuperMap.ServerGeometry} SuperMap.ServerFeature.prototype.geometry
  30187. * @description 矢量要素的几何信息。
  30188. */
  30189. this.geometry = null;
  30190. if (options) {
  30191. Util.extend(this, options);
  30192. }
  30193. this.CLASS_NAME = "SuperMap.ServerFeature";
  30194. }
  30195. /**
  30196. * @function SuperMap.ServerFeature.prototype.destroy
  30197. * @description 释放资源,将引用资源的属性置空。
  30198. */
  30199. destroy() {
  30200. var me = this;
  30201. me.fieldNames = null;
  30202. me.fieldValues = null;
  30203. if (me.geometry) {
  30204. me.geometry.destroy();
  30205. me.geometry = null;
  30206. }
  30207. }
  30208. /**
  30209. * @function SuperMap.ServerFeature.prototype.toFeature
  30210. * @description 将服务端矢量要素 ServerFeature 转换为客户端矢量要素 Feature。
  30211. * @returns {SuperMap.Vector} 转换后的客户端矢量要素。
  30212. */
  30213. toFeature() {
  30214. var names, values, geo,
  30215. attr = {},
  30216. me = this,
  30217. feature;
  30218. names = me.fieldNames;
  30219. values = me.fieldValues;
  30220. for (var i in names) {
  30221. attr[names[i]] = values[i];
  30222. }
  30223. if (me.geometry) {
  30224. geo = me.geometry.toGeometry();
  30225. }
  30226. feature = new Vector(geo, attr);
  30227. if (me.geometry && me.geometry.id) {
  30228. feature.fid = me.geometry.id;
  30229. }
  30230. return feature;
  30231. }
  30232. /**
  30233. * @function SuperMap.ServerFeature.prototype.fromJson
  30234. * @description 将 JSON 对象表示服务端矢量要素转换为 ServerFeature。
  30235. * @param {Object} jsonObject - 要转换的 JSON 对象。
  30236. * @returns {SuperMap.ServerFeature} 转化后的 ServerFeature 对象。
  30237. */
  30238. static fromJson(jsonObject) {
  30239. var geo = null;
  30240. if (!jsonObject) {
  30241. return;
  30242. }
  30243. geo = jsonObject.geometry;
  30244. if (geo) {
  30245. geo = ServerGeometry.fromJson(geo);
  30246. }
  30247. return new ServerFeature({
  30248. fieldNames: jsonObject.fieldNames,
  30249. fieldValues: jsonObject.fieldValues,
  30250. geometry: geo
  30251. });
  30252. }
  30253. }
  30254. SuperMap.ServerFeature = ServerFeature;
  30255. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoParameters.js
  30256. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30257. * This program are made available under the terms of the Apache License, Version 2.0
  30258. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30259. /**
  30260. * @class SuperMap.SetLayerInfoParameters
  30261. * @category iServer Map TempLayersSet
  30262. * @classdesc 设置图层信息参数类.
  30263. * @param {Object} options - 参数。
  30264. * @param {string} options.resourceID - 临时图层的资源 ID。
  30265. * @param {string} options.tempLayerName - 临时图层下的子图层名。
  30266. * @param {string} options.layerInfo - 要更新的图层信息。
  30267. */
  30268. class SetLayerInfoParameters {
  30269. constructor(options) {
  30270. options = options || {};
  30271. /**
  30272. * @member {string} SuperMap.SetLayerInfoParameters.prototype.resourceID
  30273. * @description 临时图层的资源 ID。
  30274. */
  30275. this.resourceID = null;
  30276. /**
  30277. * @member {string} SuperMap.SetLayerInfoParameters.prototype.tempLayerName
  30278. * @description 临时图层下子图层(或者其子图层)名,如:Countries@World.3@@World。
  30279. */
  30280. this.tempLayerName = null;
  30281. /**
  30282. * @member {Object} SuperMap.SetLayerInfoParameters.prototype.layerInfo
  30283. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  30284. */
  30285. this.layerInfo = null;
  30286. Util.extend(this, options);
  30287. this.CLASS_NAME = "SuperMap.SetLayerInfoParameters";
  30288. }
  30289. /**
  30290. * @function SuperMap.SetLayerInfoParameters.prototype.destroy
  30291. * @description 释放资源,将引用资源的属性置空。
  30292. */
  30293. destroy() {
  30294. var me = this;
  30295. me.resourceID = null;
  30296. me.tempLayerName = null;
  30297. me.layerInfo = null;
  30298. }
  30299. }
  30300. SuperMap.SetLayerInfoParameters = SetLayerInfoParameters;
  30301. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerInfoService.js
  30302. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30303. * This program are made available under the terms of the Apache License, Version 2.0
  30304. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30305. /**
  30306. * @class SuperMap.SetLayerInfoService
  30307. * @category iServer Map TempLayersSet
  30308. * @classdesc 设置图层信息服务类。可以实现临时图层中子图层的修改
  30309. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  30310. * @extends {SuperMap.CommonServiceBase}
  30311. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  30312. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World";
  30313. * @param {Object} options - 参数。
  30314. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  30315. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  30316. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  30317. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30318. * @param {Object} [options.headers] - 请求头。
  30319. */
  30320. class SetLayerInfoService extends CommonServiceBase {
  30321. constructor(url, options) {
  30322. super(url, options);
  30323. if (options) {
  30324. Util.extend(this, options);
  30325. }
  30326. this.CLASS_NAME = "SuperMap.SetLayerInfoService";
  30327. }
  30328. /**
  30329. * @override
  30330. */
  30331. destroy() {
  30332. super.destroy();
  30333. Util.reset(this);
  30334. }
  30335. /**
  30336. * @function SuperMap.SetLayerInfoService.prototype.processAsync
  30337. * @description 负责将客户端的更新参数传递到服务端。
  30338. * @param {Object} params - 修改后的图层资源信息。
  30339. * 该参数可以使用获取图层信息服务<{@link SuperMap.GetLayersInfoService}>返回图层信息,解析结果result.subLayers.layers[i],然后对其属性进行修改来获取。
  30340. */
  30341. processAsync(params) {
  30342. if (!params) {
  30343. return;
  30344. }
  30345. var me = this;
  30346. var jsonParamsStr = Util.toJSON(params);
  30347. me.request({
  30348. method: "PUT",
  30349. data: jsonParamsStr,
  30350. scope: me,
  30351. success: me.serviceProcessCompleted,
  30352. failure: me.serviceProcessFailed
  30353. });
  30354. }
  30355. }
  30356. SuperMap.SetLayerInfoService = SetLayerInfoService;
  30357. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoParameters.js
  30358. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30359. * This program are made available under the terms of the Apache License, Version 2.0
  30360. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30361. /**
  30362. * @class SuperMap.SetLayersInfoParameters
  30363. * @category iServer Map TempLayersSet
  30364. * @classdesc 设置图层信息参数类。
  30365. * @param {Object} options - 参数。
  30366. * @param {boolean} [options.isTempLayers=false] - 是否是临时图层。
  30367. * @param {string} options.resourceID - 临时图层资源 ID。
  30368. * @param {string} options.layersInfo - 要更新的图层信息。
  30369. */
  30370. class SetLayersInfoParameters {
  30371. constructor(options) {
  30372. options = options || {};
  30373. /**
  30374. * @member {boolean} [SuperMap.SetLayersInfoParameters.prototype.isTempLayers=false]
  30375. * @description 是否是临时图层。
  30376. */
  30377. this.isTempLayers = null;
  30378. /**
  30379. * @member {string} SuperMap.SetLayersInfoParameters.prototype.resourceID
  30380. * @description 临时图层资源 ID,
  30381. */
  30382. this.resourceID = null;
  30383. /**
  30384. * @member {Object} SuperMap.SetLayersInfoParameters.prototype.layersInfo
  30385. * @description 要更新的图层信息(包含修改和未修改的所有字段)。该参数可以通过图层信息服务获取,然后对返回值中 subLayers.layers[i] 图层信息属性进行修改。
  30386. */
  30387. this.layersInfo = null;
  30388. Util.extend(this, options);
  30389. this.CLASS_NAME = "SuperMap.SetLayersInfoParameters";
  30390. }
  30391. /**
  30392. * @function SuperMap.SetLayersInfoParameters.prototype.destroy
  30393. * @description 释放资源,将引用资源的属性置空。
  30394. */
  30395. destroy() {
  30396. var me = this;
  30397. me.isTempLayers = null;
  30398. me.resourceID = null;
  30399. me.layersInfo = null;
  30400. }
  30401. }
  30402. SuperMap.SetLayersInfoParameters = SetLayersInfoParameters;
  30403. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayersInfoService.js
  30404. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30405. * This program are made available under the terms of the Apache License, Version 2.0
  30406. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30407. /**
  30408. * @class SuperMap.SetLayersInfoService
  30409. * @category iServer Map TempLayersSet
  30410. * @classdesc 设置图层信息服务类。可以实现创建新的临时图层和对现有临时图层的修改,
  30411. * 当 isTempLayers 为 false的时候执行创建临时图层。当 isTempLayers 为 ture 并且临时图层资源 resourceID 被设置有效时执行对临时图层的编辑。
  30412. * 该类负责将图层设置参数传递到服务端,并获取服务端返回的结果信息。
  30413. * @extends {SuperMap.CommonServiceBase}
  30414. * @param url - {string} 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  30415. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  30416. * @param {Object} options - 参数。
  30417. * @param {string} options.resourceID - 图层资源ID,临时图层的资源ID标记。
  30418. * @param {boolean} options.isTempLayers - 当前url对应的图层是否是临时图层。
  30419. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  30420. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  30421. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  30422. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30423. * @param {Object} [options.headers] - 请求头。
  30424. */
  30425. class SetLayersInfoService extends CommonServiceBase {
  30426. constructor(url, options) {
  30427. super(url, options);
  30428. /**
  30429. * @member {string} SuperMap.SetLayersInfoService.prototype.resourceID
  30430. * @description 图层资源ID,临时图层的资源ID标记。
  30431. */
  30432. this.resourceID = null;
  30433. /**
  30434. * @function {boolean} SuperMap.SetLayersInfoService.prototype.isTempLayers
  30435. * @description 当前url对应的图层是否是临时图层。
  30436. */
  30437. this.isTempLayers = false;
  30438. if (options) {
  30439. SuperMap.Util.extend(this, options);
  30440. }
  30441. this.CLASS_NAME = "SuperMap.SetLayersInfoService";
  30442. }
  30443. /**
  30444. * @override
  30445. */
  30446. destroy() {
  30447. super.destroy();
  30448. Util.reset(this);
  30449. }
  30450. /**
  30451. * @function SuperMap.SetLayersInfoService.prototype.processAsync
  30452. * @description 负责将客户端的更新参数传递到服务端。
  30453. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务 <{@link SuperMap.GetLayersInfoService}>返回图层信息,然后对其属性进行修改来获取。
  30454. */
  30455. processAsync(params) {
  30456. if (!params) {
  30457. return;
  30458. }
  30459. var jsonParams,
  30460. subLayers = [],
  30461. me = this,
  30462. method = "";
  30463. //创建临时图层和设置修改临时图层信息对应不同的资源URL
  30464. if (me.isTempLayers) {
  30465. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + me.resourceID);
  30466. method = "PUT";
  30467. } else {
  30468. me.url = Util.urlPathAppend(me.url, "tempLayersSet");
  30469. method = "POST";
  30470. }
  30471. if (!params.subLayers) {
  30472. params.subLayers = {layers: []}
  30473. }
  30474. if (!params.subLayers.layers) {
  30475. params.subLayers.layers = [];
  30476. }
  30477. var layers = params.subLayers.layers,
  30478. len = layers.length;
  30479. for (let i in layers) {
  30480. if (layers[i].ugcLayerType === "GRID") {
  30481. var colorDictionary = {};
  30482. var colorDics = layers[i].colorDictionarys;
  30483. for (var j in colorDics) {
  30484. var key = colorDics[j].elevation;
  30485. colorDictionary[key] = colorDics[j].color;
  30486. }
  30487. }
  30488. layers[i].colorDictionary = colorDictionary;
  30489. delete layers[i].colorDictionarys;
  30490. }
  30491. for (let i = 0; i < len; i++) {
  30492. if (layers[i].toJsonObject) {
  30493. //将图层信息转换成服务端能识别的简单json对象
  30494. subLayers.push(layers[i].toJsonObject());
  30495. } else {
  30496. subLayers.push(layers[i]);
  30497. }
  30498. }
  30499. jsonParams = Util.extend(jsonParams, params);
  30500. jsonParams.subLayers = {"layers": subLayers};
  30501. jsonParams.object = null;
  30502. var jsonParamsStr = Util.toJSON([jsonParams]);
  30503. me.request({
  30504. method: method,
  30505. data: jsonParamsStr,
  30506. scope: me,
  30507. success: me.serviceProcessCompleted,
  30508. failure: me.serviceProcessFailed
  30509. });
  30510. }
  30511. }
  30512. SuperMap.SetLayersInfoService = SetLayersInfoService;
  30513. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusParameters.js
  30514. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30515. * This program are made available under the terms of the Apache License, Version 2.0
  30516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30517. /**
  30518. * @class SuperMap.SetLayerStatusParameters
  30519. * @category iServer Map TempLayersSet
  30520. * @classdesc 子图层显示控制参数类,该类存储了各子图层是否可见的状态。
  30521. * 注意在 SuperMap iClient 系列产品中所说的图层与 SuperMap Deskpro 的地图对应,子图层与 SuperMap Deskpro 的图层对应。
  30522. * @param {Object} options - 参数。
  30523. * @param {Array.<SuperMap.LayerStatus>} options.layerStatusList - 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,
  30524. * 集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  30525. * @param {number} [options.holdTime=15] - 获取或设置资源在服务端保存的时间。
  30526. * @param {string} [options.resourceID] - 获取或设置资源服务 ID。
  30527. */
  30528. class SetLayerStatusParameters {
  30529. constructor(options) {
  30530. /**
  30531. * @member {Array.<SuperMap.LayerStatus>} SuperMap.SetLayerStatusParameters.prototype.layerStatusList
  30532. * @description 获取或设置图层可见状态({@link SuperMap.LayerStatus})集合,集合中的每个 {@link SuperMap.LayerStatus} 对象代表一个子图层的可视状态。
  30533. */
  30534. this.layerStatusList = [];
  30535. /**
  30536. * @member {number} [SuperMap.SetLayerStatusParameters.prototype.holdTime=15]
  30537. * @description 获取或设置资源在服务端保存的时间。单位为分钟。
  30538. */
  30539. this.holdTime = 15;
  30540. /**
  30541. * @member {string} SuperMap.SetLayerStatusParameters.prototype.resourceID
  30542. * @description 获取或设置资源服务ID。如果设置该参数则会在指定的 TempLayer 进行图层的显示控制;
  30543. * 如果不设置该参数,则会首先创建一个 TempLayer ,然后在新创建的 TempLayer 进行图层的显示控制。
  30544. */
  30545. this.resourceID = null;
  30546. if (options) {
  30547. Util.extend(this, options);
  30548. }
  30549. }
  30550. /**
  30551. * @function SuperMap.SetLayerStatusParameters.prototype.destroy
  30552. * @description 释放资源,将引用资源的属性置空。
  30553. */
  30554. destroy() {
  30555. var me = this;
  30556. me.layerStatusList = null;
  30557. me.holdTime = null;
  30558. me.resourceID = null;
  30559. }
  30560. /**
  30561. * @function SuperMap.SetLayerStatusParameters.prototype.toJSON
  30562. * @description 生成 JSON。
  30563. * @returns {Object} 对应的 JSON 对象。
  30564. */
  30565. toJSON() {
  30566. var json = '{';
  30567. json += '"layers":[';
  30568. var v = [];
  30569. for (var i = 0, len = this.layerStatusList.length; i < len; i++) {
  30570. v.push(this.layerStatusList[i].toJSON());
  30571. }
  30572. json += v;
  30573. json += ']';
  30574. json += '}';
  30575. return json;
  30576. }
  30577. }
  30578. SuperMap.SetLayerStatusParameters = SetLayerStatusParameters;
  30579. ;// CONCATENATED MODULE: ./src/common/iServer/SetLayerStatusService.js
  30580. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30581. * This program are made available under the terms of the Apache License, Version 2.0
  30582. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30583. /**
  30584. * @class SuperMap.SetLayerStatusService
  30585. * @category iServer Map TempLayersSet
  30586. * @classdesc 子图层显示控制服务类。该类负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  30587. * 用户获取服务端返回的各子图层显示状态有两种方式:
  30588. * 一种是通过监听 SetLayerEvent.PROCESS_COMPLETE 事件;
  30589. * 一种是使用 AsyncResponder 类实现异步处理。
  30590. * @extends {SuperMap.CommonServiceBase}
  30591. * @param {string} url - 地图服务访问地址。请求地图服务,URL 应为:
  30592. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名};
  30593. * @param {Object} options - 参数。
  30594. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  30595. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  30596. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  30597. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30598. * @param {Object} [options.headers] - 请求头。
  30599. */
  30600. class SetLayerStatusService extends CommonServiceBase {
  30601. constructor(url, options) {
  30602. super(url, options);
  30603. this.lastparams = null;
  30604. this.mapUrl = url;
  30605. if (options) {
  30606. Util.extend(this, options);
  30607. }
  30608. this.CLASS_NAME = "SuperMap.SetLayerStatusService";
  30609. }
  30610. /**
  30611. * @override
  30612. */
  30613. destroy() {
  30614. super.destroy();
  30615. Util.reset(this);
  30616. }
  30617. /**
  30618. * @function SuperMap.SetLayerStatusService.prototype.processAsync
  30619. * @description 负责将客户端的更新参数传递到服务端。
  30620. * @param {Object} params - 修改后的图层资源信息。该参数可以使用获取图层信息服务{@link SuperMap.SetLayerStatusParameters}
  30621. * 返回图层信息,然后对其属性进行修改来获取。
  30622. */
  30623. processAsync(params) {
  30624. if (!(params instanceof SetLayerStatusParameters)) {
  30625. return;
  30626. }
  30627. var me = this,
  30628. method = "POST";
  30629. me.url = me.mapUrl;
  30630. if (params.resourceID == null) {
  30631. me.url = Util.urlPathAppend(me.url, 'tempLayersSet');
  30632. me.lastparams = params;
  30633. me.request({
  30634. method: method,
  30635. scope: me,
  30636. success: me.createTempLayerComplete,
  30637. failure: me.serviceProcessFailed
  30638. });
  30639. } else {
  30640. me.url = Util.urlPathAppend(me.url, "tempLayersSet/" + params.resourceID);
  30641. me.url = Util.urlAppend(me.url, "elementRemain=true&reference=" + params.resourceID + "&holdTime=" + params.holdTime.toString());
  30642. var jsonParameters = '[{';
  30643. jsonParameters += '"type":"UGC",';
  30644. if (params.layerStatusList != null && params.layerStatusList.length > 0) {
  30645. jsonParameters += '"subLayers":' + params.toJSON();
  30646. }
  30647. jsonParameters += ',"visible":' + true + ',';
  30648. jsonParameters += '"name":"' + this.getMapName(this.mapUrl) + '"';
  30649. jsonParameters += '}]';
  30650. me.request({
  30651. method: "PUT",
  30652. data: jsonParameters,
  30653. scope: me,
  30654. success: me.serviceProcessCompleted,
  30655. failure: me.serviceProcessFailed
  30656. });
  30657. }
  30658. }
  30659. /**
  30660. * @function SuperMap.SetLayerStatusService.prototype.createTempLayerComplete
  30661. * @description 设置完成,执行此方法。
  30662. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  30663. */
  30664. createTempLayerComplete(result) {
  30665. var me = this;
  30666. result = Util.transformResult(result);
  30667. if (result.succeed) {
  30668. me.lastparams.resourceID = result.newResourceID;
  30669. }
  30670. me.processAsync(me.lastparams);
  30671. }
  30672. /**
  30673. * @function SuperMap.SetLayerStatusService.prototype.getMapName
  30674. * @description 获取地图名称。
  30675. * @param {Object} url - 服务地址。
  30676. */
  30677. getMapName(url) {
  30678. var mapUrl = url;
  30679. if (mapUrl.charAt(mapUrl.length - 1) === "/") {
  30680. mapUrl = mapUrl.substr(0, mapUrl.length - 1);
  30681. }
  30682. var index = mapUrl.lastIndexOf("/");
  30683. var mapName = mapUrl.substring(index + 1, mapUrl.length);
  30684. return mapName;
  30685. }
  30686. /**
  30687. * @function SuperMap.SetLayerStatusService.prototype.setLayerCompleted
  30688. * @description 设置完成,执行此方法。
  30689. * @param {Object} result - 服务器返回的结果对象,记录设置操作是否成功。
  30690. */
  30691. serviceProcessCompleted(result) {
  30692. var me = this;
  30693. result = Util.transformResult(result);
  30694. if (result != null && me.lastparams != null) {
  30695. result.newResourceID = me.lastparams.resourceID;
  30696. }
  30697. me.events.triggerEvent("processCompleted", {result: result});
  30698. }
  30699. }
  30700. SuperMap.SetLayerStatusService = SetLayerStatusService;
  30701. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  30702. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30703. * This program are made available under the terms of the Apache License, Version 2.0
  30704. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30705. /**
  30706. * @class SuperMap.SingleObjectQueryJobsParameter
  30707. * @category iServer ProcessingService Query
  30708. * @classdesc 单对象空间查询分析任务参数类。
  30709. * @param {Object} options - 参数。
  30710. * @param {string} options.datasetName - 数据集名。
  30711. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  30712. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  30713. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  30714. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30715. */
  30716. class SingleObjectQueryJobsParameter {
  30717. constructor(options) {
  30718. if (!options) {
  30719. return;
  30720. }
  30721. /**
  30722. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  30723. * @description 数据集名。
  30724. */
  30725. this.datasetName = "";
  30726. /**
  30727. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  30728. * @description 查询对象所在的数据集名称。
  30729. */
  30730. this.datasetQuery = "";
  30731. /**
  30732. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  30733. * @description 查询对象所在的几何对象。
  30734. */
  30735. this.geometryQuery = "";
  30736. /**
  30737. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  30738. * @description 空间查询模式 。
  30739. */
  30740. this.mode = SpatialQueryMode.CONTAIN;
  30741. /**
  30742. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  30743. * @description 输出参数设置类。
  30744. */
  30745. this.output = null;
  30746. /**
  30747. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  30748. * @description 分析后结果可视化的参数类。
  30749. */
  30750. this.mappingParameters = null;
  30751. Util.extend(this, options);
  30752. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  30753. }
  30754. /**
  30755. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  30756. * @description 释放资源,将引用资源的属性置空。
  30757. */
  30758. destroy() {
  30759. this.datasetName = null;
  30760. this.datasetQuery = null;
  30761. this.geometryQuery = null;
  30762. this.mode = null;
  30763. if (this.output instanceof OutputSetting) {
  30764. this.output.destroy();
  30765. this.output = null;
  30766. }
  30767. if (this.mappingParameters instanceof MappingParameters){
  30768. this.mappingParameters.destroy();
  30769. this.mappingParameters = null;
  30770. }
  30771. }
  30772. /**
  30773. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  30774. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  30775. * @param {Object} tempObj - 目标对象。
  30776. * @description 生成单对象空间查询分析任务对象。
  30777. */
  30778. static toObject(singleObjectQueryJobsParameter, tempObj) {
  30779. for (var name in singleObjectQueryJobsParameter) {
  30780. if (name === "datasetName") {
  30781. tempObj['input'] = tempObj['input'] || {};
  30782. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  30783. continue;
  30784. }
  30785. if (name === "output"){
  30786. tempObj['output'] = tempObj['output'] || {};
  30787. tempObj['output'] = singleObjectQueryJobsParameter[name];
  30788. continue;
  30789. }
  30790. tempObj['analyst'] = tempObj['analyst'] || {};
  30791. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  30792. if(name === 'mappingParameters'){
  30793. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  30794. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  30795. }
  30796. }
  30797. }
  30798. }
  30799. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  30800. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  30801. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30802. * This program are made available under the terms of the Apache License, Version 2.0
  30803. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30804. /**
  30805. * @class SuperMap.SingleObjectQueryJobsService
  30806. * @category iServer ProcessingService Query
  30807. * @classdesc 单对象查询分析服务类
  30808. * @extends {SuperMap.ProcessingServiceBase}
  30809. * @param {string} url - 单对象空间查询分析服务地址。
  30810. * @param {Object} options - 参数。
  30811. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30812. * @param {Object} [options.headers] - 请求头。
  30813. */
  30814. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  30815. constructor(url, options) {
  30816. super(url, options);
  30817. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
  30818. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  30819. }
  30820. /**
  30821. *@override
  30822. */
  30823. destroy() {
  30824. super.destroy();
  30825. }
  30826. /**
  30827. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  30828. * @description 获取单对象空间查询分析所有任务
  30829. */
  30830. getQueryJobs() {
  30831. super.getJobs(this.url);
  30832. }
  30833. /**
  30834. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  30835. * @description 获取指定id的单对象空间查询分析服务
  30836. * @param {string} id - 指定要获取数据的id
  30837. */
  30838. getQueryJob(id) {
  30839. super.getJobs(Util.urlPathAppend(this.url, id));
  30840. }
  30841. /**
  30842. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  30843. * @description 新建单对象空间查询分析服务
  30844. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  30845. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  30846. */
  30847. addQueryJob(params, seconds) {
  30848. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  30849. }
  30850. }
  30851. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  30852. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryParameters.js
  30853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30854. * This program are made available under the terms of the Apache License, Version 2.0
  30855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30856. /**
  30857. * @class SuperMap.StopQueryParameters
  30858. * @category iServer TrafficTransferAnalyst TransferStops
  30859. * @classdesc 站点查询参数类。
  30860. * @param {Object} options - 参数。
  30861. * @param {string} options.keyWord - 站点名称关键字。
  30862. * @param {boolean} [options.returnPosition=false] - 是否返回站点坐标信息。
  30863. */
  30864. class StopQueryParameters {
  30865. constructor(options) {
  30866. options = options || {};
  30867. /**
  30868. * @member {string} SuperMap.StopQueryParameters.prototype.keyWord
  30869. * @description 站点名称关键字。
  30870. */
  30871. this.keyWord = null;
  30872. /**
  30873. * @member {boolean} [SuperMap.StopQueryParameters.prototype.returnPosition=false]
  30874. * @description 是否返回站点坐标信息。
  30875. */
  30876. this.returnPosition = false;
  30877. Util.extend(this, options);
  30878. this.CLASS_NAME = "SuperMap.StopQueryParameters";
  30879. }
  30880. /**
  30881. * @function SuperMap.StopQueryParameters.prototype.destroy
  30882. * @description 释放资源,将引用资源的属性置空。
  30883. */
  30884. destroy() {
  30885. Util.reset(this);
  30886. }
  30887. }
  30888. SuperMap.StopQueryParameters = StopQueryParameters;
  30889. ;// CONCATENATED MODULE: ./src/common/iServer/StopQueryService.js
  30890. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30891. * This program are made available under the terms of the Apache License, Version 2.0
  30892. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30893. /**
  30894. * @class SuperMap.StopQueryService
  30895. * @category iServer TrafficTransferAnalyst TransferStops
  30896. * @classdesc 站点查询服务类。
  30897. * 返回结果通过该类支持的事件的监听函数参数获取
  30898. * @extends {SuperMap.CommonServiceBase}
  30899. * @param {string} url - 与客户端交互的站点查询服务地址。
  30900. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  30901. * @param {Object} options - 参数。</br>
  30902. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  30903. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  30904. * @param {Object} [options.headers] - 请求头。
  30905. * @example 例如:
  30906. * (start code)
  30907. * var myService = new SuperMap.StopQueryService(url, {eventListeners: {
  30908. * "processCompleted": StopQueryCompleted,
  30909. * "processFailed": StopQueryError
  30910. * }
  30911. * };
  30912. * (end)
  30913. *
  30914. *
  30915. */
  30916. class StopQueryService extends CommonServiceBase {
  30917. constructor(url, options) {
  30918. super(url, options);
  30919. options = options || {};
  30920. Util.extend(this, options);
  30921. this.CLASS_NAME = "SuperMap.StopQueryService";
  30922. }
  30923. /**
  30924. *@override
  30925. */
  30926. destroy() {
  30927. super.destroy();
  30928. Util.reset(this);
  30929. }
  30930. /**
  30931. * @function SuperMap.StopQueryService.prototype.processAsync
  30932. * @description 负责将客户端的更新参数传递到服务端。
  30933. * @param {SuperMap.StopQueryParameters} params - 交通换乘参数。
  30934. */
  30935. processAsync(params) {
  30936. if (!(params instanceof StopQueryParameters)) {
  30937. return;
  30938. }
  30939. var me = this;
  30940. me.url = Util.urlPathAppend(me.url, 'stops/keyword/' + params.keyWord);
  30941. me.request({
  30942. method: "GET",
  30943. params: {returnPosition: params.returnPosition},
  30944. scope: me,
  30945. success: me.serviceProcessCompleted,
  30946. failure: me.serviceProcessFailed
  30947. });
  30948. }
  30949. }
  30950. SuperMap.StopQueryService = StopQueryService;
  30951. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  30952. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  30953. * This program are made available under the terms of the Apache License, Version 2.0
  30954. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  30955. /**
  30956. * @class SuperMap.SummaryAttributesJobsParameter
  30957. * @category iServer ProcessingService SummaryAttributes
  30958. * @classdesc 属性汇总分析任务参数类
  30959. * @param {Object} options - 参数。
  30960. * @param {string} options.datasetName - 数据集名。
  30961. * @param {string} options.groupField - 分组字段。
  30962. * @param {string} options.attributeField - 属性字段。
  30963. * @param {string} options.statisticModes - 统计模式。
  30964. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  30965. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  30966. */
  30967. class SummaryAttributesJobsParameter {
  30968. constructor(options) {
  30969. if (!options) {
  30970. return;
  30971. }
  30972. /**
  30973. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  30974. * @description 汇总数据集名称。
  30975. */
  30976. this.datasetName = "";
  30977. /**
  30978. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  30979. * @description 分组字段。
  30980. */
  30981. this.groupField = "";
  30982. /**
  30983. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  30984. * @description 属性字段。
  30985. */
  30986. this.attributeField = "";
  30987. /**
  30988. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  30989. * @description 属性汇总统计模式。
  30990. */
  30991. this.statisticModes = "";
  30992. /**
  30993. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  30994. * @description 输出参数设置类。
  30995. */
  30996. this.output = null;
  30997. /**
  30998. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  30999. * @description 分析后结果可视化的参数类。
  31000. */
  31001. this.mappingParameters = null;
  31002. Util.extend(this, options);
  31003. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  31004. }
  31005. /**
  31006. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  31007. * @override
  31008. */
  31009. destroy() {
  31010. this.datasetName = null;
  31011. this.groupField = null;
  31012. this.attributeField = null;
  31013. this.statisticModes = null;
  31014. if (this.output instanceof OutputSetting) {
  31015. this.output.destroy();
  31016. this.output = null;
  31017. }
  31018. if (this.mappingParameters instanceof MappingParameters){
  31019. this.mappingParameters.destroy();
  31020. this.mappingParameters = null;
  31021. }
  31022. }
  31023. /**
  31024. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  31025. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  31026. * @param {Object} tempObj - 目标对象。
  31027. * @description 生成属性汇总分析任务对象。
  31028. */
  31029. static toObject(SummaryAttributesJobsParameter, tempObj) {
  31030. for (var name in SummaryAttributesJobsParameter) {
  31031. if (name === "datasetName") {
  31032. tempObj['input'] = tempObj['input'] || {};
  31033. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  31034. continue;
  31035. }
  31036. if (name === "output") {
  31037. tempObj['output'] = tempObj['output'] || {};
  31038. tempObj['output'] = SummaryAttributesJobsParameter[name];
  31039. continue;
  31040. }
  31041. tempObj['analyst'] = tempObj['analyst'] || {};
  31042. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  31043. if(name === 'mappingParameters'){
  31044. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31045. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  31046. }
  31047. }
  31048. }
  31049. }
  31050. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  31051. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  31052. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31053. * This program are made available under the terms of the Apache License, Version 2.0
  31054. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31055. /**
  31056. * @class SuperMap.SummaryAttributesJobsService
  31057. * @category iServer ProcessingService SummaryAttributes
  31058. * @classdesc 属性汇总分析服务类
  31059. * @extends {SuperMap.ProcessingServiceBase}
  31060. * @param {string} url - 汇总统计分析服务地址。
  31061. * @param {Object} options - 参数。
  31062. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31063. * @param {Object} [options.headers] - 请求头。
  31064. */
  31065. class SummaryAttributesJobsService extends ProcessingServiceBase {
  31066. constructor(url, options) {
  31067. super(url, options);
  31068. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  31069. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  31070. }
  31071. /**
  31072. *@override
  31073. */
  31074. destroy() {
  31075. super.destroy();
  31076. }
  31077. /**
  31078. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  31079. * @description 获取属性汇总分析所有任务
  31080. */
  31081. getSummaryAttributesJobs (){
  31082. super.getJobs(this.url);
  31083. }
  31084. /**
  31085. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  31086. * @description 获取指定id的属性汇总分析服务
  31087. * @param {string} id - 指定要获取数据的id
  31088. */
  31089. getSummaryAttributesJob(id) {
  31090. super.getJobs(Util.urlPathAppend(this.url, id));
  31091. }
  31092. /**
  31093. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  31094. * @description 新建属性汇总分析服务
  31095. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  31096. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31097. */
  31098. addSummaryAttributesJob(params, seconds) {
  31099. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  31100. }
  31101. }
  31102. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  31103. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  31104. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31105. * This program are made available under the terms of the Apache License, Version 2.0
  31106. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31107. /**
  31108. * @class SuperMap.SummaryMeshJobParameter
  31109. * @category iServer ProcessingService AggregatePoints
  31110. * @classdesc 点聚合分析任务参数类。
  31111. * @param {Object} options - 参数。
  31112. * @param {string} options.datasetName - 数据集名。
  31113. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  31114. * @param {number} options.fields - 权重索引。
  31115. * @param {number} [options.resolution=100] - 分辨率。
  31116. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  31117. * @param {number} [options.meshType=0] - 分析类型。
  31118. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  31119. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  31120. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31121. */
  31122. class SummaryMeshJobParameter {
  31123. constructor(options) {
  31124. if (!options) {
  31125. return;
  31126. }
  31127. /**
  31128. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  31129. * @description 数据集名。
  31130. */
  31131. this.datasetName = "";
  31132. /**
  31133. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  31134. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  31135. */
  31136. this.regionDataset = "";
  31137. /**
  31138. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  31139. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  31140. */
  31141. this.query = "";
  31142. /**
  31143. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  31144. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  31145. */
  31146. this.resolution = 100;
  31147. /**
  31148. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  31149. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  31150. */
  31151. this.meshType = 0;
  31152. /**
  31153. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  31154. * @description 统计模式。
  31155. */
  31156. this.statisticModes = StatisticAnalystMode.AVERAGE;
  31157. /**
  31158. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  31159. * @description 权重字段。
  31160. */
  31161. this.fields = "";
  31162. /**
  31163. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  31164. * @description 聚合类型。
  31165. */
  31166. this.type = SummaryType.SUMMARYMESH;
  31167. /**
  31168. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  31169. * @description 输出参数设置类。
  31170. */
  31171. this.output = null;
  31172. /**
  31173. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  31174. * @description 分析后结果可视化的参数类。
  31175. */
  31176. this.mappingParameters = null;
  31177. Util.extend(this, options);
  31178. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  31179. }
  31180. /**
  31181. * @function SuperMap.SummaryMeshJobParameter.destroy
  31182. * @override
  31183. */
  31184. destroy() {
  31185. this.datasetName = null;
  31186. this.query = null;
  31187. this.resolution = null;
  31188. this.statisticModes = null;
  31189. this.meshType = null;
  31190. this.fields = null;
  31191. this.regionDataset = null;
  31192. this.type = null;
  31193. if (this.output instanceof OutputSetting) {
  31194. this.output.destroy();
  31195. this.output = null;
  31196. }
  31197. if (this.mappingParameters instanceof MappingParameters){
  31198. this.mappingParameters.destroy();
  31199. this.mappingParameters = null;
  31200. }
  31201. }
  31202. /**
  31203. * @function SuperMap.SummaryMeshJobParameter.toObject
  31204. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  31205. * @param {Object} tempObj - 目标对象。
  31206. * @description 生成点聚合分析任务对象。
  31207. */
  31208. static toObject(summaryMeshJobParameter, tempObj) {
  31209. for (var name in summaryMeshJobParameter) {
  31210. if (name === "datasetName") {
  31211. tempObj['input'] = tempObj['input'] || {};
  31212. tempObj['input'][name] = summaryMeshJobParameter[name];
  31213. continue;
  31214. }
  31215. if (name === "type") {
  31216. tempObj['type'] = summaryMeshJobParameter[name];
  31217. continue;
  31218. }
  31219. if (name === "output") {
  31220. tempObj['output'] = tempObj['output'] || {};
  31221. tempObj['output'] = summaryMeshJobParameter[name];
  31222. continue;
  31223. }
  31224. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  31225. tempObj['analyst'] = tempObj['analyst'] || {};
  31226. if (name === 'query' && summaryMeshJobParameter[name]) {
  31227. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  31228. } else {
  31229. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  31230. }
  31231. if(name === 'mappingParameters'){
  31232. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31233. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  31234. }
  31235. }
  31236. }
  31237. function contains(arr, obj) {
  31238. var i = arr.length;
  31239. while (i--) {
  31240. if (arr[i] === obj) {
  31241. return true;
  31242. }
  31243. }
  31244. return false;
  31245. }
  31246. }
  31247. }
  31248. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  31249. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  31250. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31251. * This program are made available under the terms of the Apache License, Version 2.0
  31252. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31253. /**
  31254. * @class SuperMap.SummaryMeshJobsService
  31255. * @category iServer ProcessingService AggregatePoints
  31256. * @classdesc 点聚合分析任务类。
  31257. * @param {string} url -点聚合分析任务地址。
  31258. * @param {Object} options - 参数。
  31259. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  31260. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  31261. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  31262. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  31263. * @param {number} options.length - 服务访问地址数组长度。
  31264. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31265. * @param {Object} [options.headers] - 请求头。
  31266. */
  31267. class SummaryMeshJobsService extends ProcessingServiceBase {
  31268. constructor(url, options) {
  31269. super(url, options);
  31270. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  31271. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  31272. }
  31273. /**
  31274. * @override
  31275. */
  31276. destroy() {
  31277. super.destroy();
  31278. }
  31279. /**
  31280. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  31281. * @description 获取点聚合分析任务
  31282. */
  31283. getSummaryMeshJobs() {
  31284. super.getJobs(this.url);
  31285. }
  31286. /**
  31287. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  31288. * @description 获取指定ip的点聚合分析任务
  31289. * @param {string} id - 指定要获取数据的id
  31290. */
  31291. getSummaryMeshJob(id) {
  31292. super.getJobs(Util.urlPathAppend(this.url, id));
  31293. }
  31294. /**
  31295. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  31296. * @description 新建点聚合分析服务
  31297. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  31298. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31299. */
  31300. addSummaryMeshJob(params, seconds) {
  31301. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  31302. }
  31303. }
  31304. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  31305. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  31306. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31307. * This program are made available under the terms of the Apache License, Version 2.0
  31308. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31309. /**
  31310. * @class SuperMap.SummaryRegionJobParameter
  31311. * @category iServer ProcessingService SummaryRegion
  31312. * @classdesc 区域汇总分析任务参数类。
  31313. * @param {Object} options - 参数。
  31314. * @param {string} options.datasetName - 数据集名。
  31315. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  31316. * @param {string} [options.standardFields] - 标准属性字段名称。
  31317. * @param {string} [options.weightedFields] - 权重字段名称。
  31318. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  31319. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  31320. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  31321. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  31322. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  31323. * @param {number} [options.resolution=100] - 网格大小。
  31324. * @param {number} [options.meshType=0] - 网格面汇总类型。
  31325. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  31326. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  31327. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  31328. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  31329. */
  31330. class SummaryRegionJobParameter {
  31331. constructor(options) {
  31332. if (!options) {
  31333. return;
  31334. }
  31335. /**
  31336. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  31337. * @description 数据集名。
  31338. */
  31339. this.datasetName = "";
  31340. /**
  31341. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  31342. * @description 汇总数据源(多边形汇总时用到的参数)。
  31343. */
  31344. this.regionDataset = "";
  31345. /**
  31346. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  31347. * @description 是否统计长度或面积。
  31348. */
  31349. this.sumShape = true;
  31350. /**
  31351. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  31352. * @description 分析范围。
  31353. */
  31354. this.query = "";
  31355. /**
  31356. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  31357. * @description 是否以标准属字段统计。
  31358. */
  31359. this.standardSummaryFields = false;
  31360. /**
  31361. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  31362. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  31363. */
  31364. this.standardFields = "";
  31365. /**
  31366. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  31367. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  31368. */
  31369. this.standardStatisticModes = "";
  31370. /**
  31371. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  31372. * @description 是否以权重字段统计。
  31373. */
  31374. this.weightedSummaryFields = false;
  31375. /**
  31376. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  31377. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  31378. */
  31379. this.weightedFields = "";
  31380. /**
  31381. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  31382. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  31383. */
  31384. this.weightedStatisticModes = "";
  31385. /**
  31386. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  31387. * @description 网格面汇总类型。
  31388. */
  31389. this.meshType = 0;
  31390. /**
  31391. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  31392. * @description 网格大小。
  31393. */
  31394. this.resolution = 100;
  31395. /**
  31396. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  31397. * @description 网格大小单位。
  31398. */
  31399. this.meshSizeUnit = AnalystSizeUnit.METER;
  31400. /**
  31401. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  31402. * @description 汇总类型。
  31403. */
  31404. this.type = SummaryType.SUMMARYMESH;
  31405. /**
  31406. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  31407. * @description 输出参数设置类
  31408. */
  31409. this.output = null;
  31410. /**
  31411. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  31412. * @description 分析后结果可视化的参数类。
  31413. */
  31414. this.mappingParameters = null;
  31415. Util.extend(this, options);
  31416. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  31417. }
  31418. /**
  31419. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  31420. * @description 释放资源,将引用资源的属性置空。
  31421. */
  31422. destroy() {
  31423. this.datasetName = null;
  31424. this.sumShape = null;
  31425. this.regionDataset = null;
  31426. this.query = null;
  31427. this.standardSummaryFields = null;
  31428. this.standardFields = null;
  31429. this.standardStatisticModes = null;
  31430. this.weightedSummaryFields = null;
  31431. this.weightedFields = null;
  31432. this.weightedStatisticModes = null;
  31433. this.meshType = null;
  31434. this.resolution = null;
  31435. this.meshSizeUnit = null;
  31436. this.type = null;
  31437. if (this.output instanceof OutputSetting) {
  31438. this.output.destroy();
  31439. this.output = null;
  31440. }
  31441. if (this.mappingParameters instanceof MappingParameters){
  31442. this.mappingParameters.destroy();
  31443. this.mappingParameters = null;
  31444. }
  31445. }
  31446. /**
  31447. * @function SuperMap.SummaryRegionJobParameter.toObject
  31448. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  31449. * @param {Object} tempObj - 目标对象。
  31450. * @description 生成区域汇总分析服务对象。
  31451. */
  31452. static toObject(summaryRegionJobParameter, tempObj) {
  31453. for (var name in summaryRegionJobParameter) {
  31454. if (name === "datasetName") {
  31455. tempObj['input'] = tempObj['input'] || {};
  31456. tempObj['input'][name] = summaryRegionJobParameter[name];
  31457. continue;
  31458. }
  31459. if (name === "type") {
  31460. tempObj['type'] = summaryRegionJobParameter[name];
  31461. continue;
  31462. }
  31463. if (name === "type") {
  31464. tempObj['type'] = summaryRegionJobParameter[name];
  31465. continue;
  31466. }
  31467. if (name === "output") {
  31468. tempObj['output'] = tempObj['output'] || {};
  31469. tempObj['output'] = summaryRegionJobParameter[name];
  31470. continue;
  31471. }
  31472. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  31473. tempObj['analyst'] = tempObj['analyst'] || {};
  31474. if (name === 'query' && summaryRegionJobParameter[name]) {
  31475. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  31476. } else {
  31477. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  31478. }
  31479. if(name === 'mappingParameters'){
  31480. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  31481. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  31482. }
  31483. }
  31484. }
  31485. }
  31486. }
  31487. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  31488. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  31489. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31490. * This program are made available under the terms of the Apache License, Version 2.0
  31491. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31492. /**
  31493. * @class SuperMap.SummaryRegionJobsService
  31494. * @category iServer ProcessingService SummaryRegion
  31495. * @classdesc 区域汇总分析服务类
  31496. * @extends {SuperMap.ProcessingServiceBase}
  31497. * @param {string} url - 区域汇总分析服务地址。
  31498. * @param {Object} options - 参数。
  31499. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31500. * @param {Object} [options.headers] - 请求头。
  31501. */
  31502. class SummaryRegionJobsService extends ProcessingServiceBase {
  31503. constructor(url, options) {
  31504. super(url, options);
  31505. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  31506. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  31507. }
  31508. /**
  31509. *@override
  31510. */
  31511. destroy() {
  31512. super.destroy();
  31513. }
  31514. /**
  31515. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  31516. * @description 获取区域汇总分析任务集合。
  31517. */
  31518. getSummaryRegionJobs() {
  31519. super.getJobs(this.url);
  31520. }
  31521. /**
  31522. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  31523. * @description 获取指定id的区域汇总分析任务。
  31524. * @param {string} id -要获取区域汇总分析任务的id
  31525. */
  31526. getSummaryRegionJob(id) {
  31527. super.getJobs(Util.urlPathAppend(this.url, id));
  31528. }
  31529. /**
  31530. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  31531. * @description 新建区域汇总任务。
  31532. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  31533. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  31534. */
  31535. addSummaryRegionJob(params, seconds) {
  31536. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  31537. }
  31538. }
  31539. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  31540. ;// CONCATENATED MODULE: ./src/common/iServer/SupplyCenter.js
  31541. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31542. * This program are made available under the terms of the Apache License, Version 2.0
  31543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31544. /**
  31545. * @class SuperMap.SupplyCenter
  31546. * @category iServer NetworkAnalyst Location
  31547. * @classdesc 资源供给中心类。在资源分配和选址分区分析两个功能中使用。
  31548. * @param {Object} options - 参数。
  31549. * @param {number} options.maxWeight - 资源供给中心的最大耗费值。
  31550. * @param {number} options.nodeID - 资源供给中心点的结点 ID 号。资源供给中心必须是结点。
  31551. * @param {number} options.resourceValue - 资源供给中心能提供的最大服务量或商品数量。
  31552. * @param {SuperMap.SupplyCenterType} [options.type] - 资源供给中心点的类型常量。
  31553. */
  31554. class SupplyCenter {
  31555. constructor(options) {
  31556. /**
  31557. * @member {number} SuperMap.SupplyCenter.prototype.maxWeight
  31558. * @description 资源供给中心的最大耗费值。中心点最大阻值设置越小,表示中心点所提供的资源可影响范围越大。
  31559. * 最大阻力值是用来限制需求点到中心点的花费。
  31560. * 如果需求点(弧段或结点)到此中心的花费大于最大阻力值,则该需求点不属于该资源供给中心提供资源的范围。
  31561. */
  31562. this.maxWeight = null;
  31563. /**
  31564. * @member {number} SuperMap.SupplyCenter.prototype.nodeID
  31565. * @description 资源供给中心点的结点 ID 号,资源供给中心必须是结点。
  31566. */
  31567. this.nodeID = null;
  31568. /**
  31569. * @member {number} SuperMap.SupplyCenter.prototype.resourceValue
  31570. * @description 资源供给中心能提供的最大服务量或商品数量。例如资源中心为学校,资源中心资源量表示该学校能够接纳多少学生。
  31571. */
  31572. this.resourceValue = null;
  31573. /**
  31574. * @member {SuperMap.SupplyCenterType} [SuperMap.SupplyCenter.prototype.type]
  31575. * @description 资源供给中心点的类型常量。资源供给中心点的类型包括非中心,固定中心和可选中心。
  31576. * 固定中心用于资源分配分析;固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  31577. */
  31578. this.type = null;
  31579. if (options) {
  31580. Util.extend(this, options);
  31581. }
  31582. this.CLASS_NAME = "SuperMap.SupplyCenter";
  31583. }
  31584. /**
  31585. * @function SuperMap.SupplyCenter.prototype.destroy
  31586. * @description 释放资源,将引用资源的属性置空。
  31587. */
  31588. destroy() {
  31589. var me = this;
  31590. me.maxWeight = null;
  31591. me.nodeID = null;
  31592. me.resourceValue = null;
  31593. me.type = null;
  31594. }
  31595. /**
  31596. * @function SuperMap.SupplyCenter.fromJson
  31597. * @description 将服务端 JSON 对象转换成当前客户端对象。
  31598. * @param {Object} jsonObject - 要转换的 JSON 对象。
  31599. * @returns {SuperMap.SupplyCenter} SupplyCenter 对象。
  31600. */
  31601. static fromJson(jsonObject) {
  31602. if (!jsonObject) {
  31603. return;
  31604. }
  31605. return new SupplyCenter({
  31606. maxWeight: jsonObject.maxWeight,
  31607. nodeID: jsonObject.nodeID,
  31608. resourceValue: jsonObject.resourceValue,
  31609. type: jsonObject.type
  31610. });
  31611. }
  31612. }
  31613. SuperMap.SupplyCenter = SupplyCenter;
  31614. ;// CONCATENATED MODULE: ./src/common/iServer/SurfaceAnalystService.js
  31615. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31616. * This program are made available under the terms of the Apache License, Version 2.0
  31617. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31618. /**
  31619. * @class SuperMap.SurfaceAnalystService
  31620. * @category iServer SpatialAnalyst SurfaceAnalyst
  31621. * @classdesc 表面分析服务类。
  31622. * 该类负责将客户设置的表面分析服务参数传递给服务端,并接收服务端返回的表面分析服务分析结果数据。
  31623. * 表面分析结果通过该类支持的事件的监听函数参数获取
  31624. * @param {string} url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst
  31625. * @param {Object} options - 参数。</br>
  31626. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31627. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31628. * @param {Object} [options.headers] - 请求头。
  31629. * @extends {SuperMap.SpatialAnalystBase}
  31630. * @example 例如:
  31631. * (start code)
  31632. * var mySurfaceAnalystService = new SuperMap.SurfaceAnalystService(url, {
  31633. * eventListeners: {
  31634. * "processCompleted": surfaceAnalysCompleted,
  31635. * "processFailed": surfaceAnalysFailed
  31636. * }
  31637. * });
  31638. * (end)
  31639. *
  31640. */
  31641. class SurfaceAnalystService extends SpatialAnalystBase {
  31642. constructor(url, options) {
  31643. super(url, options);
  31644. this.CLASS_NAME = "SuperMap.SurfaceAnalystService";
  31645. }
  31646. /**
  31647. * @function SuperMap.SurfaceAnalystService.prototype.destroy
  31648. * @description 释放资源,将引用的资源属性置空。
  31649. */
  31650. destroy() {
  31651. super.destroy();
  31652. }
  31653. /**
  31654. * @function SuperMap.SurfaceAnalystService.prototype.processAsync
  31655. * @description 负责将客户端的表面分析服务参数传递到服务端。
  31656. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  31657. */
  31658. processAsync(params) {
  31659. if (!(params instanceof SurfaceAnalystParameters)) {
  31660. return;
  31661. }
  31662. var me = this, jsonParameters;
  31663. jsonParameters = me.getJsonParameters(params);
  31664. me.request({
  31665. method: "POST",
  31666. data: jsonParameters,
  31667. scope: me,
  31668. success: me.serviceProcessCompleted,
  31669. failure: me.serviceProcessFailed
  31670. });
  31671. }
  31672. /**
  31673. * @function SuperMap.SurfaceAnalystService.prototype.getJsonParameters
  31674. * @description 将参数转化为 JSON 字符串。
  31675. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析提取操作参数类。
  31676. * @returns {Object} 转化后的JSON字符串。
  31677. */
  31678. getJsonParameters(params) {
  31679. var jsonParameters = '';
  31680. var parameterObject = {};
  31681. var me = this;
  31682. if (params instanceof DatasetSurfaceAnalystParameters) {
  31683. me.url = Util.urlPathAppend(
  31684. me.url,
  31685. 'datasets/' + params.dataset + '/' + params.surfaceAnalystMethod.toLowerCase()
  31686. );
  31687. DatasetSurfaceAnalystParameters.toObject(params, parameterObject);
  31688. jsonParameters = Util.toJSON(parameterObject);
  31689. } else if (params instanceof GeometrySurfaceAnalystParameters) {
  31690. me.url = Util.urlPathAppend(me.url, 'geometry/' + params.surfaceAnalystMethod.toLowerCase());
  31691. jsonParameters = Util.toJSON(params);
  31692. } else {
  31693. return;
  31694. }
  31695. me.url = Util.urlAppend(me.url, 'returnContent=true');
  31696. return jsonParameters;
  31697. }
  31698. }
  31699. SuperMap.SurfaceAnalystService = SurfaceAnalystService;
  31700. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationParameters.js
  31701. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31702. * This program are made available under the terms of the Apache License, Version 2.0
  31703. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31704. /**
  31705. * @class SuperMap.TerrainCurvatureCalculationParameters
  31706. * @category iServer SpatialAnalyst TerrainCalculation
  31707. * @classdesc 地形曲率计算参数类。
  31708. * @param {Object} options - 参数。
  31709. * @param {string} options.dataset - 要用来做地形曲率计算数据源中数据集的名称。该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  31710. * @param {string} options.averageCurvatureName - 结果数据集:平均曲率数据集的名称。
  31711. * @param {string} options.profileCurvatureName - 结果数据集:剖面曲率数据集的名称。
  31712. * @param {string} options.planCurvatureName - 结果数据集:平面曲率数据集的名称。
  31713. * @param {number} [options.zFactor=1.0] - 指定的高程缩放系数。1.0 表示不缩放。
  31714. * @param {boolean} [options.deleteExistResultDataset=false] - 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  31715. */
  31716. class TerrainCurvatureCalculationParameters {
  31717. constructor(options) {
  31718. if (!options) {
  31719. return;
  31720. }
  31721. /**
  31722. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.dataset
  31723. * @description 要用来做地形曲率计算数据源中数据集的名称。
  31724. * 该名称用形如"数据集名称@数据源别名"形式来表示,例如:JingjinTerrain@Jingjin。
  31725. * 注:地形曲率计算必须为栅格数据集。
  31726. */
  31727. this.dataset = null;
  31728. /**
  31729. * @member {number} [SuperMap.TerrainCurvatureCalculationParameters.prototype.zFactor=1.0]
  31730. * @description 指定的高程缩放系数。1.0 表示不缩放。
  31731. * 该值是指在 DEM 栅格数据中,栅格值( Z 坐标,即高程值)相对于 X 和 Y 坐标的单位变换系数。
  31732. * 通常有 X,Y,Z 都参加的计算中,需要将高程值乘以一个高程缩放系数,使得三者单位一致。
  31733. * 例如,X、Y 方向上的单位是米,而 Z 方向的单位是英尺,由于 1 英尺等于 0.3048 米,则需要指定缩放系数为 0.3048。
  31734. */
  31735. this.zFactor = 1.0;
  31736. /**
  31737. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.averageCurvatureName
  31738. * @description 结果数据集:平均曲率数据集的名称。
  31739. */
  31740. this.averageCurvatureName = null;
  31741. /**
  31742. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.profileCurvatureName
  31743. * @description 结果数据集:剖面曲率数据集的名称。
  31744. */
  31745. this.profileCurvatureName = "";
  31746. /**
  31747. * @member {string} SuperMap.TerrainCurvatureCalculationParameters.prototype.planCurvatureName
  31748. * @description 结果数据集:平面曲率数据集的名称。
  31749. */
  31750. this.planCurvatureName = "";
  31751. /**
  31752. * @member {boolean} [SuperMap.TerrainCurvatureCalculationParameters.prototype.deleteExistResultDataset=false]
  31753. * @description 如果用户命名的结果数据集名称与已有的数据集重名,是否删除已有的数据集。
  31754. */
  31755. this.deleteExistResultDataset = false;
  31756. Util.extend(this, options);
  31757. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationParameters";
  31758. }
  31759. /**
  31760. * @function SuperMap.TerrainCurvatureCalculationParameters.prototype.destroy
  31761. * @description 释放资源,将引用资源的属性置空。
  31762. */
  31763. destroy() {
  31764. var me = this;
  31765. me.dataset = null;
  31766. me.zFactor = 1.0;
  31767. me.averageCurvatureName = null;
  31768. me.profileCurvatureName = null;
  31769. me.planCurvatureName = null;
  31770. me.deleteExistResultDataset = true;
  31771. }
  31772. /**
  31773. * @function SuperMap.TerrainCurvatureCalculationParameters.toObject
  31774. * @param {Object} derrainCurvatureCalculationParameters - 地形曲率计算参数。
  31775. * @param {Object} tempObj - 目标对象。
  31776. * @description 生成地形曲率计算对象。
  31777. */
  31778. static toObject(derrainCurvatureCalculationParameters, tempObj) {
  31779. for (var name in derrainCurvatureCalculationParameters) {
  31780. if (name !== "dataset") {
  31781. tempObj[name] = derrainCurvatureCalculationParameters[name];
  31782. }
  31783. }
  31784. }
  31785. }
  31786. SuperMap.TerrainCurvatureCalculationParameters = TerrainCurvatureCalculationParameters;
  31787. ;// CONCATENATED MODULE: ./src/common/iServer/TerrainCurvatureCalculationService.js
  31788. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31789. * This program are made available under the terms of the Apache License, Version 2.0
  31790. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31791. /**
  31792. * @class SuperMap.TerrainCurvatureCalculationService
  31793. * @category iServer SpatialAnalyst TerrainCalculation
  31794. * @classdesc 地形曲率计算服务类。
  31795. * @extends {SuperMap.SpatialAnalystBase}
  31796. * @param {Object} options - 参数。
  31797. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  31798. * @param {string} options.url - 服务的访问地址。如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst 。
  31799. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  31800. * @param {Object} [options.headers] - 请求头。
  31801. * @example 例如:
  31802. * (start code)
  31803. * var myTerrainCurvatureCalculationService = new SuperMap.TerrainCurvatureCalculationService(url);
  31804. * myTerrainCurvatureCalculationService.on({
  31805. * "processCompleted": processCompleted,
  31806. * "processFailed": processFailed
  31807. * }
  31808. * );
  31809. * (end)
  31810. *
  31811. */
  31812. class TerrainCurvatureCalculationService extends SpatialAnalystBase {
  31813. constructor(url, options) {
  31814. super(url, options);
  31815. this.CLASS_NAME = "SuperMap.TerrainCurvatureCalculationService";
  31816. }
  31817. /**
  31818. *@override
  31819. */
  31820. destroy() {
  31821. super.destroy();
  31822. }
  31823. /**
  31824. * @function SuperMap.TerrainCurvatureCalculationService.prototype.processAsync
  31825. * @description 负责将客户端的查询参数传递到服务端。
  31826. * @param {SuperMap.TerrainCurvatureCalculationParameters} parameter - 地形曲率计算参数类。
  31827. */
  31828. processAsync(parameter) {
  31829. var me = this;
  31830. var parameterObject = {};
  31831. if (parameter instanceof TerrainCurvatureCalculationParameters) {
  31832. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/terraincalculation/curvature');
  31833. }
  31834. TerrainCurvatureCalculationParameters.toObject(parameter, parameterObject);
  31835. var jsonParameters = SuperMap.Util.toJSON(parameterObject);
  31836. me.url = Util.urlAppend(me.url, 'returnContent=true');
  31837. me.request({
  31838. method: "POST",
  31839. data: jsonParameters,
  31840. scope: me,
  31841. success: me.serviceProcessCompleted,
  31842. failure: me.serviceProcessFailed
  31843. });
  31844. }
  31845. }
  31846. SuperMap.TerrainCurvatureCalculationService = TerrainCurvatureCalculationService;
  31847. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRangeItem.js
  31848. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31849. * This program are made available under the terms of the Apache License, Version 2.0
  31850. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31851. /**
  31852. * @class SuperMap.ThemeGridRangeItem
  31853. * @category iServer Map Theme
  31854. * @classdesc 栅格分段专题图子项类。
  31855. * @description 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  31856. * 本类用来设置每个范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  31857. * @param {Object} options - 参数。
  31858. * @param {SuperMap.ServerColor} options.color - 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  31859. * @param {string} [options.caption] - 栅格分段专题图子项的标题。
  31860. * @param {number} [options.end=0] - 栅格分段专题图子项的终止值。
  31861. * @param {number} [options.start=0] - 栅格分段专题图子项的起始值。
  31862. * @param {boolean} [options.visible=true] - 栅格分段专题图子项是否可见。
  31863. */
  31864. class ThemeGridRangeItem {
  31865. constructor(options) {
  31866. /**
  31867. * @member {string} [SuperMap.ThemeGridRangeItem.prototype.caption]
  31868. * @description 栅格分段专题图子项的标题。
  31869. */
  31870. this.caption = null;
  31871. /**
  31872. * @member {SuperMap.ServerColor} SuperMap.ThemeGridRangeItem.prototype.color
  31873. * @description 栅格分段专题图中每一个分段专题图子项的对应的颜色。
  31874. */
  31875. this.color = new ServerColor();
  31876. /**
  31877. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.end=0]
  31878. * @description 栅格分段专题图子项的终止值,即该段专题值范围的最大值。
  31879. */
  31880. this.end = 0;
  31881. /**
  31882. * @member {number} [SuperMap.ThemeGridRangeItem.prototype.start=0]
  31883. * @description 栅格分段专题图子项的起始值,即该段专题值范围的最小值。
  31884. */
  31885. this.start = 0;
  31886. /**
  31887. * @member {boolean} [SuperMap.ThemeGridRangeItem.prototype.visible=true]
  31888. * @description 栅格分段专题图子项是否可见。
  31889. */
  31890. this.visible = true;
  31891. if (options) {
  31892. Util.extend(this, options);
  31893. }
  31894. this.CLASS_NAME = "SuperMap.ThemeGridRangeItem";
  31895. }
  31896. /**
  31897. * @function SuperMap.ThemeGridRangeItem.prototype.destroy
  31898. * @description 释放资源,将引用资源的属性置空。
  31899. */
  31900. destroy() {
  31901. var me = this;
  31902. me.caption = null;
  31903. me.end = null;
  31904. me.start = null;
  31905. //需要验证是够存在destroy方法
  31906. if (me.color) {
  31907. me.color.destroy();
  31908. me.color = null;
  31909. }
  31910. me.visible = null;
  31911. }
  31912. /**
  31913. * @function SuperMap.ThemeGridRangeItem.prototype.toServerJSONObject
  31914. * @description 转换成对应的 JSON 格式对象。
  31915. * @returns {Object} 对应的 JSON 格式对象。
  31916. */
  31917. toServerJSONObject() {
  31918. var obj = {};
  31919. obj = Util.copyAttributes(obj, this);
  31920. if (obj.color) {
  31921. if (obj.color.toServerJSONObject) {
  31922. obj.color = obj.color.toServerJSONObject();
  31923. }
  31924. }
  31925. return obj;
  31926. }
  31927. /**
  31928. * @function SuperMap.ThemeGridRangeItem.fromObj
  31929. * @description 从传入对象获取栅格分段专题图子项类。
  31930. * @param {Object} obj - 传入对象。
  31931. * @returns {SuperMap.ThemeGridRangeItem} ThemeGridRangeItem 对象。
  31932. */
  31933. static fromObj(obj) {
  31934. if (!obj) {
  31935. return;
  31936. }
  31937. var res = new ThemeGridRangeItem();
  31938. Util.copy(res, obj);
  31939. res.color = ServerColor.fromJson(obj.color);
  31940. return res;
  31941. }
  31942. }
  31943. SuperMap.ThemeGridRangeItem = ThemeGridRangeItem;
  31944. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridRange.js
  31945. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  31946. * This program are made available under the terms of the Apache License, Version 2.0
  31947. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  31948. /**
  31949. * @class SuperMap.ThemeGridRange
  31950. * @category iServer Map Theme
  31951. * @classdesc 栅格分段专题图。
  31952. * @description 栅格分段专题图,是将所有单元格的值按照某种分段方式分成多个范围段,值在同一个范围段中的单元格使用相同的颜色进行显示。
  31953. * 栅格分段专题图一般用来反映连续分布现象的数量或程度特征。比如某年的全国降水量分布图,将各气象站点的观测值经过内插之后生成的栅格数据进行分段显示。
  31954. * 该类类似于分段专题图类,不同点在于分段专题图的操作对象是矢量数据,而栅格分段专题图的操作对象是栅格数据。
  31955. * @extends {SuperMap.Theme}
  31956. * @param {Object} options - 参数。
  31957. * @param {Array.<SuperMap.ThemeGridRangeItem>} options.items - 栅格分段专题图子项数组。
  31958. * @param {boolean} [options.reverseColor=false] - 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  31959. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 分段专题图的分段模式。
  31960. * @param {number} [options.rangeParameter=0] - 分段参数。
  31961. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 渐变颜色枚举类。
  31962. */
  31963. class ThemeGridRange extends Theme {
  31964. constructor(options) {
  31965. super("GRIDRANGE", options);
  31966. /**
  31967. * @member {Array.<SuperMap.ThemeGridRangeItem>} SuperMap.ThemeGridRange.prototype.items
  31968. * @description 栅格分段专题图子项数组。<br>
  31969. * 在栅格分段专题图中,将栅格值按照某种分段模式被分成多个范围段。
  31970. * 本类用来设置每个栅格范围段的分段起始值、终止值、名称和颜色等。每个分段所表示的范围为 [Start,End)。
  31971. */
  31972. this.items = null;
  31973. /**
  31974. * @member {SuperMap.RangeMode} [SuperMap.ThemeGridRange.prototype.rangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  31975. * @description 分段专题图的分段模式。<br>
  31976. * 在栅格分段专题图中,作为专题变量的字段或表达式的值按照某种分段方式被分成多个范围段。
  31977. * 目前 SuperMap 提供的分段方式包括:等距离分段法、平方根分段法、标准差分段法、对数分段法、等计数分段法和自定义距离法,
  31978. * 显然这些分段方法根据一定的距离进行分段,因而范围分段专题图所基于的专题变量必须为数值型。
  31979. */
  31980. this.rangeMode = RangeMode.EQUALINTERVAL;
  31981. /**
  31982. * @member {number} [SuperMap.ThemeGridRange.prototype.rangeParameter=0]
  31983. * @description 分段参数。<br>
  31984. * 当分段模式为等距离分段法,平方根分段,对数分段法,计数分段法其中一种模式时,该参数用于设置分段个数,必设;当分段模式为标准差分段法时,
  31985. * 该参数不起作用;当分段模式为自定义距离时,该参数用于设置自定义距离。
  31986. */
  31987. this.rangeParameter = 0;
  31988. /**
  31989. * @member {SuperMap.ColorGradientType} [SuperMap.ThemeGridRange.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  31990. * @description 渐变颜色枚举类。
  31991. *
  31992. */
  31993. this.colorGradientType = ColorGradientType.YELLOW_RED;
  31994. /**
  31995. * @member {boolean} SuperMap.ThemeGridRange.prototype.reverseColor
  31996. * @description 是否对栅格分段专题图中分段的颜色风格进行反序显示。
  31997. */
  31998. this.reverseColor = false;
  31999. if (options) {
  32000. Util.extend(this, options);
  32001. }
  32002. this.CLASS_NAME = "SuperMap.ThemeGridRange";
  32003. }
  32004. /**
  32005. * @function SuperMap.ThemeGridRange.prototype.destroy
  32006. * @override
  32007. */
  32008. destroy() {
  32009. super.destroy();
  32010. var me = this;
  32011. if (me.items) {
  32012. if (me.items.length > 0) {
  32013. for (var item in me.items) {
  32014. me.items[item].destroy();
  32015. me.items[item] = null;
  32016. }
  32017. }
  32018. me.items = null;
  32019. }
  32020. me.reverseColor = null;
  32021. me.rangeMode = null;
  32022. me.rangeParameter = null;
  32023. me.colorGradientType = null;
  32024. }
  32025. /**
  32026. * @function SuperMap.ThemeGridRange.fromObj
  32027. * @description 从传入对象获取栅格分段专题图。
  32028. * @param {Object} obj - 传入对象。
  32029. * @returns {SuperMap.ThemeGridRange} ThemeGridRange 对象。
  32030. */
  32031. static fromObj(obj) {
  32032. if (!obj) {
  32033. return;
  32034. }
  32035. var res = new ThemeGridRange();
  32036. Util.copy(res, obj);
  32037. var itemsR = obj.items;
  32038. var len = itemsR ? itemsR.length : 0;
  32039. res.items = [];
  32040. for (var i = 0; i < len; i++) {
  32041. res.items.push(ThemeGridRangeItem.fromObj(itemsR[i]));
  32042. }
  32043. return res;
  32044. }
  32045. }
  32046. SuperMap.ThemeGridRange = ThemeGridRange;
  32047. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUniqueItem.js
  32048. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32049. * This program are made available under the terms of the Apache License, Version 2.0
  32050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32051. /**
  32052. * @class SuperMap.ThemeGridUniqueItem
  32053. * @category iServer Map Theme
  32054. * @classdesc 栅格单值专题图子项类。
  32055. * 栅格单值专题图是将值相同的单元格归为一类,每一类是一个专题图子项。
  32056. * @param {Object} options - 参数。
  32057. * @param {string} [options.caption] - 栅格单值专题图子项的名称。
  32058. * @param {SuperMap.ServerColor} [options.color] - 栅格单值专题图子项的显示颜色。
  32059. * @param {number} options.unique - 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  32060. * @param {boolean} [options.visible=true] - 栅格单值专题图子项是否可见。
  32061. */
  32062. class ThemeGridUniqueItem {
  32063. constructor(options) {
  32064. /**
  32065. * @member {string} [SuperMap.ThemeGridUniqueItem.prototype.caption]
  32066. * @description 栅格单值专题图子项的名称。
  32067. */
  32068. this.caption = null;
  32069. /**
  32070. * @member {SuperMap.ServerColor} [SuperMap.ThemeGridUniqueItem.prototype.color]
  32071. * @description 栅格单值专题图子项的显示颜色。
  32072. */
  32073. this.color = new ServerColor();
  32074. /**
  32075. * @member {number} SuperMap.ThemeGridUniqueItem.prototype.unique
  32076. * @description 栅格单值专题图子项的专题值,即单元格的值,值相同的单元格位于一个子项内。
  32077. */
  32078. this.unique = null;
  32079. /**
  32080. * @member {boolean} [SuperMap.ThemeGridUniqueItem.prototype.visible=true]
  32081. * @description 栅格单值专题图子项是否可见。
  32082. */
  32083. this.visible = true;
  32084. if (options) {
  32085. Util.extend(this, options);
  32086. }
  32087. this.CLASS_NAME = "SuperMap.ThemeGridUniqueItem";
  32088. }
  32089. /**
  32090. * @function SuperMap.ThemeGridUniqueItem.prototype.destroy
  32091. * @description 释放资源,将引用资源的属性置空。
  32092. */
  32093. destroy() {
  32094. var me = this;
  32095. me.caption = null;
  32096. me.unique = null;
  32097. if (me.color) {
  32098. me.color.destroy();
  32099. me.color = null;
  32100. }
  32101. me.visible = null;
  32102. }
  32103. /**
  32104. * @function SuperMap.ThemeGridUniqueItem.prototype.toServerJSONObject
  32105. * @description 转换成对应的 JSON 格式对象。
  32106. * @returns {Object} 对应的 JSON 格式对象。
  32107. */
  32108. toServerJSONObject() {
  32109. var obj = {};
  32110. obj = Util.copyAttributes(obj, this);
  32111. if (obj.color) {
  32112. if (obj.color.toServerJSONObject) {
  32113. obj.color = obj.color.toServerJSONObject();
  32114. }
  32115. }
  32116. return obj;
  32117. }
  32118. /**
  32119. * @function SuperMap.ThemeGridUniqueItem.fromObj
  32120. * @description 从传入对象获取栅格单值专题图子项类。
  32121. * @param {Object} obj - 传入对象。
  32122. * @returns {SuperMap.ThemeGridUniqueItem} ThemeGridUniqueItem 对象。
  32123. */
  32124. static fromObj(obj) {
  32125. var res = new ThemeGridUniqueItem();
  32126. Util.copy(res, obj);
  32127. res.color = ServerColor.fromJson(obj.color);
  32128. return res;
  32129. }
  32130. }
  32131. SuperMap.ThemeGridUniqueItem = ThemeGridUniqueItem;
  32132. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeGridUnique.js
  32133. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32134. * This program are made available under the terms of the Apache License, Version 2.0
  32135. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32136. /**
  32137. * @class SuperMap.ThemeGridUnique
  32138. * @category iServer Map Theme
  32139. * @classdesc 栅格单值专题图类。
  32140. * @description 栅格单值专题图,是将单元格值相同的归为一类,为每一类设定一种颜色,从而用来区分不同的类别。<br>
  32141. * 栅格单值专题图适用于离散栅格数据和部分连续栅格数据,对于单元格值各不相同的那些连续栅格数据,使用栅格单值专题图不具有任何意义。
  32142. * @extends {SuperMap.Theme}
  32143. * @param {Object} options - 参数。
  32144. * @param {Array.<SuperMap.ThemeGridUniqueItem>} options.items - 栅格单值专题图子项数组。
  32145. * @param {SuperMap.ServerColor} [options.defaultcolor] - 栅格单值专题图的默认颜色。
  32146. */
  32147. class ThemeGridUnique extends Theme {
  32148. constructor(options) {
  32149. super("GRIDUNIQUE", options);
  32150. /**
  32151. * @member {SuperMap.ServerColor} SuperMap.ThemeGridUnique.prototype.defaultcolor
  32152. * @description 栅格单值专题图的默认颜色。
  32153. * 对于那些未在格网单值专题图子项之列的要素使用该颜色显示。
  32154. */
  32155. this.defaultcolor = new ServerColor();
  32156. /**
  32157. * @member {Array.<SuperMap.ThemeGridUniqueItem>} SuperMap.ThemeGridUnique.prototype.items
  32158. * @description 栅格单值专题图子项数组。
  32159. * 栅格单值专题图将值相同的单元格归为一类,每一类是一个专题图子项。
  32160. */
  32161. this.items = null;
  32162. if (options) {
  32163. Util.extend(this, options);
  32164. }
  32165. this.CLASS_NAME = "SuperMap.ThemeGridUnique";
  32166. }
  32167. /**
  32168. * @function SuperMap.ThemeGridUnique.prototype.destroy
  32169. * @override
  32170. */
  32171. destroy() {
  32172. super.destroy();
  32173. var me = this;
  32174. if (me.items) {
  32175. if (me.items.length > 0) {
  32176. for (var item in me.items) {
  32177. me.items[item].destroy();
  32178. me.items[item] = null;
  32179. }
  32180. }
  32181. me.items = null;
  32182. }
  32183. if (me.defaultcolor) {
  32184. me.defaultcolor.destroy();
  32185. me.defaultcolor = null;
  32186. }
  32187. }
  32188. /**
  32189. * @function SuperMap.ThemeGridUnique.prototype.toServerJSONObject
  32190. * @description 转换成对应的 JSON 格式对象。
  32191. * @returns {Object} 对应的 JSON 格式对象
  32192. */
  32193. toServerJSONObject() {
  32194. var obj = {};
  32195. obj = Util.copyAttributes(obj, this);
  32196. if (obj.defaultcolor) {
  32197. if (obj.defaultcolor.toServerJSONObject) {
  32198. obj.defaultcolor = obj.defaultcolor.toServerJSONObject();
  32199. }
  32200. }
  32201. if (obj.items) {
  32202. var items = [],
  32203. len = obj.items.length;
  32204. for (var i = 0; i < len; i++) {
  32205. items.push(obj.items[i].toServerJSONObject());
  32206. }
  32207. obj.items = items;
  32208. }
  32209. return obj;
  32210. }
  32211. /**
  32212. * @function SuperMap.ThemeGridUnique.fromObj
  32213. * @description 从传入对象获取栅格单值专题图类。
  32214. * @param {Object} obj - 传入对象
  32215. * @returns {SuperMap.ThemeGridUnique} ThemeGridUnique 对象
  32216. */
  32217. static fromObj(obj) {
  32218. var res = new ThemeGridUnique();
  32219. var uItems = obj.items;
  32220. var len = uItems ? uItems.length : 0;
  32221. Util.extend(res, obj);
  32222. res.items = [];
  32223. res.defaultcolor = ServerColor.fromJson(obj.defaultcolor);
  32224. for (var i = 0; i < len; i++) {
  32225. res.items.push(ThemeGridUniqueItem.fromObj(uItems[i]));
  32226. }
  32227. return res;
  32228. }
  32229. }
  32230. SuperMap.ThemeGridUnique = ThemeGridUnique;
  32231. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeLabelUniqueItem.js
  32232. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32233. * This program are made available under the terms of the Apache License, Version 2.0
  32234. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32235. /**
  32236. * @class SuperMap.ThemeLabelUniqueItem
  32237. * @category iServer Map Theme
  32238. * @classdesc 单值标签专题图的子项。
  32239. * @description 标签专题图用专题值对点、线、面等对象做标注,值得注意的是,单值标签专题图允许用户通过 uniqueExpression
  32240. * 字段指定用于单值的字段,同一值的标签具有相同的显示风格,其中每一个值就是一个专题图子项,
  32241. * 每一个子项都具有其名称、风格、指定的单值、X 方向偏移量和 Y 方向偏移量。
  32242. * @param {Object} options - 参数。
  32243. * @param {string} options.unique - 单值专题图子项的值,可以为数字、字符串等。
  32244. * @param {string} [options.caption] - 专题图子项的名称。
  32245. * @param {number} [options.offsetX=0] - 标签在 X 方向偏移量。
  32246. * @param {number} [options.offsetY=0] - 标签在 Y 方向偏移量。
  32247. * @param {boolean} [options.visible=true] - 标签专题图子项是否可见。
  32248. * @param {SuperMap.ServerTextStyle} [options.style] - 标签专题图子项文本的显示风格。
  32249. */
  32250. class ThemeLabelUniqueItem {
  32251. constructor(options) {
  32252. /**
  32253. * @member {string} [SuperMap.ThemeLabelUniqueItem.prototype.caption]
  32254. * @description 标签专题子项的标题。
  32255. */
  32256. this.caption = null;
  32257. /**
  32258. * @member {string} SuperMap.ThemeLabelUniqueItem.prototype.unique
  32259. * @description 单值专题图子项的值,可以为数字、字符串等。
  32260. */
  32261. this.unique = null;
  32262. /**
  32263. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetX=0]
  32264. * @description 标签在 X 方向偏移量。
  32265. */
  32266. this.offsetX = 0;
  32267. /**
  32268. * @member {number} [SuperMap.ThemeLabelUniqueItem.prototype.offsetY=0]
  32269. * @description 标签在 Y 方向偏移量。
  32270. */
  32271. this.offsetY = 0;
  32272. /**
  32273. * @member {boolean} [SuperMap.ThemeLabelUniqueItem.prototype.visible=true]
  32274. * @description 标签专题图子项是否可见。如果标签专题图子项可见,则为 true,否则为 false。
  32275. */
  32276. this.visible = true;
  32277. /**
  32278. * @member {SuperMap.ServerTextStyle} SuperMap.ThemeLabelUniqueItem.prototype.style
  32279. * @description 标签专题图子项文本的显示风格。各种风格的优先级从高到低为:<br>
  32280. * uniformMixedStyle(标签文本的复合风格),SuperMap.ThemeLabelUniqueItem.style(单值子项的文本风格),uniformStyle(统一文本风格)。
  32281. */
  32282. this.style = new ServerTextStyle();
  32283. if (options) {
  32284. Util.extend(this, options);
  32285. }
  32286. this.CLASS_NAME = "SuperMap.ThemeLabelUniqueItem";
  32287. }
  32288. /**
  32289. * @function SuperMap.ThemeLabelUniqueItem.prototype.destroy
  32290. * @description 释放资源,将引用资源的属性置空。
  32291. */
  32292. destroy() {
  32293. var me = this;
  32294. me.unique = null;
  32295. me.caption = null;
  32296. me.offsetX = null;
  32297. me.offsetY = null;
  32298. if (me.style) {
  32299. me.style.destroy();
  32300. me.style = null;
  32301. }
  32302. me.visible = null;
  32303. }
  32304. /**
  32305. * @function SuperMap.ThemeLabelUniqueItem.fromObj
  32306. * @description 从传入对象获取单值标签专题图的子项类。
  32307. * @param {Object} obj - 传入对象。
  32308. * @returns {SuperMap.ThemeLabelUniqueItem} ThemeLabelUniqueItem 对象。
  32309. */
  32310. static fromObj(obj) {
  32311. if (!obj) {
  32312. return;
  32313. }
  32314. var t = new ThemeLabelUniqueItem();
  32315. Util.copy(t, obj);
  32316. return t;
  32317. }
  32318. }
  32319. SuperMap.ThemeLabelUniqueItem = ThemeLabelUniqueItem;
  32320. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeParameters.js
  32321. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32322. * This program are made available under the terms of the Apache License, Version 2.0
  32323. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32324. /**
  32325. * @class SuperMap.ThemeParameters
  32326. * @category iServer Map Theme
  32327. * @classdesc 专题图参数类。
  32328. * 该类存储了制作专题所需的参数,包括数据源、数据集名称和专题图对象。
  32329. * @param {Object} options - 参数。
  32330. * @param {Array.<string>} options.datasetNames - 要制作专题图的数据集数组。
  32331. * @param {Array.<string>} options.dataSourceNames - 要制作专题图的数据集所在的数据源数组。
  32332. * @param {Array.<SuperMap.JoinItem>} [options.joinItems] - 专题图外部表的连接信息 JoinItem 数组。
  32333. * @param {Array.<SuperMap.Theme>} options.themes - 专题图对象列表。
  32334. * @param {Array.<string>} [options.displayFilters] - 专题图属性过滤条件。
  32335. * @param {Array.<string>} [options.displayOrderBys] - 专题图对象生成符号叠加次序排序字段。
  32336. * @param {Object} [options.fieldValuesDisplayFilter] - 图层要素的显示和隐藏的过滤属性,其带有三个属性,分别是:values、fieldName、fieldValuesDisplayMode。
  32337. */
  32338. class ThemeParameters {
  32339. constructor(options) {
  32340. /**
  32341. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.datasetNames
  32342. * @description 要制作专题图的数据集数组。
  32343. */
  32344. this.datasetNames = null;
  32345. /**
  32346. * @member {Array.<string>} SuperMap.ThemeParameters.prototype.dataSourceNames
  32347. * @description 要制作专题图的数据集所在的数据源数组。
  32348. */
  32349. this.dataSourceNames = null;
  32350. /**
  32351. * @member {Array.<SuperMap.JoinItem>} [SuperMap.ThemeParameters.prototype.joinItems]
  32352. * @description 设置与外部表的连接信息 JoinItem 数组。
  32353. * 使用此属性可以制作与外部表连接的专题图。
  32354. */
  32355. this.joinItems = null;
  32356. /**
  32357. * @member {Array.<SuperMap.Theme>} SuperMap.ThemeParameters.prototype.themes
  32358. * @description 专题图对象列表。
  32359. * 该参数为实例化的各类专题图对象的集合。
  32360. */
  32361. this.themes = null;
  32362. /**
  32363. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayFilters]
  32364. * @description 专题图属性过滤条件。
  32365. */
  32366. this.displayFilters = null;
  32367. /**
  32368. * @member {Array.<string>} [SuperMap.ThemeParameters.prototype.displayOrderBys]
  32369. * @description 专题图对象生成符号叠加次序排序字段。
  32370. */
  32371. this.displayOrderBys = null;
  32372. /**
  32373. * @member {Object} [SuperMap.ThemeParameters.prototype.fieldValuesDisplayFilter]
  32374. * @property {Array.<number>} values - 需要过滤的值。
  32375. * @property {string} fieldName - 要过滤的字段名称只支持数字类型的字段。
  32376. * @property {string} fieldValuesDisplayMode - 目前为 DISPLAY/DISABLE。当为 DISPLAY 时,表示只显示以上设置的相应属性值的要素,否则表示不显示以上设置的相应属性值的要素。
  32377. */
  32378. this.fieldValuesDisplayFilter = null;
  32379. if (options) {
  32380. Util.extend(this, options);
  32381. }
  32382. this.CLASS_NAME = "SuperMap.ThemeParameters";
  32383. }
  32384. /**
  32385. * @function SuperMap.ThemeParameters.prototype.destroy
  32386. * @description 释放资源,将引用资源的属性置空。
  32387. */
  32388. destroy() {
  32389. var me = this;
  32390. me.datasetNames = null;
  32391. me.dataSourceNames = null;
  32392. if (me.joinItems) {
  32393. for (let i = 0, joinItems = me.joinItems, len = joinItems.length; i < len; i++) {
  32394. joinItems[i].destroy();
  32395. }
  32396. me.joinItems = null;
  32397. }
  32398. if (me.themes) {
  32399. for (let i = 0, themes = me.themes, len = themes.length; i < len; i++) {
  32400. themes[i].destroy();
  32401. }
  32402. me.themes = null;
  32403. }
  32404. }
  32405. }
  32406. SuperMap.ThemeParameters = ThemeParameters;
  32407. ;// CONCATENATED MODULE: ./src/common/iServer/ThemeService.js
  32408. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32409. * This program are made available under the terms of the Apache License, Version 2.0
  32410. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32411. /**
  32412. * @class SuperMap.ThemeService
  32413. * @category iServer Map Theme
  32414. * @classdesc 专题图服务类。
  32415. * @extends {SuperMap.CommonServiceBase}
  32416. * @example
  32417. * var myThemeService = new SuperMap.ThemeService(url, {
  32418. * eventListeners: {
  32419. * "processCompleted": themeCompleted,
  32420. * "processFailed": themeFailed
  32421. * }
  32422. * });
  32423. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  32424. * @param {Object} options - 参数。
  32425. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32426. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32427. * @param {Object} [options.headers] - 请求头。
  32428. */
  32429. class ThemeService_ThemeService extends CommonServiceBase {
  32430. constructor(url, options) {
  32431. super(url, options);
  32432. if (options) {
  32433. SuperMap.Util.extend(this, options);
  32434. }
  32435. this.url = Util.urlPathAppend(this.url, 'tempLayersSet');
  32436. this.CLASS_NAME = 'SuperMap.ThemeService';
  32437. }
  32438. /**
  32439. * @override
  32440. */
  32441. destroy() {
  32442. super.destroy();
  32443. }
  32444. /**
  32445. * @function SuperMap.ThemeService.prototype.processAsync
  32446. * @description 负责将客户端的专题图参数传递到服务端。
  32447. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  32448. */
  32449. processAsync(params) {
  32450. if (!(params instanceof ThemeParameters)) {
  32451. return;
  32452. }
  32453. var me = this,
  32454. jsonParameters = null;
  32455. jsonParameters = me.getJsonParameters(params);
  32456. me.request({
  32457. method: "POST",
  32458. data: jsonParameters,
  32459. scope: me,
  32460. success: me.serviceProcessCompleted,
  32461. failure: me.serviceProcessFailed
  32462. });
  32463. }
  32464. /**
  32465. * @function SuperMap.ThemeService.prototype.getJsonParameters
  32466. * @description 将专题图参数参数转化为 JSON 字符串。
  32467. * @param {SuperMap.ThemeParameters} parameter - 专题图参数类。
  32468. * @returns {Object} 转化后的JSON字符串。
  32469. */
  32470. getJsonParameters(parameter) {
  32471. var jsonParameters = "",
  32472. themeObj = null,
  32473. filters = null,
  32474. orderBys = null,
  32475. fieldValuesDisplayFilter;
  32476. jsonParameters += "[{'type': 'UGC','subLayers': {'layers': [";
  32477. for (var i = 0; i < parameter.themes.length; i++) {
  32478. themeObj = parameter.themes[i];
  32479. var jsonTheme = Util.toJSON(themeObj);
  32480. jsonTheme = jsonTheme.slice(0, -1);
  32481. jsonParameters += "{'theme': " + jsonTheme + "},'type': 'UGC','ugcLayerType': 'THEME',";
  32482. filters = parameter.displayFilters;
  32483. if (filters && filters.length > 0) {
  32484. if (filters.length === 1) {
  32485. jsonParameters += "'displayFilter':\"" + filters[0] + "\",";
  32486. } else {
  32487. jsonParameters += "'displayFilter':\"" + filters[i] + "\",";
  32488. }
  32489. }
  32490. orderBys = parameter.displayOrderBy;
  32491. if (orderBys && orderBys.length > 0) {
  32492. if (orderBys.length === 1) {
  32493. jsonParameters += "'displayOrderBy':'" + orderBys[0] + "',";
  32494. } else {
  32495. jsonParameters += "'displayOrderBy':'" + orderBys[i] + "',";
  32496. }
  32497. }
  32498. fieldValuesDisplayFilter = parameter.fieldValuesDisplayFilter;
  32499. if (fieldValuesDisplayFilter) {
  32500. jsonParameters += "'fieldValuesDisplayFilter':" + Util.toJSON(fieldValuesDisplayFilter) + ",";
  32501. }
  32502. if (parameter.joinItems && parameter.joinItems.length > 0 && parameter.joinItems[i]) {
  32503. jsonParameters += "'joinItems':[" + Util.toJSON(parameter.joinItems[i]) + "],";
  32504. }
  32505. if (parameter.datasetNames && parameter.dataSourceNames) {
  32506. var datasetID = parameter.datasetNames[i] ? i : (parameter.datasetNames.length - 1);
  32507. var dataSourceID = parameter.dataSourceNames[i] ? i : (parameter.dataSourceNames.length - 1);
  32508. jsonParameters += "'datasetInfo': {'name': '" + parameter.datasetNames[datasetID] +
  32509. "','dataSourceName': '" + parameter.dataSourceNames[dataSourceID] + "'}},";
  32510. } else {
  32511. jsonParameters += "},";
  32512. }
  32513. }
  32514. //去除多余的逗号
  32515. if (parameter.themes && parameter.themes.length > 0) {
  32516. jsonParameters = jsonParameters.substring(0, jsonParameters.length - 1);
  32517. }
  32518. jsonParameters += "]},";
  32519. var urlArray = this.url.split("/");
  32520. var jsonMapName = urlArray[urlArray.length - 2];
  32521. jsonParameters += "'name': '" + jsonMapName + "'}]";
  32522. return jsonParameters;
  32523. }
  32524. }
  32525. SuperMap.ThemeService = ThemeService_ThemeService;
  32526. ;// CONCATENATED MODULE: ./src/common/iServer/ThiessenAnalystService.js
  32527. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32528. * This program are made available under the terms of the Apache License, Version 2.0
  32529. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32530. /**
  32531. * @class SuperMap.ThiessenAnalystService
  32532. * @category iServer SpatialAnalyst ThiessenPolygonAnalyst
  32533. * @classdesc
  32534. * 泰森多边形分析服务类
  32535. * 该类负责将客户设置的泰森多边形分析参数传递给服务端,并接收服务端返回的分析结果数据。
  32536. * 泰森多边形分析结果通过该类支持的事件的监听函数参数获取
  32537. * 泰森多边形分析的参数支持两种,当参数为 {SuperMap.DatasetThiessenAnalystParameters} 类型
  32538. * 时,执行数据集泰森多边形分析,当参数为 {SuperMap.GeometryThiessenAnalystParameters} 类型时,
  32539. * 执行几何对象泰森多边形分析。
  32540. * @param url - {string} 服务的访问地址。
  32541. * 如 http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  32542. * @param {Object} options - 参数。</br>
  32543. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32544. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32545. * @param {Object} [options.headers] - 请求头。
  32546. * @extends {SuperMap.SpatialAnalystBase}
  32547. * @example 例如:
  32548. * (start code)
  32549. * var myThiessenAnalystService = new SuperMap.ThiessenAnalystService(url, {
  32550. * eventListeners: {
  32551. * "processCompleted": bufferCompleted,
  32552. * "processFailed": bufferFailed
  32553. * }
  32554. * });
  32555. * (end)
  32556. *
  32557. */
  32558. class ThiessenAnalystService extends SpatialAnalystBase {
  32559. constructor(url, options) {
  32560. super(url, options);
  32561. /**
  32562. * @member {string} SuperMap.ThiessenAnalystService.prototype.mode
  32563. * @description 缓冲区分析类型
  32564. */
  32565. this.mode = null;
  32566. if (options) {
  32567. Util.extend(this, options);
  32568. }
  32569. this.CLASS_NAME = "SuperMap.ThiessenAnalystService";
  32570. }
  32571. /**
  32572. * @override
  32573. */
  32574. destroy() {
  32575. super.destroy();
  32576. this.mode = null;
  32577. }
  32578. /**
  32579. * @function SuperMap.ThiessenAnalystService.prototype.processAsync
  32580. * @description 负责将客户端的查询参数传递到服务端。
  32581. * @param {(SuperMap.DatasetThiessenAnalystParameters|GeometryThiessenAnalystParameters)} parameter - 泰森多边形分析参数基类。
  32582. */
  32583. processAsync(parameter) {
  32584. var parameterObject = {};
  32585. var me = this;
  32586. if (parameter instanceof DatasetThiessenAnalystParameters) {
  32587. me.mode = "datasets";
  32588. me.url = Util.urlPathAppend(me.url, 'datasets/' + parameter.dataset + '/thiessenpolygon');
  32589. DatasetThiessenAnalystParameters.toObject(parameter, parameterObject);
  32590. } else if (parameter instanceof GeometryThiessenAnalystParameters) {
  32591. me.mode = "geometry";
  32592. me.url = Util.urlPathAppend(me.url, 'geometry/thiessenpolygon');
  32593. GeometryThiessenAnalystParameters.toObject(parameter, parameterObject);
  32594. }
  32595. var jsonParameters = Util.toJSON(parameterObject);
  32596. me.url = Util.urlAppend(me.url, 'returnContent=true');
  32597. me.request({
  32598. method: "POST",
  32599. data: jsonParameters,
  32600. scope: me,
  32601. success: me.serviceProcessCompleted,
  32602. failure: me.serviceProcessFailed
  32603. });
  32604. }
  32605. }
  32606. SuperMap.ThiessenAnalystService = ThiessenAnalystService;
  32607. ;// CONCATENATED MODULE: ./src/common/iServer/GeometryBatchAnalystService.js
  32608. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32609. * This program are made available under the terms of the Apache License, Version 2.0
  32610. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32611. /**
  32612. * @class SuperMap.GeometryBatchAnalystService
  32613. * @category iServer SpatialAnalyst BatchAnalyst
  32614. * @classdesc 批量空间分析服务类
  32615. * @description 该类负责将客户设置的叠加分析参数传递给服务端,并接收服务端返回的叠加分析结果数据。
  32616. * 叠加分析结果通过该类支持的事件的监听函数参数获取,参数类型为 {<SuperMap.REST.OverlayAnalystEventArgs>}; 获取的结果数据包括 originResult 、result 两种,
  32617. * 其中,originResult 为服务端返回的用 JSON 对象表示的量算结果数据,result 为服务端返回的量算结果数据。
  32618. * @extends {SuperMap.SpatialAnalystBase}
  32619. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/spatialanalyst-changchun/restjsr/spatialanalyst。
  32620. * @param {Object} options - 参数。
  32621. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  32622. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32623. * @param {Object} [options.headers] - 请求头。
  32624. * @example
  32625. * var myOverlayAnalystService = new SuperMap.REST.GeometryBatchAnalystService(url, {
  32626. * eventListeners: {
  32627. * "processCompleted": OverlayCompleted,
  32628. * "processFailed": OverlayFailed
  32629. * }
  32630. * });
  32631. */
  32632. class GeometryBatchAnalystService extends SpatialAnalystBase {
  32633. constructor(url, options) {
  32634. super(url, options);
  32635. if (options) {
  32636. Util.extend(this, options);
  32637. }
  32638. this.CLASS_NAME = "SuperMap.GeometryBatchAnalystService";
  32639. }
  32640. /**
  32641. * @function SuperMap.GeometryBatchAnalystService.prototype.processAsync
  32642. * @description 负责将客户端的查询参数传递到服务端。
  32643. * @param {SuperMap.GeometryBatchOverlayAnalystParameters} parameter - 批量几何对象叠加分析参数类
  32644. *
  32645. */
  32646. processAsync(parameters) {
  32647. var me = this;
  32648. me.url = Util.urlPathAppend(me.url, 'geometry/batchanalyst');
  32649. me.url = Util.urlAppend(me.url, 'returnContent=true&ignoreAnalystParam=true');
  32650. var parameterObjects = me._processParams(parameters);
  32651. var jsonParameters = Util.toJSON(parameterObjects);
  32652. me.request({
  32653. method: "POST",
  32654. data: jsonParameters,
  32655. scope: me,
  32656. success: me.serviceProcessCompleted,
  32657. failure: me.serviceProcessFailed
  32658. });
  32659. }
  32660. _processParams(parameters) {
  32661. var me = this;
  32662. if (!Util.isArray(parameters)) {
  32663. return;
  32664. }
  32665. var processParams = [];
  32666. parameters.map(function (item) {
  32667. processParams.push(me._toJSON(item));
  32668. return item;
  32669. });
  32670. return processParams;
  32671. }
  32672. _toJSON(parameter) {
  32673. var tempObj = {};
  32674. if(parameter.analystName ==="buffer"){
  32675. tempObj.analystName = "buffer";
  32676. tempObj.param = {};
  32677. //几何对象的批量空间分析,
  32678. GeometryBufferAnalystParameters.toObject(parameter.param, tempObj.param);
  32679. }else if(parameter.analystName ==="overlay"){
  32680. tempObj.analystName = "overlay";
  32681. tempObj.param = {};
  32682. GeometryOverlayAnalystParameters.toObject(parameter.param, tempObj.param);
  32683. }else if(parameter.analystName ==="interpolationDensity"){
  32684. tempObj.analystName = "interpolationDensity";
  32685. tempObj.param = {};
  32686. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  32687. }else if(parameter.analystName ==="interpolationidw"){
  32688. tempObj.analystName = "interpolationidw";
  32689. tempObj.param = {};
  32690. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  32691. }else if(parameter.analystName ==="interpolationRBF"){
  32692. tempObj.analystName = "interpolationRBF";
  32693. tempObj.param = {};
  32694. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  32695. }else if(parameter.analystName ==="interpolationKriging"){
  32696. tempObj.analystName = "interpolationKriging";
  32697. tempObj.param = {};
  32698. InterpolationAnalystParameters.toObject(parameter.param, tempObj.param);
  32699. }else if(parameter.analystName ==="thiessenpolygon"){
  32700. tempObj.analystName = "thiessenpolygon";
  32701. tempObj.param = {};
  32702. GeometryThiessenAnalystParameters.toObject(parameter.param, tempObj.param);
  32703. }else {
  32704. //isoline; isoregion; calculatemeasure; routelocator 四种分析不需要再处理参数
  32705. return parameter;
  32706. }
  32707. return tempObj;
  32708. }
  32709. /**
  32710. * @override
  32711. */
  32712. destroy() {
  32713. super.destroy();
  32714. }
  32715. }
  32716. SuperMap.GeometryBatchAnalystService = GeometryBatchAnalystService;
  32717. ;// CONCATENATED MODULE: ./src/common/iServer/TilesetsService.js
  32718. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32719. * This program are made available under the terms of the Apache License, Version 2.0
  32720. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32721. /**
  32722. * @class SuperMap.TilesetsService
  32723. * @category iServer Map Tilesets
  32724. * @classdesc 切片列表信息查询服务类;即查询切片地图服务的切片列表,返回切片集名称、地图切片元数据信息、切片版本集信息。
  32725. * @extends {SuperMap.CommonServiceBase}
  32726. * @param {string} url - 地图服务地址。URL 应为:
  32727. * http://{服务器地址}:{服务端口号}/iserver/services/{服务名}/rest/maps/map;
  32728. * 例如: "http://localhost:8090/iserver/services/test/rest/maps/tianlocal"。
  32729. * @param {Object} options - 参数。
  32730. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  32731. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  32732. * @param {SuperMap.DataFormat} [options.format=SuperMap.DataFormat.GEOJSON] - 查询结果返回格式,目前支持 iServerJSON 和 GeoJSON 两种格式。参数格式为 "ISERVER","GEOJSON"。
  32733. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32734. * @param {Object} [options.headers] - 请求头。
  32735. */
  32736. class TilesetsService extends CommonServiceBase {
  32737. constructor(url, options) {
  32738. super(url, options);
  32739. this.CLASS_NAME = "SuperMap.TilesetsService";
  32740. }
  32741. /**
  32742. * @override
  32743. */
  32744. destroy() {
  32745. super.destroy();
  32746. }
  32747. /**
  32748. * @function SuperMap.TilesetsService.prototype.processAsync
  32749. * @description 负责将客户端的查询参数传递到服务端。
  32750. */
  32751. processAsync() {
  32752. if (!this.url) {
  32753. return;
  32754. }
  32755. var me = this;
  32756. me.url = Util.urlPathAppend(me.url, 'tilesets');
  32757. me.request({
  32758. method: "GET",
  32759. scope: me,
  32760. success: me.serviceProcessCompleted,
  32761. failure: me.serviceProcessFailed
  32762. });
  32763. }
  32764. }
  32765. SuperMap.TilesetsService = TilesetsService;
  32766. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  32767. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32768. * This program are made available under the terms of the Apache License, Version 2.0
  32769. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32770. /**
  32771. * @class SuperMap.TopologyValidatorJobsParameter
  32772. * @category iServer ProcessingService TopologyValidator
  32773. * @classdesc 拓扑检查分析任务参数类。
  32774. * @param {Object} options - 必填参数。
  32775. * @param {string} options.datasetName - 数据集名。
  32776. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  32777. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  32778. * @param {string} [options.tolerance] - 容限。
  32779. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  32780. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  32781. */
  32782. class TopologyValidatorJobsParameter {
  32783. constructor(options) {
  32784. if (!options) {
  32785. return;
  32786. }
  32787. /**
  32788. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  32789. * @description 数据集名。
  32790. */
  32791. this.datasetName = "";
  32792. /**
  32793. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  32794. * @description 拓扑检查对象所在的数据集名称。
  32795. */
  32796. this.datasetTopology = "";
  32797. /**
  32798. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  32799. * @description 容限,指定的拓扑错误检查时使用的容限。
  32800. */
  32801. this.tolerance = "";
  32802. /**
  32803. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  32804. * @description 拓扑检查模式。
  32805. */
  32806. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  32807. /**
  32808. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  32809. * @description 输出参数设置类。
  32810. */
  32811. this.output = null;
  32812. /**
  32813. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  32814. * @description 分析后结果可视化的参数类。
  32815. */
  32816. this.mappingParameters = null;
  32817. Util.extend(this, options);
  32818. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  32819. }
  32820. /**
  32821. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  32822. * @description 释放资源,将引用资源的属性置空。
  32823. */
  32824. destroy() {
  32825. this.datasetName = null;
  32826. this.datasetTopology = null;
  32827. this.tolerance = null;
  32828. this.rule = null;
  32829. if (this.output instanceof OutputSetting) {
  32830. this.output.destroy();
  32831. this.output = null;
  32832. }
  32833. if (this.mappingParameters instanceof MappingParameters) {
  32834. this.mappingParameters.destroy();
  32835. this.mappingParameters = null;
  32836. }
  32837. }
  32838. /**
  32839. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  32840. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  32841. * @param {Object} tempObj - 目标对象。
  32842. * @description 生成拓扑检查分析任务对象。
  32843. */
  32844. static toObject(TopologyValidatorJobsParameter, tempObj) {
  32845. for (var name in TopologyValidatorJobsParameter) {
  32846. if (name === "datasetName") {
  32847. tempObj['input'] = tempObj['input'] || {};
  32848. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  32849. continue;
  32850. }
  32851. if (name === "output") {
  32852. tempObj['output'] = tempObj['output'] || {};
  32853. tempObj['output'] = TopologyValidatorJobsParameter[name];
  32854. continue;
  32855. }
  32856. tempObj['analyst'] = tempObj['analyst'] || {};
  32857. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  32858. if(name === 'mappingParameters'){
  32859. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  32860. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  32861. }
  32862. }
  32863. }
  32864. }
  32865. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  32866. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  32867. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32868. * This program are made available under the terms of the Apache License, Version 2.0
  32869. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32870. /**
  32871. * @class SuperMap.TopologyValidatorJobsService
  32872. * @category iServer ProcessingService TopologyValidator
  32873. * @classdesc 拓扑检查分析服务类
  32874. * @extends {SuperMap.ProcessingServiceBase}
  32875. * @param {string} url - 拓扑检查分析服务地址。
  32876. * @param {Object} options - 参数。
  32877. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  32878. * @param {Object} [options.headers] - 请求头。
  32879. */
  32880. class TopologyValidatorJobsService extends ProcessingServiceBase {
  32881. constructor(url, options) {
  32882. super(url, options);
  32883. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  32884. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  32885. }
  32886. /**
  32887. *@override
  32888. */
  32889. destroy() {
  32890. super.destroy();
  32891. }
  32892. /**
  32893. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  32894. * @description 获取拓扑检查分析所有任务
  32895. */
  32896. getTopologyValidatorJobs() {
  32897. super.getJobs(this.url);
  32898. }
  32899. /**
  32900. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  32901. * @description 获取指定id的拓扑检查分析服务
  32902. * @param {string} id - 指定要获取数据的id
  32903. */
  32904. getTopologyValidatorJob(id) {
  32905. super.getJobs( Util.urlPathAppend(this.url, id));
  32906. }
  32907. /**
  32908. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  32909. * @description 新建拓扑检查分析服务
  32910. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  32911. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  32912. */
  32913. addTopologyValidatorJob(params, seconds) {
  32914. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  32915. }
  32916. }
  32917. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  32918. ;// CONCATENATED MODULE: ./src/common/iServer/TransferLine.js
  32919. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  32920. * This program are made available under the terms of the Apache License, Version 2.0
  32921. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  32922. /**
  32923. * @class SuperMap.TransferLine
  32924. * @category iServer TrafficTransferAnalyst TransferPath
  32925. * @classdesc 换乘路线信息类。
  32926. * @param {Object} options - 参数。
  32927. * @param {number} options.lineID - 乘车路线 ID。
  32928. * @param {string} options.lineName - 乘车路线名称。
  32929. * @param {string} options.lineAliasName - 乘车路线别名。
  32930. * @param {number} options.startStopIndex - 上车站点在本公交路线中的索引。
  32931. * @param {string} options.startStopName - 上车站点名称。
  32932. * @param {string} options.startStopAliasName - 上车站点别名。
  32933. * @param {number} options.endStopIndex - 下车站点在本公交路线中的索引。
  32934. * @param {string} options.endStopName - 下车站点名称。
  32935. * @param {string} options.endStopAliasName - 下车站点别名。
  32936. */
  32937. class TransferLine {
  32938. constructor(options) {
  32939. options = options || {};
  32940. /**
  32941. * @member {number} SuperMap.TransferLine.prototype.lineID
  32942. * @description 乘车路线 ID。
  32943. */
  32944. this.lineID = null;
  32945. /**
  32946. * @member {string} SuperMap.TransferLine.prototype.lineName
  32947. * @description 乘车路线名称。
  32948. */
  32949. this.lineName = null;
  32950. /**
  32951. * @member {string} SuperMap.TransferLine.prototype.lineAliasName
  32952. * @description 乘车路线别名。
  32953. */
  32954. this.lineAliasName = null;
  32955. /**
  32956. * @member {number} SuperMap.TransferLine.prototype.startStopIndex
  32957. * @description 上车站点在本公交路线中的索引。
  32958. */
  32959. this.startStopIndex = null;
  32960. /**
  32961. * @member {string} SuperMap.TransferLine.prototype.startStopName
  32962. * @description 上车站点名称。
  32963. */
  32964. this.startStopName = null;
  32965. /**
  32966. * @member {string} SuperMap.TransferLine.prototype.startStopAliasName
  32967. * @description 上车站点别名。
  32968. */
  32969. this.startStopAliasName = null;
  32970. /**
  32971. * @member {number} SuperMap.TransferLine.prototype.endStopIndex
  32972. * @description 下车站点在本公交路线中的索引。
  32973. */
  32974. this.endStopIndex = null;
  32975. /**
  32976. * @member {string} SuperMap.TransferLine.prototype.endStopName
  32977. * @description 下车站点名称。
  32978. */
  32979. this.endStopName = null;
  32980. /**
  32981. * @member {string} SuperMap.TransferLine.prototype.endStopAliasName
  32982. * @description 下车站点别名。
  32983. */
  32984. this.endStopAliasName = null;
  32985. Util.extend(this, options);
  32986. this.CLASS_NAME = "SuperMap.TransferLine";
  32987. }
  32988. /**
  32989. * @function SuperMap.TransferLine.prototype.destroy
  32990. * @description 释放资源,将引用资源的属性置空。
  32991. */
  32992. destroy() {
  32993. Util.reset(this);
  32994. }
  32995. /**
  32996. * @function SuperMap.TransferLine.fromJson
  32997. * @description 将返回结果转化为 {@link SuperMap.TransferLine} 对象。
  32998. * @param {Object} jsonObject - 新的返回结果。
  32999. * @returns {SuperMap.TransferLine} 转化后的 {@link SuperMap.TransferLine} 对象。
  33000. */
  33001. static fromJson(jsonObject) {
  33002. if (!jsonObject) {
  33003. return;
  33004. }
  33005. return new TransferLine({
  33006. lineID: jsonObject['lineID'],
  33007. lineName: jsonObject['lineName'],
  33008. lineAliasName: jsonObject['lineAliasName'],
  33009. startStopIndex: jsonObject['startStopIndex'],
  33010. startStopName: jsonObject['startStopName'],
  33011. startStopAliasName: jsonObject['startStopAliasName'],
  33012. endStopIndex: jsonObject['endStopIndex'],
  33013. endStopName: jsonObject['endStopName'],
  33014. endStopAliasName: jsonObject['endStopAliasName']
  33015. });
  33016. }
  33017. }
  33018. SuperMap.TransferLine = TransferLine;
  33019. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathParameters.js
  33020. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33021. * This program are made available under the terms of the Apache License, Version 2.0
  33022. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33023. /**
  33024. * @class SuperMap.TransferPathParameters
  33025. * @category iServer TrafficTransferAnalyst TransferPaths
  33026. * @classdesc 交通换乘线路查询参数类。
  33027. * @param {Object} options - 参数。
  33028. * @param {Array.<SuperMap.TransferLine>} options.transferLines - 本换乘分段内可乘车的路线集合。
  33029. * @param {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} options.points - 两种查询方式:按照公交站点的起止 ID 进行查询和按照起止点的坐标进行查询。
  33030. *
  33031. */
  33032. class TransferPathParameters {
  33033. constructor(options) {
  33034. options = options || {};
  33035. /**
  33036. * @member {Array.<SuperMap.TransferLine>} SuperMap.TransferPathParameters.prototype.transferLines
  33037. * @description 本换乘分段内可乘车的路线集合,通过交通换乘方案查询得到。
  33038. */
  33039. this.transferLines = null;
  33040. /**
  33041. * @member {Array.<(string|SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.TransferPathParameters.prototype.points
  33042. * @description 两种查询方式:<br>
  33043. * 1. 按照公交站点的起止ID进行查询,则 points 参数的类型为 int[],形如:[起点ID、终点ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  33044. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  33045. */
  33046. this.points = null;
  33047. Util.extend(this, options);
  33048. this.CLASS_NAME = "SuperMap.TransferPathParameters";
  33049. }
  33050. /**
  33051. * @function SuperMap.TransferPathParameters.prototype.destroy
  33052. * @description 释放资源,将引用资源的属性置空。
  33053. */
  33054. destroy() {
  33055. Util.reset(this);
  33056. }
  33057. /**
  33058. * @function SuperMap.TransferPathParameters.toJson
  33059. * @description 将 {@link SuperMap.TransferPathParameters} 对象参数转换为 JSON 字符串。
  33060. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  33061. * @returns {string} 转化后的 JSON 字符串。
  33062. */
  33063. static toJson(params) {
  33064. if (params) {
  33065. return Util.toJSON(params);
  33066. }
  33067. }
  33068. }
  33069. SuperMap.TransferPathParameters = TransferPathParameters;
  33070. ;// CONCATENATED MODULE: ./src/common/iServer/TransferPathService.js
  33071. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33072. * This program are made available under the terms of the Apache License, Version 2.0
  33073. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33074. /**
  33075. * @class SuperMap.TransferPathService
  33076. * @category iServer TrafficTransferAnalyst TransferPath
  33077. * @classdesc 交通换乘线路查询服务类,根据交通换乘分析结果(TransferSolutionResult),获取某一条乘车路线的详细信息。
  33078. * 返回结果通过该类支持的事件的监听函数参数获取
  33079. * @extends {SuperMap.CommonServiceBase}
  33080. * @example 例如:
  33081. * var myService = new SuperMap.TransferPathService(url, {eventListeners: {
  33082. * "processCompleted": TrafficTransferCompleted,
  33083. * "processFailed": TrafficTransferError
  33084. * }
  33085. * };
  33086. * @param {string} url - 与客户端交互的交通换乘线路查询服务地址。
  33087. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  33088. * @param {Object} options - 参数。</br>
  33089. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33090. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33091. * @param {Object} [options.headers] - 请求头。
  33092. */
  33093. class TransferPathService extends CommonServiceBase {
  33094. constructor(url, options) {
  33095. super(url, options);
  33096. this.CLASS_NAME = "SuperMap.TransferPathService";
  33097. }
  33098. /**
  33099. * @override
  33100. */
  33101. destroy() {
  33102. super.destroy();
  33103. }
  33104. /**
  33105. * @function SuperMap.TransferPathService.prototype.processAsync
  33106. * @description 负责将客户端的更新参数传递到服务端。
  33107. * @param {SuperMap.TransferPathParameters} params - 交通换乘参数。
  33108. */
  33109. processAsync(params) {
  33110. if (!(params instanceof TransferPathParameters)) {
  33111. return;
  33112. }
  33113. var me = this,
  33114. method = "GET",
  33115. jsonParameters;
  33116. me.url = Util.urlPathAppend(me.url, 'path');
  33117. jsonParameters = {
  33118. points: Util.toJSON(params.points),
  33119. transferLines: Util.toJSON(params['transferLines'])
  33120. };
  33121. me.request({
  33122. method: method,
  33123. params: jsonParameters,
  33124. scope: me,
  33125. success: me.serviceProcessCompleted,
  33126. failure: me.serviceProcessFailed
  33127. });
  33128. }
  33129. }
  33130. SuperMap.TransferPathService = TransferPathService;
  33131. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionParameters.js
  33132. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33133. * This program are made available under the terms of the Apache License, Version 2.0
  33134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33135. /**
  33136. * @class SuperMap.TransferSolutionParameters
  33137. * @category iServer TrafficTransferAnalyst TransferSolutions
  33138. * @classdesc 交通换乘方案查询参数类。
  33139. * @param {Object} options - 参数。
  33140. * @param {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|number)>} options.points - 两种查询方式:按照公交站点的起止ID进行查询和按照起止点的坐标进行查询。
  33141. * @param {number} [options.solutionCount=6] - 乘车方案的数量。
  33142. * @param {SuperMap.TransferTactic} [options.transferTactic=SuperMap.TransferTactic.LESS_TIME] - 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  33143. * @param {SuperMap.TransferPreference} [options.transferPreference=SuperMap.TransferPreference.NONE] - 乘车偏好枚举。
  33144. * @param {number} [options.walkingRatio=10] - 步行与公交的消耗权重比。
  33145. * @param {Array.<number>} [options.evadeLines] - 避让路线的 ID。
  33146. * @param {Array.<number>} [options.evadeStops] - 避让站点的 ID。
  33147. * @param {Array.<number>} [options.priorLines] - 优先路线的 ID。
  33148. * @param {Array.<number>} [options.priorStops] - 优先站点的 ID。
  33149. * @param {string} [options.travelTime] - 出行的时间。
  33150. */
  33151. class TransferSolutionParameters {
  33152. constructor(options) {
  33153. options = options || {};
  33154. /**
  33155. * @member {number} [SuperMap.TransferSolutionParameters.prototype.solutionCount=6]
  33156. * @description 乘车方案的数量。
  33157. */
  33158. this.solutionCount = 6;
  33159. /**
  33160. * @member {SuperMap.TransferPreference} [SuperMap.TransferSolutionParameters.prototype.transferPreference=SuperMap.TransferPreference.NONE]
  33161. * @description 乘车偏好枚举。
  33162. */
  33163. this.transferPreference = TransferPreference.NONE;
  33164. /**
  33165. * @member {SuperMap.TransferTactic} [SuperMap.TransferSolutionParameters.prototype.transferTactic=TransferTactic|SuperMap.TransferTactic.LESS_TIME]
  33166. * @description 交通换乘策略类型,包括时间最短、距离最短、最少换乘、最少步行四种选择。
  33167. */
  33168. this.transferTactic = TransferTactic.LESS_TIME;
  33169. /**
  33170. * @member {number} [SuperMap.TransferSolutionParameters.prototype.walkingRatio=10]
  33171. * @description 步行与公交的消耗权重比。此值越大,则步行因素对于方案选择的影响越大。例如:</br>
  33172. * 例如现在有两种换乘方案(在仅考虑消耗因素的情况下):</br>
  33173. * 方案1:坐车 10 公里,走路 1 公里;</br>
  33174. * 方案2:坐车 15 公里,走路 0.5 公里;</br>
  33175. * 1. 假设权重比为 15:</br>
  33176. * •方案 1 的总消耗为:10 + 1*15 = 25</br>
  33177. * •方案 2 的总消耗为:15 + 0.5*15 = 22.5</br>
  33178. * 此时方案 2 消耗更低。</br>
  33179. * 2. 假设权重比为2:</br>
  33180. * •方案 1 的总消耗为:10+1*2 = 12</br>
  33181. * •方案 2 的总消耗为:15+0.5*2 = 17</br>
  33182. * 此时方案 1 消耗更低。</br>
  33183. */
  33184. this.walkingRatio = null;
  33185. /**
  33186. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|string)>} SuperMap.TransferSolutionParameters.prototype.points
  33187. * @description 两种查询方式:</br>
  33188. * 1. 按照公交站点的起止 ID 进行查询,则 points 参数的类型为 int[],形如:[起点 ID、终点 ID],公交站点的 ID 对应服务提供者配置中的站点 ID 字段;
  33189. * 2. 按照起止点的坐标进行查询,则 points 参数的类型为 Point2D[],形如:[{"x":44,"y":39},{"x":45,"y":40}]。
  33190. */
  33191. this.points = false;
  33192. /**
  33193. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeLinesnull]
  33194. * @description 避让路线 ID。
  33195. * */
  33196. this.evadeLines = null;
  33197. /**
  33198. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.evadeStops=TransferLine]
  33199. * @description 避让站点 ID。
  33200. * */
  33201. this.evadeStops = null;
  33202. /**
  33203. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorLines]
  33204. * @description 优先路线 ID。
  33205. * */
  33206. this.priorLines = null;
  33207. /**
  33208. * @member {Array.<number>} [SuperMap.TransferSolutionParameters.prototype.priorStops]
  33209. * @description 优先站点 ID。
  33210. * */
  33211. this.priorStops = null;
  33212. /**
  33213. * @member {string} SuperMap.TransferSolutionParameters.prototype.travelTime
  33214. * @description 出行的时间; 格式是:"小时:分钟",如:"08:30"。如果设置了该参数,在分析时,则会考虑线路的首末班车时间的限制,即在返回的结果中会提示公交的首末班发车时间。
  33215. */
  33216. this.travelTime = null;
  33217. Util.extend(this, options);
  33218. this.CLASS_NAME = "SuperMap.TransferSolutionParameters";
  33219. }
  33220. /**
  33221. * @function SuperMap.TransferSolutionParameters.prototype.destroy
  33222. * @description 释放资源,将引用资源的属性置空。
  33223. */
  33224. destroy() {
  33225. Util.reset(this);
  33226. }
  33227. /**
  33228. * @function SuperMap.TransferSolutionParameters.toJsonParameters
  33229. * @description 将 {@link SuperMap.TransferSolutionParameters} 对象参数转换为 JSON 字符串。
  33230. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  33231. * @returns {string} 转化后的 JSON 字符串。
  33232. */
  33233. static toJson(params) {
  33234. if (params) {
  33235. return Util.toJSON(params);
  33236. }
  33237. }
  33238. }
  33239. SuperMap.TransferSolutionParameters = TransferSolutionParameters;
  33240. ;// CONCATENATED MODULE: ./src/common/iServer/TransferSolutionService.js
  33241. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33242. * This program are made available under the terms of the Apache License, Version 2.0
  33243. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33244. /**
  33245. * @class SuperMap.TransferSolutionService
  33246. * @category iServer TrafficTransferAnalyst TransferSolutions
  33247. * @classdesc 交通换乘方案查询服务类。
  33248. * 返回结果通过该类支持的事件的监听函数参数获取。
  33249. * @param {string} url - 与客户端交互的交通换乘方案查询服务地址。
  33250. * 例如:</br>"http://localhost:8090/iserver/services/traffictransferanalyst-sample/restjsr/traffictransferanalyst/Traffic-Changchun"。
  33251. * @param {Object} options - 参数。</br>
  33252. * @param {Object} options.eventListeners - 需要被注册的监听器对象。</br>
  33253. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33254. * @param {Object} [options.headers] - 请求头。
  33255. * @extends {SuperMap.CommonServiceBase}
  33256. * @example 例如:
  33257. * (start code)
  33258. * var myService = new SuperMap.TransferSolutionService(url, {eventListeners: {
  33259. * "processCompleted": trafficTransferCompleted,
  33260. * "processFailed": trafficTransferError
  33261. * }
  33262. * };
  33263. * (end)
  33264. *
  33265. */
  33266. class TransferSolutionService extends CommonServiceBase {
  33267. constructor(url, options) {
  33268. super(url, options);
  33269. this.CLASS_NAME = "SuperMap.TransferSolutionService";
  33270. }
  33271. /**
  33272. * @override
  33273. */
  33274. destroy() {
  33275. super.destroy();
  33276. }
  33277. /**
  33278. * @function SuperMap.TransferSolutionService.prototype.processAsync
  33279. * @description 负责将客户端的更新参数传递到服务端。
  33280. * @param {SuperMap.TransferSolutionParameters} params - 交通换乘参数。
  33281. */
  33282. processAsync(params) {
  33283. if (!(params instanceof TransferSolutionParameters)) {
  33284. return;
  33285. }
  33286. var me = this,
  33287. method = "GET",
  33288. jsonParameters;
  33289. me.url = Util.urlPathAppend(me.url, 'solutions');
  33290. jsonParameters = {
  33291. points: Util.toJSON(params.points),
  33292. walkingRatio: params['walkingRatio'],
  33293. transferTactic: params['transferTactic'],
  33294. solutionCount: params['solutionCount'],
  33295. transferPreference: params["transferPreference"]
  33296. };
  33297. if (params.evadeLines) {
  33298. jsonParameters["evadeLines"] = Util.toJSON(params.evadeLines);
  33299. }
  33300. if (params.evadeStops) {
  33301. jsonParameters["evadeStops"] = Util.toJSON(params.evadeStops);
  33302. }
  33303. if (params.priorLines) {
  33304. jsonParameters["priorLines"] = Util.toJSON(params.priorLines);
  33305. }
  33306. if (params.priorStops) {
  33307. jsonParameters["priorStops"] = Util.toJSON(params.priorStops);
  33308. }
  33309. if (params.travelTime) {
  33310. jsonParameters["travelTime"] = params.travelTime;
  33311. }
  33312. me.request({
  33313. method: method,
  33314. params: jsonParameters,
  33315. scope: me,
  33316. success: me.serviceProcessCompleted,
  33317. failure: me.serviceProcessFailed
  33318. });
  33319. }
  33320. }
  33321. SuperMap.TransferSolutionService = TransferSolutionService;
  33322. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightParameters.js
  33323. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33324. * This program are made available under the terms of the Apache License, Version 2.0
  33325. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33326. /**
  33327. * @class SuperMap.UpdateEdgeWeightParameters
  33328. * @category iServer NetworkAnalyst EdgeWeight
  33329. * @classdesc 边的耗费权重更新服务参数类。
  33330. * @param {Object} options - 参数。
  33331. * @param {string} options.edgeId - 所在边的 ID。
  33332. * @param {string} options.fromNodeId - 起始转向点的 ID。
  33333. * @param {string} options.toNodeId - 终止转向点的 ID。
  33334. * @param {string} options.weightField - 边的耗费字段。
  33335. * @param {string} options.edgeWeight - 耗费权重。
  33336. */
  33337. class UpdateEdgeWeightParameters {
  33338. constructor(options) {
  33339. if (!options) {
  33340. return;
  33341. }
  33342. /**
  33343. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeId
  33344. * @description 所在边的 ID。
  33345. */
  33346. this.edgeId = "";
  33347. /**
  33348. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.fromNodeId
  33349. * @description 起始转向点的 ID。
  33350. */
  33351. this.fromNodeId = "";
  33352. /**
  33353. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.toNodeId
  33354. * @description 终止转向点的 ID。
  33355. */
  33356. this.toNodeId = "";
  33357. /**
  33358. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.weightField
  33359. * @description 边的耗费字段。
  33360. */
  33361. this.weightField = "";
  33362. /**
  33363. * @member {string} SuperMap.UpdateEdgeWeightParameters.prototype.edgeWeight
  33364. * @description 耗费权重。
  33365. */
  33366. this.edgeWeight = "";
  33367. Util.extend(this, options);
  33368. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightParameters";
  33369. }
  33370. /**
  33371. * @function SuperMap.UpdateEdgeWeightParameters.prototype.destroy
  33372. * @description 释放资源,将引用资源的属性置空。
  33373. */
  33374. destroy() {
  33375. this.edgeId = null;
  33376. this.fromNodeId = null;
  33377. this.toNodeId = null;
  33378. this.weightField = null;
  33379. this.edgeWeight = null;
  33380. }
  33381. }
  33382. SuperMap.UpdateEdgeWeightParameters = UpdateEdgeWeightParameters;
  33383. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateEdgeWeightService.js
  33384. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33385. * This program are made available under the terms of the Apache License, Version 2.0
  33386. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33387. /**
  33388. * @class SuperMap.UpdateEdgeWeightService
  33389. * @category iServer NetworkAnalyst EdgeWeight
  33390. * @classdesc 更新边的边的耗费权重服务
  33391. * @extends {SuperMap.NetworkAnalystServiceBase}
  33392. * @example
  33393. *(start code)
  33394. * var updateEdgeWeightService = new SuperMap.UpdateEdgeWeightService(url, {
  33395. * eventListeners: {
  33396. * "processCompleted": UpdateEdgeWeightCompleted, //参数为SuperMap.UpdateEdgeWeightEventArgs
  33397. * "processFailed": UpdateEdgeWeightError //参数为SuperMap.ServiceFailedEventArgs
  33398. * }
  33399. * });
  33400. * (end)
  33401. * @param {string} url - 服务的访问地址。如:http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  33402. * @param {Object} options - 参数。
  33403. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33404. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33405. * @param {Object} [options.headers] - 请求头。
  33406. */
  33407. class UpdateEdgeWeightService extends NetworkAnalystServiceBase {
  33408. constructor(url, options) {
  33409. super(url, options);
  33410. this.CLASS_NAME = "SuperMap.UpdateEdgeWeightService";
  33411. }
  33412. /**
  33413. * @override
  33414. */
  33415. destroy() {
  33416. super.destroy();
  33417. }
  33418. /**
  33419. * @function SuperMap.UpdateEdgeWeightService.prototype.processAsync
  33420. * @description 开始异步执行边的边的耗费权重的更新
  33421. * @param {SuperMap.UpdateEdgeWeightParameters} params - 边的耗费权重更新服务参数类
  33422. * @example
  33423. * (code)
  33424. * var updateEdgeWeightParam=new SuperMapUpdateEdgeWeightParameters({
  33425. * edgeId:"20",
  33426. * fromNodeId:"26",
  33427. * toNodeId:"109",
  33428. * weightField:"time",
  33429. * edgeWeight:"25"
  33430. * });
  33431. * updateEdgeWeightService.processAsync(updateEdgeWeightParam);
  33432. * (end)
  33433. */
  33434. processAsync(params) {
  33435. if (!(params instanceof UpdateEdgeWeightParameters)) {
  33436. return;
  33437. }
  33438. var me = this;
  33439. var paramStr = me.parse(params);
  33440. me.url = Util.urlPathAppend(me.url, paramStr);
  33441. var data = params.edgeWeight ? params.edgeWeight : null;
  33442. me.request({
  33443. method: "PUT",
  33444. scope: me,
  33445. data: data,
  33446. success: me.serviceProcessCompleted,
  33447. failure: me.serviceProcessFailed
  33448. });
  33449. }
  33450. /**
  33451. * @function SuperMap.UpdateEdgeWeightService.prototype.parse
  33452. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  33453. */
  33454. parse(params) {
  33455. if (!params) {
  33456. return;
  33457. }
  33458. var paramStr = "";
  33459. for (var attr in params) {
  33460. if (params[attr] === "" || params[attr] === "edgeWeight") {
  33461. continue;
  33462. }
  33463. switch (attr) {
  33464. case "edgeId":
  33465. paramStr += "/edgeweight/" + params[attr];
  33466. break;
  33467. case "fromNodeId":
  33468. paramStr += "/fromnode/" + params[attr];
  33469. break;
  33470. case "toNodeId":
  33471. paramStr += "/tonode/" + params[attr];
  33472. break;
  33473. case "weightField":
  33474. paramStr += "/weightfield/" + params[attr];
  33475. break;
  33476. default :
  33477. break;
  33478. }
  33479. }
  33480. return paramStr;
  33481. }
  33482. }
  33483. SuperMap.UpdateEdgeWeightService = UpdateEdgeWeightService;
  33484. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightParameters.js
  33485. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33486. * This program are made available under the terms of the Apache License, Version 2.0
  33487. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33488. /**
  33489. * @class SuperMap.UpdateTurnNodeWeightParameters
  33490. * @category iServer NetworkAnalyst TurnNodeWeight
  33491. * @classdesc 转向耗费权重更新服务参数类。
  33492. * @param {Object} options - 参数。
  33493. * @param {string} options.nodeId - 转向结点的 ID。
  33494. * @param {string} options.fromEdgeId - 起始边的 ID。
  33495. * @param {string} options.toEdgeId - 终止边的 ID。
  33496. * @param {string} options.weightField - 转向结点的耗费字段。
  33497. * @param {string} options.turnNodeWeight - 耗费权重。
  33498. */
  33499. class UpdateTurnNodeWeightParameters {
  33500. constructor(options) {
  33501. if (!options) {
  33502. return;
  33503. }
  33504. /**
  33505. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.nodeId
  33506. * @description 转向结点的 ID。
  33507. */
  33508. this.nodeId = "";
  33509. /**
  33510. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.fromEdgeId
  33511. * @description 起始边的 ID。
  33512. */
  33513. this.fromEdgeId = "";
  33514. /**
  33515. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.toEdgeId
  33516. * @description 终止边的 ID。
  33517. */
  33518. this.toEdgeId = "";
  33519. /**
  33520. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.weightField
  33521. * @description 转向结点的耗费字段。
  33522. */
  33523. this.weightField = "";
  33524. /**
  33525. * @member {string} SuperMap.UpdateTurnNodeWeightParameters.prototype.turnNodeWeight
  33526. * @description 耗费权重。
  33527. */
  33528. this.turnNodeWeight = "";
  33529. Util.extend(this, options);
  33530. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightParameters";
  33531. }
  33532. /**
  33533. * @function SuperMap.UpdateTurnNodeWeightParameters.prototype.destroy
  33534. * @description 释放资源,将引用资源的属性置空。
  33535. */
  33536. destroy() {
  33537. this.nodeId = null;
  33538. this.fromEdgeId = null;
  33539. this.toEdgeId = null;
  33540. this.weightField = null;
  33541. this.turnNodeWeight = null;
  33542. }
  33543. }
  33544. SuperMap.UpdateTurnNodeWeightParameters = UpdateTurnNodeWeightParameters;
  33545. ;// CONCATENATED MODULE: ./src/common/iServer/UpdateTurnNodeWeightService.js
  33546. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33547. * This program are made available under the terms of the Apache License, Version 2.0
  33548. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33549. /**
  33550. * @class SuperMap.UpdateTurnNodeWeightService
  33551. * @category iServer NetworkAnalyst TurnNodeWeight
  33552. * @classdesc 转向耗费权重更新服务类
  33553. * @extends {SuperMap.NetworkAnalystServiceBase}
  33554. * @example
  33555. * var UpdateTurnNodeWeightService = new SuperMap.UpdateTurnNodeWeightService(url, {
  33556. * eventListeners: {
  33557. * "processCompleted": UpdateTurnNodeWeightCompleted, //参数为SuperMap.UpdateTurnNodeWeightEventArgs
  33558. * "processFailed": UpdateTurnNodeWeightError //参数为SuperMap.ServiceFailedEventArgs
  33559. * }
  33560. * });
  33561. * @param {string} url - 服务的访问地址。如:
  33562. * http://localhost:8090/iserver/services/transportationanalyst-sample/rest/networkanalyst/RoadNet@Changchun 。
  33563. * @param {Object} options - 参数。
  33564. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  33565. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33566. * @param {Object} [options.headers] - 请求头。
  33567. */
  33568. class UpdateTurnNodeWeightService extends NetworkAnalystServiceBase {
  33569. constructor(url, options) {
  33570. super(url, options);
  33571. this.CLASS_NAME = "SuperMap.UpdateTurnNodeWeightService";
  33572. }
  33573. /**
  33574. * @override
  33575. */
  33576. destroy() {
  33577. super.destroy();
  33578. }
  33579. /**
  33580. * @function SuperMap.UpdateTurnNodeWeightService.prototype.processAsync
  33581. * @description 开始异步执行转向耗费权重的更新
  33582. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类
  33583. * @example
  33584. * (code)
  33585. * var updateTurnNodeWeightParam=new SuperMap.UpdateTurnNodeWeightParameters({
  33586. * nodeId:"106",
  33587. * fromEdgeId:"6508",
  33588. * toEdgeId:"6504",
  33589. * weightField:"TurnCost",
  33590. * turnNodeWeight:"50"
  33591. * });
  33592. * updateTurnNodeWeightService.processAsync(updateTurnNodeWeightParam);
  33593. * (end)
  33594. **/
  33595. processAsync(params) {
  33596. if (!(params instanceof UpdateTurnNodeWeightParameters)) {
  33597. return;
  33598. }
  33599. var me = this;
  33600. var paramStr = me.parse(params);
  33601. me.url = Util.urlPathAppend(me.url, paramStr);
  33602. var data = params.turnNodeWeight ? params.turnNodeWeight : null;
  33603. me.request({
  33604. method: "PUT",
  33605. scope: me,
  33606. data: data,
  33607. success: me.serviceProcessCompleted,
  33608. failure: me.serviceProcessFailed
  33609. });
  33610. }
  33611. /**
  33612. * @function SuperMap.UpdateTurnNodeWeightService.prototype.parse
  33613. * @description 将更新服务参数解析为用‘/’做分隔的字符串
  33614. */
  33615. parse(params) {
  33616. if (!params) {
  33617. return;
  33618. }
  33619. var paramStr = "";
  33620. for (var attr in params) {
  33621. if (params[attr] === "" || params[attr] === "turnNodeWeight") {
  33622. continue;
  33623. }
  33624. switch (attr) {
  33625. case "nodeId":
  33626. paramStr += "/turnnodeweight/" + params[attr];
  33627. break;
  33628. case "fromEdgeId":
  33629. paramStr += "/fromedge/" + params[attr];
  33630. break;
  33631. case "toEdgeId":
  33632. paramStr += "/toedge/" + params[attr];
  33633. break;
  33634. case "weightField":
  33635. paramStr += "/weightfield/" + params[attr];
  33636. break;
  33637. default :
  33638. break;
  33639. }
  33640. }
  33641. return paramStr;
  33642. }
  33643. }
  33644. SuperMap.UpdateTurnNodeWeightService = UpdateTurnNodeWeightService;
  33645. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  33646. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33647. * This program are made available under the terms of the Apache License, Version 2.0
  33648. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33649. /**
  33650. * @class SuperMap.VectorClipJobsParameter
  33651. * @category iServer ProcessingService VectorClip
  33652. * @classdesc 矢量裁剪分析任务参数类。
  33653. * @param {Object} options - 参数。
  33654. * @param {string} options.datasetName - 数据集名。
  33655. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  33656. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  33657. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  33658. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  33659. */
  33660. class VectorClipJobsParameter {
  33661. constructor(options) {
  33662. options = options || {};
  33663. /**
  33664. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  33665. * @description 数据集名。
  33666. */
  33667. this.datasetName = "";
  33668. /**
  33669. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  33670. * @description 裁剪对象数据集。
  33671. */
  33672. this.datasetVectorClip = "";
  33673. /**
  33674. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  33675. * @description 裁剪几何对象。
  33676. */
  33677. this.geometryClip = "";
  33678. /**
  33679. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  33680. * @description 裁剪分析模式 。
  33681. */
  33682. this.mode = ClipAnalystMode.CLIP;
  33683. /**
  33684. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  33685. * @description 输出参数设置类。
  33686. */
  33687. this.output = null;
  33688. /**
  33689. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  33690. * @description 分析后结果可视化的参数类。
  33691. */
  33692. this.mappingParameters = null;
  33693. Util.extend(this, options);
  33694. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  33695. }
  33696. /**
  33697. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  33698. * @description 释放资源,将引用资源的属性置空。
  33699. */
  33700. destroy() {
  33701. this.datasetName = null;
  33702. this.datasetVectorClip = null;
  33703. this.geometryClip = null;
  33704. this.mode = null;
  33705. if (this.output instanceof OutputSetting) {
  33706. this.output.destroy();
  33707. this.output = null;
  33708. }
  33709. if (this.mappingParameters instanceof MappingParameters) {
  33710. this.mappingParameters.destroy();
  33711. this.mappingParameters = null;
  33712. }
  33713. }
  33714. /**
  33715. * @function SuperMap.VectorClipJobsParameter.toObject
  33716. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  33717. * @param {Object} tempObj - 目标对象。
  33718. * @description 矢量裁剪分析任务对象。
  33719. */
  33720. static toObject(vectorClipJobsParameter, tempObj) {
  33721. for (var name in vectorClipJobsParameter) {
  33722. if (name === "datasetName") {
  33723. tempObj['input'] = tempObj['input'] || {};
  33724. tempObj['input'][name] = vectorClipJobsParameter[name];
  33725. continue;
  33726. }
  33727. if (name === "output"){
  33728. tempObj['output'] = tempObj['output'] || {};
  33729. tempObj['output'] = vectorClipJobsParameter[name];
  33730. continue;
  33731. }
  33732. tempObj['analyst'] = tempObj['analyst'] || {};
  33733. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  33734. if(name === 'mappingParameters'){
  33735. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  33736. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  33737. }
  33738. }
  33739. }
  33740. }
  33741. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  33742. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  33743. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33744. * This program are made available under the terms of the Apache License, Version 2.0
  33745. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33746. /**
  33747. * @class SuperMap.VectorClipJobsService
  33748. * @category iServer ProcessingService VectorClip
  33749. * @classdesc 矢量裁剪分析服务类
  33750. * @extends {SuperMap.ProcessingServiceBase}
  33751. * @param {string} url -矢量裁剪分析服务地址。
  33752. * @param {Object} options - 交互服务时所需可选参数。
  33753. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  33754. * @param {Object} [options.headers] - 请求头。
  33755. */
  33756. class VectorClipJobsService extends ProcessingServiceBase {
  33757. constructor(url, options) {
  33758. super(url, options);
  33759. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  33760. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  33761. }
  33762. /**
  33763. *@override
  33764. */
  33765. destroy() {
  33766. super.destroy();
  33767. }
  33768. /**
  33769. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  33770. * @description 获取矢量裁剪分析所有任务
  33771. */
  33772. getVectorClipJobs() {
  33773. super.getJobs(this.url);
  33774. }
  33775. /**
  33776. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  33777. * @description 获取指定id的矢量裁剪分析服务
  33778. * @param {string} id - 指定要获取数据的id
  33779. */
  33780. getVectorClipJob(id) {
  33781. super.getJobs(Util.urlPathAppend(this.url, id));
  33782. }
  33783. /**
  33784. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  33785. * @description 新建矢量裁剪分析服务
  33786. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  33787. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  33788. */
  33789. addVectorClipJob(params, seconds) {
  33790. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  33791. }
  33792. }
  33793. SuperMap.VectorClipJobsService = VectorClipJobsService;
  33794. ;// CONCATENATED MODULE: ./src/common/iServer/RasterFunctionParameter.js
  33795. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33796. * This program are made available under the terms of the Apache License, Version 2.0
  33797. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33798. /**
  33799. * @class SuperMap.RasterFunctionParameter
  33800. * @category iServer Map
  33801. * @classdesc iServer 地图服务栅格分析参数基类
  33802. * @param {Object} options - 参数。
  33803. * @param {SuperMap.RasterFunctionType} options.type - 栅格分析方法。
  33804. */
  33805. class RasterFunctionParameter {
  33806. constructor(options) {
  33807. options = options || {};
  33808. /**
  33809. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  33810. * @description 栅格分析方法。
  33811. */
  33812. this.type = null;
  33813. Util.extend(this, options);
  33814. this.CLASS_NAME = 'SuperMap.RasterFunctionParameter';
  33815. }
  33816. /**
  33817. * @function SuperMap.RasterFunctionParameter.prototype.destroy
  33818. * @description 释放资源,将资源的属性置空。
  33819. */
  33820. destroy() {
  33821. this.type = null;
  33822. }
  33823. }
  33824. SuperMap.RasterFunctionParameter = RasterFunctionParameter;
  33825. ;// CONCATENATED MODULE: ./src/common/iServer/NDVIParameter.js
  33826. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33827. * This program are made available under the terms of the Apache License, Version 2.0
  33828. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33829. /**
  33830. * @class SuperMap.NDVIParameter
  33831. * @category iServer Map
  33832. * @classdesc 归一化植被指数参数类
  33833. * @param {Object} options - 参数。
  33834. * @param {number} [options.redIndex=0] - 红光谱波段索引。
  33835. * @param {number} [options.nirIndex=1] - 近红外光谱波段索引。
  33836. * @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。仅单波段数据时设定。
  33837. * @extends {SuperMap.RasterFunctionParameter}
  33838. */
  33839. class NDVIParameter extends RasterFunctionParameter {
  33840. constructor(options) {
  33841. super(options);
  33842. /**
  33843. * @member {number} [SuperMap.NDVIParameter.prototype.redIndex=0]
  33844. * @description 红光谱波段索引。
  33845. */
  33846. this.redIndex = 0;
  33847. /**
  33848. * @member {number} [SuperMap.NDVIParameter.prototype.nirIndex=1]
  33849. * @description 近红外光谱波段索引。
  33850. */
  33851. this.nirIndex = 1;
  33852. /**
  33853. * @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"]
  33854. * @description 颜色表。由栅格的中断值和颜色停止之间的映射组成的,如0.3->d9f0a3ff 指的是[0,0.3)显示d9f0a3ff。仅单波段数据时设定。
  33855. */
  33856. this.colorMap =
  33857. '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';
  33858. /**
  33859. * @member {SuperMap.RasterFunctionType} [SuperMap.RasterFunctionParameter.prototype.type]
  33860. * @description 栅格分析方法。
  33861. */
  33862. this.type = RasterFunctionType.NDVI;
  33863. Util.extend(this, options);
  33864. this.CLASS_NAME = 'SuperMap.NDVIParameter';
  33865. }
  33866. /**
  33867. * @function SuperMap.NDVIParameter.prototype.destroy
  33868. * @override
  33869. */
  33870. destroy() {
  33871. super.destroy();
  33872. this.redIndex = null;
  33873. this.nirIndex = null;
  33874. this.colorMap = null;
  33875. }
  33876. /**
  33877. * @function SuperMap.NDVIParameter.prototype.toJSON
  33878. * @description 将 NDVIParameter 对象转化为 JSON 字符串。
  33879. * @returns {string} 返回转换后的 JSON 字符串。
  33880. */
  33881. toJSON() {
  33882. return {
  33883. redIndex: this.redIndex,
  33884. nirIndex: this.nirIndex,
  33885. colorMap: this.colorMap,
  33886. type: this.type
  33887. };
  33888. }
  33889. }
  33890. SuperMap.NDVIParameter = NDVIParameter;
  33891. ;// CONCATENATED MODULE: ./src/common/iServer/HillshadeParameter.js
  33892. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33893. * This program are made available under the terms of the Apache License, Version 2.0
  33894. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33895. /**
  33896. * @class SuperMap.HillshadeParameter
  33897. * @category iServer Map
  33898. * @classdesc 阴影面分析参数类
  33899. * @param {Object} options - 参数。
  33900. * @param {number} [options.altitude=45] - 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  33901. * @param {number} [options.azimuth=315] - 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  33902. * @param {number} [options.zFactor=1] - 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33903. * z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33904. * 如果 x,y 单位和 z 单位采用相同的测量单位,则 z 因子为 1。这是默认设置。
  33905. * 如果 x,y 单位和 z 单位采用不同的测量单位,则必须将 z 因子设置为适当的因子,否则会得到错误的结果。例如,如果 z 单位是英尺而 x,y 单位是米,则应使用 z 因子 0.3048 将 z 单位从英尺转换为米(1 英尺 = 0.3048 米)。
  33906. * 如果输入栅格位于球面坐标系中(如十进制度球面坐标系),则生成的山体阴影可能看起来很独特。这是因为水平地面单位与高程 z 单位之间的测量值存在差异。由于经度的长度随着纬度而变化,因此需要为该纬度指定一个适当的 z 因子。如果 x,y 单位是十进制度而 Z 单位是米,特定纬度的一些合适的 Z 因子为:
  33907. * Latitude Z-factor
  33908. * 0 0.00000898
  33909. * 10 0.00000912
  33910. * 20 0.00000956
  33911. * 30 0.00001036
  33912. * 40 0.00001171
  33913. * 50 0.00001395
  33914. * 60 0.00001792
  33915. * 70 0.00002619
  33916. * 80 0.00005156
  33917. * @extends {SuperMap.RasterFunctionParameter}
  33918. */
  33919. class HillshadeParameter extends RasterFunctionParameter {
  33920. constructor(options) {
  33921. super(options);
  33922. /**
  33923. * @member {number} [SuperMap.HillshadeParameter.prototype.altitude = 45]
  33924. * @description 高于地平线的光源高度角。高度角由正度数表示,0 度代表地平线,而 90 度代表头顶正上方。
  33925. */
  33926. this.altitude = 45;
  33927. /**
  33928. * @member {number} [SuperMap.HillshadeParameter.prototype.azimuth = 315]
  33929. * @description 光源的方位角。方位角由0到360度之间的正度数表示,以北为基准方向按顺时针进行测量。
  33930. */
  33931. this.azimuth = 315;
  33932. /**
  33933. * @member {number} [SuperMap.HillshadeParameter.prototype.zFactor = 1]
  33934. * @description 一个表面 z 单位中地面 x,y 单位的数量。z 单位与输入表面的 x,y 单位不同时,可使用 z 因子调整 z 单位的测量单位。计算最终输出表面时,将用 z 因子乘以输入表面的 z 值。
  33935. */
  33936. this.zFactor = 1;
  33937. /**
  33938. * @member {SuperMap.RasterFunctionType} SuperMap.RasterFunctionParameter.prototype.type
  33939. * @description 栅格分析方法。
  33940. */
  33941. this.type = RasterFunctionType.HILLSHADE;
  33942. Util.extend(this, options);
  33943. this.CLASS_NAME = 'SuperMap.HillshadeParameter';
  33944. }
  33945. /**
  33946. * @function SuperMap.HillshadeParameter.prototype.destroy
  33947. * @override
  33948. */
  33949. destroy() {
  33950. super.destroy();
  33951. this.altitude = null;
  33952. this.azimuth = null;
  33953. this.zFactor = null;
  33954. }
  33955. /**
  33956. * @function SuperMap.HillshadeParameter.prototype.toJSON
  33957. * @description 将 HillshadeParameter 对象转化为 JSON 字符串。
  33958. * @returns {string} 返回转换后的 JSON 字符串。
  33959. */
  33960. toJSON() {
  33961. return {
  33962. altitude: this.altitude,
  33963. azimuth: this.azimuth,
  33964. zFactor: this.zFactor,
  33965. type: this.type
  33966. };
  33967. }
  33968. }
  33969. SuperMap.HillshadeParameter = HillshadeParameter;
  33970. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobCustomItems.js
  33971. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  33972. * This program are made available under the terms of the Apache License, Version 2.0
  33973. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  33974. /**
  33975. * @class SuperMap.WebPrintingJobCustomItems
  33976. * @classdesc Web 打印图例元素参数类。
  33977. * @version 10.1.0
  33978. * @category iServer WebPrintingJob
  33979. * @param {Object} option - 初始化参数。
  33980. * @param {string} option.name - 图例元素的名称。
  33981. * @param {string} [option.picAsUrl] - 图例元素 Base64 格式图片。
  33982. * @param {string} [option.picAsBase64] - 图例元素图片的获取地址。
  33983. */
  33984. class WebPrintingJobCustomItems {
  33985. constructor(option) {
  33986. /**
  33987. * @member {string} SuperMap.WebPrintingJobCustomItems.prototype.name
  33988. * @description 图例元素的名称。
  33989. */
  33990. this.name = null;
  33991. /**
  33992. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsUrl]
  33993. * @description 图例元素 Base64 格式图片。
  33994. */
  33995. this.picAsUrl = null;
  33996. /**
  33997. * @member {string} [SuperMap.WebPrintingJobCustomItems.prototype.picAsBase64]
  33998. * @description 图例元素图片的获取地址。
  33999. */
  34000. this.picAsBase64 = null;
  34001. this.CLASS_NAME = 'SuperMap.WebPrintingJobCustomItems';
  34002. Util.extend(this, option);
  34003. }
  34004. /**
  34005. * @function SuperMap.WebPrintingJobCustomItems.prototype.destroy
  34006. * @description 释放资源,将引用资源的属性置空。
  34007. */
  34008. destroy() {
  34009. var me = this;
  34010. me.name = null;
  34011. me.picAsUrl = null;
  34012. me.picAsBase64 = null;
  34013. }
  34014. /**
  34015. * @function SuperMap.WebPrintingJobCustomItems.prototype.toJSON
  34016. * @description 将 SuperMap.WebPrintingJobCustomItems 对象转化为 JSON 字符串。
  34017. * @returns {string} 返回转换后的 JSON 字符串。
  34018. */
  34019. toJSON() {
  34020. var params = {
  34021. name: this.name
  34022. };
  34023. if (this.title) {
  34024. params.title = this.title;
  34025. }
  34026. if (this.picAsUrl) {
  34027. params.picAsUrl = this.picAsUrl;
  34028. } else if (this.picAsBase64) {
  34029. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  34030. }
  34031. return Util.toJSON(params);
  34032. }
  34033. }
  34034. SuperMap.WebPrintingJobCustomItems = WebPrintingJobCustomItems;
  34035. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobImage.js
  34036. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34037. * This program are made available under the terms of the Apache License, Version 2.0
  34038. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34039. /**
  34040. * @class SuperMap.WebPrintingJobImage
  34041. * @classdesc 表达小地图的静态图片参数类。
  34042. * @version 10.1.0
  34043. * @category iServer WebPrintingJob
  34044. * @param {Object} option - 初始化参数。
  34045. * @param {string} [option.picAsUrl] - 小地图的图片 url 地址。
  34046. * @param {string} [option.picAsBase64] - 小地图的base64位图片信息。
  34047. */
  34048. class WebPrintingJobImage {
  34049. constructor(option) {
  34050. /**
  34051. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsUrl]
  34052. * @description 小地图的图片 url 地址。
  34053. */
  34054. this.picAsUrl = null;
  34055. /**
  34056. * @member {string} [SuperMap.WebPrintingJobImage.prototype.picAsBase64]
  34057. * @description 小地图的base64位图片信息。
  34058. */
  34059. this.picAsBase64 = null;
  34060. this.CLASS_NAME = 'SuperMap.WebPrintingJobImage';
  34061. Util.extend(this, option);
  34062. }
  34063. /**
  34064. * @function SuperMap.WebPrintingJobImage.prototype.destroy
  34065. * @description 释放资源,将引用资源的属性置空。
  34066. */
  34067. destroy() {
  34068. this.picAsUrl = null;
  34069. this.picAsBase64 = null;
  34070. }
  34071. /**
  34072. * @function SuperMap.WebPrintingJobImage.prototype.toJSON
  34073. * @description 将 SuperMap.WebPrintingJobImage 对象转化为 JSON 字符串。
  34074. * @returns {string} 返回转换后的 JSON 字符串。
  34075. */
  34076. toJSON() {
  34077. var params = {};
  34078. if (this.picAsUrl) {
  34079. params.picAsUrl = this.picAsUrl;
  34080. }
  34081. if (this.picAsBase64) {
  34082. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  34083. }
  34084. return Util.toJSON(params);
  34085. }
  34086. }
  34087. SuperMap.WebPrintingJobImage = WebPrintingJobImage;
  34088. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayers.js
  34089. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34090. * This program are made available under the terms of the Apache License, Version 2.0
  34091. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34092. /**
  34093. * @class SuperMap.WebPrintingJobLayers
  34094. * @classdesc 将图例添加到布局的业务图层参数类。
  34095. * @version 10.1.0
  34096. * @category iServer WebPrintingJob
  34097. * @param {Object} option - 初始化参数。
  34098. * @param {string} [option.name] - 表示图层 name 的字符串。此 name 必须唯一,并且必须与定义业务图层的 LegendOptions_layers 元素中的图层 name 匹配。
  34099. */
  34100. class WebPrintingJobLayers {
  34101. constructor(option) {
  34102. /**
  34103. * @member {string} SuperMap.WebPrintingJobLayers.prototype.name
  34104. * @description 图层 name。
  34105. */
  34106. this.name = null;
  34107. /**
  34108. * @member {string} SuperMap.WebPrintingJobLayers.prototype.layerType
  34109. * @description 图层 type。
  34110. */
  34111. this.layerType = null;
  34112. /**
  34113. * @member {string} SuperMap.WebPrintingJobLayers.prototype.url
  34114. * @description 图层 url。
  34115. */
  34116. this.url = null;
  34117. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayers';
  34118. Util.extend(this, option);
  34119. }
  34120. /**
  34121. * @function SuperMap.WebPrintingJobLayers.prototype.destroy
  34122. * @description 释放资源,将引用资源的属性置空。
  34123. */
  34124. destroy() {
  34125. this.name = null;
  34126. this.layerType = null;
  34127. this.url = null;
  34128. }
  34129. }
  34130. SuperMap.WebPrintingJobLayers = WebPrintingJobLayers;
  34131. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLegendOptions.js
  34132. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34133. * This program are made available under the terms of the Apache License, Version 2.0
  34134. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34135. /**
  34136. * @class SuperMap.WebPrintingJobLegendOptions
  34137. * @classdesc Web 打印图例参数类。
  34138. * @version 10.1.0
  34139. * @category iServer WebPrintingJob
  34140. * @param {Object} option - 初始化参数。
  34141. * @param {string} [option.title] - 图例名称。
  34142. * @param {string} [option.picAsUrl] - 图例的图片 url 地址。
  34143. * @param {string} [option.picAsBase64] - 图例的 base64 位图片信息。
  34144. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 图例的布局业务图层参数类。
  34145. * @param {SuperMap.WebPrintingJobCustomItems} [option.customItems] - 自定义图例元素参数类。
  34146. */
  34147. class WebPrintingJobLegendOptions {
  34148. constructor(option) {
  34149. /**
  34150. * @member {string} SuperMap.WebPrintingJobLegendOptions.prototype.title
  34151. * @description 图例名称。
  34152. */
  34153. this.title = null;
  34154. /**
  34155. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsUrl]
  34156. * @description 图例的图片 url 地址。
  34157. */
  34158. this.picAsUrl = null;
  34159. /**
  34160. * @member {string} [SuperMap.WebPrintingJobLegendOptions.prototype.picAsBase64]
  34161. * @description 图例的 base64 位图片信息。
  34162. */
  34163. this.picAsBase64 = null;
  34164. /**
  34165. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLegendOptions.prototype.layers]
  34166. * @description 图例的布局业务图层参数类。
  34167. */
  34168. this.layers = null;
  34169. /**
  34170. * @member {SuperMap.WebPrintingJobCustomItems} [SuperMap.WebPrintingJobLegendOptions.prototype.customItems]
  34171. * @description 自定义图例元素参数类。
  34172. */
  34173. this.customItems = null;
  34174. this.CLASS_NAME = 'SuperMap.WebPrintingJobLegendOptions';
  34175. Util.extend(this, option);
  34176. }
  34177. /**
  34178. * @function SuperMap.WebPrintingJobLegendOptions.prototype.destroy
  34179. * @description 释放资源,将引用资源的属性置空。
  34180. */
  34181. destroy() {
  34182. this.title = null;
  34183. this.picAsUrl = null;
  34184. this.picAsBase64 = null;
  34185. if (this.layers instanceof WebPrintingJobLayers) {
  34186. this.layers.destroy();
  34187. this.layers = null;
  34188. }
  34189. if (this.customItems instanceof WebPrintingJobCustomItems) {
  34190. this.customItems.destroy();
  34191. this.customItems = null;
  34192. }
  34193. }
  34194. /**
  34195. * @function SuperMap.WebPrintingJobLegendOptions.prototype.toJSON
  34196. * @description 将 SuperMap.WebPrintingJobLegendOptions 对象转化为 JSON 字符串。
  34197. * @returns {string} 返回转换后的 JSON 字符串。
  34198. */
  34199. toJSON() {
  34200. var params = {
  34201. title: this.title || ""
  34202. };
  34203. if (this.picAsUrl) {
  34204. params.picAsUrl = this.picAsUrl;
  34205. } else if (this.picAsBase64) {
  34206. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  34207. } else if (this.customItems) {
  34208. params.customItems = this.customItems;
  34209. }
  34210. return Util.toJSON(params);
  34211. }
  34212. }
  34213. SuperMap.WebPrintingJobLegendOptions = WebPrintingJobLegendOptions;
  34214. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLittleMapOptions.js
  34215. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34216. * This program are made available under the terms of the Apache License, Version 2.0
  34217. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34218. /**
  34219. * @class SuperMap.WebPrintingJobLittleMapOptions
  34220. * @classdesc Web 打印小地图参数类。
  34221. * @version 10.1.0
  34222. * @category iServer WebPrintingJob
  34223. * @param {Object} option - 初始化参数。
  34224. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} option.center - 小地图的中心点。
  34225. * @param {number} [option.scale] - 小地图的比例尺。
  34226. * @param {Array.<string>} [option.layerNames] - 指定 WebMap中图层名称的列表,用于渲染小地图。
  34227. * @param {SuperMap.WebPrintingJobImage} [option.image] - 表达小地图的静态图类。
  34228. * @param {SuperMap.WebPrintingJobLayers} [option.layers] - 指定 WebMap 中的 layers 图层类。
  34229. */
  34230. class WebPrintingJobLittleMapOptions {
  34231. constructor(option) {
  34232. /**
  34233. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} SuperMap.WebPrintingJobLittleMapOptions.prototype.center
  34234. * @description 小地图的中心点。
  34235. */
  34236. this.center = null;
  34237. /**
  34238. * @member {number} [SuperMap.WebPrintingJobLittleMapOptions.prototype.scale]
  34239. * @description 小地图的比例尺。
  34240. */
  34241. this.scale = null;
  34242. /**
  34243. * @member {Array.<string>} SuperMap.WebPrintingJobLittleMapOptions.prototype.layerNames
  34244. * @description 指定 WebMap中图层名称的列表,用于渲染小地图。
  34245. */
  34246. this.layerNames = null;
  34247. /**
  34248. * @member {SuperMap.WebPrintingJobImage} [SuperMap.WebPrintingJobLittleMapOptions.prototype.image]
  34249. * @description 表达小地图的静态图类。暂不支持
  34250. */
  34251. this.image = null;
  34252. /**
  34253. * @member {SuperMap.WebPrintingJobLayers} [SuperMap.WebPrintingJobLittleMapOptions.prototype.layers]
  34254. * @description 指定 WebMap 中的 layers 图层类。
  34255. */
  34256. this.layers = null;
  34257. this.CLASS_NAME = 'SuperMap.WebPrintingJobLittleMapOptions';
  34258. Util.extend(this, option);
  34259. }
  34260. /**
  34261. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.destroy
  34262. * @description 释放资源,将引用资源的属性置空。
  34263. */
  34264. destroy() {
  34265. this.center = null;
  34266. this.scale = null;
  34267. this.layerNames = null;
  34268. if (this.image instanceof WebPrintingJobImage) {
  34269. this.image.destroy();
  34270. this.image = null;
  34271. }
  34272. if (this.layers instanceof WebPrintingJobLayers) {
  34273. this.layers.destroy();
  34274. this.layers = null;
  34275. }
  34276. }
  34277. /**
  34278. * @function SuperMap.WebPrintingJobLittleMapOptions.prototype.toJSON
  34279. * @description 将 SuperMap.WebPrintingJobLittleMapOptions 对象转化为 JSON 字符串。
  34280. * @returns {string} 返回转换后的 JSON 字符串。
  34281. */
  34282. toJSON() {
  34283. var params = {
  34284. scale: this.scale,
  34285. center: this.center
  34286. };
  34287. if (this.layerNames) {
  34288. params.layerNames = this.layerNames;
  34289. } else if (this.layers) {
  34290. params.layers = this.layers;
  34291. }
  34292. if (this.image) {
  34293. params.image = this.image;
  34294. }
  34295. return Util.toJSON(params);
  34296. }
  34297. }
  34298. SuperMap.WebPrintingJobLittleMapOptions = WebPrintingJobLittleMapOptions;
  34299. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobNorthArrowOptions.js
  34300. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34301. * This program are made available under the terms of the Apache License, Version 2.0
  34302. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34303. /**
  34304. * @class SuperMap.WebPrintingJobNorthArrowOptions
  34305. * @classdesc Web 打印地图指北针参数类。
  34306. * @version 10.1.0
  34307. * @category iServer WebPrintingJob
  34308. * @param {Object} option - 初始化参数。
  34309. * @param {string} option.picAsUrl - 指北针的图片 url 地址。
  34310. * @param {string} [option.picAsBase64] - 指北针的base64位图片信息。
  34311. */
  34312. class WebPrintingJobNorthArrowOptions {
  34313. constructor(option) {
  34314. /**
  34315. * @member {string} SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsUrl
  34316. * @description 指北针的图片 url 地址。
  34317. */
  34318. this.picAsUrl = null;
  34319. /**
  34320. * @member {string} [SuperMap.WebPrintingJobNorthArrowOptions.prototype.picAsBase64]
  34321. * @description 指北针的base64位图片信息。
  34322. */
  34323. this.picAsBase64 = null;
  34324. this.CLASS_NAME = 'SuperMap.WebPrintingJobNorthArrowOptions';
  34325. Util.extend(this, option);
  34326. }
  34327. /**
  34328. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.destroy
  34329. * @description 释放资源,将引用资源的属性置空。
  34330. */
  34331. destroy() {
  34332. this.picAsUrl = null;
  34333. this.picAsBase64 = null;
  34334. }
  34335. /**
  34336. * @function SuperMap.WebPrintingJobNorthArrowOptions.prototype.toJSON
  34337. * @description 将 SuperMap.WebPrintingJobNorthArrowOptions 对象转化为 JSON 字符串。
  34338. * @returns {string} 返回转换后的 JSON 字符串。
  34339. */
  34340. toJSON() {
  34341. var params = {};
  34342. if (this.picAsUrl) {
  34343. params.picAsUrl = this.picAsUrl;
  34344. } else if (this.picAsBase64) {
  34345. params.picAsBase64 = this.picAsBase64.replace(/^data:.+;base64,/, '');
  34346. }
  34347. return Util.toJSON(params);
  34348. }
  34349. }
  34350. SuperMap.WebPrintingJobNorthArrowOptions = WebPrintingJobNorthArrowOptions;
  34351. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobScaleBarOptions.js
  34352. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34353. * This program are made available under the terms of the Apache License, Version 2.0
  34354. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34355. /**
  34356. * @class SuperMap.WebPrintingJobScaleBarOptions
  34357. * @classdesc Web 打印比例尺参数类。
  34358. * @category iServer WebPrintingJob
  34359. * @version 10.1.0
  34360. * @param {Object} option - 初始化参数。
  34361. * @param {string} [option.scaleText] - 比例尺文本信息。例如:1:1000000
  34362. * @param {SuperMap.WebScaleOrientationType} [option.orientation] - 比例尺的方位样式。
  34363. * @param {SuperMap.WebScaleType} [option.type] - 比例尺的样式。
  34364. * @param {number} [option.intervals] - 比例尺条的段数。
  34365. * @param {SuperMap.WebScaleUnit} [option.unit] - 比例尺的单位制。
  34366. */
  34367. class WebPrintingJobScaleBarOptions {
  34368. constructor(option) {
  34369. /**
  34370. * @member {string} SuperMap.WebPrintingJobScaleBarOptions.prototype.scaleText
  34371. * @description 比例尺文本信息。
  34372. */
  34373. this.scaleText = null;
  34374. /**
  34375. * @member {SuperMap.WebScaleOrientationType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.orientation]
  34376. * @description 比例尺的方位样式。
  34377. */
  34378. this.orientation = null;
  34379. /**
  34380. * @member {SuperMap.WebScaleType} [SuperMap.WebPrintingJobScaleBarOptions.prototype.type]
  34381. * @description 比例尺的样式。
  34382. */
  34383. this.type = null;
  34384. /**
  34385. * @member {object} [SuperMap.WebPrintingJobScaleBarOptions.prototype.intervals]
  34386. * @description 比例尺条的段数。
  34387. */
  34388. this.intervals = null;
  34389. /**
  34390. * @member {SuperMap.WebScaleUnit} [SuperMap.WebPrintingJobScaleBarOptions.prototype.unit]
  34391. * @description 比例尺的单位制。
  34392. */
  34393. this.unit = null;
  34394. this.CLASS_NAME = 'SuperMap.WebPrintingJobScaleBarOptions';
  34395. Util.extend(this, option);
  34396. }
  34397. /**
  34398. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.destroy
  34399. * @description 释放资源,将引用资源的属性置空。
  34400. */
  34401. destroy() {
  34402. this.scaleText = null;
  34403. this.orientation = null;
  34404. this.type = null;
  34405. this.intervals = null;
  34406. this.unit = null;
  34407. }
  34408. /**
  34409. * @function SuperMap.WebPrintingJobScaleBarOptions.prototype.toJSON
  34410. * @description 将 SuperMap.WebPrintingJobScaleBarOptions 对象转化为 JSON 字符串。
  34411. * @returns {string} 返回转换后的 JSON 字符串。
  34412. */
  34413. toJSON() {
  34414. var params = {
  34415. scaleText: this.scaleText || "",
  34416. type: this.type || "BAR",
  34417. intervals: this.intervals || "",
  34418. unit: this.unit || "METER"
  34419. };
  34420. if (this.orientation) {
  34421. params.orientation = this.orientation;
  34422. }
  34423. return Util.toJSON(params);
  34424. }
  34425. }
  34426. SuperMap.WebPrintingJobScaleBarOptions = WebPrintingJobScaleBarOptions;
  34427. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobContent.js
  34428. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34429. * This program are made available under the terms of the Apache License, Version 2.0
  34430. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34431. /**
  34432. * @class SuperMap.WebPrintingJobContent
  34433. * @classdesc Web 打印内容参数类。
  34434. * @version 10.1.0
  34435. * @category iServer WebPrintingJob
  34436. * @param {Object} option - 初始化参数。
  34437. * @param {string} option.type - Web 打印内容支持的类型。目前支持的类型:WEBMAP
  34438. * @param {string} [option.url] - 待打印的 SuperMap iPortal WebMap 的 url 地址。例如:http://supermapiportal:8190/iportal/web/maps/{mapid}/map.rjson
  34439. * @param {string} [option.token] - 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  34440. * @param {WebMapSummaryObject} [option.value] - 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。如果已填了 url 参数,此参数可不传
  34441. */
  34442. class WebPrintingJobContent {
  34443. constructor(option) {
  34444. /**
  34445. * @member {string} SuperMap.WebPrintingJobContent.prototype.type
  34446. * @description Web 打印内容支持的类型。
  34447. */
  34448. this.type = null;
  34449. /**
  34450. * @member {string} [SuperMap.WebPrintingJobContent.prototype.url]
  34451. * @description 待打印的 SuperMap iPortal WebMap 的 url 地址。
  34452. */
  34453. this.url = null;
  34454. /**
  34455. * @member {string} [SuperMap.WebPrintingJobContent.prototype.token]
  34456. * @description 如果待打印的是 SuperMap iPortal 用户私有的 WebMap,需要提供 SuperMap iPortal 用户的 token。
  34457. */
  34458. this.token = null;
  34459. /**
  34460. * @member {WebMapSummaryObject} [SuperMap.WebPrintingJobContent.prototype.value]
  34461. * @description 传递的是一个符合 SuperMap WebMap 规范的 WebMap 的 JSON 表达,也可以是一个完整的 SuperMap iPortal 数据上图制作的 WebMap 的 json 表达。
  34462. */
  34463. this.value = null;
  34464. this.CLASS_NAME = 'SuperMap.WebPrintingJobContent';
  34465. Util.extend(this, option);
  34466. }
  34467. /**
  34468. * @function SuperMap.WebPrintingJobContent.prototype.destroy
  34469. * @description 释放资源,将引用资源的属性置空。
  34470. */
  34471. destroy() {
  34472. this.type = false || "WEBMAP";
  34473. this.url = null;
  34474. this.token = null;
  34475. this.value = null;
  34476. }
  34477. /**
  34478. * @function SuperMap.WebPrintingJobContent.prototype.toJSON
  34479. * @description 将 SuperMap.WebPrintingJobContent 对象转化为 JSON 字符串。
  34480. * @returns {string} 返回转换后的 JSON 字符串。
  34481. */
  34482. toJSON() {
  34483. var params = {
  34484. type: this.type
  34485. };
  34486. if (this.token) {
  34487. params.token = this.token;
  34488. }
  34489. if (this.url) {
  34490. params.url = this.url;
  34491. } else if (this.value) {
  34492. params.value = this.value;
  34493. }
  34494. return Util.toJSON(params);
  34495. }
  34496. }
  34497. SuperMap.WebPrintingJobContent = WebPrintingJobContent;
  34498. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobLayoutOptions.js
  34499. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34500. * This program are made available under the terms of the Apache License, Version 2.0
  34501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34502. /**
  34503. * @class SuperMap.WebPrintingJobLayoutOptions
  34504. * @classdesc Web 打印的布局参数类。
  34505. * @version 10.1.0
  34506. * @category iServer WebPrintingJob
  34507. * @param {Object} option - 初始化参数。
  34508. * @param {string} option.templateName - 布局模板的名称。
  34509. * @param {string} option.title - 地图主标题名称。
  34510. * @param {string} option.subTitle - 地图副标题名称。
  34511. * @param {string} option.author - 地图作者名称。
  34512. * @param {string} option.copyright - 地图版权信息。
  34513. * @param {SuperMap.WebPrintingJobLittleMapOptions} option.littleMapOptions - 小地图参数类。
  34514. * @param {SuperMap.WebPrintingJobLegendOptions} option.legendOptions - 图例参数类。
  34515. * @param {SuperMap.WebPrintingJobScaleBarOptions} [option.scaleBarOptions] - 地图比例尺参数类。
  34516. * @param {SuperMap.WebPrintingJobNorthArrowOptions} [option.northArrowOptions] - 地图指北针参数类。
  34517. */
  34518. class WebPrintingJobLayoutOptions {
  34519. constructor(option) {
  34520. /**
  34521. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.templateName
  34522. * @description 布局模板的名称。
  34523. */
  34524. this.templateName = null;
  34525. /**
  34526. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.title
  34527. * @description 地图主标题名称。
  34528. */
  34529. this.title = null;
  34530. /**
  34531. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.subTitle
  34532. * @description 地图副标题名称。
  34533. */
  34534. this.subTitle = null;
  34535. /**
  34536. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.author
  34537. * @description 地图作者名称。
  34538. */
  34539. this.author = null;
  34540. /**
  34541. * @member {string} SuperMap.WebPrintingJobLayoutOptions.prototype.copyright
  34542. * @description 地图版权信息。
  34543. */
  34544. this.copyright = null;
  34545. /**
  34546. * @member {SuperMap.WebPrintingJobScaleBarOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.scaleBarOptions]
  34547. * @description 地图比例尺参数类。
  34548. */
  34549. this.scaleBarOptions = null;
  34550. /**
  34551. * @member {SuperMap.WebPrintingJobNorthArrowOptions} [SuperMap.WebPrintingJobLayoutOptions.prototype.northArrowOptions]
  34552. * @description 地图指北针参数类。
  34553. */
  34554. this.northArrowOptions = null;
  34555. /**
  34556. * @member {SuperMap.WebPrintingJobLittleMapOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.littleMapOptions
  34557. * @description 小地图参数类。
  34558. */
  34559. this.littleMapOptions = null;
  34560. /**
  34561. * @member {SuperMap.WebPrintingJobLegendOptions} SuperMap.WebPrintingJobLayoutOptions.prototype.legendOptions
  34562. * @description 图例参数类。
  34563. */
  34564. this.legendOptions = null;
  34565. this.CLASS_NAME = 'SuperMap.WebPrintingJobLayoutOptions';
  34566. Util.extend(this, option);
  34567. }
  34568. /**
  34569. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.destroy
  34570. * @description 释放资源,将引用资源的属性置空。
  34571. */
  34572. destroy() {
  34573. this.templateName = null;
  34574. this.title = null;
  34575. this.subTitle = null;
  34576. this.author = null;
  34577. this.copyright = null;
  34578. if (this.scaleBarOptions instanceof WebPrintingJobScaleBarOptions) {
  34579. this.scaleBarOptions.destroy();
  34580. this.scaleBarOptions = null;
  34581. }
  34582. if (this.northArrowOptions instanceof WebPrintingJobNorthArrowOptions) {
  34583. this.northArrowOptions.destroy();
  34584. this.northArrowOptions = null;
  34585. }
  34586. if (this.littleMapOptions instanceof WebPrintingJobLittleMapOptions) {
  34587. this.littleMapOptions.destroy();
  34588. this.littleMapOptions = null;
  34589. }
  34590. if (this.legendOptions instanceof WebPrintingJobLegendOptions) {
  34591. this.legendOptions.destroy();
  34592. this.legendOptions = null;
  34593. }
  34594. }
  34595. /**
  34596. * @function SuperMap.WebPrintingJobLayoutOptions.prototype.toJSON
  34597. * @description 将 SuperMap.WebPrintingJobLayoutOptions 对象转化为 JSON 字符串。
  34598. * @returns {string} 返回转换后的 JSON 字符串。
  34599. */
  34600. toJSON() {
  34601. var params = {
  34602. templateName: this.templateName,
  34603. title: this.title,
  34604. subTitle: this.subTitle,
  34605. author: this.author,
  34606. copyright: this.copyright
  34607. };
  34608. if (this.scaleBarOptions) {
  34609. params.scaleBarOptions = this.scaleBarOptions;
  34610. }
  34611. if (this.northArrowOptions) {
  34612. params.northArrowOptions = this.northArrowOptions;
  34613. }
  34614. if (this.littleMapOptions) {
  34615. params.littleMapOptions = this.littleMapOptions;
  34616. }
  34617. if (this.legendOptions) {
  34618. params.legendOptions = this.legendOptions;
  34619. }
  34620. return Util.toJSON(params);
  34621. }
  34622. }
  34623. SuperMap.WebPrintingJobLayoutOptions = WebPrintingJobLayoutOptions;
  34624. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobExportOptions.js
  34625. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34626. * This program are made available under the terms of the Apache License, Version 2.0
  34627. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34628. /**
  34629. * @class SuperMap.WebPrintingJobExportOptions
  34630. * @classdesc Web 打印的输出参数类。
  34631. * @version 10.1.0
  34632. * @category iServer WebPrintingJob
  34633. * @param {Object} option - 初始化参数。
  34634. * @param {SuperMap.WebExportFormatType} option.format - Web 打印输出的格式,目前支持:PNG、PDF。
  34635. * @param {number} [option.dpi=96] - Web 打印输出的分辨率,单位为每英寸点数。默认值为 96 dpi。
  34636. * @param {number} [option.scale] - Web 打印输出的地图比例尺。
  34637. * @param {number} [option.rotation] - Web 打印输出的地图角度。
  34638. * @param {SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point|mapboxgl.LngLat|mapboxgl.Point|Array.<number>} [option.center] - Web 打印输出的地图中心点。
  34639. */
  34640. class WebPrintingJobExportOptions {
  34641. constructor(option) {
  34642. /**
  34643. * @member {SuperMap.WebExportFormatType} SuperMap.WebPrintingJobExportOptions.prototype.format
  34644. * @description Web 打印输出的格式。
  34645. */
  34646. this.format = null;
  34647. /**
  34648. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.dpi=96]
  34649. * @description Web 打印输出的分辨率,单位为每英寸点数。
  34650. */
  34651. this.dpi = 96;
  34652. /**
  34653. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.scale]
  34654. * @description Web 打印输出的地图比例尺。
  34655. */
  34656. this.scale = null;
  34657. /**
  34658. * @member {number} [SuperMap.WebPrintingJobExportOptions.prototype.rotation]
  34659. * @description Web 打印输出的地图角度。
  34660. */
  34661. this.rotation = null;
  34662. /**
  34663. * @member {Array.<(SuperMap.Geometry.Point|L.Point|L.LatLng|ol.geom.Point)>} [SuperMap.WebPrintingJobExportOptions.prototype.center]
  34664. * @description Web 打印输出的地图中心点。
  34665. */
  34666. this.center = null;
  34667. this.CLASS_NAME = 'SuperMap.WebPrintingJobExportOptions';
  34668. Util.extend(this, option);
  34669. }
  34670. /**
  34671. * @function SuperMap.WebPrintingJobExportOptions.prototype.destroy
  34672. * @description 释放资源,将引用资源的属性置空。
  34673. */
  34674. destroy() {
  34675. this.format = null;
  34676. this.dpi = null;
  34677. this.scale = null;
  34678. this.rotation = null;
  34679. this.center = null;
  34680. this.outputSize = null;
  34681. }
  34682. /**
  34683. * @function SuperMap.WebPrintingJobExportOptions.prototype.toJSON
  34684. * @description 将 SuperMap.WebPrintingJobExportOptions 对象转化为 JSON 字符串。
  34685. * @returns {string} 返回转换后的 JSON 字符串。
  34686. */
  34687. toJSON() {
  34688. var params = {
  34689. format: this.format || "PDF",
  34690. dpi: this.dpi,
  34691. scale: this.scale,
  34692. center: this.center
  34693. };
  34694. if (this.rotation) {
  34695. params.rotation = this.rotation;
  34696. }
  34697. if (this.outputSize) {
  34698. params.outputSize = this.outputSize;
  34699. }
  34700. return Util.toJSON(params);
  34701. }
  34702. }
  34703. SuperMap.WebPrintingJobExportOptions = WebPrintingJobExportOptions;
  34704. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingJobParameters.js
  34705. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34706. * This program are made available under the terms of the Apache License, Version 2.0
  34707. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34708. /**
  34709. * @class SuperMap.WebPrintingJobParameters
  34710. * @category iServer WebPrintingJob
  34711. * @version 10.1.0
  34712. * @classdesc Web 打印参数类
  34713. * @param {Object} options - 初始化参数。
  34714. * @param {SuperMap.WebPrintingJobContent} options.content - Web 打印的内容类。
  34715. * @param {SuperMap.WebPrintingJobLayoutOptions} options.layoutOptions - Web 打印的布局类,包含各种布局元素的设置。
  34716. * @param {SuperMap.WebPrintingJobExportOptions} options.exportOptions - Web 打印的输出类,包含 DPI、页面大小等。
  34717. */
  34718. class WebPrintingJobParameters {
  34719. constructor(options) {
  34720. if (!options) {
  34721. return;
  34722. }
  34723. /**
  34724. * @member {SuperMap.WebPrintingJobContent} SuperMap.WebPrintingJobParameters.prototype.content
  34725. * @description Web 打印的内容类。
  34726. */
  34727. this.content = null;
  34728. /**
  34729. * @member {SuperMap.WebPrintingJobLayoutOptions} SuperMap.WebPrintingJobParameters.prototype.layoutOptions
  34730. * @description Web 打印的布局类,包含各种布局元素的设置。
  34731. */
  34732. this.layoutOptions = null;
  34733. /**
  34734. * @member {SuperMap.WebPrintingJobExportOptions} SuperMap.WebPrintingJobParameters.prototype.exportOptions
  34735. * @description Web 打印的输出类,包含 DPI、页面大小等。
  34736. */
  34737. this.exportOptions = null;
  34738. Util.extend(this, options);
  34739. this.CLASS_NAME = 'SuperMap.WebPrintingJobParameters';
  34740. }
  34741. /**
  34742. * @function SuperMap.WebPrintingJobParameters.prototype.destroy
  34743. * @description 释放资源,将引用资源的属性置空。
  34744. */
  34745. destroy() {
  34746. if (this.content instanceof WebPrintingJobContent) {
  34747. this.content.destroy();
  34748. this.content = null;
  34749. }
  34750. if (this.layoutOptions instanceof WebPrintingJobLayoutOptions) {
  34751. this.layoutOptions.destroy();
  34752. this.layoutOptions = null;
  34753. }
  34754. if (this.exportOptions instanceof WebPrintingJobExportOptions) {
  34755. this.exportOptions.destroy();
  34756. this.exportOptions = null;
  34757. }
  34758. }
  34759. }
  34760. SuperMap.WebPrintingJobParameters = WebPrintingJobParameters;
  34761. ;// CONCATENATED MODULE: ./src/common/iServer/WebPrintingService.js
  34762. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34763. * This program are made available under the terms of the Apache License, Version 2.0
  34764. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34765. /**
  34766. * @class SuperMap.WebPrintingService
  34767. * @category iServer WebPrintingJob
  34768. * @version 10.1.0
  34769. * @classdesc 打印地图服务基类。
  34770. * @extends {SuperMap.CommonServiceBase}
  34771. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  34772. * @param {Object} options - 参数。
  34773. * @param {Object} options.eventListeners - 事件监听器对象。有processCompleted属性可传入处理完成后的回调函数。processFailed属性传入处理失败后的回调函数。
  34774. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  34775. * @param {Object} [options.headers] - 请求头。
  34776. */
  34777. class WebPrintingService extends CommonServiceBase {
  34778. /**
  34779. * @function SuperMap.WebPrintingService.prototype.constructor
  34780. * @description 打印地图服务基类。
  34781. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  34782. * @param {Object} options -参数。
  34783. * @param {Object} options.eventListeners - 需要被注册的监听器对象。
  34784. */
  34785. constructor(url, options) {
  34786. super(url, options);
  34787. if (options) {
  34788. Util.extend(this, options);
  34789. }
  34790. this.CLASS_NAME = 'SuperMap.WebPrintingService';
  34791. if (!this.url) {
  34792. return;
  34793. }
  34794. }
  34795. /**
  34796. * @function SuperMap.WebPrintingService.prototype.destroy
  34797. * @description 释放资源,将引用资源的属性置空。
  34798. */
  34799. destroy() {
  34800. super.destroy();
  34801. }
  34802. /**
  34803. * @function SuperMap.WebPrintingService.prototype.createWebPrintingJob
  34804. * @description 创建 Web 打印任务。
  34805. * @param {SuperMap.WebPrintingJobParameters} params - Web 打印的请求参数。
  34806. */
  34807. createWebPrintingJob(params) {
  34808. if (!params) {
  34809. return;
  34810. }
  34811. if (params.layoutOptions) {
  34812. if (params.layoutOptions.legendOptions) {
  34813. !params.layoutOptions.legendOptions.title && (params.layoutOptions.legendOptions.title = '');
  34814. params.layoutOptions.legendOptions.picAsBase64 =
  34815. params.layoutOptions.legendOptions.picAsBase64 &&
  34816. params.layoutOptions.legendOptions.picAsBase64.replace(/^data:.+;base64,/, '');
  34817. if (
  34818. params.layoutOptions.legendOptions.customItems &&
  34819. params.layoutOptions.legendOptions.customItems.hasOwnProperty('picAsBase64')
  34820. ) {
  34821. params.layoutOptions.legendOptions.customItems.picAsBase64 = params.layoutOptions.legendOptions.customItems.picAsBase64.replace(
  34822. /^data:.+;base64,/,
  34823. ''
  34824. );
  34825. }
  34826. }
  34827. }
  34828. var me = this;
  34829. me.request({
  34830. url: me._processUrl('jobs'),
  34831. method: 'POST',
  34832. data: Util.toJSON(params),
  34833. scope: me,
  34834. success: me.serviceProcessCompleted,
  34835. failure: me.serviceProcessFailed
  34836. });
  34837. }
  34838. /**
  34839. * @function SuperMap.WebPrintingService.prototype.getPrintingJob
  34840. * @description 获取 Web 打印输出文档任务。
  34841. * @param {String} jobId - Web 打印任务 ID
  34842. */
  34843. getPrintingJob(jobId) {
  34844. var me = this;
  34845. var url = me._processUrl(`jobs/${jobId}`);
  34846. me.request({
  34847. url,
  34848. method: 'GET',
  34849. scope: me,
  34850. success: function (result) {
  34851. me.rollingProcess(result, url);
  34852. },
  34853. failure: me.serviceProcessFailed
  34854. });
  34855. }
  34856. /**
  34857. * @function SuperMap.WebPrintingService.prototype.getPrintingJobResult
  34858. * @description 获取 Web 打印任务的输出文档。
  34859. * @param {String} jobId - Web 打印输入文档任务 ID。
  34860. */
  34861. getPrintingJobResult(jobId) {
  34862. var me = this;
  34863. me.request({
  34864. url: me._processUrl(`jobs/${jobId}/result`),
  34865. method: 'GET',
  34866. scope: me,
  34867. success: me.serviceProcessCompleted,
  34868. failure: me.serviceProcessFailed
  34869. });
  34870. }
  34871. /**
  34872. * @function SuperMap.WebPrintingService.prototype.getLayoutTemplates
  34873. * @description 查询 Web 打印服务所有可用的模板信息。
  34874. */
  34875. getLayoutTemplates() {
  34876. var me = this;
  34877. me.request({
  34878. url: me._processUrl('layouts'),
  34879. method: 'GET',
  34880. scope: me,
  34881. success: me.serviceProcessCompleted,
  34882. failure: me.serviceProcessFailed
  34883. });
  34884. }
  34885. /**
  34886. * @function SuperMap.WebPrintingService.prototype.rollingProcess
  34887. * @description 轮询查询 Web 打印任务。
  34888. * @param {Object} result - 服务器返回的结果对象。
  34889. */
  34890. rollingProcess(result, url) {
  34891. var me = this;
  34892. if (!result) {
  34893. return;
  34894. }
  34895. var id = setInterval(function () {
  34896. me.request({
  34897. url,
  34898. method: 'GET',
  34899. scope: me,
  34900. success: function (result) {
  34901. switch (result.status) {
  34902. case 'FINISHED':
  34903. clearInterval(id);
  34904. me.serviceProcessCompleted(result);
  34905. break;
  34906. case 'ERROR':
  34907. clearInterval(id);
  34908. me.serviceProcessFailed(result);
  34909. break;
  34910. case 'RUNNING':
  34911. me.events.triggerEvent('processRunning', result);
  34912. break;
  34913. }
  34914. },
  34915. failure: me.serviceProcessFailed
  34916. });
  34917. }, 1000);
  34918. }
  34919. _processUrl(appendContent) {
  34920. if (appendContent) {
  34921. return Util.urlPathAppend(this.url, appendContent);
  34922. }
  34923. return this.url;
  34924. }
  34925. }
  34926. SuperMap.WebPrintingService = WebPrintingService;
  34927. ;// CONCATENATED MODULE: ./src/common/iServer/index.js
  34928. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34929. * This program are made available under the terms of the Apache License, Version 2.0
  34930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34931. ;// CONCATENATED MODULE: ./src/common/online/OnlineResources.js
  34932. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  34933. * This program are made available under the terms of the Apache License, Version 2.0
  34934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  34935. /**
  34936. * @enum ServiceStatus
  34937. * @memberOf SuperMap
  34938. * @category iPortal/Online
  34939. * @description 服务发布状态。
  34940. */
  34941. var ServiceStatus = SuperMap.ServiceStatus = {
  34942. /** 不涉及,不可发布。 */
  34943. DOES_NOT_INVOLVE: "DOES_NOT_INVOLVE",
  34944. /** 发布失败。 */
  34945. PUBLISH_FAILED: "PUBLISH_FAILED",
  34946. /** 已发布。 */
  34947. PUBLISHED: "PUBLISHED",
  34948. /** 正在发布。 */
  34949. PUBLISHING: "PUBLISHING",
  34950. /** 未发布。 */
  34951. UNPUBLISHED: "UNPUBLISHED",
  34952. /** 取消服务失败。 */
  34953. UNPUBLISHED_FAILED: "UNPUBLISHED_FAILED"
  34954. };
  34955. /**
  34956. *
  34957. * @enum DataItemType
  34958. * @memberOf SuperMap
  34959. * @category iPortal/Online
  34960. * @description 数据项类型。
  34961. */
  34962. var OnlineResources_DataItemType = SuperMap.DataItemType = {
  34963. /** AUDIO */
  34964. AUDIO: "AUDIO",
  34965. /** COLOR */
  34966. COLOR: "COLOR",
  34967. /** COLORSCHEME */
  34968. COLORSCHEME: "COLORSCHEME",
  34969. /** CSV */
  34970. CSV: "CSV",
  34971. /** EXCEL */
  34972. EXCEL: "EXCEL",
  34973. /** FILLSYMBOL */
  34974. FILLSYMBOL: "FILLSYMBOL",
  34975. /** IMAGE */
  34976. IMAGE: "IMAGE",
  34977. /** LAYERTEMPLATE */
  34978. LAYERTEMPLATE: "LAYERTEMPLATE",
  34979. /** LAYOUTTEMPLATE */
  34980. LAYOUTTEMPLATE: "LAYOUTTEMPLATE",
  34981. /** LINESYMBOL */
  34982. LINESYMBOL: "LINESYMBOL",
  34983. /** MAPTEMPLATE */
  34984. MAPTEMPLATE: "MAPTEMPLATE",
  34985. /** MARKERSYMBOL */
  34986. MARKERSYMBOL: "MARKERSYMBOL",
  34987. /** MBTILES */
  34988. MBTILES: "MBTILES",
  34989. /** PHOTOS */
  34990. PHOTOS: "PHOTOS",
  34991. /** SHP */
  34992. SHP: "SHP",
  34993. /** SMTILES */
  34994. SMTILES: "SMTILES",
  34995. /** SVTILES */
  34996. SVTILES: "SVTILES",
  34997. /** THEMETEMPLATE */
  34998. THEMETEMPLATE: "THEMETEMPLATE",
  34999. /** TPK */
  35000. TPK: "TPK",
  35001. /** UDB */
  35002. UDB: "UDB",
  35003. /** UGCV5 */
  35004. UGCV5: "UGCV5",
  35005. /** UNKNOWN */
  35006. UNKNOWN: "UNKNOWN",
  35007. /** VIDEO */
  35008. VIDEO: "VIDEO",
  35009. /** WORKENVIRONMENT */
  35010. WORKENVIRONMENT: "WORKENVIRONMENT",
  35011. /** WORKSPACE */
  35012. WORKSPACE: "WORKSPACE"
  35013. };
  35014. /**
  35015. * @enum DataItemOrderBy
  35016. * @memberOf SuperMap
  35017. * @category iPortal/Online
  35018. * @description 数据排序字段。
  35019. */
  35020. var DataItemOrderBy = SuperMap.DataItemOrderBy = {
  35021. /** FILENAME */
  35022. FILENAME: "FILENAME",
  35023. /** ID */
  35024. ID: "ID",
  35025. /** LASTMODIFIEDTIME */
  35026. LASTMODIFIEDTIME: "LASTMODIFIEDTIME",
  35027. /** NICKNAME */
  35028. NICKNAME: "NICKNAME",
  35029. /** SERVICESTATUS */
  35030. SERVICESTATUS: "SERVICESTATUS",
  35031. /** SIZE */
  35032. SIZE: "SIZE",
  35033. /** STATUS */
  35034. STATUS: "STATUS",
  35035. /** TYPE */
  35036. TYPE: "TYPE",
  35037. /** UPDATETIME */
  35038. UPDATETIME: "UPDATETIME",
  35039. /** USERNAME */
  35040. USERNAME: "USERNAME"
  35041. };
  35042. /**
  35043. * @enum FilterField
  35044. * @memberOf SuperMap
  35045. * @category iPortal/Online
  35046. * @description 关键字查询时的过滤字段。
  35047. */
  35048. var FilterField = SuperMap.FilterField = {
  35049. /** LINKPAGE */
  35050. LINKPAGE: "LINKPAGE",
  35051. /** LINKPAGE */
  35052. MAPTITLE: "MAPTITLE",
  35053. /** LINKPAGE */
  35054. NICKNAME: "NICKNAME",
  35055. /** LINKPAGE */
  35056. RESTITLE: "RESTITLE",
  35057. /** LINKPAGE */
  35058. USERNAME: "USERNAME"
  35059. };
  35060. ;// CONCATENATED MODULE: ./src/common/online/OnlineServiceBase.js
  35061. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35062. * This program are made available under the terms of the Apache License, Version 2.0
  35063. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35064. // import {SecurityManager} from '../security/SecurityManager';
  35065. /**
  35066. * @class SuperMap.OnlineServiceBase
  35067. * @classdesc Online 服务基类(使用 key 作为权限限制的类需要实现此类)。
  35068. * @category iPortal/Online
  35069. * @param {Object} options - 服务参数。
  35070. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35071. * @param {Object} [options.headers] - 请求头。
  35072. */
  35073. class OnlineServiceBase {
  35074. constructor(options) {
  35075. options = options || {};
  35076. Util.extend(this, options);
  35077. this.serverType = ServerType.ONLINE;
  35078. this.CLASS_NAME = "SuperMap.OnlineServiceBase";
  35079. }
  35080. /**
  35081. * @function SuperMap.OnlineServiceBase.prototype.request
  35082. * @description 请求 online 服务
  35083. * @param {string} [method='GET'] - 请求方式, 'GET', 'PUT', 'POST', 'DELETE'。
  35084. * @param {string} url - 服务地址。
  35085. * @param {Object} param - URL 查询参数。
  35086. * @param {Object} [requestOptions] - http 请求参数, 比如请求头,超时时间等。
  35087. * @returns {Promise} 返回包含请求结果的 Promise 对象。
  35088. */
  35089. request(method, url, param, requestOptions = {}) {
  35090. url = this.createCredentialUrl(url);
  35091. requestOptions['crossOrigin'] = this.options.crossOrigin;
  35092. requestOptions['headers'] = this.options.headers;
  35093. return FetchRequest.commit(method, url, param, requestOptions).then(function(response) {
  35094. return response.json();
  35095. });
  35096. }
  35097. /**
  35098. * @function SuperMap.OnlineServiceBase.prototype.createCredentialUrl
  35099. * @description 追加授权信息。
  35100. * @param {string} url - 对接的 online 服务地址。
  35101. */
  35102. createCredentialUrl(url) {
  35103. var newUrl = url,
  35104. key = this.getCredential();
  35105. if (key) {
  35106. var paramStr = "key=" + key;
  35107. var endStr = newUrl.substring(newUrl.length - 1, newUrl.length);
  35108. if (newUrl.indexOf("?") > -1 && endStr === "?") {
  35109. newUrl += paramStr;
  35110. } else if (newUrl.indexOf("?") > -1 && endStr !== "?") {
  35111. newUrl += "&" + paramStr;
  35112. } else {
  35113. newUrl += "?" + paramStr;
  35114. }
  35115. }
  35116. return newUrl;
  35117. }
  35118. //其子类需要重写该方法,修改其中获取key的字段
  35119. //存储key可能是服务id字段,可能是url,或者是WebAPI类型
  35120. getCredential() {
  35121. //return SecurityManager.getKey(this.id);
  35122. //或
  35123. //return SecurityManager.getKey(this.serviceUrl);
  35124. }
  35125. }
  35126. SuperMap.OnlineServiceBase = OnlineServiceBase;
  35127. ;// CONCATENATED MODULE: ./src/common/online/OnlineData.js
  35128. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35129. * This program are made available under the terms of the Apache License, Version 2.0
  35130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35131. /**
  35132. * @class SuperMap.OnlineData
  35133. * @classdesc Online myData 服务。
  35134. * @category iPortal/Online
  35135. * @param {string} serviceRootUrl - 服务根地址。
  35136. * @param {Object} options - 服务相关参数。
  35137. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  35138. * @param {Object} [options.headers] - 请求头。
  35139. */
  35140. class OnlineData extends OnlineServiceBase {
  35141. //TODO 目前并没有对接服务支持的所有操作,日后需要补充完整
  35142. constructor(serviceRootUrl, options) {
  35143. super(serviceRootUrl);
  35144. options = options || {};
  35145. //MD5
  35146. this.MD5 = null;
  35147. //文件类型。
  35148. this.type = null;
  35149. //数据上传者名称。
  35150. this.userName = null;
  35151. //文件名称。
  35152. this.fileName = null;
  35153. //文件大小,单位为 B 。
  35154. this.size = null;
  35155. //服务发布状态。
  35156. this.serviceStatus = null;
  35157. //服务 id 。
  35158. this.serviceId = null;
  35159. //数据项 id 。
  35160. this.id = null;
  35161. //最后修改时间。
  35162. this.lastModfiedTime = null;
  35163. //文件状态。
  35164. this.status = null;
  35165. //数据文件存储 id 。
  35166. this.storageId = null;
  35167. //数据的发布信息。
  35168. this.publishInfo = null;
  35169. //数据的权限信息。
  35170. this.authorizeSetting = null;
  35171. //用户的昵称。
  35172. this.nickname = null;
  35173. //数据的标签。
  35174. this.tags = [];
  35175. //数据的描述信息。
  35176. this.description = null;
  35177. //数据发布的服务信息集合。
  35178. this.dataItemServices = null;
  35179. //数据坐标类型。
  35180. this.coordType = null;
  35181. //数据审核信息
  35182. this.dataCheckResult = null;
  35183. //数据元数据信息
  35184. this.dataMetaInfo = null;
  35185. //数据的缩略图路径。
  35186. this.thumbnail = null;
  35187. Util.extend(this, options);
  35188. if (this.id) {
  35189. this.serviceUrl = serviceRootUrl + "/" + this.id;
  35190. }
  35191. this.CLASS_NAME = "SuperMap.OnlineData";
  35192. }
  35193. /**
  35194. * @function SuperMap.OnlineData.prototype.load
  35195. * @description 通过 URL 请求获取该服务完整信息。
  35196. * @returns {Promise} 返回不包含请求结果的 Promise 对象,请求返回结果自动填充到该类属性中。
  35197. */
  35198. load() {
  35199. if (!this.serviceUrl) {
  35200. return;
  35201. }
  35202. var me = this;
  35203. return me.request("GET", this.serviceUrl).then(function (result) {
  35204. Util.extend(me, result);
  35205. });
  35206. }
  35207. /**
  35208. * @function SuperMap.OnlineData.prototype.getPublishedServices
  35209. * @description 获取数据发布的所有服务。
  35210. * @returns {Object} 数据发布的所有服务。
  35211. */
  35212. getPublishedServices() {
  35213. return this.dataItemServices;
  35214. }
  35215. /**
  35216. * @function SuperMap.OnlineData.prototype.getAuthorizeSetting
  35217. * @description 获取数据的权限信息。
  35218. * @returns {Object} 权限信息。
  35219. */
  35220. getAuthorizeSetting() {
  35221. return this.authorizeSetting;
  35222. }
  35223. }
  35224. SuperMap.OnlineData = OnlineData;
  35225. ;// CONCATENATED MODULE: ./src/common/online/Online.js
  35226. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35227. * This program are made available under the terms of the Apache License, Version 2.0
  35228. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35229. /**
  35230. * @class SuperMap.Online
  35231. * @classdesc 对接 SuperMap Online 所有基础服务。
  35232. * @category iPortal/Online
  35233. * @example
  35234. * var online=new SuperMap.Online();
  35235. * var services = online.queryDatas(param);
  35236. * service.then(function(services){
  35237. * var service= services[0];
  35238. * service.updateDataInfo();
  35239. * })
  35240. */
  35241. class Online {
  35242. //TODO 目前并没有对接Online的所有操作,需要补充完整
  35243. //所有查询返回的是一个Promise,在外部使用的时候通过Promise的then方法获取异步结果
  35244. constructor() {
  35245. this.rootUrl = "https://www.supermapol.com";
  35246. this.webUrl = this.rootUrl + "/web";
  35247. var mContentUrl = this.webUrl + "/mycontent";
  35248. this.mDatasUrl = mContentUrl + "/datas";
  35249. this.CLASS_NAME = "SuperMap.Online";
  35250. }
  35251. /**
  35252. * @function SuperMap.Online.prototype.load
  35253. * @description 加载 online,验证 online 是否可用。
  35254. * @returns {Promise} 返回包含网络请求结果的 Promise 对象。
  35255. */
  35256. load() {
  35257. return FetchRequest.get(this.rootUrl).then(function (response) {
  35258. return response;
  35259. });
  35260. }
  35261. /**
  35262. * @function SuperMap.Online.prototype.login
  35263. * @description 登录Online
  35264. */
  35265. login() {
  35266. SecurityManager.loginOnline(this.rootUrl, true);
  35267. }
  35268. /**
  35269. * @function SuperMap.Online.prototype.queryDatas
  35270. * @description 查询 Online “我的内容” 下 “我的数据” 服务(需要登录状态获取),并返回可操作的服务对象。
  35271. * @param {SuperMap.OnlineQueryDatasParameter} parameter - myDatas 服务资源查询参数。
  35272. * @returns {Promise} 返回包含所有数据服务信息的 Promise 对象。
  35273. */
  35274. queryDatas(parameter) {
  35275. var me = this, url = me.mDatasUrl;
  35276. if (parameter) {
  35277. parameter = parameter.toJSON();
  35278. }
  35279. return FetchRequest.get(url, parameter).then(function (json) {
  35280. if (!json || !json.content || json.content.length < 1) {
  35281. return;
  35282. }
  35283. var services = [], contents = json.content, len = contents.length;
  35284. for (var i = 0; i < len; i++) {
  35285. var content = contents[i];
  35286. var service = new OnlineData(me.mDatasUrl, content);
  35287. services.push(service);
  35288. }
  35289. return services;
  35290. });
  35291. }
  35292. }
  35293. SuperMap.Online = Online;
  35294. ;// CONCATENATED MODULE: ./src/common/online/OnlineQueryDatasParameter.js
  35295. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35296. * This program are made available under the terms of the Apache License, Version 2.0
  35297. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35298. /**
  35299. * @class SuperMap.OnlineQueryDatasParameter
  35300. * @classdesc myDatas 服务资源查询参数。
  35301. * @category iPortal/Online
  35302. * @param {Object} options - 查询参数。
  35303. */
  35304. class OnlineQueryDatasParameter {
  35305. constructor(options) {
  35306. options = options || {};
  35307. /**
  35308. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.userNames
  35309. * @description 数据作者名。可以根据数据作者名查询,默认查询全部。
  35310. */
  35311. this.userNames = null;
  35312. /**
  35313. * @member {Array.<Object>} SuperMap.OnlineQueryDatasParameter.prototype.types
  35314. * @description 数据类型。
  35315. */
  35316. this.types = null;
  35317. /**
  35318. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.fileName
  35319. * @description 文件名称。
  35320. */
  35321. this.fileName = null;
  35322. /**
  35323. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceStatuses
  35324. * @description 服务发布状态。
  35325. */
  35326. this.serviceStatuses = null;
  35327. /**
  35328. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.serviceId
  35329. * @description 服务 ID。
  35330. */
  35331. this.serviceId = null;
  35332. /**
  35333. * @member {Array.<integer>} SuperMap.OnlineQueryDatasParameter.prototype.ids
  35334. * @description 由数据项 ID 组成的整型数组。
  35335. */
  35336. this.ids = null;
  35337. /**
  35338. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.keywords
  35339. * @description 关键字。
  35340. */
  35341. this.keywords = null;
  35342. /**
  35343. * @member {string} SuperMap.OnlineQueryDatasParameter.prototype.orderBy
  35344. * @description 排序字段。
  35345. */
  35346. this.orderBy = null;
  35347. /**
  35348. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.tags
  35349. * @description 数据的标签。
  35350. */
  35351. this.tags = null;
  35352. /**
  35353. * @member {Array.<string>} SuperMap.OnlineQueryDatasParameter.prototype.filterFields
  35354. * @description 用于关键字查询时的过滤字段。
  35355. */
  35356. this.filterFields = null;
  35357. Util.extend(this, options)
  35358. this.CLASS_NAME = "SuperMap.OnlineQueryDatasParameter";
  35359. }
  35360. /**
  35361. * @function SuperMap.OnlineQueryDatasParameter.prototype.toJSON
  35362. * @description 返回对应的 JSON 对象。
  35363. * @returns {Object} 对应的 JSON 对象。
  35364. */
  35365. toJSON() {
  35366. var me = this;
  35367. var jsonObj = {
  35368. "types": me.types,
  35369. "fileName": me.fileName,
  35370. "serviceStatuses": me.serviceStatuses,
  35371. "serviceId": me.serviceId,
  35372. "ids": me.ids,
  35373. "keywords": me.keywords,
  35374. "orderBy": me.orderBy,
  35375. "tags": me.tags,
  35376. "filterFields": me.filterFields
  35377. };
  35378. for (var key in jsonObj) {
  35379. if (jsonObj[key] == null) {
  35380. delete jsonObj[key]
  35381. }
  35382. }
  35383. return jsonObj;
  35384. }
  35385. }
  35386. SuperMap.OnlineQueryDatasParameter = OnlineQueryDatasParameter;
  35387. ;// CONCATENATED MODULE: ./src/common/online/index.js
  35388. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35389. * This program are made available under the terms of the Apache License, Version 2.0
  35390. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35391. ;// CONCATENATED MODULE: ./src/common/security/KeyServiceParameter.js
  35392. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35393. * This program are made available under the terms of the Apache License, Version 2.0
  35394. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35395. /**
  35396. * @class SuperMap.KeyServiceParameter
  35397. * @classdesc key申请参数
  35398. * @category Security
  35399. * @param {Object} options - 参数。
  35400. * @param {string} options.name - 申请服务名称。
  35401. * @param {number} options.serviceIds - 服务 ID。
  35402. * @param {SuperMap.ClientType} [options.clientType=SuperMap.ClientType.SERVER] - 服务端类型。
  35403. * @param {number} options.limitation - 有效期
  35404. */
  35405. class KeyServiceParameter {
  35406. constructor(options) {
  35407. this.name = null;
  35408. this.serviceIds = null;
  35409. this.clientType = ClientType.SERVER;
  35410. this.limitation = null;
  35411. Util.extend(this, options);
  35412. this.CLASS_NAME = "SuperMap.KeyServiceParameter";
  35413. }
  35414. /**
  35415. * @function SuperMap.KeyServiceParameter.prototype.toJSON
  35416. * @description 转换成 JSON 对象
  35417. * @returns {Object} 参数的 JSON 对象
  35418. */
  35419. toJSON() {
  35420. return {
  35421. name: this.name,
  35422. serviceIds: this.serviceIds,
  35423. clientType: this.clientType,
  35424. limitation: this.limitation
  35425. }
  35426. }
  35427. }
  35428. SuperMap.KeyServiceParameter = KeyServiceParameter;
  35429. ;// CONCATENATED MODULE: ./src/common/security/ServerInfo.js
  35430. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35431. * This program are made available under the terms of the Apache License, Version 2.0
  35432. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35433. /**
  35434. * @class SuperMap.ServerInfo
  35435. * @classdesc 服务器信息(安全相关),包含服务器类型,服务地址,token服务地址等
  35436. * @category Security
  35437. * @param {string} type - 服务器类型
  35438. * @param {Object} options - 服务器信息相关可选参数。
  35439. * @param {string} options.server - 服务器地址,如:http://supermapiserver:8090/iserver
  35440. * @param {string} [options.tokenServiceUrl] - 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  35441. * @param {string} [options.keyServiceUrl] - 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  35442. */
  35443. class ServerInfo {
  35444. constructor(type, options) {
  35445. /**
  35446. * @member {SuperMap.ServerType} SuperMap.ServerInfo.prototype.type
  35447. * @description 服务器类型
  35448. */
  35449. this.type = type;
  35450. /**
  35451. * @member {string} SuperMap.ServerInfo.prototype.server
  35452. * @description 服务器地址
  35453. */
  35454. this.server = null;
  35455. /**
  35456. * @member {string} [SuperMap.ServerInfo.prototype.tokenServiceUrl]
  35457. * @description 如:http://supermapiserver:8090/iserver/services/security/tokens.json
  35458. */
  35459. this.tokenServiceUrl = null;
  35460. /**
  35461. * @member {string} [SuperMap.ServerInfo.prototype.keyServiceUrl]
  35462. * @description 如:http://supermapiserver:8092/web/mycontent/keys/register.json
  35463. */
  35464. this.keyServiceUrl = null;
  35465. Util.extend(this, options);
  35466. this.CLASS_NAME = "SuperMap.ServerInfo";
  35467. this.type = this.type || ServerType.ISERVER;
  35468. if (!this.server) {
  35469. console.error('server url require is not undefined')
  35470. }
  35471. // var patten = /http:\/\/([^\/]+)/i;
  35472. //this.server = this.server.match(patten)[0];
  35473. var tokenServiceSuffix = "/services/security/tokens";
  35474. if (this.type === ServerType.ISERVER && this.server.indexOf("iserver") < 0) {
  35475. tokenServiceSuffix = "/iserver" + tokenServiceSuffix;
  35476. }
  35477. if (!this.tokenServiceUrl) {
  35478. this.tokenServiceUrl = Util.urlPathAppend(this.server, tokenServiceSuffix);
  35479. }
  35480. if (!this.keyServiceUrl) {
  35481. if (this.type === ServerType.IPORTAL) {
  35482. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys/register");
  35483. } else if (this.type === ServerType.ONLINE) {
  35484. this.keyServiceUrl = Util.urlPathAppend(this.server, "/web/mycontent/keys");
  35485. }
  35486. }
  35487. }
  35488. }
  35489. SuperMap.ServerInfo = ServerInfo;
  35490. ;// CONCATENATED MODULE: ./src/common/security/TokenServiceParameter.js
  35491. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35492. * This program are made available under the terms of the Apache License, Version 2.0
  35493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35494. /**
  35495. * @class SuperMap.TokenServiceParameter
  35496. * @classdesc token 申请参数。
  35497. * @category Security
  35498. * @param {Object} options - token 申请参数。
  35499. * @param {string} options.username - 用户名。
  35500. * @param {string} options.password - 密码。
  35501. * @param {SuperMap.ClientType} [options.clientType='SuperMap.ClientType.NONE'] - token 申请的客户端标识类型。
  35502. * @param {string} [options.ip] - clientType=IP 时,必选。
  35503. * @param {string} [options.referer] -clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  35504. * @param {number} [options.expiration=60] - 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  35505. *
  35506. *
  35507. */
  35508. class TokenServiceParameter {
  35509. constructor(options) {
  35510. /**
  35511. * @member {string} SuperMap.TokenServiceParameter.prototype.userName
  35512. * @description 用户名。
  35513. */
  35514. this.userName = null;
  35515. /**
  35516. * @member {string} SuperMap.TokenServiceParameter.prototype.password
  35517. * @description 密码。
  35518. */
  35519. this.password = null;
  35520. /**
  35521. * @member {SuperMap.ClientType} SuperMap.TokenServiceParameter.prototype.clientType
  35522. * @description token 申请的客户端标识类型。
  35523. */
  35524. this.clientType = ClientType.NONE;
  35525. /**
  35526. * @member {string} [SuperMap.TokenServiceParameter.prototype.ip]
  35527. * @description clientType=IP 时,必选。
  35528. */
  35529. this.ip = null;
  35530. /**
  35531. * @member {string} [SuperMap.TokenServiceParameter.prototype.referer]
  35532. * @description clientType=Referer 时,必选。如果按照指定 URL 的方式申请令牌,则设置相应的 URL。
  35533. */
  35534. this.referer = null;
  35535. /**
  35536. * @member {number} SuperMap.TokenServiceParameter.prototype.expiration
  35537. * @description 申请令牌的有效期,从发布令牌的时间开始计算,单位为分钟。
  35538. */
  35539. this.expiration = 60;
  35540. Util.extend(this, options);
  35541. this.CLASS_NAME = "SuperMap.TokenServiceParameter";
  35542. }
  35543. /**
  35544. * @function SuperMap.TokenServiceParameter.prototype.toJSON
  35545. * @description 将所有信息转成 JSON 字符串
  35546. * @returns {string} 参数的 JSON 字符串
  35547. */
  35548. toJSON() {
  35549. return {
  35550. userName: this.userName,
  35551. password: this.password,
  35552. clientType: this.clientType,
  35553. ip: this.ip,
  35554. referer: this.referer,
  35555. expiration: this.expiration
  35556. }
  35557. }
  35558. }
  35559. SuperMap.TokenServiceParameter = TokenServiceParameter;
  35560. ;// CONCATENATED MODULE: ./src/common/security/index.js
  35561. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35562. * This program are made available under the terms of the Apache License, Version 2.0
  35563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35564. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  35565. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  35566. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  35567. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  35568. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  35569. * This program are made available under the terms of the Apache License, Version 2.0
  35570. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  35571. /**
  35572. * @class SuperMap.ElasticSearch
  35573. * @classdesc ElasticSearch服务类。
  35574. * @category ElasticSearch
  35575. * @param {string} url - ElasticSearch服务地址。
  35576. * @param {Object} options - 参数。
  35577. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  35578. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  35579. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  35580. * @param {Object} [options.geoFence] - 地理围栏。
  35581. */
  35582. class ElasticSearch {
  35583. constructor(url, options) {
  35584. options = options || {};
  35585. /**
  35586. * @member {string} SuperMap.ElasticSearch.prototype.url
  35587. * @description ElasticSearch服务地址
  35588. */
  35589. this.url = url;
  35590. /**
  35591. * @member {Object} SuperMap.ElasticSearch.prototype.client
  35592. * @description client ES客户端
  35593. */
  35594. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  35595. host: this.url
  35596. });
  35597. /**
  35598. * @deprecated
  35599. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  35600. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  35601. */
  35602. this.change = null;
  35603. /**
  35604. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  35605. * @description 是否开启地理围栏验证,默认为不开启。
  35606. */
  35607. this.openGeoFence = false;
  35608. /**
  35609. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  35610. * @description 数据超出地理围栏后执行的函数
  35611. */
  35612. this.outOfGeoFence = null;
  35613. /**
  35614. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  35615. * @description 地理围栏
  35616. * @example {
  35617. * radius: 1000,//单位是m
  35618. * center: [104.40, 30.43],
  35619. * unit: 'meter|degree'
  35620. * }
  35621. */
  35622. this.geoFence = null;
  35623. /*
  35624. * Constant: EVENT_TYPES
  35625. * {Array.<String>}
  35626. * 此类支持的事件类型。
  35627. *
  35628. */
  35629. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  35630. /**
  35631. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  35632. * @description 事件
  35633. */
  35634. this.events = new Events(this, null, this.EVENT_TYPES);
  35635. /**
  35636. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  35637. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  35638. * 相当于调用 SuperMap.Events.on(eventListeners)。
  35639. */
  35640. this.eventListeners = null;
  35641. Util.extend(this, options);
  35642. if (this.eventListeners instanceof Object) {
  35643. this.events.on(this.eventListeners);
  35644. }
  35645. }
  35646. /**
  35647. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  35648. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  35649. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  35650. */
  35651. setGeoFence(geoFence) {
  35652. this.geoFence = geoFence;
  35653. }
  35654. /**
  35655. * @function SuperMap.ElasticSearch.prototype.bulk
  35656. * @description 批量操作API,允许执行多个索引/删除操作。
  35657. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  35658. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  35659. * @param {Object} params - 参数。
  35660. * @param {function} callback - 回调函数。
  35661. */
  35662. bulk(params, callback) {
  35663. return this.client.bulk(params, callback);
  35664. }
  35665. /**
  35666. * @function SuperMap.ElasticSearch.prototype.clearScroll
  35667. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  35668. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  35669. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  35670. * @param {Object} params - 参数。
  35671. * @param {function} callback - 回调函数。
  35672. */
  35673. clearScroll(params, callback) {
  35674. return this.client.clearScroll(params, callback);
  35675. }
  35676. /**
  35677. * @function SuperMap.ElasticSearch.prototype.count
  35678. * @description 获取集群、索引、类型或查询的文档个数。
  35679. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  35680. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  35681. * @param {Object} params - 参数。
  35682. * @param {function} callback - 回调函数。
  35683. */
  35684. count(params, callback) {
  35685. return this.client.count(params, callback);
  35686. }
  35687. /**
  35688. * @function SuperMap.ElasticSearch.prototype.count
  35689. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  35690. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  35691. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  35692. * @param {Object} params - 参数。
  35693. * @param {function} callback - 回调函数。
  35694. */
  35695. create(params, callback) {
  35696. return this.client.create(params, callback);
  35697. }
  35698. /**
  35699. * @function SuperMap.ElasticSearch.prototype.delete
  35700. * @description 根据其ID从特定索引中删除键入的JSON文档。
  35701. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  35702. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  35703. * @param {Object} params - 参数。
  35704. * @param {function} callback - 回调函数。
  35705. */
  35706. delete(params, callback) {
  35707. return this.client.delete(params, callback);
  35708. }
  35709. /**
  35710. * @function SuperMap.ElasticSearch.prototype.delete
  35711. * @description 根据其ID从特定索引中删除键入的JSON文档。
  35712. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  35713. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  35714. * @param {Object} params - 参数。
  35715. * @param {function} callback - 回调函数。
  35716. */
  35717. deleteByQuery(params, callback) {
  35718. return this.client.deleteByQuery(params, callback);
  35719. }
  35720. /**
  35721. * @function SuperMap.ElasticSearch.prototype.delete
  35722. * @description 根据其ID删除脚本。</br>
  35723. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  35724. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35725. * @param {Object} params - 参数。
  35726. * @param {function} callback - 回调函数。
  35727. */
  35728. deleteScript(params, callback) {
  35729. return this.client.deleteScript(params, callback);
  35730. }
  35731. /**
  35732. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  35733. * @description 根据其ID删除模板。</br>
  35734. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  35735. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35736. * @param {Object} params - 参数。
  35737. * @param {function} callback - 回调函数。
  35738. */
  35739. deleteTemplate(params, callback) {
  35740. return this.client.deleteTemplate(params, callback);
  35741. }
  35742. /**
  35743. * @function SuperMap.ElasticSearch.prototype.exists
  35744. * @description 检查给定文档是否存在。</br>
  35745. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  35746. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35747. * @param {Object} params - 参数。
  35748. * @param {function} callback - 回调函数。
  35749. */
  35750. exists(params, callback) {
  35751. return this.client.exists(params, callback);
  35752. }
  35753. /**
  35754. * @function SuperMap.ElasticSearch.prototype.existsSource
  35755. * @description 检查资源是否存在。</br>
  35756. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  35757. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35758. * @param {Object} params - 参数。
  35759. * @param {function} callback - 回调函数。
  35760. */
  35761. existsSource(params, callback) {
  35762. return this.client.existsSource(params, callback);
  35763. }
  35764. /**
  35765. * @function SuperMap.ElasticSearch.prototype.explain
  35766. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  35767. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  35768. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  35769. * @param {Object} params - 参数。
  35770. * @param {function} callback - 回调函数。
  35771. */
  35772. explain(params, callback) {
  35773. return this.client.explain(params, callback);
  35774. }
  35775. /**
  35776. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  35777. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  35778. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  35779. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  35780. * @param {Object} params - 参数。
  35781. * @param {function} callback - 回调函数。
  35782. */
  35783. fieldCaps(params, callback) {
  35784. return this.client.fieldCaps(params, callback);
  35785. }
  35786. /**
  35787. * @function SuperMap.ElasticSearch.prototype.get
  35788. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  35789. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  35790. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35791. * @param {Object} params - 参数。
  35792. * @param {function} callback - 回调函数。
  35793. */
  35794. get(params, callback) {
  35795. return this.client.get(params, callback);
  35796. }
  35797. /**
  35798. * @function SuperMap.ElasticSearch.prototype.getScript
  35799. * @description 获取脚本。</br>
  35800. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  35801. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35802. * @param {Object} params - 参数。
  35803. * @param {function} callback - 回调函数。
  35804. */
  35805. getScript(params, callback) {
  35806. return this.client.getScript(params, callback);
  35807. }
  35808. /**
  35809. * @function SuperMap.ElasticSearch.prototype.getSource
  35810. * @description 通过索引,类型和ID获取文档的源。</br>
  35811. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  35812. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  35813. * @param {Object} params - 参数。
  35814. * @param {function} callback - 回调函数。
  35815. */
  35816. getSource(params, callback) {
  35817. return this.client.getSource(params, callback);
  35818. }
  35819. /**
  35820. * @function SuperMap.ElasticSearch.prototype.getTemplate
  35821. * @description 获取模板。</br>
  35822. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  35823. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35824. * @param {Object} params - 参数。
  35825. * @param {function} callback - 回调函数。
  35826. */
  35827. getTemplate(params, callback) {
  35828. return this.client.getTemplate(params, callback);
  35829. }
  35830. /**
  35831. * @function SuperMap.ElasticSearch.prototype.index
  35832. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  35833. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  35834. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  35835. * @param {Object} params - 参数。
  35836. * @param {function} callback - 回调函数。
  35837. */
  35838. index(params, callback) {
  35839. return this.client.index(params, callback);
  35840. }
  35841. /**
  35842. * @function SuperMap.ElasticSearch.prototype.info
  35843. * @description 从当前集群获取基本信息。</br>
  35844. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  35845. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  35846. * @param {Object} params - 参数。
  35847. * @param {function} callback - 回调函数。
  35848. */
  35849. info(params, callback) {
  35850. return this.client.info(params, callback);
  35851. }
  35852. /**
  35853. * @function SuperMap.ElasticSearch.prototype.mget
  35854. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  35855. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  35856. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  35857. * @param {Object} params - 参数。
  35858. * @param {function} callback - 回调函数。
  35859. */
  35860. mget(params, callback) {
  35861. return this.client.mget(params, callback);
  35862. }
  35863. /**
  35864. * @function SuperMap.ElasticSearch.prototype.msearch
  35865. * @description 在同一请求中执行多个搜索请求。</br>
  35866. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  35867. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  35868. * @param {Object} params - 参数。
  35869. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  35870. * 回调参数:error,response。结果存储在response.responses中
  35871. */
  35872. msearch(params, callback) {
  35873. let me = this;
  35874. return me.client.msearch(params)
  35875. .then(function (resp) {
  35876. me._update(resp.responses, callback);
  35877. return resp;
  35878. }, function (err) {
  35879. callback(err);
  35880. me.events.triggerEvent('error', {error: err});
  35881. return err;
  35882. });
  35883. }
  35884. /**
  35885. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  35886. * @description 在同一请求中执行多个搜索模板请求。</br>
  35887. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  35888. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35889. * @param {Object} params - 参数。
  35890. * @param {function} callback - 回调函数。
  35891. */
  35892. msearchTemplate(params, callback) {
  35893. return this.client.msearchTemplate(params, callback);
  35894. }
  35895. /**
  35896. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  35897. * @description 多termvectors API允许一次获得多个termvectors。</br>
  35898. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  35899. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  35900. * @param {Object} params - 参数。
  35901. * @param {function} callback - 回调函数。
  35902. */
  35903. mtermvectors(params, callback) {
  35904. return this.client.mtermvectors(params, callback);
  35905. }
  35906. /**
  35907. * @function SuperMap.ElasticSearch.prototype.ping
  35908. * @description 测试连接。</br>
  35909. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  35910. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  35911. * @param {Object} params - 参数。
  35912. * @param {function} callback - 回调函数。
  35913. */
  35914. ping(params, callback) {
  35915. return this.client.ping(params, callback);
  35916. }
  35917. /**
  35918. * @function SuperMap.ElasticSearch.prototype.putScript
  35919. * @description 添加脚本。</br>
  35920. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  35921. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  35922. * @param {Object} params - 参数。
  35923. * @param {function} callback - 回调函数。
  35924. */
  35925. putScript(params, callback) {
  35926. return this.client.putScript(params, callback);
  35927. }
  35928. /**
  35929. * @function SuperMap.ElasticSearch.prototype.putTemplate
  35930. * @description 添加模板。</br>
  35931. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  35932. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35933. * @param {Object} params - 参数。
  35934. * @param {function} callback - 回调函数。
  35935. */
  35936. putTemplate(params, callback) {
  35937. return this.client.putTemplate(params, callback);
  35938. }
  35939. /**
  35940. * @function SuperMap.ElasticSearch.prototype.reindex
  35941. * @description 重新索引。</br>
  35942. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  35943. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  35944. * @param {Object} params - 参数。
  35945. * @param {function} callback - 回调函数。
  35946. */
  35947. reindex(params, callback) {
  35948. return this.client.reindex(params, callback);
  35949. }
  35950. /**
  35951. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  35952. * @description 重新索引。</br>
  35953. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  35954. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  35955. * @param {Object} params - 参数。
  35956. * @param {function} callback - 回调函数。
  35957. */
  35958. reindexRessrottle(params, callback) {
  35959. return this.client.reindexRessrottle(params, callback);
  35960. }
  35961. /**
  35962. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  35963. * @description 搜索模板。</br>
  35964. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  35965. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  35966. * @param {Object} params - 参数。
  35967. * @param {function} callback - 回调函数。
  35968. */
  35969. renderSearchTemplate(params, callback) {
  35970. return this.client.renderSearchTemplate(params, callback);
  35971. }
  35972. /**
  35973. * @function SuperMap.ElasticSearch.prototype.scroll
  35974. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  35975. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  35976. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  35977. * @param {Object} params - 参数。
  35978. * @param {function} callback - 回调函数。
  35979. */
  35980. scroll(params, callback) {
  35981. return this.client.scroll(params, callback);
  35982. }
  35983. /**
  35984. * @function SuperMap.ElasticSearch.prototype.search
  35985. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  35986. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  35987. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  35988. * @param {Object} params - 参数。
  35989. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  35990. * 回调参数:error,response,结果存储在response.responses中
  35991. */
  35992. search(params, callback) {
  35993. let me = this;
  35994. return me.client.search(params)
  35995. .then(function (resp) {
  35996. me._update(resp.responses, callback);
  35997. return resp;
  35998. }, function (err) {
  35999. callback(err);
  36000. me.events.triggerEvent('error', {error: err});
  36001. return err;
  36002. });
  36003. }
  36004. /**
  36005. * @function SuperMap.ElasticSearch.prototype.searchShards
  36006. * @description 返回要执行搜索请求的索引和分片。
  36007. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  36008. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  36009. * @param {Object} params - 参数。
  36010. * @param {function} callback - 回调函数。
  36011. */
  36012. searchShards(params, callback) {
  36013. return this.client.searchShards(params, callback);
  36014. }
  36015. /**
  36016. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  36017. * @description 搜索模板。
  36018. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  36019. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  36020. * @param {Object} params - 参数。
  36021. * @param {function} callback - 回调函数。
  36022. */
  36023. searchTemplate(params, callback) {
  36024. return this.client.searchTemplate(params, callback);
  36025. }
  36026. /**
  36027. * @function SuperMap.ElasticSearch.prototype.suggest
  36028. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  36029. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  36030. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  36031. * @param {Object} params - 参数。
  36032. * @param {function} callback - 回调函数。
  36033. */
  36034. suggest(params, callback) {
  36035. return this.client.suggest(params, callback);
  36036. }
  36037. /**
  36038. * @function SuperMap.ElasticSearch.prototype.termvectors
  36039. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  36040. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  36041. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  36042. * @param {Object} params - 参数。
  36043. * @param {function} callback - 回调函数。
  36044. */
  36045. termvectors(params, callback) {
  36046. return this.client.termvectors(params, callback);
  36047. }
  36048. /**
  36049. * @function SuperMap.ElasticSearch.prototype.update
  36050. * @description 更新文档的部分。
  36051. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  36052. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  36053. * @param {Object} params - 参数。
  36054. * @param {function} callback - 回调函数。
  36055. */
  36056. update(params, callback) {
  36057. return this.client.update(params, callback);
  36058. }
  36059. /**
  36060. * @function SuperMap.ElasticSearch.prototype.update
  36061. * @description 通过查询API来更新文档。
  36062. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  36063. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  36064. * @param {Object} params - 参数。
  36065. * @param {function} callback - 回调函数。
  36066. */
  36067. updateByQuery(params, callback) {
  36068. return this.client.updateByQuery(params, callback);
  36069. }
  36070. _update(data, callback) {
  36071. let me = this;
  36072. if (!data) {
  36073. return;
  36074. }
  36075. me.data = data;
  36076. if (me.openGeoFence && me.geoFence) {
  36077. me._validateDatas(data);
  36078. }
  36079. me.events.triggerEvent('change', {data: me.data});
  36080. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  36081. if (me.change) {
  36082. me.change && me.change(data);
  36083. } else {
  36084. //加responses是为了保持跟原来es自身的数据结构一致
  36085. callback && callback(undefined, {responses: data});
  36086. }
  36087. }
  36088. _validateDatas(datas) {
  36089. if (!datas) {
  36090. return;
  36091. }
  36092. if (!(datas instanceof Array)) {
  36093. datas = [datas];
  36094. }
  36095. var i, len = datas.length;
  36096. for (i = 0; i < len; i++) {
  36097. this._validateData(datas[i]);
  36098. }
  36099. }
  36100. _validateData(data) {
  36101. let me = this;
  36102. data.hits.hits.map(function (source) {
  36103. let content = source._source;
  36104. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  36105. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  36106. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  36107. let contentX = content.x * meterUnit;
  36108. let contentY = content.y * meterUnit;
  36109. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  36110. let radius = me.geoFence.radius;
  36111. if (distance > radius) {
  36112. me.outOfGeoFence && me.outOfGeoFence(data);
  36113. me.events.triggerEvent('outOfGeoFence', {data: data});
  36114. }
  36115. return source;
  36116. });
  36117. }
  36118. _distance(x1, y1, x2, y2) {
  36119. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  36120. }
  36121. _getMeterPerMapUnit(mapUnit) {
  36122. let earchRadiusInMeters = 6378137;
  36123. let meterPerMapUnit;
  36124. if (mapUnit === 'meter') {
  36125. meterPerMapUnit = 1;
  36126. } else if (mapUnit === 'degree') {
  36127. // 每度表示多少米。
  36128. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  36129. }
  36130. return meterPerMapUnit;
  36131. }
  36132. }
  36133. SuperMap.ElasticSearch = ElasticSearch;
  36134. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/index.js
  36135. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  36136. * This program are made available under the terms of the Apache License, Version 2.0
  36137. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36138. ;// CONCATENATED MODULE: ./src/common/thirdparty/index.js
  36139. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  36140. * This program are made available under the terms of the Apache License, Version 2.0
  36141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36142. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Util.js
  36143. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  36144. * This program are made available under the terms of the Apache License, Version 2.0
  36145. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36146. /**
  36147. * @private
  36148. * @class SuperMap.LevelRenderer.Tool.Util
  36149. * @category Visualization Theme
  36150. * LevelRenderer 基础工具类
  36151. *
  36152. */
  36153. class Util_Util {
  36154. /**
  36155. * @function SuperMap.LevelRenderer.Tool.Util.constructor
  36156. * @description 构造函数。
  36157. *
  36158. */
  36159. constructor() {
  36160. /**
  36161. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype.BUILTIN_OBJECT
  36162. * @description 用于处理merge时无法遍历Date等对象的问题
  36163. */
  36164. this.BUILTIN_OBJECT = {
  36165. '[object Function]': 1,
  36166. '[object RegExp]': 1,
  36167. '[object Date]': 1,
  36168. '[object Error]': 1,
  36169. '[object CanvasGradient]': 1
  36170. };
  36171. /**
  36172. * @member {Object} SuperMap.LevelRenderer.Tool.Util.prototype._ctx
  36173. */
  36174. this._ctx = null;
  36175. /**
  36176. * Property: _canvas
  36177. * {Object}
  36178. */
  36179. this._canvas = null;
  36180. /**
  36181. * Property: _pixelCtx
  36182. * {Object}
  36183. */
  36184. this._pixelCtx = null;
  36185. /**
  36186. * Property: _width
  36187. * {Object}
  36188. */
  36189. this._width = null;
  36190. /**
  36191. * Property: _height
  36192. * {Object}
  36193. */
  36194. this._height = null;
  36195. /**
  36196. * Property: _offsetX
  36197. * {Object}
  36198. */
  36199. this._offsetX = 0;
  36200. /**
  36201. * Property: _offsetY
  36202. * {Object}
  36203. */
  36204. this._offsetY = 0;
  36205. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Util";
  36206. }
  36207. /**
  36208. * @function SuperMap.LevelRenderer.Tool.Util.prototype.clone
  36209. * @description 对一个object进行深度拷贝。
  36210. *
  36211. * @param {Object} source - 需要进行拷贝的对象。
  36212. * @return {Object} 拷贝后的新对象。
  36213. */
  36214. clone(source) {
  36215. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  36216. if (typeof source == 'object' && source !== null) {
  36217. var result = source;
  36218. if (source instanceof Array) {
  36219. result = [];
  36220. for (var i = 0, len = source.length; i < len; i++) {
  36221. result[i] = this.clone(source[i]);
  36222. }
  36223. } else if (!BUILTIN_OBJECT[Object.prototype.toString.call(source)]) {
  36224. result = {};
  36225. for (var key in source) {
  36226. if (source.hasOwnProperty(key)) {
  36227. result[key] = this.clone(source[key]);
  36228. }
  36229. }
  36230. }
  36231. return result;
  36232. }
  36233. return source;
  36234. }
  36235. /**
  36236. * @function SuperMap.LevelRenderer.Tool.Util.prototype.mergeItem
  36237. * @description 合并源对象的单个属性到目标对象。
  36238. *
  36239. * @param {Object} target - 目标对象。
  36240. * @param {Object} source - 源对象。
  36241. * @param {string} key - 键。
  36242. * @param {boolean} overwrite - 是否覆盖。
  36243. * @return {Object} 目标对象
  36244. */
  36245. mergeItem(target, source, key, overwrite) {
  36246. var BUILTIN_OBJECT = this.BUILTIN_OBJECT;
  36247. if (source.hasOwnProperty(key)) {
  36248. if (typeof target[key] == 'object'
  36249. && !BUILTIN_OBJECT[Object.prototype.toString.call(target[key])]
  36250. ) {
  36251. // 如果需要递归覆盖,就递归调用merge
  36252. this.merge(
  36253. target[key],
  36254. source[key],
  36255. overwrite
  36256. );
  36257. } else if (overwrite || !(key in target)) {
  36258. // 否则只处理overwrite为true,或者在目标对象中没有此属性的情况
  36259. target[key] = source[key];
  36260. }
  36261. }
  36262. }
  36263. /**
  36264. * @function SuperMap.LevelRenderer.Tool.Util.prototype.merge
  36265. * @description 合并源对象的属性到目标对象。
  36266. *
  36267. * @param {Object} target - 目标对象。
  36268. * @param {Object} source - 源对象。
  36269. * @param {boolean} overwrite - 是否覆盖。
  36270. * @return {Object} 目标对象。
  36271. */
  36272. merge(target, source, overwrite) {
  36273. for (var i in source) {
  36274. this.mergeItem(target, source, i, overwrite);
  36275. }
  36276. return target;
  36277. }
  36278. /**
  36279. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getContext
  36280. * @description 获取 Canvas 上下文。
  36281. * @return {Object} 上下文。
  36282. */
  36283. getContext() {
  36284. if (!this._ctx) {
  36285. this._ctx = document.createElement('canvas').getContext('2d');
  36286. }
  36287. return this._ctx;
  36288. }
  36289. /**
  36290. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelContext
  36291. * @description 获取像素拾取专用的上下文。
  36292. * @return {Object} 像素拾取专用的上下文。
  36293. */
  36294. getPixelContext() {
  36295. if (!this._pixelCtx) {
  36296. this._canvas = document.createElement('canvas');
  36297. this._width = this._canvas.width;
  36298. this._height = this._canvas.height;
  36299. this._pixelCtx = this._canvas.getContext('2d');
  36300. }
  36301. return this._pixelCtx;
  36302. }
  36303. /**
  36304. * @function SuperMap.LevelRenderer.Tool.Util.prototype.adjustCanvasSize
  36305. * @description 如果坐标处在_canvas外部,改变_canvas的大小,修改canvas的大小 需要重新设置translate
  36306. *
  36307. * @param {number} x - 横坐标。
  36308. * @param {number} y - 纵坐标。
  36309. *
  36310. */
  36311. adjustCanvasSize(x, y) {
  36312. var _canvas = this._canvas;
  36313. var _pixelCtx = this._pixelCtx;
  36314. var _width = this._width;
  36315. var _height = this._height;
  36316. var _offsetX = this._offsetX;
  36317. var _offsetY = this._offsetY;
  36318. // 每次加的长度
  36319. var _v = 100;
  36320. var _flag;
  36321. if (x + _offsetX > _width) {
  36322. _width = x + _offsetX + _v;
  36323. _canvas.width = _width;
  36324. _flag = true;
  36325. }
  36326. if (y + _offsetY > _height) {
  36327. _height = y + _offsetY + _v;
  36328. _canvas.height = _height;
  36329. _flag = true;
  36330. }
  36331. if (x < -_offsetX) {
  36332. _offsetX = Math.ceil(-x / _v) * _v;
  36333. _width += _offsetX;
  36334. _canvas.width = _width;
  36335. _flag = true;
  36336. }
  36337. if (y < -_offsetY) {
  36338. _offsetY = Math.ceil(-y / _v) * _v;
  36339. _height += _offsetY;
  36340. _canvas.height = _height;
  36341. _flag = true;
  36342. }
  36343. if (_flag) {
  36344. _pixelCtx.translate(_offsetX, _offsetY);
  36345. }
  36346. }
  36347. /**
  36348. * @function SuperMap.LevelRenderer.Tool.Util.prototype.getPixelOffset
  36349. * @description 获取像素canvas的偏移量。
  36350. * @return {Object} 偏移量。
  36351. */
  36352. getPixelOffset() {
  36353. return {
  36354. x: this._offsetX,
  36355. y: this._offsetY
  36356. };
  36357. }
  36358. /**
  36359. * @function SuperMap.LevelRenderer.Tool.Util.prototype.indexOf
  36360. * @description 查询数组中元素的index
  36361. * @return {Object} 偏移量。
  36362. */
  36363. indexOf(array, value) {
  36364. if (array.indexOf) {
  36365. return array.indexOf(value);
  36366. }
  36367. for (var i = 0, len = array.length; i < len; i++) {
  36368. if (array[i] === value) {
  36369. return i;
  36370. }
  36371. }
  36372. return -1;
  36373. }
  36374. /**
  36375. * @function SuperMap.LevelRenderer.Tool.Util.prototype.inherits
  36376. * @description 构造类继承关系
  36377. *
  36378. * @param {Function} clazz - 源类。
  36379. * @param {Function} baseClazz - 基类。
  36380. * @return {Object} 偏移量。
  36381. */
  36382. inherits(clazz, baseClazz) {
  36383. var clazzPrototype = clazz.prototype;
  36384. function F() {
  36385. }
  36386. F.prototype = baseClazz.prototype;
  36387. clazz.prototype = new F();
  36388. for (var prop in clazzPrototype) {
  36389. clazz.prototype[prop] = clazzPrototype[prop];
  36390. }
  36391. clazz.constructor = clazz;
  36392. }
  36393. }
  36394. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Color.js
  36395. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  36396. * This program are made available under the terms of the Apache License, Version 2.0
  36397. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  36398. /**
  36399. * @class SuperMap.LevelRenderer.Tool.Color
  36400. * @category Visualization Theme
  36401. * @classdesc LevelRenderer 工具-颜色辅助类
  36402. * @private
  36403. */
  36404. class Color {
  36405. constructor() {
  36406. /**
  36407. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Color.prototype.util
  36408. * @description LevelRenderer 基础工具对象。
  36409. */
  36410. this.util = new Util_Util();
  36411. /**
  36412. * @member {Object} SuperMap.LevelRenderer.Tool.Color.prototype._ctx
  36413. * @description _ctx。
  36414. */
  36415. this._ctx = null;
  36416. /**
  36417. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype.palette
  36418. * @description 默认色板。色板是一个包含图表默认颜色系列的数组,当色板中所有颜色被使用过后,又将从新回到色板中的第一个颜色。
  36419. */
  36420. this.palette = [
  36421. '#ff9277', ' #dddd00', ' #ffc877', ' #bbe3ff', ' #d5ffbb',
  36422. '#bbbbff', ' #ddb000', ' #b0dd00', ' #e2bbff', ' #ffbbe3',
  36423. '#ff7777', ' #ff9900', ' #83dd00', ' #77e3ff', ' #778fff',
  36424. '#c877ff', ' #ff77ab', ' #ff6600', ' #aa8800', ' #77c7ff',
  36425. '#ad77ff', ' #ff77ff', ' #dd0083', ' #777700', ' #00aa00',
  36426. '#0088aa', ' #8400dd', ' #aa0088', ' #dd0000', ' #772e00'
  36427. ];
  36428. /**
  36429. * @member {Array} SuperMap.LevelRenderer.Tool.Color.prototype._palette
  36430. * @description 复位色板,用于复位 palette
  36431. */
  36432. this._palette = this.palette;
  36433. /**
  36434. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.highlightColor
  36435. * @description 高亮色
  36436. */
  36437. this.highlightColor = 'rgba(0,0,255,1)';
  36438. /**
  36439. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._highlightColor
  36440. * @description 复位高亮色
  36441. */
  36442. this._highlightColor = this.highlightColor;
  36443. /**
  36444. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype.colorRegExp
  36445. * @description 颜色格式,正则表达式。
  36446. */
  36447. 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;
  36448. /**
  36449. * @member {string} SuperMap.LevelRenderer.Tool.Color.prototype._nameColors
  36450. * @description 颜色名。
  36451. */
  36452. this._nameColors = {
  36453. aliceblue: '#f0f8ff',
  36454. antiquewhite: '#faebd7',
  36455. aqua: '#0ff',
  36456. aquamarine: '#7fffd4',
  36457. azure: '#f0ffff',
  36458. beige: '#f5f5dc',
  36459. bisque: '#ffe4c4',
  36460. black: '#000',
  36461. blanchedalmond: '#ffebcd',
  36462. blue: '#00f',
  36463. blueviolet: '#8a2be2',
  36464. brown: '#a52a2a',
  36465. burlywood: '#deb887',
  36466. cadetblue: '#5f9ea0',
  36467. chartreuse: '#7fff00',
  36468. chocolate: '#d2691e',
  36469. coral: '#ff7f50',
  36470. cornflowerblue: '#6495ed',
  36471. cornsilk: '#fff8dc',
  36472. crimson: '#dc143c',
  36473. cyan: '#0ff',
  36474. darkblue: '#00008b',
  36475. darkcyan: '#008b8b',
  36476. darkgoldenrod: '#b8860b',
  36477. darkgray: '#a9a9a9',
  36478. darkgrey: '#a9a9a9',
  36479. darkgreen: '#006400',
  36480. darkkhaki: '#bdb76b',
  36481. darkmagenta: '#8b008b',
  36482. darkolivegreen: '#556b2f',
  36483. darkorange: '#ff8c00',
  36484. darkorchid: '#9932cc',
  36485. darkred: '#8b0000',
  36486. darksalmon: '#e9967a',
  36487. darkseagreen: '#8fbc8f',
  36488. darkslateblue: '#483d8b',
  36489. darkslategray: '#2f4f4f',
  36490. darkslategrey: '#2f4f4f',
  36491. darkturquoise: '#00ced1',
  36492. darkviolet: '#9400d3',
  36493. deeppink: '#ff1493',
  36494. deepskyblue: '#00bfff',
  36495. dimgray: '#696969',
  36496. dimgrey: '#696969',
  36497. dodgerblue: '#1e90ff',
  36498. firebrick: '#b22222',
  36499. floralwhite: '#fffaf0',
  36500. forestgreen: '#228b22',
  36501. fuchsia: '#f0f',
  36502. gainsboro: '#dcdcdc',
  36503. ghostwhite: '#f8f8ff',
  36504. gold: '#ffd700',
  36505. goldenrod: '#daa520',
  36506. gray: '#808080',
  36507. grey: '#808080',
  36508. green: '#008000',
  36509. greenyellow: '#adff2f',
  36510. honeydew: '#f0fff0',
  36511. hotpink: '#ff69b4',
  36512. indianred: '#cd5c5c',
  36513. indigo: '#4b0082',
  36514. ivory: '#fffff0',
  36515. khaki: '#f0e68c',
  36516. lavender: '#e6e6fa',
  36517. lavenderblush: '#fff0f5',
  36518. lawngreen: '#7cfc00',
  36519. lemonchiffon: '#fffacd',
  36520. lightblue: '#add8e6',
  36521. lightcoral: '#f08080',
  36522. lightcyan: '#e0ffff',
  36523. lightgoldenrodyellow: '#fafad2',
  36524. lightgray: '#d3d3d3',
  36525. lightgrey: '#d3d3d3',
  36526. lightgreen: '#90ee90',
  36527. lightpink: '#ffb6c1',
  36528. lightsalmon: '#ffa07a',
  36529. lightseagreen: '#20b2aa',
  36530. lightskyblue: '#87cefa',
  36531. lightslategray: '#789',
  36532. lightslategrey: '#789',
  36533. lightsteelblue: '#b0c4de',
  36534. lightyellow: '#ffffe0',
  36535. lime: '#0f0',
  36536. limegreen: '#32cd32',
  36537. linen: '#faf0e6',
  36538. magenta: '#f0f',
  36539. maroon: '#800000',
  36540. mediumaquamarine: '#66cdaa',
  36541. mediumblue: '#0000cd',
  36542. mediumorchid: '#ba55d3',
  36543. mediumpurple: '#9370d8',
  36544. mediumseagreen: '#3cb371',
  36545. mediumslateblue: '#7b68ee',
  36546. mediumspringgreen: '#00fa9a',
  36547. mediumturquoise: '#48d1cc',
  36548. mediumvioletred: '#c71585',
  36549. midnightblue: '#191970',
  36550. mintcream: '#f5fffa',
  36551. mistyrose: '#ffe4e1',
  36552. moccasin: '#ffe4b5',
  36553. navajowhite: '#ffdead',
  36554. navy: '#000080',
  36555. oldlace: '#fdf5e6',
  36556. olive: '#808000',
  36557. olivedrab: '#6b8e23',
  36558. orange: '#ffa500',
  36559. orangered: '#ff4500',
  36560. orchid: '#da70d6',
  36561. palegoldenrod: '#eee8aa',
  36562. palegreen: '#98fb98',
  36563. paleturquoise: '#afeeee',
  36564. palevioletred: '#d87093',
  36565. papayawhip: '#ffefd5',
  36566. peachpuff: '#ffdab9',
  36567. peru: '#cd853f',
  36568. pink: '#ffc0cb',
  36569. plum: '#dda0dd',
  36570. powderblue: '#b0e0e6',
  36571. purple: '#800080',
  36572. red: '#f00',
  36573. rosybrown: '#bc8f8f',
  36574. royalblue: '#4169e1',
  36575. saddlebrown: '#8b4513',
  36576. salmon: '#fa8072',
  36577. sandybrown: '#f4a460',
  36578. seagreen: '#2e8b57',
  36579. seashell: '#fff5ee',
  36580. sienna: '#a0522d',
  36581. silver: '#c0c0c0',
  36582. skyblue: '#87ceeb',
  36583. slateblue: '#6a5acd',
  36584. slategray: '#708090',
  36585. slategrey: '#708090',
  36586. snow: '#fffafa',
  36587. springgreen: '#00ff7f',
  36588. steelblue: '#4682b4',
  36589. tan: '#d2b48c',
  36590. teal: '#008080',
  36591. thistle: '#d8bfd8',
  36592. tomato: '#ff6347',
  36593. turquoise: '#40e0d0',
  36594. violet: '#ee82ee',
  36595. wheat: '#f5deb3',
  36596. white: '#fff',
  36597. whitesmoke: '#f5f5f5',
  36598. yellow: '#ff0',
  36599. yellowgreen: '#9acd32'
  36600. };
  36601. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Color";
  36602. }
  36603. /**
  36604. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customPalette
  36605. * @description 自定义调色板。
  36606. * @param {Array} userPalete - 颜色板。
  36607. */
  36608. customPalette(userPalete) {
  36609. this.palette = userPalete;
  36610. }
  36611. /**
  36612. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetPalette
  36613. * @description 复位默认色板。
  36614. */
  36615. resetPalette() {
  36616. this.palette = this._palette;
  36617. }
  36618. /**
  36619. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getColor
  36620. * @description 获取色板颜色。
  36621. * @param {number} idx - 色板位置。
  36622. * @param {Array} userPalete - 色板。
  36623. * @returns {string} 颜色值。
  36624. */
  36625. getColor(idx, userPalete) {
  36626. idx = idx | 0;
  36627. userPalete = userPalete || this.palette;
  36628. return userPalete[idx % userPalete.length];
  36629. }
  36630. /**
  36631. * @function SuperMap.LevelRenderer.Tool.Color.prototype.customHighlight
  36632. * @description 自定义默认高亮颜色。
  36633. * @param {string} userHighlightColor - 自定义高亮色。
  36634. */
  36635. customHighlight(userHighlightColor) {
  36636. this.highlightColor = userHighlightColor;
  36637. }
  36638. /**
  36639. * @function SuperMap.LevelRenderer.Tool.Color.prototype.resetHighlight
  36640. * @description 重置默认高亮颜色。将当前的高亮色作为默认高亮颜色
  36641. */
  36642. resetHighlight() {
  36643. this.highlightColor = this._highlightColor;
  36644. }
  36645. /**
  36646. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getHighlightColor
  36647. * @description 获取默认高亮颜色
  36648. * @returns {string} 颜色值。
  36649. */
  36650. getHighlightColor() {
  36651. return this.highlightColor;
  36652. }
  36653. /**
  36654. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getRadialGradient
  36655. * @description 径向渐变。
  36656. * @param {number} x0 - 渐变起点横坐标。
  36657. * @param {number} y0 - 渐变起点纵坐标。
  36658. * @param {number} r0 - 半径
  36659. * @param {number} x1 - 渐变终点横坐标。
  36660. * @param {number} y1 - 渐变终点纵坐标。
  36661. * @param {number} r1 - 半径
  36662. * @param {Array} colorList - 颜色列表。
  36663. * @returns {CanvasGradient} Cavans 渐变颜色。
  36664. */
  36665. getRadialGradient(x0, y0, r0, x1, y1, r1, colorList) {
  36666. var util = this.util;
  36667. if (!this._ctx) {
  36668. this._ctx = util.getContext();
  36669. }
  36670. var gradient = this._ctx.createRadialGradient(x0, y0, r0, x1, y1, r1);
  36671. for (var i = 0, l = colorList.length; i < l; i++) {
  36672. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  36673. }
  36674. gradient.__nonRecursion = true;
  36675. return gradient;
  36676. }
  36677. /**
  36678. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getLinearGradient
  36679. * @description 线性渐变。
  36680. * @param {number} x0 - 渐变起点横坐标。
  36681. * @param {number} y0 - 渐变起点纵坐标。
  36682. * @param {number} x1 - 渐变终点横坐标。
  36683. * @param {number} y1 - 渐变终点纵坐标。
  36684. * @param {Array} colorList - 颜色列表。
  36685. * @returns {CanvasGradient} Cavans 渐变颜色。
  36686. */
  36687. getLinearGradient(x0, y0, x1, y1, colorList) {
  36688. var util = this.util;
  36689. if (!this._ctx) {
  36690. this._ctx = util.getContext();
  36691. }
  36692. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  36693. for (var i = 0, l = colorList.length; i < l; i++) {
  36694. gradient.addColorStop(colorList[i][0], colorList[i][1]);
  36695. }
  36696. gradient.__nonRecursion = true;
  36697. return gradient;
  36698. }
  36699. /**
  36700. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getStepColors
  36701. * @description 获取两种颜色之间渐变颜色数组。
  36702. * @param {Object} start - 起始颜色对象。
  36703. * @param {Object} end - 结束颜色对象。
  36704. * @param {number} step - 渐变级数。
  36705. * @returns {Array} 颜色数组。
  36706. */
  36707. getStepColors(start, end, step) {
  36708. start = this.toRGBA(start);
  36709. end = this.toRGBA(end);
  36710. start = this.getData(start);
  36711. end = this.getData(end);
  36712. var colors = [];
  36713. var stepR = (end[0] - start[0]) / step;
  36714. var stepG = (end[1] - start[1]) / step;
  36715. var stepB = (end[2] - start[2]) / step;
  36716. var stepA = (end[3] - start[3]) / step;
  36717. // 生成颜色集合
  36718. // fix by linfeng 颜色堆积
  36719. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  36720. colors[i] = this.toColor([
  36721. this.adjust(Math.floor(r), [0, 255]),
  36722. this.adjust(Math.floor(g), [0, 255]),
  36723. this.adjust(Math.floor(b), [0, 255]),
  36724. a.toFixed(4) - 0
  36725. ], 'rgba');
  36726. r += stepR;
  36727. g += stepG;
  36728. b += stepB;
  36729. a += stepA;
  36730. }
  36731. r = end[0];
  36732. g = end[1];
  36733. b = end[2];
  36734. a = end[3];
  36735. colors[i] = this.toColor([r, g, b, a], 'rgba');
  36736. return colors;
  36737. }
  36738. /**
  36739. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getGradientColors
  36740. * @description 获取指定级数的渐变颜色数组。
  36741. * @param {Array.<string>} colors - 颜色数组。
  36742. * @param {number} [step=20] - 渐变级数。
  36743. * @returns {Array.<string>} 颜色数组。
  36744. */
  36745. getGradientColors(colors, step) {
  36746. var ret = [];
  36747. var len = colors.length;
  36748. if (step === undefined) {
  36749. step = 20;
  36750. }
  36751. if (len === 1) {
  36752. ret = this.getStepColors(colors[0], colors[0], step);
  36753. } else if (len > 1) {
  36754. for (var i = 0, n = len - 1; i < n; i++) {
  36755. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  36756. if (i < n - 1) {
  36757. steps.pop();
  36758. }
  36759. ret = ret.concat(steps);
  36760. }
  36761. }
  36762. return ret;
  36763. }
  36764. /**
  36765. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toColor
  36766. * @description 颜色值数组转为指定格式颜色。
  36767. * @param {Array} data - 颜色值数组。
  36768. * @param {string} format - 格式,默认'rgb'
  36769. * @returns {string} 颜色。
  36770. */
  36771. toColor(data, format) {
  36772. format = format || 'rgb';
  36773. if (data && (data.length === 3 || data.length === 4)) {
  36774. data = this.map(data,
  36775. function (c) {
  36776. return c > 1 ? Math.ceil(c) : c;
  36777. }
  36778. );
  36779. if (format.indexOf('hex') > -1) {
  36780. return '#' + ((1 << 24) + (data[0] << 16) + (data[1] << 8) + (+data[2])).toString(16).slice(1);
  36781. } else if (format.indexOf('hs') > -1) {
  36782. var sx = this.map(data.slice(1, 3),
  36783. function (c) {
  36784. return c + '%';
  36785. }
  36786. );
  36787. data[1] = sx[0];
  36788. data[2] = sx[1];
  36789. }
  36790. if (format.indexOf('a') > -1) {
  36791. if (data.length === 3) {
  36792. data.push(1);
  36793. }
  36794. data[3] = this.adjust(data[3], [0, 1]);
  36795. return format + '(' + data.slice(0, 4).join(',') + ')';
  36796. }
  36797. return format + '(' + data.slice(0, 3).join(',') + ')';
  36798. }
  36799. }
  36800. /**
  36801. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toArray
  36802. * @description 颜色字符串转换为rgba数组。
  36803. * @param {string} color - 颜色。
  36804. * @returns {Array.<number>} 颜色值数组。
  36805. */
  36806. toArray(color) {
  36807. color = this.trim(color);
  36808. if (color.indexOf('rgba') < 0) {
  36809. color = this.toRGBA(color);
  36810. }
  36811. var data = [];
  36812. var i = 0;
  36813. color.replace(/[\d.]+/g, function (n) {
  36814. if (i < 3) {
  36815. n = n | 0;
  36816. } else {
  36817. // Alpha
  36818. n = +n;
  36819. }
  36820. data[i++] = n;
  36821. });
  36822. return data;
  36823. }
  36824. /**
  36825. * @function SuperMap.LevelRenderer.Tool.Color.prototype.convert
  36826. * @description 颜色格式转化。
  36827. * @param {Array} data - 颜色值数组。
  36828. * @param {string} format - 格式,默认'rgb'
  36829. * @returns {string} 颜色。
  36830. */
  36831. convert(color, format) {
  36832. if (!this.isCalculableColor(color)) {
  36833. return color;
  36834. }
  36835. var data = this.getData(color);
  36836. var alpha = data[3];
  36837. if (typeof alpha === 'undefined') {
  36838. alpha = 1;
  36839. }
  36840. if (color.indexOf('hsb') > -1) {
  36841. data = this._HSV_2_RGB(data);
  36842. } else if (color.indexOf('hsl') > -1) {
  36843. data = this._HSL_2_RGB(data);
  36844. }
  36845. if (format.indexOf('hsb') > -1 || format.indexOf('hsv') > -1) {
  36846. data = this._RGB_2_HSB(data);
  36847. } else if (format.indexOf('hsl') > -1) {
  36848. data = this._RGB_2_HSL(data);
  36849. }
  36850. data[3] = alpha;
  36851. return this.toColor(data, format);
  36852. }
  36853. /**
  36854. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGBA
  36855. * @description 转换为rgba格式的颜色。
  36856. * @param {string} color - 颜色。
  36857. * @returns {string} 颜色。
  36858. */
  36859. toRGBA(color) {
  36860. return this.convert(color, 'rgba');
  36861. }
  36862. /**
  36863. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toRGB
  36864. * @description 转换为rgb数字格式的颜色。
  36865. * @param {string} color - 颜色。
  36866. * @returns {string} 颜色。
  36867. */
  36868. toRGB(color) {
  36869. return this.convert(color, 'rgb');
  36870. }
  36871. /**
  36872. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHex
  36873. * @description 转换为16进制颜色。
  36874. * @param {string} color - 颜色。
  36875. * @returns {string} 16进制颜色,#rrggbb格式
  36876. */
  36877. toHex(color) {
  36878. return this.convert(color, 'hex');
  36879. }
  36880. /**
  36881. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSVA
  36882. * @description 转换为HSV颜色。
  36883. * @param {string} color - 颜色。
  36884. * @returns {string} HSVA颜色,hsva(h,s,v,a)
  36885. */
  36886. toHSVA(color) {
  36887. return this.convert(color, 'hsva');
  36888. }
  36889. /**
  36890. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSV
  36891. * @description 转换为HSV颜色。
  36892. * @param {string} color - 颜色。
  36893. * @returns {string} HSV颜色,hsv(h,s,v)
  36894. */
  36895. toHSV(color) {
  36896. return this.convert(color, 'hsv');
  36897. }
  36898. /**
  36899. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSBA
  36900. * @description 转换为HSBA颜色。
  36901. * @param {string} color - 颜色。
  36902. * @returns {string} HSBA颜色,hsba(h,s,b,a)
  36903. */
  36904. toHSBA(color) {
  36905. return this.convert(color, 'hsba');
  36906. }
  36907. /**
  36908. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSB
  36909. * @description 转换为HSB颜色。
  36910. * @param {string} color - 颜色。
  36911. * @returns {string} HSB颜色,hsb(h,s,b)
  36912. */
  36913. toHSB(color) {
  36914. return this.convert(color, 'hsb');
  36915. }
  36916. /**
  36917. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSLA
  36918. * @description 转换为HSLA颜色。
  36919. * @param {string} color - 颜色。
  36920. * @returns {string} HSLA颜色,hsla(h,s,l,a)
  36921. */
  36922. toHSLA(color) {
  36923. return this.convert(color, 'hsla');
  36924. }
  36925. /**
  36926. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toHSL
  36927. * @description 转换为HSL颜色。
  36928. * @param {string} color - 颜色。
  36929. * @returns {string} HSL颜色,hsl(h,s,l)
  36930. */
  36931. toHSL(color) {
  36932. return this.convert(color, 'hsl');
  36933. }
  36934. /**
  36935. * @function SuperMap.LevelRenderer.Tool.Color.prototype.toName
  36936. * @description 转换颜色名。
  36937. * @param {string} color - 颜色。
  36938. * @returns {string} 颜色名
  36939. */
  36940. toName(color) {
  36941. for (var key in this._nameColors) {
  36942. if (this.toHex(this._nameColors[key]) === this.toHex(color)) {
  36943. return key;
  36944. }
  36945. }
  36946. return null;
  36947. }
  36948. /**
  36949. * @function SuperMap.LevelRenderer.Tool.Color.prototype.trim
  36950. * @description 移除颜色中多余空格。
  36951. * @param {string} color - 颜色。
  36952. * @returns {string} 无空格颜色
  36953. */
  36954. trim(color) {
  36955. return String(color).replace(/\s+/g, '');
  36956. }
  36957. /**
  36958. * @function SuperMap.LevelRenderer.Tool.Color.prototype.normalize
  36959. * @description 颜色规范化。
  36960. * @param {string} color - 颜色。
  36961. * @returns {string} 规范化后的颜色
  36962. */
  36963. normalize(color) {
  36964. // 颜色名
  36965. if (this._nameColors[color]) {
  36966. color = this._nameColors[color];
  36967. }
  36968. // 去掉空格
  36969. color = this.trim(color);
  36970. // hsv与hsb等价
  36971. color = color.replace(/hsv/i, 'hsb');
  36972. // rgb转为rrggbb
  36973. if (/^#[\da-f]{3}$/i.test(color)) {
  36974. color = parseInt(color.slice(1), 16);
  36975. var r = (color & 0xf00) << 8;
  36976. var g = (color & 0xf0) << 4;
  36977. var b = color & 0xf;
  36978. color = '#' + ((1 << 24) + (r << 4) + r + (g << 4) + g + (b << 4) + b).toString(16).slice(1);
  36979. }
  36980. // 或者使用以下正则替换,不过 chrome 下性能相对差点
  36981. // color = color.replace(/^#([\da-f])([\da-f])([\da-f])$/i, '#$1$1$2$2$3$3');
  36982. return color;
  36983. }
  36984. /**
  36985. * @function SuperMap.LevelRenderer.Tool.Color.prototype.lift
  36986. * @description 颜色加深或减淡,当level>0加深,当level<0减淡。
  36987. * @param {string} color - 颜色。
  36988. * @param {number} level - 升降程度,取值区间[-1,1]。
  36989. * @returns {string} 加深或减淡后颜色值
  36990. */
  36991. lift(color, level) {
  36992. if (!this.isCalculableColor(color)) {
  36993. return color;
  36994. }
  36995. var direct = level > 0 ? 1 : -1;
  36996. if (typeof level === 'undefined') {
  36997. level = 0;
  36998. }
  36999. level = Math.abs(level) > 1 ? 1 : Math.abs(level);
  37000. color = this.toRGB(color);
  37001. var data = this.getData(color);
  37002. for (var i = 0; i < 3; i++) {
  37003. if (direct === 1) {
  37004. data[i] = data[i] * (1 - level) | 0;
  37005. } else {
  37006. data[i] = ((255 - data[i]) * level + data[i]) | 0;
  37007. }
  37008. }
  37009. return 'rgb(' + data.join(',') + ')';
  37010. }
  37011. /**
  37012. * @function SuperMap.LevelRenderer.Tool.Color.prototype.reverse
  37013. * @description 颜色翻转。[255-r,255-g,255-b,1-a]
  37014. * @param {string} color - 颜色。
  37015. * @returns {string} 翻转颜色
  37016. */
  37017. reverse(color) {
  37018. if (!this.isCalculableColor(color)) {
  37019. return color;
  37020. }
  37021. var data = this.getData(this.toRGBA(color));
  37022. data = this.map(data,
  37023. function (c) {
  37024. return 255 - c;
  37025. }
  37026. );
  37027. return this.toColor(data, 'rgb');
  37028. }
  37029. /**
  37030. * @function SuperMap.LevelRenderer.Tool.Color.prototype.mix
  37031. * @description 简单两种颜色混合
  37032. * @param {string} color1 - 第一种颜色。
  37033. * @param {string} color2 - 第二种颜色。
  37034. * @param {number} weight - 混合权重[0-1]。
  37035. * @returns {string} 结果色。rgb(r,g,b)或rgba(r,g,b,a)
  37036. */
  37037. mix(color1, color2, weight) {
  37038. if (!this.isCalculableColor(color1) || !this.isCalculableColor(color2)) {
  37039. return color1;
  37040. }
  37041. if (typeof weight === 'undefined') {
  37042. weight = 0.5;
  37043. }
  37044. weight = 1 - this.adjust(weight, [0, 1]);
  37045. var w = weight * 2 - 1;
  37046. var data1 = this.getData(this.toRGBA(color1));
  37047. var data2 = this.getData(this.toRGBA(color2));
  37048. var d = data1[3] - data2[3];
  37049. var weight1 = (((w * d === -1) ? w : (w + d) / (1 + w * d)) + 1) / 2;
  37050. var weight2 = 1 - weight1;
  37051. var data = [];
  37052. for (var i = 0; i < 3; i++) {
  37053. data[i] = data1[i] * weight1 + data2[i] * weight2;
  37054. }
  37055. var alpha = data1[3] * weight + data2[3] * (1 - weight);
  37056. alpha = Math.max(0, Math.min(1, alpha));
  37057. if (data1[3] === 1 && data2[3] === 1) {// 不考虑透明度
  37058. return this.toColor(data, 'rgb');
  37059. }
  37060. data[3] = alpha;
  37061. return this.toColor(data, 'rgba');
  37062. }
  37063. /**
  37064. * @function SuperMap.LevelRenderer.Tool.Color.prototype.random
  37065. * @description 随机颜色
  37066. * @returns {string} 颜色值,#rrggbb格式
  37067. */
  37068. random() {
  37069. return '#' + Math.random().toString(16).slice(2, 8);
  37070. }
  37071. /**
  37072. * @function SuperMap.LevelRenderer.Tool.Color.prototype.getData
  37073. * @description 获取颜色值数组,返回值范围。
  37074. * RGB 范围[0-255]
  37075. * HSL/HSV/HSB 范围[0-1]
  37076. * A透明度范围[0-1]
  37077. * 支持格式:
  37078. * #rgb
  37079. * #rrggbb
  37080. * rgb(r,g,b)
  37081. * rgb(r%,g%,b%)
  37082. * rgba(r,g,b,a)
  37083. * hsb(h,s,b) // hsv与hsb等价
  37084. * hsb(h%,s%,b%)
  37085. * hsba(h,s,b,a)
  37086. * hsl(h,s,l)
  37087. * hsl(h%,s%,l%)
  37088. * hsla(h,s,l,a)
  37089. * @param {string} color - 颜色。
  37090. * @returns {Array.<number>} 颜色值数组或null
  37091. */
  37092. getData(color) {
  37093. color = this.normalize(color);
  37094. var r = color.match(this.colorRegExp);
  37095. if (r === null) {
  37096. throw new Error('The color format error'); // 颜色格式错误
  37097. }
  37098. var d;
  37099. var a;
  37100. var data = [];
  37101. var rgb;
  37102. if (r[2]) {
  37103. // #rrggbb
  37104. d = r[2].replace('#', '').split('');
  37105. rgb = [d[0] + d[1], d[2] + d[3], d[4] + d[5]];
  37106. data = this.map(rgb,
  37107. function (c) {
  37108. return Color.prototype.adjust.call(this, parseInt(c, 16), [0, 255]);
  37109. }
  37110. );
  37111. } else if (r[4]) {
  37112. // rgb rgba
  37113. var rgba = (r[4]).split(',');
  37114. a = rgba[3];
  37115. rgb = rgba.slice(0, 3);
  37116. data = this.map(
  37117. rgb,
  37118. function (c) {
  37119. c = Math.floor(
  37120. c.indexOf('%') > 0 ? parseInt(c, 0) * 2.55 : c
  37121. );
  37122. return Color.prototype.adjust.call(this, c, [0, 255]);
  37123. }
  37124. );
  37125. if (typeof a !== 'undefined') {
  37126. data.push(this.adjust(parseFloat(a), [0, 1]));
  37127. }
  37128. } else if (r[5] || r[6]) {
  37129. // hsb hsba hsl hsla
  37130. var hsxa = (r[5] || r[6]).split(',');
  37131. var h = parseInt(hsxa[0], 0) / 360;
  37132. var s = hsxa[1];
  37133. var x = hsxa[2];
  37134. a = hsxa[3];
  37135. data = this.map([s, x],
  37136. function (c) {
  37137. return Color.prototype.adjust.call(this, parseFloat(c) / 100, [0, 1]);
  37138. }
  37139. );
  37140. data.unshift(h);
  37141. if (typeof a !== 'undefined') {
  37142. data.push(this.adjust(parseFloat(a), [0, 1]));
  37143. }
  37144. }
  37145. return data;
  37146. }
  37147. /**
  37148. * @function SuperMap.LevelRenderer.Tool.Color.prototype.alpha
  37149. * @description 设置颜色透明度
  37150. * @param {string} color - 颜色。
  37151. * @param {number} a - 透明度,区间[0,1]。
  37152. * @returns {string} rgba颜色值
  37153. */
  37154. alpha(color, a) {
  37155. if (!this.isCalculableColor(color)) {
  37156. return color;
  37157. }
  37158. if (a === null) {
  37159. a = 1;
  37160. }
  37161. var data = this.getData(this.toRGBA(color));
  37162. data[3] = this.adjust(Number(a).toFixed(4), [0, 1]);
  37163. return this.toColor(data, 'rgba');
  37164. }
  37165. /**
  37166. * @function SuperMap.LevelRenderer.Tool.Color.prototype.map
  37167. * @description 数组映射
  37168. * @param {Array} array - 数组。
  37169. * @param {function} fun - 函数。
  37170. * @returns {string} 数组映射结果
  37171. */
  37172. map(array, fun) {
  37173. if (typeof fun !== 'function') {
  37174. throw new TypeError();
  37175. }
  37176. var len = array ? array.length : 0;
  37177. for (var i = 0; i < len; i++) {
  37178. array[i] = fun(array[i]);
  37179. }
  37180. return array;
  37181. }
  37182. /**
  37183. * @function SuperMap.LevelRenderer.Tool.Color.prototype.adjust
  37184. * @description 调整值区间
  37185. * @param {Array.<number>} value - 数组。
  37186. * @param {Array.<number>} region - 区间。
  37187. * @returns {number} 调整后的值
  37188. */
  37189. adjust(value, region) {
  37190. // < to <= & > to >=
  37191. // modify by linzhifeng 2014-05-25 because -0 == 0
  37192. if (value <= region[0]) {
  37193. value = region[0];
  37194. } else if (value >= region[1]) {
  37195. value = region[1];
  37196. }
  37197. return value;
  37198. }
  37199. /**
  37200. * @function SuperMap.LevelRenderer.Tool.Color.prototype.isCalculableColor
  37201. * @description 判断是否是可计算的颜色
  37202. * @param {string} color - 颜色。
  37203. * @returns {boolean} 是否是可计算的颜色
  37204. */
  37205. isCalculableColor(color) {
  37206. return color instanceof Array || typeof color === 'string';
  37207. }
  37208. /**
  37209. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSV_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  37210. */
  37211. _HSV_2_RGB(data) {
  37212. var H = data[0];
  37213. var S = data[1];
  37214. var V = data[2];
  37215. // HSV from 0 to 1
  37216. var R;
  37217. var G;
  37218. var B;
  37219. if (S === 0) {
  37220. R = V * 255;
  37221. G = V * 255;
  37222. B = V * 255;
  37223. } else {
  37224. var h = H * 6;
  37225. if (h === 6) {
  37226. h = 0;
  37227. }
  37228. var i = h | 0;
  37229. var v1 = V * (1 - S);
  37230. var v2 = V * (1 - S * (h - i));
  37231. var v3 = V * (1 - S * (1 - (h - i)));
  37232. var r = 0;
  37233. var g = 0;
  37234. var b = 0;
  37235. if (i === 0) {
  37236. r = V;
  37237. g = v3;
  37238. b = v1;
  37239. } else if (i === 1) {
  37240. r = v2;
  37241. g = V;
  37242. b = v1;
  37243. } else if (i === 2) {
  37244. r = v1;
  37245. g = V;
  37246. b = v3;
  37247. } else if (i === 3) {
  37248. r = v1;
  37249. g = v2;
  37250. b = V;
  37251. } else if (i === 4) {
  37252. r = v3;
  37253. g = v1;
  37254. b = V;
  37255. } else {
  37256. r = V;
  37257. g = v1;
  37258. b = v2;
  37259. }
  37260. // RGB results from 0 to 255
  37261. R = r * 255;
  37262. G = g * 255;
  37263. B = b * 255;
  37264. }
  37265. return [R, G, B];
  37266. }
  37267. /**
  37268. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HSL_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  37269. */
  37270. _HSL_2_RGB(data) {
  37271. var H = data[0];
  37272. var S = data[1];
  37273. var L = data[2];
  37274. // HSL from 0 to 1
  37275. var R;
  37276. var G;
  37277. var B;
  37278. if (S === 0) {
  37279. R = L * 255;
  37280. G = L * 255;
  37281. B = L * 255;
  37282. } else {
  37283. var v2;
  37284. if (L < 0.5) {
  37285. v2 = L * (1 + S);
  37286. } else {
  37287. v2 = (L + S) - (S * L);
  37288. }
  37289. var v1 = 2 * L - v2;
  37290. R = 255 * this._HUE_2_RGB(v1, v2, H + (1 / 3));
  37291. G = 255 * this._HUE_2_RGB(v1, v2, H);
  37292. B = 255 * this._HUE_2_RGB(v1, v2, H - (1 / 3));
  37293. }
  37294. return [R, G, B];
  37295. }
  37296. /**
  37297. * @function SuperMap.LevelRenderer.Tool.Color.prototype._HUE_2_RGB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  37298. */
  37299. _HUE_2_RGB(v1, v2, vH) {
  37300. if (vH < 0) {
  37301. vH += 1;
  37302. }
  37303. if (vH > 1) {
  37304. vH -= 1;
  37305. }
  37306. if ((6 * vH) < 1) {
  37307. return (v1 + (v2 - v1) * 6 * vH);
  37308. }
  37309. if ((2 * vH) < 1) {
  37310. return (v2);
  37311. }
  37312. if ((3 * vH) < 2) {
  37313. return (v1 + (v2 - v1) * ((2 / 3) - vH) * 6);
  37314. }
  37315. return v1;
  37316. }
  37317. /**
  37318. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSB。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  37319. */
  37320. _RGB_2_HSB(data) {
  37321. // RGB from 0 to 255
  37322. var R = (data[0] / 255);
  37323. var G = (data[1] / 255);
  37324. var B = (data[2] / 255);
  37325. var vMin = Math.min(R, G, B); // Min. value of RGB
  37326. var vMax = Math.max(R, G, B); // Max. value of RGB
  37327. var delta = vMax - vMin; // Delta RGB value
  37328. var V = vMax;
  37329. var H;
  37330. var S;
  37331. // HSV results from 0 to 1
  37332. if (delta === 0) {
  37333. H = 0;
  37334. S = 0;
  37335. } else {
  37336. S = delta / vMax;
  37337. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  37338. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  37339. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  37340. if (R === vMax) {
  37341. H = deltaB - deltaG;
  37342. } else if (G === vMax) {
  37343. H = (1 / 3) + deltaR - deltaB;
  37344. } else if (B === vMax) {
  37345. H = (2 / 3) + deltaG - deltaR;
  37346. }
  37347. if (H < 0) {
  37348. H += 1;
  37349. }
  37350. if (H > 1) {
  37351. H -= 1;
  37352. }
  37353. }
  37354. H = H * 360;
  37355. S = S * 100;
  37356. V = V * 100;
  37357. return [H, S, V];
  37358. }
  37359. /**
  37360. * @function SuperMap.LevelRenderer.Tool.Color.prototype._RGB_2_HSL。参见{@link http://www.easyrgb.com/index.php?X=MATH}
  37361. */
  37362. _RGB_2_HSL(data) {
  37363. // RGB from 0 to 255
  37364. var R = (data[0] / 255);
  37365. var G = (data[1] / 255);
  37366. var B = (data[2] / 255);
  37367. var vMin = Math.min(R, G, B); // Min. value of RGB
  37368. var vMax = Math.max(R, G, B); // Max. value of RGB
  37369. var delta = vMax - vMin; // Delta RGB value
  37370. var L = (vMax + vMin) / 2;
  37371. var H;
  37372. var S;
  37373. // HSL results from 0 to 1
  37374. if (delta === 0) {
  37375. H = 0;
  37376. S = 0;
  37377. } else {
  37378. if (L < 0.5) {
  37379. S = delta / (vMax + vMin);
  37380. } else {
  37381. S = delta / (2 - vMax - vMin);
  37382. }
  37383. var deltaR = (((vMax - R) / 6) + (delta / 2)) / delta;
  37384. var deltaG = (((vMax - G) / 6) + (delta / 2)) / delta;
  37385. var deltaB = (((vMax - B) / 6) + (delta / 2)) / delta;
  37386. if (R === vMax) {
  37387. H = deltaB - deltaG;
  37388. } else if (G === vMax) {
  37389. H = (1 / 3) + deltaR - deltaB;
  37390. } else if (B === vMax) {
  37391. H = (2 / 3) + deltaG - deltaR;
  37392. }
  37393. if (H < 0) {
  37394. H += 1;
  37395. }
  37396. if (H > 1) {
  37397. H -= 1;
  37398. }
  37399. }
  37400. H = H * 360;
  37401. S = S * 100;
  37402. L = L * 100;
  37403. return [H, S, L];
  37404. }
  37405. }
  37406. ;// CONCATENATED MODULE: ./src/common/util/ColorsPickerUtil.js
  37407. var ColorRender = new Color();
  37408. // let "http://www.qzu.zj.cn": "#bd10e0"
  37409. // "www.qzct.net": "#7ed321" = new SuperMap.LevelRenderer.Tool.Color();
  37410. /**
  37411. * Created by yzy on 2016/11/9.
  37412. * 色带选择器工具类 用于1、创建canvas对象,2、从几种颜色中获取一定数量的渐变色
  37413. *
  37414. */
  37415. class ColorsPickerUtil {
  37416. /**
  37417. * 创建DOM canvas
  37418. * @param height canvas 高度
  37419. * @param width canvas 宽度
  37420. *
  37421. */
  37422. static createCanvas (height, width){
  37423. var canvas = document.createElement("canvas");
  37424. canvas.height = height;
  37425. canvas.width = width;
  37426. return canvas.getContext("2d");
  37427. }
  37428. /**
  37429. * 线性渐变。
  37430. * Parameters:
  37431. * x0 - {Number} 渐变起点。
  37432. * y0 - {Number}
  37433. * x1 - {Number} 渐变终点。
  37434. * y1 - {Number}
  37435. * colorList - {Array} 颜色列表。
  37436. *
  37437. * Returns:
  37438. * {CanvasGradient} Cavans 渐变颜色。
  37439. */
  37440. static getLinearGradient (x0, y0, x1, y1, colorList){
  37441. if (!this._ctx) {
  37442. this._ctx = this.getContext();
  37443. }
  37444. var gradient = this._ctx.createLinearGradient(x0, y0, x1, y1);
  37445. var leng = colorList.length;
  37446. var add = 1/(leng -1);
  37447. var offset = 0;
  37448. for (var i = 0; i < leng; i++) {
  37449. gradient.addColorStop(offset, colorList[i]);
  37450. offset += add;
  37451. }
  37452. gradient.__nonRecursion = true;
  37453. return gradient;
  37454. }
  37455. /**
  37456. * 获取 Cavans 上下文
  37457. *
  37458. * Returns:
  37459. * {Object} Cavans 上下文。
  37460. */
  37461. static getContext () {
  37462. if (!this._ctx) {
  37463. this._ctx = document.createElement('canvas').getContext('2d');
  37464. }
  37465. return this._ctx;
  37466. }
  37467. /**
  37468. * 获取两种颜色之间渐变颜色数组。
  37469. *
  37470. * Parameters:
  37471. * start - {color} 起始颜色。
  37472. * end - {color} 结束颜色。
  37473. * step - {Number} 渐变级数。
  37474. * colorList - {Array} 颜色列表。
  37475. *
  37476. * Returns:
  37477. * {Array} 颜色数组。
  37478. */
  37479. static getStepColors (start, end, step){
  37480. start = ColorRender.toRGBA(start);
  37481. end = ColorRender.toRGBA(end);
  37482. start = ColorRender.getData(start);
  37483. end = ColorRender.getData(end);
  37484. var colors = [];
  37485. var stepR = (end[0] - start[0]) / step;
  37486. var stepG = (end[1] - start[1]) / step;
  37487. var stepB = (end[2] - start[2]) / step;
  37488. var stepA = (end[3] - start[3]) / step;
  37489. // 生成颜色集合
  37490. // fix by linfeng 颜色堆积
  37491. for (var i = 0, r = start[0], g = start[1], b = start[2], a = start[3]; i < step; i++) {
  37492. colors[i] = ColorRender.toColor([
  37493. ColorRender.adjust(Math.floor(r), [ 0, 255 ]),
  37494. ColorRender.adjust(Math.floor(g), [ 0, 255 ]),
  37495. ColorRender.adjust(Math.floor(b), [ 0, 255 ]),
  37496. a.toFixed(4) - 0
  37497. ],'hex');
  37498. r += stepR;
  37499. g += stepG;
  37500. b += stepB;
  37501. a += stepA;
  37502. }
  37503. r = end[0];
  37504. g = end[1];
  37505. b = end[2];
  37506. a = end[3];
  37507. colors[i] = ColorRender.toColor([r, g, b, a], 'hex');
  37508. return colors;
  37509. }
  37510. /**
  37511. * APIMethod: getGradientColors
  37512. * 获取指定级数的渐变颜色数组。
  37513. *
  37514. * Parameters:
  37515. * colors - {Array{String}} 颜色组。
  37516. * total - {Number} 颜色总数。
  37517. * total - {String} 专题类型
  37518. *
  37519. * Returns:
  37520. * {Array{String}} 颜色数组。
  37521. */
  37522. static getGradientColors (colors, total, themeType){
  37523. var ret = [], step;
  37524. var i, n, len = colors.length;
  37525. if (total === undefined) {
  37526. return;
  37527. }
  37528. if(len >= total){
  37529. if(themeType === 'RANGE'){
  37530. for(i = 0; i<total; i++){
  37531. ret.push(colors[i]);
  37532. }
  37533. }else {
  37534. //1/2前后取色
  37535. for(i = 0; i<total; i++){
  37536. let ii = Math.floor(i/2);
  37537. if(i%2 === 0){
  37538. ret.push(colors[ii]);
  37539. }else {
  37540. let index = colors.length -1 - ii;
  37541. ret.push(colors[index]);
  37542. }
  37543. }
  37544. }
  37545. } else {
  37546. step = Math.ceil(total/(len-1));
  37547. for (i = 0, n = len - 1; i < n; i++) {
  37548. var steps = this.getStepColors(colors[i], colors[i + 1], step);
  37549. if (i < n - 1) {
  37550. steps.pop();
  37551. }
  37552. ret = ret.concat(steps);
  37553. }
  37554. //删除多余元素
  37555. var nouse = ret.length - total;
  37556. for(var j = 0, index = 0; j< nouse; j++){
  37557. ret.splice(index+2,1);
  37558. }
  37559. }
  37560. return ret;
  37561. }
  37562. }
  37563. SuperMap.ColorsPickerUtil = ColorsPickerUtil;
  37564. ;// CONCATENATED MODULE: ./src/common/util/ArrayStatistic.js
  37565. class ArrayStatistic {
  37566. // geostatsInstance: null,
  37567. /**
  37568. * 初始化插件实例
  37569. */
  37570. static newInstance() {
  37571. // if(!this.geostatsInstance) {
  37572. // // this.geostatsInstance = new geostats();
  37573. // // }
  37574. // window.dataList = [];
  37575. if(!this.geostatsInstance) {
  37576. this.geostatsInstance = new window.geostats();
  37577. }
  37578. return this.geostatsInstance;
  37579. }
  37580. /**
  37581. * 设置需要被处理的数组
  37582. *
  37583. * @param array
  37584. */
  37585. static getInstance(array) {
  37586. let instance = this.newInstance();
  37587. instance.setSerie(array);
  37588. return instance;
  37589. }
  37590. /**
  37591. * 获取数组统计的值
  37592. *
  37593. * @param array 需要统计的数组
  37594. * @param type 统计方法
  37595. */
  37596. static getArrayStatistic(array, type){
  37597. if(!array.length) {
  37598. return 0;
  37599. }
  37600. if(type === "Sum" || type === "求和"){
  37601. return this.getSum(array);
  37602. } else if(type === "Maximum" || type === "最大值"){
  37603. return this.getMax(array);
  37604. } else if(type === "Minimum" || type === "最小值"){
  37605. return this.getMin(array);
  37606. } else if(type === "Average" || type === "平均值"){
  37607. return this.getMean(array);
  37608. } else if(type === "Median" || type === "中位数"){
  37609. return this.getMedian(array);
  37610. } else if(type === "times" || type === "计数"){
  37611. return this.getTimes(array);
  37612. }
  37613. }
  37614. /**
  37615. * 获取数组分段后的数值
  37616. *
  37617. * @param array 需要分段的数组
  37618. * @param type 分段方法
  37619. * @param segNum 分段个数
  37620. */
  37621. static getArraySegments(array, type, segNum) {
  37622. if(type === "offset") {
  37623. return this.getEqInterval(array, segNum);
  37624. } else if(type === "jenks") {
  37625. return this.getJenks(array, segNum);
  37626. } else if(type === "square") {
  37627. // 数据都必须 >= 0
  37628. let minValue = this.getMin(array);
  37629. if(minValue >= 0){
  37630. return this.getSqrtInterval(array, segNum);
  37631. }else {
  37632. //console.log('数据都必须 >= 0');
  37633. // Util.showMessage(Language.hasNegValue + Language.noSupportRange, 'ERROR');
  37634. return false;
  37635. }
  37636. } else if(type === "logarithm") {
  37637. // 数据都必须 > 0
  37638. let minValue = this.getMin(array);
  37639. if(minValue > 0){
  37640. return this.getGeometricProgression(array, segNum);
  37641. }else {
  37642. //console.log('数据都必须 > 0');
  37643. // Util.showMessage(Language.hasZeroNegValue + Language.noSupportRange, 'ERROR');
  37644. return false;
  37645. }
  37646. }
  37647. }
  37648. /**
  37649. * 求和
  37650. * @param array
  37651. * @returns {number}
  37652. */
  37653. static getSum(array){
  37654. return this.getInstance(array).sum();
  37655. }
  37656. /**
  37657. * 最小值
  37658. * @param array
  37659. * @returns {*}
  37660. */
  37661. static getMax(array){
  37662. return this.getInstance(array).max();
  37663. }
  37664. /**
  37665. * 最大值
  37666. * @param array
  37667. * @returns {*}
  37668. */
  37669. static getMin(array){
  37670. return this.getInstance(array).min();
  37671. }
  37672. /**
  37673. * 求平均
  37674. * @param array
  37675. * @returns {number}
  37676. */
  37677. static getMean(array){
  37678. return this.getInstance(array).mean();
  37679. }
  37680. /**
  37681. * 求中位数
  37682. *
  37683. * @param array
  37684. * @returns {number}
  37685. */
  37686. static getMedian(array) {
  37687. return this.getInstance(array).median();
  37688. }
  37689. /**
  37690. * 计数
  37691. *
  37692. * @param array
  37693. * @returns {number}
  37694. */
  37695. static getTimes(array) {
  37696. return array.length;
  37697. }
  37698. /**
  37699. * 等距分段法
  37700. *
  37701. * @param array
  37702. * @param segNum
  37703. */
  37704. static getEqInterval(array, segNum) {
  37705. return this.getInstance(array).getClassEqInterval(segNum);
  37706. }
  37707. /**
  37708. * 自然断裂法
  37709. *
  37710. * @param array
  37711. * @param segNum
  37712. */
  37713. static getJenks(array, segNum) {
  37714. return this.getInstance(array).getClassJenks(segNum);
  37715. }
  37716. /**
  37717. * 平方根分段法
  37718. *
  37719. * @param array
  37720. * @param segNum
  37721. */
  37722. static getSqrtInterval(array, segNum) {
  37723. array = array.map(function(value) {
  37724. return Math.sqrt(value);
  37725. });
  37726. let breaks = this.getInstance(array).getClassEqInterval(segNum);
  37727. return (
  37728. breaks.map(function(value) {
  37729. return value * value;
  37730. })
  37731. )
  37732. }
  37733. /**
  37734. * 对数分段法
  37735. *
  37736. * @param array
  37737. * @param segNum
  37738. */
  37739. static getGeometricProgression(array, segNum) {
  37740. return this.getInstance(array).getClassGeometricProgression(segNum);
  37741. }
  37742. }
  37743. SuperMap.ArrayStatistic = ArrayStatistic;
  37744. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  37745. var getMeterPerMapUnit = function(mapUnit) {
  37746. var earchRadiusInMeters = 6378137;
  37747. var meterPerMapUnit;
  37748. if (mapUnit === Unit.METER) {
  37749. meterPerMapUnit = 1;
  37750. } else if (mapUnit === Unit.DEGREE) {
  37751. // 每度表示多少米。
  37752. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  37753. } else if (mapUnit === Unit.KILOMETER) {
  37754. meterPerMapUnit = 1.0e-3;
  37755. } else if (mapUnit === Unit.INCH) {
  37756. meterPerMapUnit = 1 / 2.5399999918e-2;
  37757. } else if (mapUnit === Unit.FOOT) {
  37758. meterPerMapUnit = 0.3048;
  37759. } else {
  37760. return meterPerMapUnit;
  37761. }
  37762. return meterPerMapUnit;
  37763. };
  37764. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  37765. var max = range[1],
  37766. min = range[0],
  37767. d = max - min;
  37768. if (x === max && includeMax) {
  37769. return x;
  37770. }
  37771. if (x === min && includeMin) {
  37772. return x;
  37773. }
  37774. var tmp = (((x - min) % d) + d) % d;
  37775. if (tmp === 0 && includeMax) {
  37776. return max;
  37777. }
  37778. return ((((x - min) % d) + d) % d) + min;
  37779. }
  37780. function conversionDegree(degrees) {
  37781. const degree = parseInt(degrees);
  37782. let fraction = parseInt((degrees - degree) * 60);
  37783. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  37784. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  37785. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  37786. return `${degree}°${fraction}'${second}`;
  37787. }
  37788. ;// CONCATENATED MODULE: ./src/common/util/index.js
  37789. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  37790. * This program are made available under the terms of the Apache License, Version 2.0
  37791. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37792. // EXTERNAL MODULE: ./node_modules/lodash.topairs/index.js
  37793. var lodash_topairs = __webpack_require__(52);
  37794. var lodash_topairs_default = /*#__PURE__*/__webpack_require__.n(lodash_topairs);
  37795. ;// CONCATENATED MODULE: ./src/common/style/CartoCSS.js
  37796. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  37797. * This program are made available under the terms of the Apache License, Version 2.0
  37798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  37799. /**
  37800. * @class SuperMap.CartoCSS
  37801. * @classdesc CartoCSS 解析类,其主要功能为将 CartoCSS 字符串解析为 CartoCSS 的 shader 属性风格对象。
  37802. * @category BaseTypes Style
  37803. * @param {string} cartoStr - CartoCSS 样式表字符串
  37804. * @example
  37805. * var cartocss = "@provinceLineColor:#ddd;
  37806. * #China_Provinces_L___China400{
  37807. * line-dasharray:10,10;
  37808. * line-color:@provinceLineColor;
  37809. * line-width:1;
  37810. * }";
  37811. * new SuperMap.CartoCSS(cartocss);
  37812. */
  37813. /*eslint no-useless-escape: "off"*/
  37814. class CartoCSS {
  37815. constructor(cartoStr) {
  37816. this.env = null;
  37817. /**
  37818. * @member SuperMap.CartoCSS.prototype.parser
  37819. * @description 解析器
  37820. */
  37821. this.parser = null;
  37822. /**
  37823. * @member SuperMap.CartoCSS.prototype.ruleSet
  37824. * @description CartoCSS 规则对象
  37825. */
  37826. this.ruleSet = null;
  37827. /**
  37828. * @member SuperMap.CartoCSS.prototype.cartoStr
  37829. * @description CartoCSS 样式表字符串
  37830. */
  37831. this.cartoStr = "";
  37832. /**
  37833. * @member SuperMap.CartoCSS.prototype.shaders
  37834. * @description Carto 着色器集
  37835. */
  37836. this.shaders = null;
  37837. if (typeof cartoStr === "string") {
  37838. this.cartoStr = cartoStr;
  37839. this.env = {
  37840. frames: [],
  37841. errors: [],
  37842. error: function (obj) {
  37843. this.errors.push(obj);
  37844. }
  37845. };
  37846. this.parser = this.getParser(this.env);
  37847. this.parse(cartoStr);
  37848. this.shaders = this.toShaders();
  37849. }
  37850. }
  37851. /**
  37852. * @function SuperMap.CartoCSS.prototype.getParser
  37853. * @description 获取 CartoCSS 解析器
  37854. */
  37855. getParser(env) {
  37856. var input, // LeSS input string
  37857. i, // current index in `input`
  37858. j, // current chunk
  37859. temp, // temporarily holds a chunk's state, for backtracking
  37860. memo, // temporarily holds `i`, when backtracking
  37861. furthest, // furthest index the parser has gone to
  37862. chunks, // chunkified input
  37863. current, // index of current chunk, in `input`
  37864. parser;
  37865. var that = this;
  37866. // This function is called after all files
  37867. // have been imported through `@import`.
  37868. var finish = function () {//NOSONAR
  37869. //所有文件导入完成之后调用
  37870. };
  37871. function save() {
  37872. temp = chunks[j];
  37873. memo = i;
  37874. current = i;
  37875. }
  37876. function restore() {
  37877. chunks[j] = temp;
  37878. i = memo;
  37879. current = i;
  37880. }
  37881. function sync() {
  37882. if (i > current) {
  37883. chunks[j] = chunks[j].slice(i - current);
  37884. current = i;
  37885. }
  37886. }
  37887. //
  37888. // Parse from a token, regexp or string, and move forward if match
  37889. //
  37890. function _match(tok) {
  37891. var match, length, c, endIndex;
  37892. // Non-terminal
  37893. if (tok instanceof Function) {
  37894. return tok.call(parser.parsers);
  37895. // Terminal
  37896. // Either match a single character in the input,
  37897. // or match a regexp in the current chunk (chunk[j]).
  37898. } else if (typeof(tok) === 'string') {
  37899. match = input.charAt(i) === tok ? tok : null;
  37900. length = 1;
  37901. sync();
  37902. } else {
  37903. sync();
  37904. match = tok.exec(chunks[j]);
  37905. if (match) {
  37906. length = match[0].length;
  37907. } else {
  37908. return null;
  37909. }
  37910. }
  37911. // The match is confirmed, add the match length to `i`,
  37912. // and consume any extra white-space characters (' ' || '\n')
  37913. // which come after that. The reason for this is that LeSS's
  37914. // grammar is mostly white-space insensitive.
  37915. if (match) {
  37916. var mem = i += length;
  37917. endIndex = i + chunks[j].length - length;
  37918. while (i < endIndex) {
  37919. c = input.charCodeAt(i);
  37920. if (!(c === 32 || c === 10 || c === 9)) {
  37921. break;
  37922. }
  37923. i++;
  37924. }
  37925. chunks[j] = chunks[j].slice(length + (i - mem));
  37926. current = i;
  37927. if (chunks[j].length === 0 && j < chunks.length - 1) {
  37928. j++;
  37929. }
  37930. if (typeof(match) === 'string') {
  37931. return match;
  37932. } else {
  37933. return match.length === 1 ? match[0] : match;
  37934. }
  37935. }
  37936. }
  37937. // Same as _match(), but don't change the state of the parser,
  37938. // just return the match.
  37939. function peek(tok) {
  37940. if (typeof(tok) === 'string') {
  37941. return input.charAt(i) === tok;
  37942. } else {
  37943. return !!tok.test(chunks[j]);
  37944. }
  37945. }
  37946. // Make an error object from a passed set of properties.
  37947. // Accepted properties:
  37948. // - `message`: Text of the error message.
  37949. // - `filename`: Filename where the error occurred.
  37950. // - `index`: Char. index where the error occurred.
  37951. function makeError(err) {
  37952. var einput;
  37953. var defautls = {
  37954. index: furthest,
  37955. filename: env.filename,
  37956. message: 'Parse error.',
  37957. line: 0,
  37958. column: -1
  37959. };
  37960. for (var prop in defautls) {
  37961. if (err[prop] === 0) {
  37962. err[prop] = defautls[prop];
  37963. }
  37964. }
  37965. if (err.filename && that.env.inputs && that.env.inputs[err.filename]) {
  37966. einput = that.env.inputs[err.filename];
  37967. } else {
  37968. einput = input;
  37969. }
  37970. err.line = (einput.slice(0, err.index).match(/\n/g) || '').length + 1;
  37971. for (var n = err.index; n >= 0 && einput.charAt(n) !== '\n'; n--) {
  37972. err.column++;
  37973. }
  37974. return new Error([err.filename, err.line, err.column, err.message].join(";"));
  37975. }
  37976. this.env = env = env || {};
  37977. this.env.filename = this.env.filename || null;
  37978. this.env.inputs = this.env.inputs || {};
  37979. // The Parser
  37980. parser = {
  37981. // Parse an input string into an abstract syntax tree.
  37982. // Throws an error on parse errors.
  37983. parse: function (str) {
  37984. var root, error = null;
  37985. i = j = current = furthest = 0;
  37986. chunks = [];
  37987. input = str.replace(/\r\n/g, '\n');
  37988. if (env.filename) {
  37989. that.env.inputs[env.filename] = input;
  37990. }
  37991. // Split the input into chunks.
  37992. chunks = (function (chunks) {
  37993. var j = 0,
  37994. skip = /(?:@\{[\w-]+\}|[^"'`\{\}\/\(\)\\])+/g,
  37995. comment = /\/\*(?:[^*]|\*+[^\/*])*\*+\/|\/\/.*/g,
  37996. string = /"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'|`((?:[^`]|\\.)*)`/g,
  37997. level = 0,
  37998. match,
  37999. chunk = chunks[0],
  38000. inParam;
  38001. for (var i = 0, c, cc; i < input.length;) {
  38002. skip.lastIndex = i;
  38003. if (match = skip.exec(input)) {
  38004. if (match.index === i) {
  38005. i += match[0].length;
  38006. chunk.push(match[0]);
  38007. }
  38008. }
  38009. c = input.charAt(i);
  38010. comment.lastIndex = string.lastIndex = i;
  38011. if (match = string.exec(input)) {
  38012. if (match.index === i) {
  38013. i += match[0].length;
  38014. chunk.push(match[0]);
  38015. continue;
  38016. }
  38017. }
  38018. if (!inParam && c === '/') {
  38019. cc = input.charAt(i + 1);
  38020. if (cc === '/' || cc === '*') {
  38021. if (match = comment.exec(input)) {
  38022. if (match.index === i) {
  38023. i += match[0].length;
  38024. chunk.push(match[0]);
  38025. continue;
  38026. }
  38027. }
  38028. }
  38029. }
  38030. switch (c) {
  38031. case '{'://NOSONAR
  38032. if (!inParam) {
  38033. level++;
  38034. chunk.push(c);
  38035. break;
  38036. }
  38037. case '}'://NOSONAR
  38038. if (!inParam) {
  38039. level--;
  38040. chunk.push(c);
  38041. chunks[++j] = chunk = [];
  38042. break;
  38043. }
  38044. case '('://NOSONAR
  38045. if (!inParam) {
  38046. inParam = true;
  38047. chunk.push(c);
  38048. break;
  38049. }
  38050. case ')'://NOSONAR
  38051. if (inParam) {
  38052. inParam = false;
  38053. chunk.push(c);
  38054. break;
  38055. }
  38056. default:
  38057. chunk.push(c);
  38058. break;
  38059. }
  38060. i++;
  38061. }
  38062. if (level !== 0) {
  38063. error = {
  38064. index: i - 1,
  38065. type: 'Parse',
  38066. message: (level > 0) ? "missing closing `}`" : "missing opening `{`"
  38067. };
  38068. }
  38069. return chunks.map(function (c) {
  38070. return c.join('');
  38071. });
  38072. })([[]]);
  38073. if (error) {
  38074. throw makeError(error);
  38075. }
  38076. // Sort rules by specificity: this function expects selectors to be
  38077. // split already.
  38078. //
  38079. // Written to be used as a .sort(Function);
  38080. // argument.
  38081. //
  38082. // [1, 0, 0, 467] > [0, 0, 1, 520]
  38083. var specificitySort = function (a, b) {
  38084. var as = a.specificity;
  38085. var bs = b.specificity;
  38086. if (as[0] != bs[0]) {return bs[0] - as[0];}
  38087. if (as[1] != bs[1]) {return bs[1] - as[1];}
  38088. if (as[2] != bs[2]) {return bs[2] - as[2];}
  38089. return bs[3] - as[3];
  38090. };
  38091. // Start with the primary rule.
  38092. // The whole syntax tree is held under a Ruleset node,
  38093. // with the `root` property set to true, so no `{}` are
  38094. // output.
  38095. root = new SuperMap.CartoCSS.Tree.Ruleset([], _match(this.parsers.primary));
  38096. root.root = true;
  38097. // Get an array of Ruleset objects, flattened
  38098. // and sorted according to specificitySort
  38099. root.toList = (function () {
  38100. return function (env) {
  38101. env.error = function (e) {
  38102. if (!env.errors) {env.errors = new Error('');}
  38103. if (env.errors.message) {
  38104. env.errors.message += '\n' + makeError(e).message;
  38105. } else {
  38106. env.errors.message = makeError(e).message;
  38107. }
  38108. };
  38109. env.frames = env.frames || [];
  38110. // call populates Invalid-caused errors
  38111. var definitions = this.flatten([], [], env);
  38112. definitions.sort(specificitySort);
  38113. return definitions;
  38114. };
  38115. })();
  38116. return root;
  38117. },
  38118. // Here in, the parsing rules/functions
  38119. //
  38120. // The basic structure of the syntax tree generated is as follows:
  38121. //
  38122. // Ruleset -> Rule -> Value -> Expression -> Entity
  38123. //
  38124. // In general, most rules will try to parse a token with the `_match()` function, and if the return
  38125. // value is truly, will return a new node, of the relevant type. Sometimes, we need to check
  38126. // first, before parsing, that's when we use `peek()`.
  38127. parsers: {
  38128. // The `primary` rule is the *entry* and *exit* point of the parser.
  38129. // The rules here can appear at any level of the parse tree.
  38130. //
  38131. // The recursive nature of the grammar is an interplay between the `block`
  38132. // rule, which represents `{ ... }`, the `ruleset` rule, and this `primary` rule,
  38133. // as represented by this simplified grammar:
  38134. //
  38135. // primary → (ruleset | rule)+
  38136. // ruleset → selector+ block
  38137. // block → '{' primary '}'
  38138. //
  38139. // Only at one point is the primary rule not called from the
  38140. // block rule: at the root level.
  38141. primary: function () {
  38142. var node, root = [];
  38143. while ((node = _match(this.rule) || _match(this.ruleset) ||
  38144. _match(this.comment)) ||
  38145. _match(/^[\s\n]+/) || (node = _match(this.invalid))) {
  38146. if (node) {root.push(node);}
  38147. }
  38148. return root;
  38149. },
  38150. invalid: function () {
  38151. var chunk = _match(/^[^;\n]*[;\n]/);
  38152. // To fail gracefully, match everything until a semicolon or linebreak.
  38153. if (chunk) {
  38154. return new SuperMap.CartoCSS.Tree.Invalid(chunk, memo);
  38155. }
  38156. },
  38157. // We create a Comment node for CSS comments `/* */`,
  38158. // but keep the LeSS comments `//` silent, by just skipping
  38159. // over them.
  38160. comment: function () {
  38161. var comment;
  38162. if (input.charAt(i) !== '/') {return;}
  38163. if (input.charAt(i + 1) === '/') {
  38164. return new SuperMap.CartoCSS.Tree.Comment(_match(/^\/\/.*/), true);
  38165. } else if (comment = _match(/^\/\*(?:[^*]|\*+[^\/*])*\*+\/\n?/)) {
  38166. return new SuperMap.CartoCSS.Tree.Comment(comment);
  38167. }
  38168. },
  38169. // Entities are tokens which can be found inside an Expression
  38170. entities: {
  38171. // A string, which supports escaping " and ' "milky way" 'he\'s the one!'
  38172. quoted: function () {
  38173. if (input.charAt(i) !== '"' && input.charAt(i) !== "'") {return;}
  38174. var str = _match(/^"((?:[^"\\\r\n]|\\.)*)"|'((?:[^'\\\r\n]|\\.)*)'/);
  38175. if (str) {
  38176. return new SuperMap.CartoCSS.Tree.Quoted(str[1] || str[2]);
  38177. }
  38178. },
  38179. // A reference to a Mapnik field, like [NAME]
  38180. // Behind the scenes, this has the same representation, but Carto
  38181. // needs to be careful to warn when unsupported operations are used.
  38182. field: function () {
  38183. var l = '[', r = ']';
  38184. if (!_match(l)) {return;}
  38185. var field_name = _match(/(^[^\]]+)/);
  38186. if (!_match(r)) {return;}
  38187. if (field_name) {return new SuperMap.CartoCSS.Tree.Field(field_name[1]);}
  38188. },
  38189. // This is a comparison operator
  38190. comparison: function () {
  38191. var str = _match(/^=~|=|!=|<=|>=|<|>/);
  38192. if (str) {
  38193. return str;
  38194. }
  38195. },
  38196. // A catch-all word, such as: hard-light
  38197. // These can start with either a letter or a dash (-),
  38198. // and then contain numbers, underscores, and letters.
  38199. keyword: function () {
  38200. var k = _match(/^[A-Za-z\u4e00-\u9fa5-]+[A-Za-z-0-9\u4e00-\u9fa5_]*/);
  38201. if (k) {
  38202. return new SuperMap.CartoCSS.Tree.Keyword(k);
  38203. }
  38204. },
  38205. // A function call like rgb(255, 0, 255)
  38206. // The arguments are parsed with the `entities.arguments` parser.
  38207. call: function () {
  38208. var name, args;
  38209. if (!(name = /^([\w\-]+|%)\(/.exec(chunks[j]))) {return;}
  38210. name = name[1];
  38211. if (name === 'url') {
  38212. // url() is handled by the url parser instead
  38213. return null;
  38214. } else {
  38215. i += name.length;
  38216. }
  38217. var l = '(', r = ')';
  38218. _match(l); // Parse the '(' and consume whitespace.
  38219. args = _match(this.entities['arguments']);
  38220. if (!_match(r)) {return;}
  38221. if (name) {
  38222. return new SuperMap.CartoCSS.Tree.Call(name, args, i);
  38223. }
  38224. },
  38225. // Arguments are comma-separated expressions
  38226. 'arguments': function () {
  38227. var args = [], arg;
  38228. while (arg = _match(this.expression)) {
  38229. args.push(arg);
  38230. var q = ',';
  38231. if (!_match(q)) {
  38232. break;
  38233. }
  38234. }
  38235. return args;
  38236. },
  38237. literal: function () {
  38238. return _match(this.entities.dimension) ||
  38239. _match(this.entities.keywordcolor) ||
  38240. _match(this.entities.hexcolor) ||
  38241. _match(this.entities.quoted);
  38242. },
  38243. // Parse url() tokens
  38244. //
  38245. // We use a specific rule for urls, because they don't really behave like
  38246. // standard function calls. The difference is that the argument doesn't have
  38247. // to be enclosed within a string, so it can't be parsed as an Expression.
  38248. url: function () {
  38249. var value;
  38250. if (input.charAt(i) !== 'u' || !_match(/^url\(/)) {return;}
  38251. value = _match(this.entities.quoted) || _match(this.entities.variable) ||
  38252. _match(/^[\-\w%@_match\/.&=:;#+?~]+/) || '';
  38253. var r = ')';
  38254. if (!_match(r)) {
  38255. return new SuperMap.CartoCSS.Tree.Invalid(value, memo, 'Missing closing ) in URL.');
  38256. } else {
  38257. return new SuperMap.CartoCSS.Tree.URL((typeof value.value !== 'undefined' ||
  38258. value instanceof SuperMap.CartoCSS.Tree.Variable) ?
  38259. value : new SuperMap.CartoCSS.Tree.Quoted(value));
  38260. }
  38261. },
  38262. // A Variable entity, such as `@fink`, in
  38263. //
  38264. // width: @fink + 2px
  38265. //
  38266. // We use a different parser for variable definitions,
  38267. // see `parsers.variable`.
  38268. variable: function () {
  38269. var name, index = i;
  38270. if (input.charAt(i) === '@' && (name = _match(/^@[\w-]+/))) {
  38271. return new SuperMap.CartoCSS.Tree.Variable(name, index, env.filename);
  38272. }
  38273. },
  38274. hexcolor: function () {
  38275. var rgb;
  38276. if (input.charAt(i) === '#' && (rgb = _match(/^#([a-fA-F0-9]{6}|[a-fA-F0-9]{3})/))) {
  38277. return new SuperMap.CartoCSS.Tree.Color(rgb[1]);
  38278. }
  38279. },
  38280. keywordcolor: function () {
  38281. var rgb = chunks[j].match(/^[a-z]+/);
  38282. if (rgb && rgb[0] in SuperMap.CartoCSS.Tree.Reference.data.colors) {
  38283. return new SuperMap.CartoCSS.Tree.Color(SuperMap.CartoCSS.Tree.Reference.data.colors[_match(/^[a-z]+/)]);
  38284. }
  38285. },
  38286. // A Dimension, that is, a number and a unit. The only
  38287. // unit that has an effect is %
  38288. dimension: function () {
  38289. var c = input.charCodeAt(i);
  38290. if ((c > 57 || c < 45) || c === 47) {return;}
  38291. var value = _match(/^(-?\d*\.?\d+(?:[eE][-+]?\d+)?)(\%|\w+)?/);
  38292. if (value) {
  38293. return new SuperMap.CartoCSS.Tree.Dimension(value[1], value[2], memo);
  38294. }
  38295. }
  38296. },
  38297. // The variable part of a variable definition.
  38298. // Used in the `rule` parser. Like @fink:
  38299. variable: function () {
  38300. var name;
  38301. if (input.charAt(i) === '@' && (name = _match(/^(@[\w-]+)\s*:/))) {
  38302. return name[1];
  38303. }
  38304. },
  38305. // Entities are the smallest recognized token,
  38306. // and can be found inside a rule's value.
  38307. entity: function () {
  38308. var property1 = _match(this.entities.call) || _match(this.entities.literal);
  38309. var property2 = _match(this.entities.field) || _match(this.entities.variable);
  38310. var property3 = _match(this.entities.url) || _match(this.entities.keyword);
  38311. return property1 || property2 || property3;
  38312. },
  38313. // A Rule terminator. Note that we use `peek()` to check for '}',
  38314. // because the `block` rule will be expecting it, but we still need to make sure
  38315. // it's there, if ';' was ommitted.
  38316. end: function () {
  38317. var q = ';';
  38318. return _match(q) || peek('}');
  38319. },
  38320. // Elements are the building blocks for Selectors. They consist of
  38321. // an element name, such as a tag a class, or `*`.
  38322. //增加对中文的支持,[\u4e00-\u9fa5]
  38323. element: function () {
  38324. var e = _match(/^(?:[.#][\w\u4e00-\u9fa5\-]+|\*|Map)/);
  38325. if (e) {return new SuperMap.CartoCSS.Tree.Element(e);}
  38326. },
  38327. // Attachments allow adding multiple lines, polygons etc. to an
  38328. // object. There can only be one attachment per selector.
  38329. attachment: function () {
  38330. var s = _match(/^::([\w\-]+(?:\/[\w\-]+)*)/);
  38331. if (s) {return s[1];}
  38332. },
  38333. // Selectors are made out of one or more Elements, see above.
  38334. selector: function () {
  38335. var a, attachment,
  38336. e, elements = [],
  38337. f, filters = new SuperMap.CartoCSS.Tree.Filterset(),
  38338. z, zooms = [],
  38339. segments = 0, conditions = 0;
  38340. while (
  38341. (e = _match(this.element)) ||
  38342. (z = _match(this.zoom)) ||
  38343. (f = _match(this.filter)) ||
  38344. (a = _match(this.attachment))
  38345. ) {
  38346. segments++;
  38347. if (e) {
  38348. elements.push(e);
  38349. } else if (z) {
  38350. zooms.push(z);
  38351. conditions++;
  38352. } else if (f) {
  38353. var err = filters.add(f);
  38354. if (err) {
  38355. throw makeError({
  38356. message: err,
  38357. index: i - 1
  38358. });
  38359. }
  38360. conditions++;
  38361. } else if (attachment) {
  38362. throw makeError({
  38363. message: 'Encountered second attachment name.',
  38364. index: i - 1
  38365. });
  38366. } else {
  38367. attachment = a;
  38368. }
  38369. var c = input.charAt(i);
  38370. if (c === '{' || c === '}' || c === ';' || c === ',') {
  38371. break;
  38372. }
  38373. }
  38374. if (segments) {
  38375. return new SuperMap.CartoCSS.Tree.Selector(filters, zooms, elements, attachment, conditions, memo);
  38376. }
  38377. },
  38378. filter: function () {
  38379. save();
  38380. var key, op, val, l = '[', r = ']';
  38381. if (!_match(l)) {return;}
  38382. if (key = _match(/^[a-zA-Z0-9\-_]+/) ||
  38383. _match(this.entities.quoted) ||
  38384. _match(this.entities.variable) ||
  38385. _match(this.entities.keyword) ||
  38386. _match(this.entities.field)) {
  38387. if (key instanceof SuperMap.CartoCSS.Tree.Quoted) {
  38388. key = new SuperMap.CartoCSS.Tree.Field(key.toString());
  38389. }
  38390. if ((op = _match(this.entities.comparison)) &&
  38391. (val = _match(this.entities.quoted) ||
  38392. _match(this.entities.variable) ||
  38393. _match(this.entities.dimension) ||
  38394. _match(this.entities.keyword) ||
  38395. _match(this.entities.field))) {
  38396. if (!_match(r)) {
  38397. throw makeError({
  38398. message: 'Missing closing ] of filter.',
  38399. index: memo - 1
  38400. });
  38401. }
  38402. if (!key.is) {key = new SuperMap.CartoCSS.Tree.Field(key);}
  38403. return new SuperMap.CartoCSS.Tree.Filter(key, op, val, memo, env.filename);
  38404. }
  38405. }
  38406. },
  38407. zoom: function () {
  38408. save();
  38409. var op, val, r = ']';
  38410. if (_match(/^\[\s*zoom/g) &&
  38411. (op = _match(this.entities.comparison)) &&
  38412. (val = _match(this.entities.variable) || _match(this.entities.dimension)) && _match(r)) {
  38413. return new SuperMap.CartoCSS.Tree.Zoom(op, val, memo);
  38414. } else {
  38415. // backtrack
  38416. restore();
  38417. }
  38418. },
  38419. // The `block` rule is used by `ruleset`
  38420. // It's a wrapper around the `primary` rule, with added `{}`.
  38421. block: function () {
  38422. var content, l = '{', r = '}';
  38423. if (_match(l) && (content = _match(this.primary)) && _match(r)) {
  38424. return content;
  38425. }
  38426. },
  38427. // div, .class, body > p {...}
  38428. ruleset: function () {
  38429. var selectors = [], s, rules, q = ',';
  38430. save();
  38431. while (s = _match(this.selector)) {
  38432. selectors.push(s);
  38433. while (_match(this.comment)) {//NOSONAR
  38434. }
  38435. if (!_match(q)) {
  38436. break;
  38437. }
  38438. while (_match(this.comment)) {//NOSONAR
  38439. }
  38440. }
  38441. if (s) {
  38442. while (_match(this.comment)) {//NOSONAR
  38443. }
  38444. }
  38445. if (selectors.length > 0 && (rules = _match(this.block))) {
  38446. if (selectors.length === 1 &&
  38447. selectors[0].elements.length &&
  38448. selectors[0].elements[0].value === 'Map') {
  38449. var rs = new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  38450. rs.isMap = true;
  38451. return rs;
  38452. }
  38453. return new SuperMap.CartoCSS.Tree.Ruleset(selectors, rules);
  38454. } else {
  38455. // Backtrack
  38456. restore();
  38457. }
  38458. },
  38459. rule: function () {
  38460. var name, value, c = input.charAt(i);
  38461. save();
  38462. if (c === '.' || c === '#') {
  38463. return;
  38464. }
  38465. if (name = _match(this.variable) || _match(this.property)) {
  38466. value = _match(this.value);
  38467. if (value && _match(this.end)) {
  38468. return new SuperMap.CartoCSS.Tree.Rule(name, value, memo, env.filename);
  38469. } else {
  38470. furthest = i;
  38471. restore();
  38472. }
  38473. }
  38474. },
  38475. font: function () {
  38476. var value = [], expression = [], e, q = ',';
  38477. while (e = _match(this.entity)) {
  38478. expression.push(e);
  38479. }
  38480. value.push(new SuperMap.CartoCSS.Tree.Expression(expression));
  38481. if (_match(q)) {
  38482. while (e = _match(this.expression)) {
  38483. value.push(e);
  38484. if (!_match(q)) {
  38485. break;
  38486. }
  38487. }
  38488. }
  38489. return new SuperMap.CartoCSS.Tree.Value(value);
  38490. },
  38491. // A Value is a comma-delimited list of Expressions
  38492. // In a Rule, a Value represents everything after the `:`,
  38493. // and before the `;`.
  38494. value: function () {
  38495. var e, expressions = [], q = ',';
  38496. while (e = _match(this.expression)) {
  38497. expressions.push(e);
  38498. if (!_match(q)) {
  38499. break;
  38500. }
  38501. }
  38502. if (expressions.length > 1) {
  38503. return new SuperMap.CartoCSS.Tree.Value(expressions.map(function (e) {
  38504. return e.value[0];
  38505. }));
  38506. } else if (expressions.length === 1) {
  38507. return new SuperMap.CartoCSS.Tree.Value(expressions);
  38508. }
  38509. },
  38510. // A sub-expression, contained by parenthensis
  38511. sub: function () {
  38512. var e, l = '(', r = ")";
  38513. if (_match(l) && (e = _match(this.expression)) && _match(r)) {
  38514. return e;
  38515. }
  38516. },
  38517. // This is a misnomer because it actually handles multiplication
  38518. // and division.
  38519. multiplication: function () {
  38520. var m, a, op, operation, q = '/';
  38521. if (m = _match(this.operand)) {
  38522. while ((op = (_match(q) || _match('*') || _match('%'))) && (a = _match(this.operand))) {
  38523. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  38524. }
  38525. return operation || m;
  38526. }
  38527. },
  38528. addition: function () {
  38529. var m, a, op, operation, plus = '+';
  38530. if (m = _match(this.multiplication)) {
  38531. while ((op = _match(/^[-+]\s+/) || (input.charAt(i - 1) != ' ' && (_match(plus) || _match('-')))) &&
  38532. (a = _match(this.multiplication))) {
  38533. operation = new SuperMap.CartoCSS.Tree.Operation(op, [operation || m, a], memo);
  38534. }
  38535. return operation || m;
  38536. }
  38537. },
  38538. // An operand is anything that can be part of an operation,
  38539. // such as a Color, or a Variable
  38540. operand: function () {
  38541. return _match(this.sub) || _match(this.entity);
  38542. },
  38543. // Expressions either represent mathematical operations,
  38544. // or white-space delimited Entities. @var * 2
  38545. expression: function () {
  38546. var e, entities = [];
  38547. while (e = _match(this.addition) || _match(this.entity)) {
  38548. entities.push(e);
  38549. }
  38550. if (entities.length > 0) {
  38551. return new SuperMap.CartoCSS.Tree.Expression(entities);
  38552. }
  38553. },
  38554. property: function () {
  38555. var name = _match(/^(([a-z][-a-z_0-9]*\/)?\*?-?[-a-z_0-9]+)\s*:/);
  38556. if (name) {return name[1];}
  38557. }
  38558. }
  38559. };
  38560. return parser;
  38561. }
  38562. /**
  38563. * @function SuperMap.CartoCSS.prototype.parse
  38564. * @description 利用CartoCSS解析器里面的parse方法,将CartoCSS样式表字符串转化为CartoCSS规则集
  38565. * @returns {Object} CartoCSS规则集
  38566. */
  38567. parse(str) {
  38568. var parser = this.parser;
  38569. var ruleSet = this.ruleSet = parser.parse(str);
  38570. return ruleSet;
  38571. }
  38572. /**
  38573. * @function SuperMap.CartoCSS.prototype.toShaders
  38574. * @description 将CartoCSS规则集转化为着色器
  38575. * @returns {Array} CartoCSS着色器集
  38576. */
  38577. toShaders() {
  38578. if (this.ruleSet) {
  38579. var ruleset = this.ruleSet;
  38580. if (ruleset) {
  38581. var defs = ruleset.toList(this.env);
  38582. defs.reverse();
  38583. var shaders = {};
  38584. var keys = [];
  38585. this._toShaders(shaders,keys,defs);
  38586. var ordered_shaders = [];
  38587. var done = {};
  38588. for (var i = 0, len0 = defs.length; i < len0; ++i) {
  38589. var def = defs[i];
  38590. var k = def.attachment;
  38591. var shader = shaders[keys[i]];
  38592. var shaderArray = [];
  38593. if (!done[k]) {
  38594. var j = 0;
  38595. for (var prop in shader) {
  38596. if (prop !== 'zoom' && prop !== 'frames' && prop !== "attachment" && prop != "elements") {
  38597. //对layer-index作特殊处理以实现图层的控制
  38598. if (prop === "layer-index") {
  38599. /*var getLayerIndex = Function("attributes", "zoom", "var _value = null;" + shader[prop].join('\n') + "; return _value; ");*/
  38600. var getLayerIndex = function (attributes, zoom) {//NOSONAR
  38601. var _value = null;
  38602. shader[prop].join('\n');
  38603. return _value;
  38604. };
  38605. var layerIndex = getLayerIndex();
  38606. Object.defineProperty(shaderArray, "layerIndex", {
  38607. configurable: true,
  38608. enumerable: false,
  38609. value: layerIndex
  38610. });
  38611. } else {
  38612. shaderArray[j++] = function (ops, shaderArray) {//NOSONAR
  38613. if (!Array.isArray(ops)) {
  38614. return ops;
  38615. }
  38616. var body = ops.join('\n');
  38617. var myKeyword = 'attributes["FEATUREID"]&&attributes["FEATUREID"]';
  38618. var index = body.indexOf(myKeyword);
  38619. if (index >= 0) {
  38620. //对featureID作一些特殊处理,以将featureID提取出来
  38621. if (!shaderArray.featureFilter) {
  38622. var featureFilterStart = index + myKeyword.length;
  38623. var featureFilterEnd = body.indexOf(")", featureFilterStart + 1);
  38624. var featureFilterStr = "featureId&&(featureId" + body.substring(featureFilterStart, featureFilterEnd) + ")";
  38625. /*var featureFilter = Function("featureId", "if(" + featureFilterStr + "){return true;}return false;");*/
  38626. var featureFilter = function (featureId) {
  38627. if (featureFilterStr) {
  38628. return true;
  38629. }
  38630. return false;
  38631. }
  38632. Object.defineProperty(shaderArray, "featureFilter", {
  38633. configurable: true,
  38634. enumerable: false,
  38635. value: featureFilter
  38636. });
  38637. }
  38638. return {
  38639. "property": prop,
  38640. "getValue": Function("attributes", "zoom", "seftFilter", "var _value = null; var isExcute=typeof seftFilter=='function'?sefgFilter():seftFilter;if(isExcute){" + body + ";} return _value; ")//NOSONAR
  38641. };
  38642. } else {
  38643. return {
  38644. "property": prop,
  38645. "getValue": Function("attributes", "zoom", "var _value = null;" + body + "; return _value; ")//NOSONAR
  38646. };
  38647. }
  38648. }(shader[prop], shaderArray);
  38649. }
  38650. }
  38651. }
  38652. Object.defineProperty(shaderArray, "attachment", {
  38653. configurable: true,
  38654. enumerable: false,
  38655. value: k
  38656. });
  38657. Object.defineProperty(shaderArray, "elements", {
  38658. configurable: true,
  38659. enumerable: false,
  38660. value: def.elements
  38661. });
  38662. ordered_shaders.push(shaderArray);
  38663. done[keys[i]] = true;
  38664. }
  38665. Object.defineProperty(shaderArray, "zoom", {
  38666. configurable: true,
  38667. enumerable: false,
  38668. value: def.zoom
  38669. });
  38670. //shader.frames.push(def.frame_offset);
  38671. }
  38672. return ordered_shaders;
  38673. }
  38674. }
  38675. return null;
  38676. }
  38677. _toShaders(shaders, keys,defs) {
  38678. for (let i = 0, len0 = defs.length; i < len0; ++i) {
  38679. let def = defs[i];
  38680. let element_str = [];
  38681. for (let j = 0, len1 = def.elements.length; j < len1; j++) {
  38682. element_str.push(def.elements[j]);
  38683. }
  38684. let filters = def.filters.filters;
  38685. let filterStr = [];
  38686. for (let attr in filters) {
  38687. filterStr.push(filters[attr].id);
  38688. }
  38689. let key = element_str.join("/") + "::" + def.attachment + "_" + filterStr.join("_");
  38690. keys.push(key);
  38691. let shader = shaders[key] = (shaders[key] || {});
  38692. //shader.frames = [];
  38693. shader.zoom = SuperMap.CartoCSS.Tree.Zoom.all;
  38694. let props = def.toJS(this.env);
  38695. for (let v in props) {
  38696. (shader[v] = (shader[v] || [])).push(props[v].join('\n'))
  38697. }
  38698. }
  38699. }
  38700. /**
  38701. * @function SuperMap.CartoCSS.prototype.getShaders
  38702. * @description 获取CartoCSS着色器
  38703. * @returns {Array} 着色器集
  38704. * @example
  38705. * //shaders的结构大概如下:
  38706. * var shaders=[
  38707. * {
  38708. * attachment:"one",
  38709. * elements:[],
  38710. * zoom:23,
  38711. * length:2,
  38712. * 0:{property:"line-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  38713. * 1:{preoperty:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  38714. * },
  38715. * {
  38716. * attachment:"two",
  38717. * elements:[],
  38718. * zoom:23,
  38719. * length:2,
  38720. * 0:{property:"polygon-color",value:function(attribute,zoom){var _value=null;if(zoom){_value="#123456"}return _vlaue;}},
  38721. * 1:{property:"line-width",value:function(attribute,zoom){var _value=null;if(zoom){_value=3}return _vlaue;}}
  38722. * }
  38723. * ];
  38724. */
  38725. getShaders() {
  38726. return this.shaders;
  38727. }
  38728. /**
  38729. * @function SuperMap.CartoCSS.prototype.destroy
  38730. * @description CartoCSS解析对象的析构函数,用于销毁CartoCSS解析对象
  38731. */
  38732. destroy() {
  38733. this.cartoStr = null;
  38734. this.env = null;
  38735. this.ruleSet = null;
  38736. this.parser = null;
  38737. this.shaders = null;
  38738. }
  38739. }
  38740. SuperMap._mapnik_reference_latest = {
  38741. "version": "2.1.1",
  38742. "style": {
  38743. "filter-mode": {
  38744. "type": [
  38745. "all",
  38746. "first"
  38747. ],
  38748. "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)",
  38749. "default-value": "all",
  38750. "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."
  38751. },
  38752. "image-filters": {
  38753. "css": "image-filters",
  38754. "default-value": "none",
  38755. "default-meaning": "no filters",
  38756. "type": "functions",
  38757. "functions": [
  38758. ["agg-stack-blur", 2],
  38759. ["emboss", 0],
  38760. ["blur", 0],
  38761. ["gray", 0],
  38762. ["sobel", 0],
  38763. ["edge-detect", 0],
  38764. ["x-gradient", 0],
  38765. ["y-gradient", 0],
  38766. ["invert", 0],
  38767. ["sharpen", 0]
  38768. ],
  38769. "doc": "A list of image filters."
  38770. },
  38771. "comp-op": {
  38772. "css": "comp-op",
  38773. "default-value": "src-over",
  38774. "default-meaning": "add the current layer on top of other layers",
  38775. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  38776. "type": ["clear",
  38777. "src",
  38778. "dst",
  38779. "src-over",
  38780. "dst-over",
  38781. "src-in",
  38782. "dst-in",
  38783. "src-out",
  38784. "dst-out",
  38785. "src-atop",
  38786. "dst-atop",
  38787. "xor",
  38788. "plus",
  38789. "minus",
  38790. "multiply",
  38791. "screen",
  38792. "overlay",
  38793. "darken",
  38794. "lighten",
  38795. "color-dodge",
  38796. "color-burn",
  38797. "hard-light",
  38798. "soft-light",
  38799. "difference",
  38800. "exclusion",
  38801. "contrast",
  38802. "invert",
  38803. "invert-rgb",
  38804. "grain-merge",
  38805. "grain-extract",
  38806. "hue",
  38807. "saturation",
  38808. "color",
  38809. "value"
  38810. ]
  38811. },
  38812. "opacity": {
  38813. "css": "opacity",
  38814. "type": "float",
  38815. "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)",
  38816. "default-value": 1,
  38817. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  38818. }
  38819. },
  38820. "layer": {
  38821. "name": {
  38822. "default-value": "",
  38823. "type": "string",
  38824. "required": true,
  38825. "default-meaning": "No layer name has been provided",
  38826. "doc": "The name of a layer. Can be anything you wish and is not strictly validated, but ideally unique in the map"
  38827. },
  38828. "srs": {
  38829. "default-value": "",
  38830. "type": "string",
  38831. "default-meaning": "No srs value is provided and the value will be inherited from the Map's srs",
  38832. "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'"
  38833. },
  38834. "status": {
  38835. "default-value": true,
  38836. "type": "boolean",
  38837. "default-meaning": "This layer will be marked as active and available for processing",
  38838. "doc": "A property that can be set to false to disable this layer from being processed"
  38839. },
  38840. "minzoom": {
  38841. "default-value": "0",
  38842. "type": "float",
  38843. "default-meaning": "The layer will be visible at the minimum possible scale",
  38844. "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"
  38845. },
  38846. "maxzoom": {
  38847. "default-value": "1.79769e+308",
  38848. "type": "float",
  38849. "default-meaning": "The layer will be visible at the maximum possible scale",
  38850. "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"
  38851. },
  38852. "queryable": {
  38853. "default-value": false,
  38854. "type": "boolean",
  38855. "default-meaning": "The layer will not be available for the direct querying of data values",
  38856. "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"
  38857. },
  38858. "clear-label-cache": {
  38859. "default-value": false,
  38860. "type": "boolean",
  38861. "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",
  38862. "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"
  38863. },
  38864. "group-by": {
  38865. "default-value": "",
  38866. "type": "string",
  38867. "default-meaning": "No special layer grouping will be used during rendering",
  38868. "doc": "https://github.com/mapnik/mapnik/wiki/Grouped-rendering"
  38869. },
  38870. "buffer-size": {
  38871. "default-value": "0",
  38872. "type": "float",
  38873. "default-meaning": "No buffer will be used",
  38874. "doc": "Extra tolerance around the Layer extent (in pixels) used to when querying and (potentially) clipping the layer data during rendering"
  38875. },
  38876. "maximum-extent": {
  38877. "default-value": "none",
  38878. "type": "bbox",
  38879. "default-meaning": "No clipping extent will be used",
  38880. "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."
  38881. }
  38882. },
  38883. "symbolizers": {
  38884. "*": {
  38885. "image-filters": {
  38886. "css": "image-filters",
  38887. "default-value": "none",
  38888. "default-meaning": "no filters",
  38889. "type": "functions",
  38890. "functions": [
  38891. ["agg-stack-blur", 2],
  38892. ["emboss", 0],
  38893. ["blur", 0],
  38894. ["gray", 0],
  38895. ["sobel", 0],
  38896. ["edge-detect", 0],
  38897. ["x-gradient", 0],
  38898. ["y-gradient", 0],
  38899. ["invert", 0],
  38900. ["sharpen", 0]
  38901. ],
  38902. "doc": "A list of image filters."
  38903. },
  38904. "comp-op": {
  38905. "css": "comp-op",
  38906. "default-value": "src-over",
  38907. "default-meaning": "add the current layer on top of other layers",
  38908. "doc": "Composite operation. This defines how this layer should behave relative to layers atop or below it.",
  38909. "type": ["clear",
  38910. "src",
  38911. "dst",
  38912. "src-over",
  38913. "dst-over",
  38914. "src-in",
  38915. "dst-in",
  38916. "src-out",
  38917. "dst-out",
  38918. "src-atop",
  38919. "dst-atop",
  38920. "xor",
  38921. "plus",
  38922. "minus",
  38923. "multiply",
  38924. "screen",
  38925. "overlay",
  38926. "darken",
  38927. "lighten",
  38928. "color-dodge",
  38929. "color-burn",
  38930. "hard-light",
  38931. "soft-light",
  38932. "difference",
  38933. "exclusion",
  38934. "contrast",
  38935. "invert",
  38936. "invert-rgb",
  38937. "grain-merge",
  38938. "grain-extract",
  38939. "hue",
  38940. "saturation",
  38941. "color",
  38942. "value"
  38943. ]
  38944. },
  38945. "opacity": {
  38946. "css": "opacity",
  38947. "type": "float",
  38948. "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)",
  38949. "default-value": 1,
  38950. "default-meaning": "no separate buffer will be used and no alpha will be applied to the style after rendering"
  38951. }
  38952. },
  38953. "map": {
  38954. "background-color": {
  38955. "css": "background-color",
  38956. "default-value": "none",
  38957. "default-meaning": "transparent",
  38958. "type": "color",
  38959. "doc": "Map Background color"
  38960. },
  38961. "background-image": {
  38962. "css": "background-image",
  38963. "type": "uri",
  38964. "default-value": "",
  38965. "default-meaning": "transparent",
  38966. "doc": "An image that is repeated below all features on a map as a background.",
  38967. "description": "Map Background image"
  38968. },
  38969. "srs": {
  38970. "css": "srs",
  38971. "type": "string",
  38972. "default-value": "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs",
  38973. "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",
  38974. "doc": "Map spatial reference (proj4 string)"
  38975. },
  38976. "buffer-size": {
  38977. "css": "buffer-size",
  38978. "default-value": "0",
  38979. "type": "float",
  38980. "default-meaning": "No buffer will be used",
  38981. "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\"."
  38982. },
  38983. "maximum-extent": {
  38984. "css": "",
  38985. "default-value": "none",
  38986. "type": "bbox",
  38987. "default-meaning": "No clipping extent will be used",
  38988. "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."
  38989. },
  38990. "base": {
  38991. "css": "base",
  38992. "default-value": "",
  38993. "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.",
  38994. "type": "string",
  38995. "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."
  38996. },
  38997. "paths-from-xml": {
  38998. "css": "",
  38999. "default-value": true,
  39000. "default-meaning": "Paths read from XML will be interpreted from the location of the XML",
  39001. "type": "boolean",
  39002. "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()"
  39003. },
  39004. "minimum-version": {
  39005. "css": "",
  39006. "default-value": "none",
  39007. "default-meaning": "Mapnik version will not be detected and no error will be thrown about compatibility",
  39008. "type": "string",
  39009. "doc": "The minumum Mapnik version (e.g. 0.7.2) needed to use certain functionality in the stylesheet"
  39010. },
  39011. "font-directory": {
  39012. "css": "font-directory",
  39013. "type": "uri",
  39014. "default-value": "none",
  39015. "default-meaning": "No map-specific fonts will be registered",
  39016. "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)."
  39017. }
  39018. },
  39019. "polygon": {
  39020. "fill": {
  39021. "css": "polygon-fill",
  39022. "type": "color",
  39023. "default-value": "rgba(128,128,128,1)",
  39024. "default-meaning": "gray and fully opaque (alpha = 1), same as rgb(128,128,128)",
  39025. "doc": "Fill color to assign to a polygon"
  39026. },
  39027. "fill-opacity": {
  39028. "css": "polygon-opacity",
  39029. "type": "float",
  39030. "doc": "The opacity of the polygon",
  39031. "default-value": 1,
  39032. "default-meaning": "opaque"
  39033. },
  39034. "gamma": {
  39035. "css": "polygon-gamma",
  39036. "type": "float",
  39037. "default-value": 1,
  39038. "default-meaning": "fully antialiased",
  39039. "range": "0-1",
  39040. "doc": "Level of antialiasing of polygon edges"
  39041. },
  39042. "gamma-method": {
  39043. "css": "polygon-gamma-method",
  39044. "type": [
  39045. "power",
  39046. "linear",
  39047. "none",
  39048. "threshold",
  39049. "multiply"
  39050. ],
  39051. "default-value": "power",
  39052. "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",
  39053. "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"
  39054. },
  39055. "clip": {
  39056. "css": "polygon-clip",
  39057. "type": "boolean",
  39058. "default-value": true,
  39059. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39060. "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."
  39061. },
  39062. "smooth": {
  39063. "css": "polygon-smooth",
  39064. "type": "float",
  39065. "default-value": 0,
  39066. "default-meaning": "no smoothing",
  39067. "range": "0-1",
  39068. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39069. },
  39070. "geometry-transform": {
  39071. "css": "polygon-geometry-transform",
  39072. "type": "functions",
  39073. "default-value": "none",
  39074. "default-meaning": "geometry will not be transformed",
  39075. "doc": "Allows transformation functions to be applied to the geometry.",
  39076. "functions": [
  39077. ["matrix", 6],
  39078. ["translate", 2],
  39079. ["scale", 2],
  39080. ["rotate", 3],
  39081. ["skewX", 1],
  39082. ["skewY", 1]
  39083. ]
  39084. },
  39085. "comp-op": {
  39086. "css": "polygon-comp-op",
  39087. "default-value": "src-over",
  39088. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39089. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39090. "type": ["clear",
  39091. "src",
  39092. "dst",
  39093. "src-over",
  39094. "dst-over",
  39095. "src-in",
  39096. "dst-in",
  39097. "src-out",
  39098. "dst-out",
  39099. "src-atop",
  39100. "dst-atop",
  39101. "xor",
  39102. "plus",
  39103. "minus",
  39104. "multiply",
  39105. "screen",
  39106. "overlay",
  39107. "darken",
  39108. "lighten",
  39109. "color-dodge",
  39110. "color-burn",
  39111. "hard-light",
  39112. "soft-light",
  39113. "difference",
  39114. "exclusion",
  39115. "contrast",
  39116. "invert",
  39117. "invert-rgb",
  39118. "grain-merge",
  39119. "grain-extract",
  39120. "hue",
  39121. "saturation",
  39122. "color",
  39123. "value"
  39124. ]
  39125. }
  39126. },
  39127. "line": {
  39128. "stroke": {
  39129. "css": "line-color",
  39130. "default-value": "rgba(0,0,0,1)",
  39131. "type": "color",
  39132. "default-meaning": "black and fully opaque (alpha = 1), same as rgb(0,0,0)",
  39133. "doc": "The color of a drawn line"
  39134. },
  39135. "stroke-width": {
  39136. "css": "line-width",
  39137. "default-value": 1,
  39138. "type": "float",
  39139. "doc": "The width of a line in pixels"
  39140. },
  39141. "stroke-opacity": {
  39142. "css": "line-opacity",
  39143. "default-value": 1,
  39144. "type": "float",
  39145. "default-meaning": "opaque",
  39146. "doc": "The opacity of a line"
  39147. },
  39148. "stroke-linejoin": {
  39149. "css": "line-join",
  39150. "default-value": "miter",
  39151. "type": [
  39152. "miter",
  39153. "round",
  39154. "bevel"
  39155. ],
  39156. "doc": "The behavior of lines when joining"
  39157. },
  39158. "stroke-linecap": {
  39159. "css": "line-cap",
  39160. "default-value": "butt",
  39161. "type": [
  39162. "butt",
  39163. "round",
  39164. "square"
  39165. ],
  39166. "doc": "The display of line endings"
  39167. },
  39168. "stroke-gamma": {
  39169. "css": "line-gamma",
  39170. "type": "float",
  39171. "default-value": 1,
  39172. "default-meaning": "fully antialiased",
  39173. "range": "0-1",
  39174. "doc": "Level of antialiasing of stroke line"
  39175. },
  39176. "stroke-gamma-method": {
  39177. "css": "line-gamma-method",
  39178. "type": [
  39179. "power",
  39180. "linear",
  39181. "none",
  39182. "threshold",
  39183. "multiply"
  39184. ],
  39185. "default-value": "power",
  39186. "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",
  39187. "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"
  39188. },
  39189. "stroke-dasharray": {
  39190. "css": "line-dasharray",
  39191. "type": "numbers",
  39192. "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.",
  39193. "default-value": "none",
  39194. "default-meaning": "solid line"
  39195. },
  39196. "stroke-dashoffset": {
  39197. "css": "line-dash-offset",
  39198. "type": "numbers",
  39199. "doc": "valid parameter but not currently used in renderers (only exists for experimental svg support in Mapnik which is not yet enabled)",
  39200. "default-value": "none",
  39201. "default-meaning": "solid line"
  39202. },
  39203. "stroke-miterlimit": {
  39204. "css": "line-miterlimit",
  39205. "type": "float",
  39206. "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.",
  39207. "default-value": 4.0,
  39208. "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 )'"
  39209. },
  39210. "clip": {
  39211. "css": "line-clip",
  39212. "type": "boolean",
  39213. "default-value": true,
  39214. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39215. "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."
  39216. },
  39217. "smooth": {
  39218. "css": "line-smooth",
  39219. "type": "float",
  39220. "default-value": 0,
  39221. "default-meaning": "no smoothing",
  39222. "range": "0-1",
  39223. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39224. },
  39225. "offset": {
  39226. "css": "line-offset",
  39227. "type": "float",
  39228. "default-value": 0,
  39229. "default-meaning": "no offset",
  39230. "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)."
  39231. },
  39232. "rasterizer": {
  39233. "css": "line-rasterizer",
  39234. "type": [
  39235. "full",
  39236. "fast"
  39237. ],
  39238. "default-value": "full",
  39239. "doc": "Exposes an alternate AGG rendering method that sacrifices some accuracy for speed."
  39240. },
  39241. "geometry-transform": {
  39242. "css": "line-geometry-transform",
  39243. "type": "functions",
  39244. "default-value": "none",
  39245. "default-meaning": "geometry will not be transformed",
  39246. "doc": "Allows transformation functions to be applied to the geometry.",
  39247. "functions": [
  39248. ["matrix", 6],
  39249. ["translate", 2],
  39250. ["scale", 2],
  39251. ["rotate", 3],
  39252. ["skewX", 1],
  39253. ["skewY", 1]
  39254. ]
  39255. },
  39256. "comp-op": {
  39257. "css": "line-comp-op",
  39258. "default-value": "src-over",
  39259. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39260. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39261. "type": ["clear",
  39262. "src",
  39263. "dst",
  39264. "src-over",
  39265. "dst-over",
  39266. "src-in",
  39267. "dst-in",
  39268. "src-out",
  39269. "dst-out",
  39270. "src-atop",
  39271. "dst-atop",
  39272. "xor",
  39273. "plus",
  39274. "minus",
  39275. "multiply",
  39276. "screen",
  39277. "overlay",
  39278. "darken",
  39279. "lighten",
  39280. "color-dodge",
  39281. "color-burn",
  39282. "hard-light",
  39283. "soft-light",
  39284. "difference",
  39285. "exclusion",
  39286. "contrast",
  39287. "invert",
  39288. "invert-rgb",
  39289. "grain-merge",
  39290. "grain-extract",
  39291. "hue",
  39292. "saturation",
  39293. "color",
  39294. "value"
  39295. ]
  39296. }
  39297. },
  39298. "markers": {
  39299. "file": {
  39300. "css": "marker-file",
  39301. "doc": "An SVG file that this marker shows at each placement. If no file is given, the marker will show an ellipse.",
  39302. "default-value": "",
  39303. "default-meaning": "An ellipse or circle, if width equals height",
  39304. "type": "uri"
  39305. },
  39306. "opacity": {
  39307. "css": "marker-opacity",
  39308. "doc": "The overall opacity of the marker, if set, overrides both the opacity of both the fill and stroke",
  39309. "default-value": 1,
  39310. "default-meaning": "The stroke-opacity and fill-opacity will be used",
  39311. "type": "float"
  39312. },
  39313. "fill-opacity": {
  39314. "css": "marker-fill-opacity",
  39315. "doc": "The fill opacity of the marker",
  39316. "default-value": 1,
  39317. "default-meaning": "opaque",
  39318. "type": "float"
  39319. },
  39320. "stroke": {
  39321. "css": "marker-line-color",
  39322. "doc": "The color of the stroke around a marker shape.",
  39323. "default-value": "black",
  39324. "type": "color"
  39325. },
  39326. "stroke-width": {
  39327. "css": "marker-line-width",
  39328. "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.",
  39329. "type": "float"
  39330. },
  39331. "stroke-opacity": {
  39332. "css": "marker-line-opacity",
  39333. "default-value": 1,
  39334. "default-meaning": "opaque",
  39335. "doc": "The opacity of a line",
  39336. "type": "float"
  39337. },
  39338. "placement": {
  39339. "css": "marker-placement",
  39340. "type": [
  39341. "point",
  39342. "line",
  39343. "interior"
  39344. ],
  39345. "default-value": "point",
  39346. "default-meaning": "Place markers at the center point (centroid) of the geometry",
  39347. "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"
  39348. },
  39349. "multi-policy": {
  39350. "css": "marker-multi-policy",
  39351. "type": [
  39352. "each",
  39353. "whole",
  39354. "largest"
  39355. ],
  39356. "default-value": "each",
  39357. "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",
  39358. "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)."
  39359. },
  39360. "marker-type": {
  39361. "css": "marker-type",
  39362. "type": [
  39363. "arrow",
  39364. "ellipse"
  39365. ],
  39366. "default-value": "ellipse",
  39367. "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)"
  39368. },
  39369. "width": {
  39370. "css": "marker-width",
  39371. "default-value": 10,
  39372. "doc": "The width of the marker, if using one of the default types.",
  39373. "type": "expression"
  39374. },
  39375. "height": {
  39376. "css": "marker-height",
  39377. "default-value": 10,
  39378. "doc": "The height of the marker, if using one of the default types.",
  39379. "type": "expression"
  39380. },
  39381. "fill": {
  39382. "css": "marker-fill",
  39383. "default-value": "blue",
  39384. "doc": "The color of the area of the marker.",
  39385. "type": "color"
  39386. },
  39387. "allow-overlap": {
  39388. "css": "marker-allow-overlap",
  39389. "type": "boolean",
  39390. "default-value": false,
  39391. "doc": "Control whether overlapping markers are shown or hidden.",
  39392. "default-meaning": "Do not allow makers to overlap with each other - overlapping markers will not be shown."
  39393. },
  39394. "ignore-placement": {
  39395. "css": "marker-ignore-placement",
  39396. "type": "boolean",
  39397. "default-value": false,
  39398. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  39399. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  39400. },
  39401. "spacing": {
  39402. "css": "marker-spacing",
  39403. "doc": "Space between repeated labels",
  39404. "default-value": 100,
  39405. "type": "float"
  39406. },
  39407. "max-error": {
  39408. "css": "marker-max-error",
  39409. "type": "float",
  39410. "default-value": 0.2,
  39411. "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."
  39412. },
  39413. "transform": {
  39414. "css": "marker-transform",
  39415. "type": "functions",
  39416. "functions": [
  39417. ["matrix", 6],
  39418. ["translate", 2],
  39419. ["scale", 2],
  39420. ["rotate", 3],
  39421. ["skewX", 1],
  39422. ["skewY", 1]
  39423. ],
  39424. "default-value": "",
  39425. "default-meaning": "No transformation",
  39426. "doc": "SVG transformation definition"
  39427. },
  39428. "clip": {
  39429. "css": "marker-clip",
  39430. "type": "boolean",
  39431. "default-value": true,
  39432. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39433. "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."
  39434. },
  39435. "smooth": {
  39436. "css": "marker-smooth",
  39437. "type": "float",
  39438. "default-value": 0,
  39439. "default-meaning": "no smoothing",
  39440. "range": "0-1",
  39441. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39442. },
  39443. "geometry-transform": {
  39444. "css": "marker-geometry-transform",
  39445. "type": "functions",
  39446. "default-value": "none",
  39447. "default-meaning": "geometry will not be transformed",
  39448. "doc": "Allows transformation functions to be applied to the geometry.",
  39449. "functions": [
  39450. ["matrix", 6],
  39451. ["translate", 2],
  39452. ["scale", 2],
  39453. ["rotate", 3],
  39454. ["skewX", 1],
  39455. ["skewY", 1]
  39456. ]
  39457. },
  39458. "comp-op": {
  39459. "css": "marker-comp-op",
  39460. "default-value": "src-over",
  39461. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39462. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39463. "type": ["clear",
  39464. "src",
  39465. "dst",
  39466. "src-over",
  39467. "dst-over",
  39468. "src-in",
  39469. "dst-in",
  39470. "src-out",
  39471. "dst-out",
  39472. "src-atop",
  39473. "dst-atop",
  39474. "xor",
  39475. "plus",
  39476. "minus",
  39477. "multiply",
  39478. "screen",
  39479. "overlay",
  39480. "darken",
  39481. "lighten",
  39482. "color-dodge",
  39483. "color-burn",
  39484. "hard-light",
  39485. "soft-light",
  39486. "difference",
  39487. "exclusion",
  39488. "contrast",
  39489. "invert",
  39490. "invert-rgb",
  39491. "grain-merge",
  39492. "grain-extract",
  39493. "hue",
  39494. "saturation",
  39495. "color",
  39496. "value"
  39497. ]
  39498. }
  39499. },
  39500. "shield": {
  39501. "name": {
  39502. "css": "shield-name",
  39503. "type": "expression",
  39504. "serialization": "content",
  39505. "doc": "Value to use for a shield\"s text label. Data columns are specified using brackets like [column_name]"
  39506. },
  39507. "file": {
  39508. "css": "shield-file",
  39509. "required": true,
  39510. "type": "uri",
  39511. "default-value": "none",
  39512. "doc": "Image file to render behind the shield text"
  39513. },
  39514. "face-name": {
  39515. "css": "shield-face-name",
  39516. "type": "string",
  39517. "validate": "font",
  39518. "doc": "Font name and style to use for the shield text",
  39519. "default-value": "",
  39520. "required": true
  39521. },
  39522. "unlock-image": {
  39523. "css": "shield-unlock-image",
  39524. "type": "boolean",
  39525. "doc": "This parameter should be set to true if you are trying to position text beside rather than on top of the shield image",
  39526. "default-value": false,
  39527. "default-meaning": "text alignment relative to the shield image uses the center of the image as the anchor for text positioning."
  39528. },
  39529. "size": {
  39530. "css": "shield-size",
  39531. "type": "float",
  39532. "doc": "The size of the shield text in pixels"
  39533. },
  39534. "fill": {
  39535. "css": "shield-fill",
  39536. "type": "color",
  39537. "doc": "The color of the shield text"
  39538. },
  39539. "placement": {
  39540. "css": "shield-placement",
  39541. "type": [
  39542. "point",
  39543. "line",
  39544. "vertex",
  39545. "interior"
  39546. ],
  39547. "default-value": "point",
  39548. "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."
  39549. },
  39550. "avoid-edges": {
  39551. "css": "shield-avoid-edges",
  39552. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  39553. "type": "boolean",
  39554. "default-value": false
  39555. },
  39556. "allow-overlap": {
  39557. "css": "shield-allow-overlap",
  39558. "type": "boolean",
  39559. "default-value": false,
  39560. "doc": "Control whether overlapping shields are shown or hidden.",
  39561. "default-meaning": "Do not allow shields to overlap with other map elements already placed."
  39562. },
  39563. "minimum-distance": {
  39564. "css": "shield-min-distance",
  39565. "type": "float",
  39566. "default-value": 0,
  39567. "doc": "Minimum distance to the next shield symbol, not necessarily the same shield."
  39568. },
  39569. "spacing": {
  39570. "css": "shield-spacing",
  39571. "type": "float",
  39572. "default-value": 0,
  39573. "doc": "The spacing between repeated occurrences of the same shield on a line"
  39574. },
  39575. "minimum-padding": {
  39576. "css": "shield-min-padding",
  39577. "default-value": 0,
  39578. "doc": "Determines the minimum amount of padding that a shield gets relative to other shields",
  39579. "type": "float"
  39580. },
  39581. "wrap-width": {
  39582. "css": "shield-wrap-width",
  39583. "type": "unsigned",
  39584. "default-value": 0,
  39585. "doc": "Length of a chunk of text in characters before wrapping text"
  39586. },
  39587. "wrap-before": {
  39588. "css": "shield-wrap-before",
  39589. "type": "boolean",
  39590. "default-value": false,
  39591. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  39592. },
  39593. "wrap-character": {
  39594. "css": "shield-wrap-character",
  39595. "type": "string",
  39596. "default-value": " ",
  39597. "doc": "Use this character instead of a space to wrap long names."
  39598. },
  39599. "halo-fill": {
  39600. "css": "shield-halo-fill",
  39601. "type": "color",
  39602. "default-value": "#FFFFFF",
  39603. "default-meaning": "white",
  39604. "doc": "Specifies the color of the halo around the text."
  39605. },
  39606. "halo-radius": {
  39607. "css": "shield-halo-radius",
  39608. "doc": "Specify the radius of the halo in pixels",
  39609. "default-value": 0,
  39610. "default-meaning": "no halo",
  39611. "type": "float"
  39612. },
  39613. "character-spacing": {
  39614. "css": "shield-character-spacing",
  39615. "type": "unsigned",
  39616. "default-value": 0,
  39617. "doc": "Horizontal spacing between characters (in pixels). Currently works for point placement only, not line placement."
  39618. },
  39619. "line-spacing": {
  39620. "css": "shield-line-spacing",
  39621. "doc": "Vertical spacing between lines of multiline labels (in pixels)",
  39622. "type": "unsigned"
  39623. },
  39624. "dx": {
  39625. "css": "shield-text-dx",
  39626. "type": "float",
  39627. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  39628. "default-value": 0
  39629. },
  39630. "dy": {
  39631. "css": "shield-text-dy",
  39632. "type": "float",
  39633. "doc": "Displace text within shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  39634. "default-value": 0
  39635. },
  39636. "shield-dx": {
  39637. "css": "shield-dx",
  39638. "type": "float",
  39639. "doc": "Displace shield by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  39640. "default-value": 0
  39641. },
  39642. "shield-dy": {
  39643. "css": "shield-dy",
  39644. "type": "float",
  39645. "doc": "Displace shield by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  39646. "default-value": 0
  39647. },
  39648. "opacity": {
  39649. "css": "shield-opacity",
  39650. "type": "float",
  39651. "doc": "(Default 1.0) - opacity of the image used for the shield",
  39652. "default-value": 1
  39653. },
  39654. "text-opacity": {
  39655. "css": "shield-text-opacity",
  39656. "type": "float",
  39657. "doc": "(Default 1.0) - opacity of the text placed on top of the shield",
  39658. "default-value": 1
  39659. },
  39660. "horizontal-alignment": {
  39661. "css": "shield-horizontal-alignment",
  39662. "type": [
  39663. "left",
  39664. "middle",
  39665. "right",
  39666. "auto"
  39667. ],
  39668. "doc": "The shield's horizontal alignment from its centerpoint",
  39669. "default-value": "auto"
  39670. },
  39671. "vertical-alignment": {
  39672. "css": "shield-vertical-alignment",
  39673. "type": [
  39674. "top",
  39675. "middle",
  39676. "bottom",
  39677. "auto"
  39678. ],
  39679. "doc": "The shield's vertical alignment from its centerpoint",
  39680. "default-value": "middle"
  39681. },
  39682. "text-transform": {
  39683. "css": "shield-text-transform",
  39684. "type": [
  39685. "none",
  39686. "uppercase",
  39687. "lowercase",
  39688. "capitalize"
  39689. ],
  39690. "doc": "Transform the case of the characters",
  39691. "default-value": "none"
  39692. },
  39693. "justify-alignment": {
  39694. "css": "shield-justify-alignment",
  39695. "type": [
  39696. "left",
  39697. "center",
  39698. "right",
  39699. "auto"
  39700. ],
  39701. "doc": "Define how text in a shield's label is justified",
  39702. "default-value": "auto"
  39703. },
  39704. "clip": {
  39705. "css": "shield-clip",
  39706. "type": "boolean",
  39707. "default-value": true,
  39708. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39709. "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."
  39710. },
  39711. "comp-op": {
  39712. "css": "shield-comp-op",
  39713. "default-value": "src-over",
  39714. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39715. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39716. "type": ["clear",
  39717. "src",
  39718. "dst",
  39719. "src-over",
  39720. "dst-over",
  39721. "src-in",
  39722. "dst-in",
  39723. "src-out",
  39724. "dst-out",
  39725. "src-atop",
  39726. "dst-atop",
  39727. "xor",
  39728. "plus",
  39729. "minus",
  39730. "multiply",
  39731. "screen",
  39732. "overlay",
  39733. "darken",
  39734. "lighten",
  39735. "color-dodge",
  39736. "color-burn",
  39737. "hard-light",
  39738. "soft-light",
  39739. "difference",
  39740. "exclusion",
  39741. "contrast",
  39742. "invert",
  39743. "invert-rgb",
  39744. "grain-merge",
  39745. "grain-extract",
  39746. "hue",
  39747. "saturation",
  39748. "color",
  39749. "value"
  39750. ]
  39751. }
  39752. },
  39753. "line-pattern": {
  39754. "file": {
  39755. "css": "line-pattern-file",
  39756. "type": "uri",
  39757. "default-value": "none",
  39758. "required": true,
  39759. "doc": "An image file to be repeated and warped along a line"
  39760. },
  39761. "clip": {
  39762. "css": "line-pattern-clip",
  39763. "type": "boolean",
  39764. "default-value": true,
  39765. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39766. "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."
  39767. },
  39768. "smooth": {
  39769. "css": "line-pattern-smooth",
  39770. "type": "float",
  39771. "default-value": 0,
  39772. "default-meaning": "no smoothing",
  39773. "range": "0-1",
  39774. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39775. },
  39776. "geometry-transform": {
  39777. "css": "line-pattern-geometry-transform",
  39778. "type": "functions",
  39779. "default-value": "none",
  39780. "default-meaning": "geometry will not be transformed",
  39781. "doc": "Allows transformation functions to be applied to the geometry.",
  39782. "functions": [
  39783. ["matrix", 6],
  39784. ["translate", 2],
  39785. ["scale", 2],
  39786. ["rotate", 3],
  39787. ["skewX", 1],
  39788. ["skewY", 1]
  39789. ]
  39790. },
  39791. "comp-op": {
  39792. "css": "line-pattern-comp-op",
  39793. "default-value": "src-over",
  39794. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39795. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39796. "type": ["clear",
  39797. "src",
  39798. "dst",
  39799. "src-over",
  39800. "dst-over",
  39801. "src-in",
  39802. "dst-in",
  39803. "src-out",
  39804. "dst-out",
  39805. "src-atop",
  39806. "dst-atop",
  39807. "xor",
  39808. "plus",
  39809. "minus",
  39810. "multiply",
  39811. "screen",
  39812. "overlay",
  39813. "darken",
  39814. "lighten",
  39815. "color-dodge",
  39816. "color-burn",
  39817. "hard-light",
  39818. "soft-light",
  39819. "difference",
  39820. "exclusion",
  39821. "contrast",
  39822. "invert",
  39823. "invert-rgb",
  39824. "grain-merge",
  39825. "grain-extract",
  39826. "hue",
  39827. "saturation",
  39828. "color",
  39829. "value"
  39830. ]
  39831. }
  39832. },
  39833. "polygon-pattern": {
  39834. "file": {
  39835. "css": "polygon-pattern-file",
  39836. "type": "uri",
  39837. "default-value": "none",
  39838. "required": true,
  39839. "doc": "Image to use as a repeated pattern fill within a polygon"
  39840. },
  39841. "alignment": {
  39842. "css": "polygon-pattern-alignment",
  39843. "type": [
  39844. "local",
  39845. "global"
  39846. ],
  39847. "default-value": "local",
  39848. "doc": "Specify whether to align pattern fills to the layer or to the map."
  39849. },
  39850. "gamma": {
  39851. "css": "polygon-pattern-gamma",
  39852. "type": "float",
  39853. "default-value": 1,
  39854. "default-meaning": "fully antialiased",
  39855. "range": "0-1",
  39856. "doc": "Level of antialiasing of polygon pattern edges"
  39857. },
  39858. "opacity": {
  39859. "css": "polygon-pattern-opacity",
  39860. "type": "float",
  39861. "doc": "(Default 1.0) - Apply an opacity level to the image used for the pattern",
  39862. "default-value": 1,
  39863. "default-meaning": "The image is rendered without modifications"
  39864. },
  39865. "clip": {
  39866. "css": "polygon-pattern-clip",
  39867. "type": "boolean",
  39868. "default-value": true,
  39869. "default-meaning": "geometry will be clipped to map bounds before rendering",
  39870. "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."
  39871. },
  39872. "smooth": {
  39873. "css": "polygon-pattern-smooth",
  39874. "type": "float",
  39875. "default-value": 0,
  39876. "default-meaning": "no smoothing",
  39877. "range": "0-1",
  39878. "doc": "Smooths out geometry angles. 0 is no smoothing, 1 is fully smoothed. Values greater than 1 will produce wild, looping geometries."
  39879. },
  39880. "geometry-transform": {
  39881. "css": "polygon-pattern-geometry-transform",
  39882. "type": "functions",
  39883. "default-value": "none",
  39884. "default-meaning": "geometry will not be transformed",
  39885. "doc": "Allows transformation functions to be applied to the geometry.",
  39886. "functions": [
  39887. ["matrix", 6],
  39888. ["translate", 2],
  39889. ["scale", 2],
  39890. ["rotate", 3],
  39891. ["skewX", 1],
  39892. ["skewY", 1]
  39893. ]
  39894. },
  39895. "comp-op": {
  39896. "css": "polygon-pattern-comp-op",
  39897. "default-value": "src-over",
  39898. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39899. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39900. "type": ["clear",
  39901. "src",
  39902. "dst",
  39903. "src-over",
  39904. "dst-over",
  39905. "src-in",
  39906. "dst-in",
  39907. "src-out",
  39908. "dst-out",
  39909. "src-atop",
  39910. "dst-atop",
  39911. "xor",
  39912. "plus",
  39913. "minus",
  39914. "multiply",
  39915. "screen",
  39916. "overlay",
  39917. "darken",
  39918. "lighten",
  39919. "color-dodge",
  39920. "color-burn",
  39921. "hard-light",
  39922. "soft-light",
  39923. "difference",
  39924. "exclusion",
  39925. "contrast",
  39926. "invert",
  39927. "invert-rgb",
  39928. "grain-merge",
  39929. "grain-extract",
  39930. "hue",
  39931. "saturation",
  39932. "color",
  39933. "value"
  39934. ]
  39935. }
  39936. },
  39937. "raster": {
  39938. "opacity": {
  39939. "css": "raster-opacity",
  39940. "default-value": 1,
  39941. "default-meaning": "opaque",
  39942. "type": "float",
  39943. "doc": "The opacity of the raster symbolizer on top of other symbolizers."
  39944. },
  39945. "filter-factor": {
  39946. "css": "raster-filter-factor",
  39947. "default-value": -1,
  39948. "default-meaning": "Allow the datasource to choose appropriate downscaling.",
  39949. "type": "float",
  39950. "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."
  39951. },
  39952. "scaling": {
  39953. "css": "raster-scaling",
  39954. "type": [
  39955. "near",
  39956. "fast",
  39957. "bilinear",
  39958. "bilinear8",
  39959. "bicubic",
  39960. "spline16",
  39961. "spline36",
  39962. "hanning",
  39963. "hamming",
  39964. "hermite",
  39965. "kaiser",
  39966. "quadric",
  39967. "catrom",
  39968. "gaussian",
  39969. "bessel",
  39970. "mitchell",
  39971. "sinc",
  39972. "lanczos",
  39973. "blackman"
  39974. ],
  39975. "default-value": "near",
  39976. "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."
  39977. },
  39978. "mesh-size": {
  39979. "css": "raster-mesh-size",
  39980. "default-value": 16,
  39981. "default-meaning": "Reprojection mesh will be 1/16 of the resolution of the source image",
  39982. "type": "unsigned",
  39983. "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."
  39984. },
  39985. "comp-op": {
  39986. "css": "raster-comp-op",
  39987. "default-value": "src-over",
  39988. "default-meaning": "add the current symbolizer on top of other symbolizer",
  39989. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  39990. "type": ["clear",
  39991. "src",
  39992. "dst",
  39993. "src-over",
  39994. "dst-over",
  39995. "src-in",
  39996. "dst-in",
  39997. "src-out",
  39998. "dst-out",
  39999. "src-atop",
  40000. "dst-atop",
  40001. "xor",
  40002. "plus",
  40003. "minus",
  40004. "multiply",
  40005. "screen",
  40006. "overlay",
  40007. "darken",
  40008. "lighten",
  40009. "color-dodge",
  40010. "color-burn",
  40011. "hard-light",
  40012. "soft-light",
  40013. "difference",
  40014. "exclusion",
  40015. "contrast",
  40016. "invert",
  40017. "invert-rgb",
  40018. "grain-merge",
  40019. "grain-extract",
  40020. "hue",
  40021. "saturation",
  40022. "color",
  40023. "value"
  40024. ]
  40025. }
  40026. },
  40027. "point": {
  40028. "file": {
  40029. "css": "point-file",
  40030. "type": "uri",
  40031. "required": false,
  40032. "default-value": "none",
  40033. "doc": "Image file to represent a point"
  40034. },
  40035. "allow-overlap": {
  40036. "css": "point-allow-overlap",
  40037. "type": "boolean",
  40038. "default-value": false,
  40039. "doc": "Control whether overlapping points are shown or hidden.",
  40040. "default-meaning": "Do not allow points to overlap with each other - overlapping markers will not be shown."
  40041. },
  40042. "ignore-placement": {
  40043. "css": "point-ignore-placement",
  40044. "type": "boolean",
  40045. "default-value": false,
  40046. "default-meaning": "do not store the bbox of this geometry in the collision detector cache",
  40047. "doc": "value to control whether the placement of the feature will prevent the placement of other features"
  40048. },
  40049. "opacity": {
  40050. "css": "point-opacity",
  40051. "type": "float",
  40052. "default-value": 1.0,
  40053. "default-meaning": "Fully opaque",
  40054. "doc": "A value from 0 to 1 to control the opacity of the point"
  40055. },
  40056. "placement": {
  40057. "css": "point-placement",
  40058. "type": [
  40059. "centroid",
  40060. "interior"
  40061. ],
  40062. "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.",
  40063. "default-value": "centroid"
  40064. },
  40065. "transform": {
  40066. "css": "point-transform",
  40067. "type": "functions",
  40068. "functions": [
  40069. ["matrix", 6],
  40070. ["translate", 2],
  40071. ["scale", 2],
  40072. ["rotate", 3],
  40073. ["skewX", 1],
  40074. ["skewY", 1]
  40075. ],
  40076. "default-value": "",
  40077. "default-meaning": "No transformation",
  40078. "doc": "SVG transformation definition"
  40079. },
  40080. "comp-op": {
  40081. "css": "point-comp-op",
  40082. "default-value": "src-over",
  40083. "default-meaning": "add the current symbolizer on top of other symbolizer",
  40084. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  40085. "type": ["clear",
  40086. "src",
  40087. "dst",
  40088. "src-over",
  40089. "dst-over",
  40090. "src-in",
  40091. "dst-in",
  40092. "src-out",
  40093. "dst-out",
  40094. "src-atop",
  40095. "dst-atop",
  40096. "xor",
  40097. "plus",
  40098. "minus",
  40099. "multiply",
  40100. "screen",
  40101. "overlay",
  40102. "darken",
  40103. "lighten",
  40104. "color-dodge",
  40105. "color-burn",
  40106. "hard-light",
  40107. "soft-light",
  40108. "difference",
  40109. "exclusion",
  40110. "contrast",
  40111. "invert",
  40112. "invert-rgb",
  40113. "grain-merge",
  40114. "grain-extract",
  40115. "hue",
  40116. "saturation",
  40117. "color",
  40118. "value"
  40119. ]
  40120. }
  40121. },
  40122. "text": {
  40123. "name": {
  40124. "css": "text-name",
  40125. "type": "expression",
  40126. "required": true,
  40127. "default-value": "",
  40128. "serialization": "content",
  40129. "doc": "Value to use for a text label. Data columns are specified using brackets like [column_name]"
  40130. },
  40131. "face-name": {
  40132. "css": "text-face-name",
  40133. "type": "string",
  40134. "validate": "font",
  40135. "doc": "Font name and style to render a label in",
  40136. "required": true
  40137. },
  40138. "size": {
  40139. "css": "text-size",
  40140. "type": "float",
  40141. "default-value": 10,
  40142. "doc": "Text size in pixels"
  40143. },
  40144. "text-ratio": {
  40145. "css": "text-ratio",
  40146. "doc": "Define the amount of text (of the total) present on successive lines when wrapping occurs",
  40147. "default-value": 0,
  40148. "type": "unsigned"
  40149. },
  40150. "wrap-width": {
  40151. "css": "text-wrap-width",
  40152. "doc": "Length of a chunk of text in characters before wrapping text",
  40153. "default-value": 0,
  40154. "type": "unsigned"
  40155. },
  40156. "wrap-before": {
  40157. "css": "text-wrap-before",
  40158. "type": "boolean",
  40159. "default-value": false,
  40160. "doc": "Wrap text before wrap-width is reached. If false, wrapped lines will be a bit longer than wrap-width."
  40161. },
  40162. "wrap-character": {
  40163. "css": "text-wrap-character",
  40164. "type": "string",
  40165. "default-value": " ",
  40166. "doc": "Use this character instead of a space to wrap long text."
  40167. },
  40168. "spacing": {
  40169. "css": "text-spacing",
  40170. "type": "unsigned",
  40171. "doc": "Distance between repeated text labels on a line (aka. label-spacing)"
  40172. },
  40173. "character-spacing": {
  40174. "css": "text-character-spacing",
  40175. "type": "float",
  40176. "default-value": 0,
  40177. "doc": "Horizontal spacing adjustment between characters in pixels"
  40178. },
  40179. "line-spacing": {
  40180. "css": "text-line-spacing",
  40181. "default-value": 0,
  40182. "type": "unsigned",
  40183. "doc": "Vertical spacing adjustment between lines in pixels"
  40184. },
  40185. "label-position-tolerance": {
  40186. "css": "text-label-position-tolerance",
  40187. "default-value": 0,
  40188. "type": "unsigned",
  40189. "doc": "Allows the label to be displaced from its ideal position by a number of pixels (only works with placement:line)"
  40190. },
  40191. "max-char-angle-delta": {
  40192. "css": "text-max-char-angle-delta",
  40193. "type": "float",
  40194. "default-value": "22.5",
  40195. "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."
  40196. },
  40197. "fill": {
  40198. "css": "text-fill",
  40199. "doc": "Specifies the color for the text",
  40200. "default-value": "#000000",
  40201. "type": "color"
  40202. },
  40203. "opacity": {
  40204. "css": "text-opacity",
  40205. "doc": "A number from 0 to 1 specifying the opacity for the text",
  40206. "default-value": 1.0,
  40207. "default-meaning": "Fully opaque",
  40208. "type": "float"
  40209. },
  40210. "halo-fill": {
  40211. "css": "text-halo-fill",
  40212. "type": "color",
  40213. "default-value": "#FFFFFF",
  40214. "default-meaning": "white",
  40215. "doc": "Specifies the color of the halo around the text."
  40216. },
  40217. "halo-radius": {
  40218. "css": "text-halo-radius",
  40219. "doc": "Specify the radius of the halo in pixels",
  40220. "default-value": 0,
  40221. "default-meaning": "no halo",
  40222. "type": "float"
  40223. },
  40224. "dx": {
  40225. "css": "text-dx",
  40226. "type": "float",
  40227. "doc": "Displace text by fixed amount, in pixels, +/- along the X axis. A positive value will shift the text right",
  40228. "default-value": 0
  40229. },
  40230. "dy": {
  40231. "css": "text-dy",
  40232. "type": "float",
  40233. "doc": "Displace text by fixed amount, in pixels, +/- along the Y axis. A positive value will shift the text down",
  40234. "default-value": 0
  40235. },
  40236. "vertical-alignment": {
  40237. "css": "text-vertical-alignment",
  40238. "type": [
  40239. "top",
  40240. "middle",
  40241. "bottom",
  40242. "auto"
  40243. ],
  40244. "doc": "Position of label relative to point position.",
  40245. "default-value": "auto",
  40246. "default-meaning": "Default affected by value of dy; \"bottom\" for dy>0, \"top\" for dy<0."
  40247. },
  40248. "avoid-edges": {
  40249. "css": "text-avoid-edges",
  40250. "doc": "Tell positioning algorithm to avoid labeling near intersection edges.",
  40251. "default-value": false,
  40252. "type": "boolean"
  40253. },
  40254. "minimum-distance": {
  40255. "css": "text-min-distance",
  40256. "doc": "Minimum permitted distance to the next text symbolizer.",
  40257. "type": "float"
  40258. },
  40259. "minimum-padding": {
  40260. "css": "text-min-padding",
  40261. "doc": "Determines the minimum amount of padding that a text symbolizer gets relative to other text",
  40262. "type": "float"
  40263. },
  40264. "minimum-path-length": {
  40265. "css": "text-min-path-length",
  40266. "type": "float",
  40267. "default-value": 0,
  40268. "default-meaning": "place labels on all paths",
  40269. "doc": "Place labels only on paths longer than this value."
  40270. },
  40271. "allow-overlap": {
  40272. "css": "text-allow-overlap",
  40273. "type": "boolean",
  40274. "default-value": false,
  40275. "doc": "Control whether overlapping text is shown or hidden.",
  40276. "default-meaning": "Do not allow text to overlap with other text - overlapping markers will not be shown."
  40277. },
  40278. "orientation": {
  40279. "css": "text-orientation",
  40280. "type": "expression",
  40281. "doc": "Rotate the text."
  40282. },
  40283. "placement": {
  40284. "css": "text-placement",
  40285. "type": [
  40286. "point",
  40287. "line",
  40288. "vertex",
  40289. "interior"
  40290. ],
  40291. "default-value": "point",
  40292. "doc": "Control the style of placement of a point versus the geometry it is attached to."
  40293. },
  40294. "placement-type": {
  40295. "css": "text-placement-type",
  40296. "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.",
  40297. "type": [
  40298. "dummy",
  40299. "simple"
  40300. ],
  40301. "default-value": "dummy"
  40302. },
  40303. "placements": {
  40304. "css": "text-placements",
  40305. "type": "string",
  40306. "default-value": "",
  40307. "doc": "If \"placement-type\" is set to \"simple\", use this \"POSITIONS,[SIZES]\" string. An example is `text-placements: \"E,NE,SE,W,NW,SW\";` "
  40308. },
  40309. "text-transform": {
  40310. "css": "text-transform",
  40311. "type": [
  40312. "none",
  40313. "uppercase",
  40314. "lowercase",
  40315. "capitalize"
  40316. ],
  40317. "doc": "Transform the case of the characters",
  40318. "default-value": "none"
  40319. },
  40320. "horizontal-alignment": {
  40321. "css": "text-horizontal-alignment",
  40322. "type": [
  40323. "left",
  40324. "middle",
  40325. "right",
  40326. "auto"
  40327. ],
  40328. "doc": "The text's horizontal alignment from its centerpoint",
  40329. "default-value": "auto"
  40330. },
  40331. "justify-alignment": {
  40332. "css": "text-align",
  40333. "type": [
  40334. "left",
  40335. "right",
  40336. "center",
  40337. "auto"
  40338. ],
  40339. "doc": "Define how text is justified",
  40340. "default-value": "auto",
  40341. "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"
  40342. },
  40343. "clip": {
  40344. "css": "text-clip",
  40345. "type": "boolean",
  40346. "default-value": true,
  40347. "default-meaning": "geometry will be clipped to map bounds before rendering",
  40348. "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."
  40349. },
  40350. "comp-op": {
  40351. "css": "text-comp-op",
  40352. "default-value": "src-over",
  40353. "default-meaning": "add the current symbolizer on top of other symbolizer",
  40354. "doc": "Composite operation. This defines how this symbolizer should behave relative to symbolizers atop or below it.",
  40355. "type": ["clear",
  40356. "src",
  40357. "dst",
  40358. "src-over",
  40359. "dst-over",
  40360. "src-in",
  40361. "dst-in",
  40362. "src-out",
  40363. "dst-out",
  40364. "src-atop",
  40365. "dst-atop",
  40366. "xor",
  40367. "plus",
  40368. "minus",
  40369. "multiply",
  40370. "screen",
  40371. "overlay",
  40372. "darken",
  40373. "lighten",
  40374. "color-dodge",
  40375. "color-burn",
  40376. "hard-light",
  40377. "soft-light",
  40378. "difference",
  40379. "exclusion",
  40380. "contrast",
  40381. "invert",
  40382. "invert-rgb",
  40383. "grain-merge",
  40384. "grain-extract",
  40385. "hue",
  40386. "saturation",
  40387. "color",
  40388. "value"
  40389. ]
  40390. }
  40391. },
  40392. "building": {
  40393. "fill": {
  40394. "css": "building-fill",
  40395. "default-value": "#FFFFFF",
  40396. "doc": "The color of the buildings walls.",
  40397. "type": "color"
  40398. },
  40399. "fill-opacity": {
  40400. "css": "building-fill-opacity",
  40401. "type": "float",
  40402. "doc": "The opacity of the building as a whole, including all walls.",
  40403. "default-value": 1
  40404. },
  40405. "height": {
  40406. "css": "building-height",
  40407. "doc": "The height of the building in pixels.",
  40408. "type": "expression",
  40409. "default-value": "0"
  40410. }
  40411. }
  40412. },
  40413. "colors": {
  40414. "aliceblue": [240, 248, 255],
  40415. "antiquewhite": [250, 235, 215],
  40416. "aqua": [0, 255, 255],
  40417. "aquamarine": [127, 255, 212],
  40418. "azure": [240, 255, 255],
  40419. "beige": [245, 245, 220],
  40420. "bisque": [255, 228, 196],
  40421. "black": [0, 0, 0],
  40422. "blanchedalmond": [255, 235, 205],
  40423. "blue": [0, 0, 255],
  40424. "blueviolet": [138, 43, 226],
  40425. "brown": [165, 42, 42],
  40426. "burlywood": [222, 184, 135],
  40427. "cadetblue": [95, 158, 160],
  40428. "chartreuse": [127, 255, 0],
  40429. "chocolate": [210, 105, 30],
  40430. "coral": [255, 127, 80],
  40431. "cornflowerblue": [100, 149, 237],
  40432. "cornsilk": [255, 248, 220],
  40433. "crimson": [220, 20, 60],
  40434. "cyan": [0, 255, 255],
  40435. "darkblue": [0, 0, 139],
  40436. "darkcyan": [0, 139, 139],
  40437. "darkgoldenrod": [184, 134, 11],
  40438. "darkgray": [169, 169, 169],
  40439. "darkgreen": [0, 100, 0],
  40440. "darkgrey": [169, 169, 169],
  40441. "darkkhaki": [189, 183, 107],
  40442. "darkmagenta": [139, 0, 139],
  40443. "darkolivegreen": [85, 107, 47],
  40444. "darkorange": [255, 140, 0],
  40445. "darkorchid": [153, 50, 204],
  40446. "darkred": [139, 0, 0],
  40447. "darksalmon": [233, 150, 122],
  40448. "darkseagreen": [143, 188, 143],
  40449. "darkslateblue": [72, 61, 139],
  40450. "darkslategrey": [47, 79, 79],
  40451. "darkturquoise": [0, 206, 209],
  40452. "darkviolet": [148, 0, 211],
  40453. "deeppink": [255, 20, 147],
  40454. "deepskyblue": [0, 191, 255],
  40455. "dimgray": [105, 105, 105],
  40456. "dimgrey": [105, 105, 105],
  40457. "dodgerblue": [30, 144, 255],
  40458. "firebrick": [178, 34, 34],
  40459. "floralwhite": [255, 250, 240],
  40460. "forestgreen": [34, 139, 34],
  40461. "fuchsia": [255, 0, 255],
  40462. "gainsboro": [220, 220, 220],
  40463. "ghostwhite": [248, 248, 255],
  40464. "gold": [255, 215, 0],
  40465. "goldenrod": [218, 165, 32],
  40466. "gray": [128, 128, 128],
  40467. "grey": [128, 128, 128],
  40468. "green": [0, 128, 0],
  40469. "greenyellow": [173, 255, 47],
  40470. "honeydew": [240, 255, 240],
  40471. "hotpink": [255, 105, 180],
  40472. "indianred": [205, 92, 92],
  40473. "indigo": [75, 0, 130],
  40474. "ivory": [255, 255, 240],
  40475. "khaki": [240, 230, 140],
  40476. "lavender": [230, 230, 250],
  40477. "lavenderblush": [255, 240, 245],
  40478. "lawngreen": [124, 252, 0],
  40479. "lemonchiffon": [255, 250, 205],
  40480. "lightblue": [173, 216, 230],
  40481. "lightcoral": [240, 128, 128],
  40482. "lightcyan": [224, 255, 255],
  40483. "lightgoldenrodyellow": [250, 250, 210],
  40484. "lightgray": [211, 211, 211],
  40485. "lightgreen": [144, 238, 144],
  40486. "lightgrey": [211, 211, 211],
  40487. "lightpink": [255, 182, 193],
  40488. "lightsalmon": [255, 160, 122],
  40489. "lightseagreen": [32, 178, 170],
  40490. "lightskyblue": [135, 206, 250],
  40491. "lightslategray": [119, 136, 153],
  40492. "lightslategrey": [119, 136, 153],
  40493. "lightsteelblue": [176, 196, 222],
  40494. "lightyellow": [255, 255, 224],
  40495. "lime": [0, 255, 0],
  40496. "limegreen": [50, 205, 50],
  40497. "linen": [250, 240, 230],
  40498. "magenta": [255, 0, 255],
  40499. "maroon": [128, 0, 0],
  40500. "mediumaquamarine": [102, 205, 170],
  40501. "mediumblue": [0, 0, 205],
  40502. "mediumorchid": [186, 85, 211],
  40503. "mediumpurple": [147, 112, 219],
  40504. "mediumseagreen": [60, 179, 113],
  40505. "mediumslateblue": [123, 104, 238],
  40506. "mediumspringgreen": [0, 250, 154],
  40507. "mediumturquoise": [72, 209, 204],
  40508. "mediumvioletred": [199, 21, 133],
  40509. "midnightblue": [25, 25, 112],
  40510. "mintcream": [245, 255, 250],
  40511. "mistyrose": [255, 228, 225],
  40512. "moccasin": [255, 228, 181],
  40513. "navajowhite": [255, 222, 173],
  40514. "navy": [0, 0, 128],
  40515. "oldlace": [253, 245, 230],
  40516. "olive": [128, 128, 0],
  40517. "olivedrab": [107, 142, 35],
  40518. "orange": [255, 165, 0],
  40519. "orangered": [255, 69, 0],
  40520. "orchid": [218, 112, 214],
  40521. "palegoldenrod": [238, 232, 170],
  40522. "palegreen": [152, 251, 152],
  40523. "paleturquoise": [175, 238, 238],
  40524. "palevioletred": [219, 112, 147],
  40525. "papayawhip": [255, 239, 213],
  40526. "peachpuff": [255, 218, 185],
  40527. "peru": [205, 133, 63],
  40528. "pink": [255, 192, 203],
  40529. "plum": [221, 160, 221],
  40530. "powderblue": [176, 224, 230],
  40531. "purple": [128, 0, 128],
  40532. "red": [255, 0, 0],
  40533. "rosybrown": [188, 143, 143],
  40534. "royalblue": [65, 105, 225],
  40535. "saddlebrown": [139, 69, 19],
  40536. "salmon": [250, 128, 114],
  40537. "sandybrown": [244, 164, 96],
  40538. "seagreen": [46, 139, 87],
  40539. "seashell": [255, 245, 238],
  40540. "sienna": [160, 82, 45],
  40541. "silver": [192, 192, 192],
  40542. "skyblue": [135, 206, 235],
  40543. "slateblue": [106, 90, 205],
  40544. "slategray": [112, 128, 144],
  40545. "slategrey": [112, 128, 144],
  40546. "snow": [255, 250, 250],
  40547. "springgreen": [0, 255, 127],
  40548. "steelblue": [70, 130, 180],
  40549. "tan": [210, 180, 140],
  40550. "teal": [0, 128, 128],
  40551. "thistle": [216, 191, 216],
  40552. "tomato": [255, 99, 71],
  40553. "turquoise": [64, 224, 208],
  40554. "violet": [238, 130, 238],
  40555. "wheat": [245, 222, 179],
  40556. "white": [255, 255, 255],
  40557. "whitesmoke": [245, 245, 245],
  40558. "yellow": [255, 255, 0],
  40559. "yellowgreen": [154, 205, 50],
  40560. "transparent": [0, 0, 0, 0]
  40561. },
  40562. "filter": {
  40563. "value": [
  40564. "true",
  40565. "false",
  40566. "null",
  40567. "point",
  40568. "linestring",
  40569. "polygon",
  40570. "collection"
  40571. ]
  40572. }
  40573. };
  40574. CartoCSS['mapnik_reference'] = {
  40575. version: {
  40576. latest: SuperMap._mapnik_reference_latest,
  40577. '2.1.1': SuperMap._mapnik_reference_latest
  40578. }
  40579. };
  40580. SuperMap.CartoCSS = CartoCSS;
  40581. SuperMap.CartoCSS.Tree = {};
  40582. SuperMap.CartoCSS.Tree.operate = function(op, a, b) {
  40583. switch (op) {
  40584. case '+': return a + b;
  40585. case '-': return a - b;
  40586. case '*': return a * b;
  40587. case '%': return a % b;
  40588. case '/': return a / b;
  40589. }
  40590. };
  40591. SuperMap.CartoCSS.Tree.functions = {
  40592. rgb: function (r, g, b) {
  40593. return this.rgba(r, g, b, 1.0);
  40594. },
  40595. rgba: function (r, g, b, a) {
  40596. var me = this;
  40597. var rgb = [r, g, b].map(function (c) {
  40598. return me.number(c);
  40599. });
  40600. a = me.number(a);
  40601. if (rgb.some(isNaN) || isNaN(a)) {return null;}
  40602. return new SuperMap.CartoCSS.Tree.Color(rgb, a);
  40603. },
  40604. // Only require val
  40605. stop: function (val) {
  40606. var color, mode;
  40607. if (arguments.length > 1) {color = arguments[1];}
  40608. if (arguments.length > 2) {mode = arguments[2];}
  40609. return {
  40610. is: 'tag',
  40611. val: val,
  40612. color: color,
  40613. mode: mode,
  40614. toString(env) {
  40615. return '\n\t<stop value="' + val.ev(env) + '"' +
  40616. (color ? ' color="' + color.ev(env) + '" ' : '') +
  40617. (mode ? ' mode="' + mode.ev(env) + '" ' : '') +
  40618. '/>';
  40619. }
  40620. };
  40621. },
  40622. hsl: function (h, s, l) {
  40623. return this.hsla(h, s, l, 1.0);
  40624. },
  40625. hsla: function (h, s, l, a) {
  40626. h = (this.number(h) % 360) / 360;
  40627. s = this.number(s);
  40628. l = this.number(l);
  40629. a = this.number(a);
  40630. if ([h, s, l, a].some(isNaN)) {return null;}
  40631. var m2 = l <= 0.5 ? l * (s + 1) : l + s - l * s,
  40632. m1 = l * 2 - m2;
  40633. return this.rgba(hue(h + 1 / 3) * 255,
  40634. hue(h) * 255,
  40635. hue(h - 1 / 3) * 255,
  40636. a);
  40637. function hue(h) {
  40638. h = h < 0 ? h + 1 : (h > 1 ? h - 1 : h);
  40639. 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;}
  40640. }
  40641. },
  40642. hue: function (color) {
  40643. if (!('toHSL' in color)) {return null;}
  40644. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().h));
  40645. },
  40646. saturation: function (color) {
  40647. if (!('toHSL' in color)) {return null;}
  40648. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().s * 100), '%');
  40649. },
  40650. lightness: function (color) {
  40651. if (!('toHSL' in color)) {return null;}
  40652. return new SuperMap.CartoCSS.Tree.Dimension(Math.round(color.toHSL().l * 100), '%');
  40653. },
  40654. alpha: function (color) {
  40655. if (!('toHSL' in color)) {return null;}
  40656. return new SuperMap.CartoCSS.Tree.Dimension(color.toHSL().a);
  40657. },
  40658. saturate: function (color, amount) {
  40659. if (!('toHSL' in color)) {return null;}
  40660. var hsl = color.toHSL();
  40661. hsl.s += amount.value / 100;
  40662. hsl.s = this.clamp(hsl.s);
  40663. return this.hsla_simple(hsl);
  40664. },
  40665. desaturate: function (color, amount) {
  40666. if (!('toHSL' in color)) {return null;}
  40667. var hsl = color.toHSL();
  40668. hsl.s -= amount.value / 100;
  40669. hsl.s = this.clamp(hsl.s);
  40670. return this.hsla_simple(hsl);
  40671. },
  40672. lighten: function (color, amount) {
  40673. if (!('toHSL' in color)) {return null;}
  40674. var hsl = color.toHSL();
  40675. hsl.l += amount.value / 100;
  40676. hsl.l = this.clamp(hsl.l);
  40677. return this.hsla_simple(hsl);
  40678. },
  40679. darken: function (color, amount) {
  40680. if (!('toHSL' in color)) {return null;}
  40681. var hsl = color.toHSL();
  40682. hsl.l -= amount.value / 100;
  40683. hsl.l = this.clamp(hsl.l);
  40684. return this.hsla_simple(hsl);
  40685. },
  40686. fadein: function (color, amount) {
  40687. if (!('toHSL' in color)) {return null;}
  40688. var hsl = color.toHSL();
  40689. hsl.a += amount.value / 100;
  40690. hsl.a = this.clamp(hsl.a);
  40691. return this.hsla_simple(hsl);
  40692. },
  40693. fadeout: function (color, amount) {
  40694. if (!('toHSL' in color)) {return null;}
  40695. var hsl = color.toHSL();
  40696. hsl.a -= amount.value / 100;
  40697. hsl.a = this.clamp(hsl.a);
  40698. return this.hsla_simple(hsl);
  40699. },
  40700. spin: function (color, amount) {
  40701. if (!('toHSL' in color)) {return null;}
  40702. var hsl = color.toHSL();
  40703. var hue = (hsl.h + amount.value) % 360;
  40704. hsl.h = hue < 0 ? 360 + hue : hue;
  40705. return this.hsla_simple(hsl);
  40706. },
  40707. replace: function (entity, a, b) {
  40708. if (entity.is === 'field') {
  40709. return entity.toString + '.replace(' + a.toString() + ', ' + b.toString() + ')';
  40710. } else {
  40711. return entity.replace(a, b);
  40712. }
  40713. },
  40714. //
  40715. // Copyright (c) 2006-2009 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein
  40716. // http://sass-lang.com
  40717. //
  40718. mix: function (color1, color2, weight) {
  40719. var p = weight.value / 100.0;
  40720. var w = p * 2 - 1;
  40721. var a = color1.toHSL().a - color2.toHSL().a;
  40722. var w1 = (((w * a == -1) ? w : (w + a) / (1 + w * a)) + 1) / 2.0;
  40723. var w2 = 1 - w1;
  40724. var rgb = [color1.rgb[0] * w1 + color2.rgb[0] * w2,
  40725. color1.rgb[1] * w1 + color2.rgb[1] * w2,
  40726. color1.rgb[2] * w1 + color2.rgb[2] * w2];
  40727. var alpha = color1.alpha * p + color2.alpha * (1 - p);
  40728. return new SuperMap.CartoCSS.Tree.Color(rgb, alpha);
  40729. },
  40730. greyscale: function (color) {
  40731. return this.desaturate(color, new SuperMap.CartoCSS.Tree.Dimension(100));
  40732. },
  40733. '%': function (quoted /* arg, arg, ...*/) {
  40734. var args = Array.prototype.slice.call(arguments, 1),
  40735. str = quoted.value;
  40736. for (var i = 0; i < args.length; i++) {
  40737. str = str.replace(/%s/, args[i].value)
  40738. .replace(/%[da]/, args[i].toString());
  40739. }
  40740. str = str.replace(/%%/g, '%');
  40741. return new SuperMap.CartoCSS.Tree.Quoted(str);
  40742. },
  40743. hsla_simple: function (h) {
  40744. return this.hsla(h.h, h.s, h.l, h.a);
  40745. },
  40746. number: function (n) {
  40747. if (n instanceof SuperMap.CartoCSS.Tree.Dimension) {
  40748. return parseFloat(n.unit === '%' ? n.value / 100 : n.value);
  40749. } else if (typeof(n) === 'number') {
  40750. return n;
  40751. } else {
  40752. return NaN;
  40753. }
  40754. },
  40755. clamp: function (val) {
  40756. return Math.min(1, Math.max(0, val));
  40757. }
  40758. };
  40759. SuperMap.CartoCSS.Tree.Call = class Call {
  40760. constructor(name, args, index) {
  40761. this.is = 'call';
  40762. this.name = name;
  40763. this.args = args;
  40764. this.index = index;
  40765. }
  40766. // When evuating a function call,
  40767. // we either find the function in `tree.functions` [1],
  40768. // in which case we call it, passing the evaluated arguments,
  40769. // or we simply print it out as it appeared originally [2].
  40770. // The *functions.js* file contains the built-in functions.
  40771. // The reason why we evaluate the arguments, is in the case where
  40772. // we try to pass a variable to a function, like: `saturate(@color)`.
  40773. // The function should receive the value, not the variable.
  40774. 'ev'(env) {
  40775. var args = this.args.map(function (a) {
  40776. return a.ev(env);
  40777. });
  40778. for (var i = 0; i < args.length; i++) {
  40779. if (args[i].is === 'undefined') {
  40780. return {
  40781. is: 'undefined',
  40782. value: 'undefined'
  40783. };
  40784. }
  40785. }
  40786. if (this.name in SuperMap.CartoCSS.Tree.functions) {
  40787. if (SuperMap.CartoCSS.Tree.functions[this.name].length <= args.length) {
  40788. var val = SuperMap.CartoCSS.Tree.functions[this.name].apply(SuperMap.CartoCSS.Tree.functions, args);
  40789. if (val === null) {
  40790. env.error({
  40791. message: 'incorrect arguments given to ' + this.name + '()',
  40792. index: this.index,
  40793. type: 'runtime',
  40794. filename: this.filename
  40795. });
  40796. return {is: 'undefined', value: 'undefined'};
  40797. }
  40798. return val;
  40799. } else {
  40800. env.error({
  40801. message: 'incorrect number of arguments for ' + this.name +
  40802. '(). ' + SuperMap.CartoCSS.Tree.functions[this.name].length + ' expected.',
  40803. index: this.index,
  40804. type: 'runtime',
  40805. filename: this.filename
  40806. });
  40807. return {
  40808. is: 'undefined',
  40809. value: 'undefined'
  40810. };
  40811. }
  40812. } else {
  40813. var fn = SuperMap.CartoCSS.Tree.Reference.mapnikFunctions[this.name];
  40814. if (fn === undefined) {
  40815. var functions = lodash_topairs_default()(SuperMap.CartoCSS.Tree.Reference.mapnikFunctions);
  40816. // cheap closest, needs improvement.
  40817. var name = this.name;
  40818. var mean = functions.map(function (f) {
  40819. return [f[0], SuperMap.CartoCSS.Tree.Reference.editDistance(name, f[0]), f[1]];
  40820. }).sort(function (a, b) {
  40821. return a[1] - b[1];
  40822. });
  40823. env.error({
  40824. message: 'unknown function ' + this.name + '(), did you mean ' +
  40825. mean[0][0] + '(' + mean[0][2] + ')',
  40826. index: this.index,
  40827. type: 'runtime',
  40828. filename: this.filename
  40829. });
  40830. return {
  40831. is: 'undefined',
  40832. value: 'undefined'
  40833. };
  40834. }
  40835. if (fn !== args.length &&
  40836. // support variable-arg functions like `colorize-alpha`
  40837. fn !== -1) {
  40838. env.error({
  40839. message: 'function ' + this.name + '() takes ' +
  40840. fn + ' arguments and was given ' + args.length,
  40841. index: this.index,
  40842. type: 'runtime',
  40843. filename: this.filename
  40844. });
  40845. return {
  40846. is: 'undefined',
  40847. value: 'undefined'
  40848. };
  40849. } else {
  40850. // Save the evaluated versions of arguments
  40851. this.args = args;
  40852. return this;
  40853. }
  40854. }
  40855. }
  40856. toString(env, format) {
  40857. if (this.args.length) {
  40858. return this.name + '(' + this.args.join(',') + ')';
  40859. } else {
  40860. return this.name;
  40861. }
  40862. }
  40863. };
  40864. SuperMap.CartoCSS.Tree.Color = class Color {
  40865. constructor(rgb, a) {
  40866. this.is = 'color';
  40867. // The end goal here, is to parse the arguments
  40868. // into an integer triplet, such as `128, 255, 0`
  40869. //
  40870. // This facilitates operations and conversions.
  40871. if (Array.isArray(rgb)) {
  40872. this.rgb = rgb.slice(0, 3);
  40873. } else if (rgb.length == 6) {
  40874. this.rgb = rgb.match(/.{2}/g).map(function (c) {
  40875. return parseInt(c, 16);
  40876. });
  40877. } else {
  40878. this.rgb = rgb.split('').map(function (c) {
  40879. return parseInt(c + c, 16);
  40880. });
  40881. }
  40882. if (typeof(a) === 'number') {
  40883. this.alpha = a;
  40884. } else if (rgb.length === 4) {
  40885. this.alpha = rgb[3];
  40886. } else {
  40887. this.alpha = 1;
  40888. }
  40889. }
  40890. 'ev'() {
  40891. return this;
  40892. }
  40893. // If we have some transparency, the only way to represent it
  40894. // is via `rgba`. Otherwise, we use the hex representation,
  40895. // which has better compatibility with older browsers.
  40896. // Values are capped between `0` and `255`, rounded and zero-padded.
  40897. toString() {
  40898. /* if (this.alpha < 1.0) {*/
  40899. return 'rgba(' + this.rgb.map(function (c) {
  40900. return Math.round(c);
  40901. }).concat(this.alpha).join(', ') + ')';
  40902. /*} else {
  40903. return '#' + this.rgb.map(function(i) {
  40904. i = Math.round(i);
  40905. i = (i > 255 ? 255 : (i < 0 ? 0 : i)).toString(16);
  40906. return i.length === 1 ? '0' + i : i;
  40907. }).join('');
  40908. }*/
  40909. }
  40910. // Operations have to be done per-channel, if not,
  40911. // channels will spill onto each other. Once we have
  40912. // our result, in the form of an integer triplet,
  40913. // we create a new Color node to hold the result.
  40914. operate(env, op, other) {
  40915. var result = [];
  40916. if (!(other instanceof SuperMap.CartoCSS.Tree.Color)) {
  40917. other = other.toColor();
  40918. }
  40919. for (var c = 0; c < 3; c++) {
  40920. result[c] = SuperMap.CartoCSS.Tree.operate(op, this.rgb[c], other.rgb[c]);
  40921. }
  40922. return new SuperMap.CartoCSS.Tree.Color(result);
  40923. }
  40924. toHSL() {
  40925. var r = this.rgb[0] / 255,
  40926. g = this.rgb[1] / 255,
  40927. b = this.rgb[2] / 255,
  40928. a = this.alpha;
  40929. var max = Math.max(r, g, b), min = Math.min(r, g, b);
  40930. var h, s, l = (max + min) / 2, d = max - min;
  40931. if (max === min) {
  40932. h = s = 0;
  40933. } else {
  40934. s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
  40935. switch (max) {
  40936. case r:
  40937. h = (g - b) / d + (g < b ? 6 : 0);
  40938. break;
  40939. case g:
  40940. h = (b - r) / d + 2;
  40941. break;
  40942. case b:
  40943. h = (r - g) / d + 4;
  40944. break;
  40945. default:
  40946. break;
  40947. }
  40948. h /= 6;
  40949. }
  40950. return {h: h * 360, s: s, l: l, a: a};
  40951. }
  40952. };
  40953. SuperMap.CartoCSS.Tree.Comment = class Comment {
  40954. constructor(value, silent) {
  40955. this.value = value;
  40956. this.silent = !!silent;
  40957. }
  40958. toString(env) {
  40959. return '<!--' + this.value + '-->';
  40960. }
  40961. 'ev'() {
  40962. return this;
  40963. }
  40964. };
  40965. SuperMap.CartoCSS.Tree.Definition = class Definition {
  40966. constructor(selector, rules) {
  40967. this.elements = selector.elements;
  40968. //assert.ok(selector.filters instanceof SuperMap.CartoCSS.Tree.Filterset);
  40969. this.rules = rules;
  40970. this.ruleIndex = {};
  40971. for (var i = 0; i < this.rules.length; i++) {
  40972. if ('zoom' in this.rules[i]) {this.rules[i] = this.rules[i].clone();}
  40973. this.rules[i].zoom = selector.zoom;
  40974. this.ruleIndex[this.rules[i].updateID()] = true;
  40975. }
  40976. this.filters = selector.filters;
  40977. this.zoom = selector.zoom;
  40978. this.attachment = selector.attachment || '__default__';
  40979. this.specificity = selector.specificity();
  40980. }
  40981. toString() {
  40982. var str = this.filters.toString();
  40983. for (var i = 0; i < this.rules.length; i++) {
  40984. str += '\n ' + this.rules[i];
  40985. }
  40986. return str;
  40987. }
  40988. toJS(env) {
  40989. var shaderAttrs = {};
  40990. // merge conditions from filters with zoom condition of the
  40991. // definition
  40992. var zoom = this.zoom;
  40993. //var frame_offset = this.frame_offset;
  40994. var _if = this.filters.toJS(env);
  40995. var filters = [zoom];
  40996. if (_if) {filters.push(_if);}
  40997. //if(frame_offset) filters.push('ctx["frame-offset"] === ' + frame_offset);
  40998. _if = filters.join(" && ");
  40999. function eachRule(rule) {
  41000. if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  41001. shaderAttrs[rule.name] = shaderAttrs[rule.name] || [];
  41002. if (_if) {
  41003. shaderAttrs[rule.name].push(
  41004. "if(" + _if + "){" + rule.value.toJS(env) + "}"
  41005. );
  41006. } else {
  41007. shaderAttrs[rule.name].push(rule.value.toJS(env));
  41008. }
  41009. } else {
  41010. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  41011. var sh = rule.toJS(env);
  41012. for (var v in sh) {
  41013. shaderAttrs[v] = shaderAttrs[v] || [];
  41014. for (var attr in sh[v]) {
  41015. shaderAttrs[v].push(sh[v][attr]);
  41016. }
  41017. }
  41018. }
  41019. }
  41020. }
  41021. for (var id in this.rules) {
  41022. eachRule(this.rules[id]);
  41023. }
  41024. return shaderAttrs;
  41025. }
  41026. };
  41027. SuperMap.CartoCSS.Tree.Dimension = class Dimension {
  41028. constructor(value, unit, index) {
  41029. this.is = 'float';
  41030. this.physical_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc'];
  41031. this.screen_units = ['px', '%'];
  41032. this.all_units = ['m', 'cm', 'in', 'mm', 'pt', 'pc', 'px', '%'];
  41033. this.densities = {
  41034. m: 0.0254,
  41035. mm: 25.4,
  41036. cm: 2.54,
  41037. pt: 72,
  41038. pc: 6
  41039. };
  41040. this.value = parseFloat(value);
  41041. this.unit = unit || null;
  41042. this.index = index;
  41043. }
  41044. ev(env) {
  41045. if (this.unit && this.all_units.indexOf(this.unit)<0) {
  41046. env.error({
  41047. message: "Invalid unit: '" + this.unit + "'",
  41048. index: this.index
  41049. });
  41050. return {is: 'undefined', value: 'undefined'};
  41051. }
  41052. // normalize units which are not px or %
  41053. if (this.unit && this.physical_units.indexOf(this.unit)>=0) {
  41054. if (!env.ppi) {
  41055. env.error({
  41056. message: "ppi is not set, so metric units can't be used",
  41057. index: this.index
  41058. });
  41059. return {is: 'undefined', value: 'undefined'};
  41060. }
  41061. // convert all units to inch
  41062. // convert inch to px using ppi
  41063. this.value = (this.value / this.densities[this.unit]) * env.ppi;
  41064. this.unit = 'px';
  41065. }
  41066. return this;
  41067. }
  41068. toColor() {
  41069. return new SuperMap.CartoCSS.Tree.Color([this.value, this.value, this.value]);
  41070. }
  41071. round() {
  41072. this.value = Math.round(this.value);
  41073. return this;
  41074. }
  41075. toString() {
  41076. return this.value.toString();
  41077. }
  41078. operate(env, op, other) {
  41079. if (this.unit === '%' && other.unit !== '%') {
  41080. env.error({
  41081. message: 'If two operands differ, the first must not be %',
  41082. index: this.index
  41083. });
  41084. return {
  41085. is: 'undefined',
  41086. value: 'undefined'
  41087. };
  41088. }
  41089. if (this.unit !== '%' && other.unit === '%') {
  41090. if (op === '*' || op === '/' || op === '%') {
  41091. env.error({
  41092. message: 'Percent values can only be added or subtracted from other values',
  41093. index: this.index
  41094. });
  41095. return {
  41096. is: 'undefined',
  41097. value: 'undefined'
  41098. };
  41099. }
  41100. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op,
  41101. this.value, this.value * other.value * 0.01),
  41102. this.unit);
  41103. }
  41104. //here the operands are either the same (% or undefined or px), or one is undefined and the other is px
  41105. return new SuperMap.CartoCSS.Tree.Dimension(SuperMap.CartoCSS.Tree.operate(op, this.value, other.value),
  41106. this.unit || other.unit);
  41107. }
  41108. };
  41109. SuperMap.CartoCSS.Tree.Element = class Element {
  41110. constructor(value) {
  41111. this.value = value.trim();
  41112. if (this.value[0] === '#') {
  41113. this.type = 'id';
  41114. this.clean = this.value.replace(/^#/, '');
  41115. }
  41116. if (this.value[0] === '.') {
  41117. this.type = 'class';
  41118. this.clean = this.value.replace(/^\./, '');
  41119. }
  41120. if (this.value.indexOf('*') !== -1) {
  41121. this.type = 'wildcard';
  41122. }
  41123. }
  41124. specificity() {
  41125. return [
  41126. (this.type === 'id') ? 1 : 0, // a
  41127. (this.type === 'class') ? 1 : 0 // b
  41128. ];
  41129. }
  41130. toString() {
  41131. return this.value;
  41132. }
  41133. };
  41134. SuperMap.CartoCSS.Tree.Expression = class Expression {
  41135. constructor(value) {
  41136. this.is = 'expression';
  41137. this.value = value;
  41138. }
  41139. ev(env) {
  41140. if (this.value.length > 1) {
  41141. return new SuperMap.CartoCSS.Tree.Expression(this.value.map(function (e) {
  41142. return e.ev(env);
  41143. }));
  41144. } else {
  41145. return this.value[0].ev(env);
  41146. }
  41147. }
  41148. toString(env) {
  41149. return this.value.map(function (e) {
  41150. return e.toString(env);
  41151. }).join(' ');
  41152. }
  41153. };
  41154. SuperMap.CartoCSS.Tree.Field = class Field {
  41155. constructor(content) {
  41156. this.is = 'field';
  41157. this.value = content || '';
  41158. }
  41159. toString() {
  41160. return '["' + this.value.toUpperCase() + '"]';
  41161. }
  41162. 'ev'() {
  41163. return this;
  41164. }
  41165. };
  41166. SuperMap.CartoCSS.Tree.Filter = class Filter {
  41167. constructor(key, op, val, index, filename) {
  41168. this.ops = {
  41169. '<': [' &lt; ', 'numeric'],
  41170. '>': [' &gt; ', 'numeric'],
  41171. '=': [' = ', 'both'],
  41172. '!=': [' != ', 'both'],
  41173. '<=': [' &lt;= ', 'numeric'],
  41174. '>=': [' &gt;= ', 'numeric'],
  41175. '=~': ['.match(', 'string', ')']
  41176. };
  41177. this.key = key;
  41178. this.op = op;
  41179. this.val = val;
  41180. this.index = index;
  41181. this.filename = filename;
  41182. this.id = this.key + this.op + this.val;
  41183. }
  41184. ev(env) {
  41185. this.key = this.key.ev(env);
  41186. this.val = this.val.ev(env);
  41187. return this;
  41188. }
  41189. toString() {
  41190. return '[' + this.id + ']';
  41191. }
  41192. };
  41193. SuperMap.CartoCSS.Tree.Filterset = class Filterset {
  41194. constructor() {
  41195. this.filters = {};
  41196. }
  41197. toJS(env) {
  41198. function eachFilter(filter) {
  41199. var op = filter.op;
  41200. if (op === "=") {
  41201. op = "==";
  41202. }
  41203. var val = filter.val;
  41204. if (filter._val !== undefined) {
  41205. val = filter._val.toString(true);
  41206. }
  41207. //对scale进行特殊处理,将值转换成数值
  41208. if (filter.key && filter.key.value === 'scale') {
  41209. val = +val;
  41210. } else if (typeof val === 'string' || typeof val === 'object') {
  41211. val = "'" + val + "'";
  41212. }
  41213. var attrs = "attributes";
  41214. return attrs + "&&" + attrs + filter.key + "&&" + attrs + filter.key + " " + op + val;
  41215. }
  41216. var results = [];
  41217. for (var id in this.filters) {
  41218. results.push(eachFilter(this.filters[id]));
  41219. }
  41220. return results.join(' && ');
  41221. }
  41222. toString() {
  41223. var arr = [];
  41224. for (var id in this.filters) {arr.push(this.filters[id].id);}
  41225. return arr.sort().join('\t');
  41226. }
  41227. ev(env) {
  41228. for (var i in this.filters) {
  41229. this.filters[i].ev(env);
  41230. }
  41231. return this;
  41232. }
  41233. clone() {
  41234. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  41235. for (var id in this.filters) {
  41236. clone.filters[id] = this.filters[id];
  41237. }
  41238. return clone;
  41239. }
  41240. cloneWith(other) {
  41241. var additions = [];
  41242. for (var id in other.filters) {
  41243. var status = this.addable(other.filters[id]);
  41244. // status is true, false or null. if it's null we don't fail this
  41245. // clone nor do we add the filter.
  41246. if (status === false) {
  41247. return false;
  41248. }
  41249. if (status === true) {
  41250. // Adding the filter will override another value.
  41251. additions.push(other.filters[id]);
  41252. }
  41253. }
  41254. // Adding the other filters doesn't make this filterset invalid, but it
  41255. // doesn't add anything to it either.
  41256. if (!additions.length) {
  41257. return null;
  41258. }
  41259. // We can successfully add all filters. Now clone the filterset and add the
  41260. // new rules.
  41261. var clone = new SuperMap.CartoCSS.Tree.Filterset();
  41262. // We can add the rules that are already present without going through the
  41263. // add function as a Filterset is always in it's simplest canonical form.
  41264. for (id in this.filters) {
  41265. clone.filters[id] = this.filters[id];
  41266. }
  41267. // Only add new filters that actually change the filter.
  41268. while (id = additions.shift()) {
  41269. clone.add(id);
  41270. }
  41271. return clone;
  41272. }
  41273. addable(filter) {
  41274. var key = filter.key.toString(),
  41275. value = filter.val.toString();
  41276. if (value.match(/^[0-9]+(\.[0-9]*)?_match/)) {value = parseFloat(value);}
  41277. switch (filter.op) {
  41278. case '=':
  41279. // if there is already foo= and we're adding foo=
  41280. if (this.filters[key + '='] !== undefined) {
  41281. if (this.filters[key + '='].val.toString() != value) {
  41282. return false;
  41283. } else {
  41284. return null;
  41285. }
  41286. }
  41287. if (this.filters[key + '!=' + value] !== undefined) {return false;}
  41288. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  41289. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  41290. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  41291. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  41292. return true;
  41293. case '=~':
  41294. return true;
  41295. case '!=':
  41296. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val === value) ? false : null;}
  41297. if (this.filters[key + '!=' + value] !== undefined) {return null;}
  41298. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  41299. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  41300. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  41301. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  41302. return true;
  41303. case '>':
  41304. if (key + '=' in this.filters) {
  41305. if (this.filters[key + '='].val <= value) {
  41306. return false;
  41307. } else {
  41308. return null;
  41309. }
  41310. }
  41311. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  41312. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return false;}
  41313. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  41314. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return null;}
  41315. return true;
  41316. case '>=':
  41317. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val < value) ? false : null;}
  41318. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return false;}
  41319. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return false;}
  41320. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return null;}
  41321. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return null;}
  41322. return true;
  41323. case '<':
  41324. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val >= value) ? false : null;}
  41325. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  41326. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val >= value) {return false;}
  41327. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  41328. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val < value) {return null;}
  41329. return true;
  41330. case '<=':
  41331. if (this.filters[key + '='] !== undefined) {return (this.filters[key + '='].val > value) ? false : null;}
  41332. if (this.filters[key + '>'] !== undefined && this.filters[key + '>'].val >= value) {return false;}
  41333. if (this.filters[key + '>='] !== undefined && this.filters[key + '>='].val > value) {return false;}
  41334. if (this.filters[key + '<'] !== undefined && this.filters[key + '<'].val <= value) {return null;}
  41335. if (this.filters[key + '<='] !== undefined && this.filters[key + '<='].val <= value) {return null;}
  41336. return true;
  41337. default:
  41338. break;
  41339. }
  41340. }
  41341. conflict(filter) {
  41342. var key = filter.key.toString(),
  41343. value = filter.val.toString();
  41344. if (!isNaN(parseFloat(value))) {value = parseFloat(value);}
  41345. // if (a=b) && (a=c)
  41346. // if (a=b) && (a!=b)
  41347. // or (a!=b) && (a=b)
  41348. if ((filter.op === '=' && this.filters[key + '='] !== undefined &&
  41349. value != this.filters[key + '='].val.toString()) ||
  41350. (filter.op === '!=' && this.filters[key + '='] !== undefined &&
  41351. value == this.filters[key + '='].val.toString()) ||
  41352. (filter.op === '=' && this.filters[key + '!='] !== undefined &&
  41353. value === this.filters[key + '!='].val.toString())) {
  41354. return filter.toString() + ' added to ' + this.toString() + ' produces an invalid filter';
  41355. }
  41356. return false;
  41357. }
  41358. add(filter, env) {
  41359. var key = filter.key.toString(),
  41360. op = filter.op,
  41361. conflict = this.conflict(filter),
  41362. numval;
  41363. if (conflict) {return conflict;}
  41364. if (op === '=') {
  41365. for (var i in this.filters) {
  41366. if (this.filters[i].key === key) {delete this.filters[i];}
  41367. }
  41368. this.filters[key + '='] = filter;
  41369. } else if (op === '!=') {
  41370. this.filters[key + '!=' + filter.val] = filter;
  41371. } else if (op === '=~') {
  41372. this.filters[key + '=~' + filter.val] = filter;
  41373. } else if (op === '>') {
  41374. // If there are other filters that are also >
  41375. // but are less than this one, they don't matter, so
  41376. // remove them.
  41377. for (var j in this.filters) {
  41378. if (this.filters[j].key === key && this.filters[j].val <= filter.val) {
  41379. delete this.filters[j];
  41380. }
  41381. }
  41382. this.filters[key + '>'] = filter;
  41383. } else if (op === '>=') {
  41384. for (var k in this.filters) {
  41385. numval = (+this.filters[k].val.toString());
  41386. if (this.filters[k].key === key && numval < filter.val) {
  41387. delete this.filters[k];
  41388. }
  41389. }
  41390. if (this.filters[key + '!=' + filter.val] !== undefined) {
  41391. delete this.filters[key + '!=' + filter.val];
  41392. filter.op = '>';
  41393. this.filters[key + '>'] = filter;
  41394. } else {
  41395. this.filters[key + '>='] = filter;
  41396. }
  41397. } else if (op === '<') {
  41398. for (var l in this.filters) {
  41399. numval = (+this.filters[l].val.toString());
  41400. if (this.filters[l].key === key && numval >= filter.val) {
  41401. delete this.filters[l];
  41402. }
  41403. }
  41404. this.filters[key + '<'] = filter;
  41405. } else if (op === '<=') {
  41406. for (var m in this.filters) {
  41407. numval = (+this.filters[m].val.toString());
  41408. if (this.filters[m].key === key && numval > filter.val) {
  41409. delete this.filters[m];
  41410. }
  41411. }
  41412. if (this.filters[key + '!=' + filter.val] !== undefined) {
  41413. delete this.filters[key + '!=' + filter.val];
  41414. filter.op = '<';
  41415. this.filters[key + '<'] = filter;
  41416. } else {
  41417. this.filters[key + '<='] = filter;
  41418. }
  41419. }
  41420. }
  41421. };
  41422. SuperMap.CartoCSS.Tree.Fontset = class Fontset {
  41423. constructor(env, fonts) {
  41424. this.fonts = fonts;
  41425. this.name = 'fontset-' + env.effects.length;
  41426. }
  41427. };
  41428. SuperMap.CartoCSS.Tree.Invalid = class Invalid {
  41429. constructor(chunk, index, message) {
  41430. this.is = 'invalid';
  41431. this.chunk = chunk;
  41432. this.index = index;
  41433. this.type = 'syntax';
  41434. this.message = message || "Invalid code: " + this.chunk;
  41435. }
  41436. ev(env) {
  41437. env.error({
  41438. chunk: this.chunk,
  41439. index: this.index,
  41440. type: 'syntax',
  41441. message: this.message || "Invalid code: " + this.chunk
  41442. });
  41443. return {
  41444. is: 'undefined'
  41445. };
  41446. }
  41447. };
  41448. SuperMap.CartoCSS.Tree.Keyword = class Keyword {
  41449. ev() {
  41450. return this;
  41451. }
  41452. constructor(value) {
  41453. this.value = value;
  41454. var special = {
  41455. 'transparent': 'color',
  41456. 'true': 'boolean',
  41457. 'false': 'boolean'
  41458. };
  41459. this.is = special[value] ? special[value] : 'keyword';
  41460. }
  41461. toString() {
  41462. return this.value;
  41463. }
  41464. };
  41465. /*Layer:class Invalid ),*/
  41466. SuperMap.CartoCSS.Tree.Literal = class Literal {
  41467. constructor(content) {
  41468. this.value = content || '';
  41469. this.is = 'field';
  41470. }
  41471. toString() {
  41472. return this.value;
  41473. }
  41474. 'ev'() {
  41475. return this;
  41476. }
  41477. };
  41478. SuperMap.CartoCSS.Tree.Operation = class Operation {
  41479. constructor(op, operands, index) {
  41480. this.is = 'operation';
  41481. this.op = op.trim();
  41482. this.operands = operands;
  41483. this.index = index;
  41484. }
  41485. ev(env) {
  41486. var a = this.operands[0].ev(env),
  41487. b = this.operands[1].ev(env),
  41488. temp;
  41489. if (a.is === 'undefined' || b.is === 'undefined') {
  41490. return {
  41491. is: 'undefined',
  41492. value: 'undefined'
  41493. };
  41494. }
  41495. if (a instanceof SuperMap.CartoCSS.Tree.Dimension && b instanceof SuperMap.CartoCSS.Tree.Color) {
  41496. if (this.op === '*' || this.op === '+') {
  41497. temp = b;
  41498. b = a;
  41499. a = temp;
  41500. } else {
  41501. env.error({
  41502. name: "OperationError",
  41503. message: "Can't substract or divide a color from a number",
  41504. index: this.index
  41505. });
  41506. }
  41507. }
  41508. // Only concatenate plain strings, because this is easily
  41509. // pre-processed
  41510. if (a instanceof SuperMap.CartoCSS.Tree.Quoted && b instanceof SuperMap.CartoCSS.Tree.Quoted && this.op !== '+') {
  41511. env.error({
  41512. message: "Can't subtract, divide, or multiply strings.",
  41513. index: this.index,
  41514. type: 'runtime',
  41515. filename: this.filename
  41516. });
  41517. return {
  41518. is: 'undefined',
  41519. value: 'undefined'
  41520. };
  41521. }
  41522. // Fields, literals, dimensions, and quoted strings can be combined.
  41523. if (a instanceof SuperMap.CartoCSS.Tree.Field || b instanceof SuperMap.CartoCSS.Tree.Field ||
  41524. a instanceof SuperMap.CartoCSS.Tree.Literal || b instanceof SuperMap.CartoCSS.Tree.Literal) {
  41525. if (a.is === 'color' || b.is === 'color') {
  41526. env.error({
  41527. message: "Can't subtract, divide, or multiply colors in expressions.",
  41528. index: this.index,
  41529. type: 'runtime',
  41530. filename: this.filename
  41531. });
  41532. return {
  41533. is: 'undefined',
  41534. value: 'undefined'
  41535. };
  41536. } else {
  41537. return new SuperMap.CartoCSS.Tree.Literal(a.ev(env).toString(true) + this.op + b.ev(env).toString(true));
  41538. }
  41539. }
  41540. if (a.operate === undefined) {
  41541. env.error({
  41542. message: 'Cannot do math with type ' + a.is + '.',
  41543. index: this.index,
  41544. type: 'runtime',
  41545. filename: this.filename
  41546. });
  41547. return {
  41548. is: 'undefined',
  41549. value: 'undefined'
  41550. };
  41551. }
  41552. return a.operate(env, this.op, b);
  41553. }
  41554. };
  41555. SuperMap.CartoCSS.Tree.Quoted = class Quoted {
  41556. constructor(content) {
  41557. this.is = 'string';
  41558. this.value = content || '';
  41559. }
  41560. toString(quotes) {
  41561. var escapedValue = this.value
  41562. .replace(/&/g, '&amp;')
  41563. var xmlvalue = escapedValue
  41564. .replace(/\'/g, '\\\'')
  41565. .replace(/\"/g, '&quot;')
  41566. .replace(/</g, '&lt;')
  41567. .replace(/\>/g, '&gt;');
  41568. return (quotes === true) ? "'" + xmlvalue + "'" : escapedValue;
  41569. }
  41570. ev() {
  41571. return this;
  41572. }
  41573. operate(env, op, other) {
  41574. return new SuperMap.CartoCSS.Tree.Quoted(SuperMap.CartoCSS.Tree.operate(op, this.toString(), other.toString(this.contains_field)));
  41575. }
  41576. };
  41577. SuperMap.CartoCSS.Tree.Reference = {
  41578. _validateValue: {
  41579. 'font': function (env, value) {
  41580. if (env.validation_data && env.validation_data.fonts) {
  41581. return env.validation_data.fonts.indexOf(value) != -1;
  41582. } else {
  41583. return true;
  41584. }
  41585. }
  41586. },
  41587. setData: function (data) {
  41588. this.data = data;
  41589. this.selector_cache = generateSelectorCache(data);
  41590. this.mapnikFunctions = generateMapnikFunctions(data);
  41591. this.required_cache = generateRequiredProperties(data);
  41592. function generateSelectorCache(data) {
  41593. var index = {};
  41594. for (var i in data.symbolizers) {
  41595. for (var j in data.symbolizers[i]) {
  41596. if (data.symbolizers[i][j].hasOwnProperty('css')) {
  41597. index[data.symbolizers[i][j].css] = [data.symbolizers[i][j], i, j];
  41598. }
  41599. }
  41600. }
  41601. return index;
  41602. }
  41603. function generateMapnikFunctions(data) {
  41604. var functions = {};
  41605. for (var i in data.symbolizers) {
  41606. for (var j in data.symbolizers[i]) {
  41607. if (data.symbolizers[i][j].type === 'functions') {
  41608. for (var k = 0; k < data.symbolizers[i][j].functions.length; k++) {
  41609. var fn = data.symbolizers[i][j].functions[k];
  41610. functions[fn[0]] = fn[1];
  41611. }
  41612. }
  41613. }
  41614. }
  41615. return functions;
  41616. }
  41617. function generateRequiredProperties(data) {
  41618. var cache = {};
  41619. for (var symbolizer_name in data.symbolizers) {
  41620. cache[symbolizer_name] = [];
  41621. for (var j in data.symbolizers[symbolizer_name]) {
  41622. if (data.symbolizers[symbolizer_name][j].required) {
  41623. cache[symbolizer_name].push(data.symbolizers[symbolizer_name][j].css);
  41624. }
  41625. }
  41626. }
  41627. return cache;
  41628. }
  41629. },
  41630. setVersion: function (version) {
  41631. if (SuperMap.CartoCSS.mapnik_reference.version.hasOwnProperty(version)) {
  41632. this.setData(SuperMap.CartoCSS.mapnik_reference.version[version]);
  41633. return true;
  41634. }
  41635. return false;
  41636. },
  41637. selectorData: function (selector, i) {
  41638. if (this.selector_cache && this.selector_cache[selector]) {return this.selector_cache[selector][i];}
  41639. },
  41640. validSelector: function (selector) {
  41641. return !!this.selector_cache[selector];
  41642. },
  41643. selectorName: function (selector) {
  41644. return this.selectorData(selector, 2);
  41645. },
  41646. selector: function (selector) {
  41647. return this.selectorData(selector, 0);
  41648. },
  41649. symbolizer: function (selector) {
  41650. return this.selectorData(selector, 1);
  41651. },
  41652. requiredProperties: function (symbolizer_name, rules) {
  41653. var req = this.required_cache[symbolizer_name];
  41654. for (var i in req) {
  41655. if (!(req[i] in rules)) {
  41656. return 'Property ' + req[i] + ' required for defining ' +
  41657. symbolizer_name + ' styles.';
  41658. }
  41659. }
  41660. },
  41661. isFont: function (selector) {
  41662. return this.selector(selector).validate === 'font';
  41663. },
  41664. editDistance: function (a, b) {
  41665. if (a.length === 0) {return b.length;}
  41666. if (b.length === 0) {return a.length;}
  41667. var matrix = [];
  41668. for (var i = 0; i <= b.length; i++) {
  41669. matrix[i] = [i];
  41670. }
  41671. for (var j = 0; j <= a.length; j++) {
  41672. matrix[0][j] = j;
  41673. }
  41674. for (i = 1; i <= b.length; i++) {
  41675. for (j = 1; j <= a.length; j++) {
  41676. if (b.charAt(i - 1) === a.charAt(j - 1)) {
  41677. matrix[i][j] = matrix[i - 1][j - 1];
  41678. } else {
  41679. matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, // substitution
  41680. Math.min(matrix[i][j - 1] + 1, // insertion
  41681. matrix[i - 1][j] + 1)); // deletion
  41682. }
  41683. }
  41684. }
  41685. return matrix[b.length][a.length];
  41686. },
  41687. validValue: function (env, selector, value) {
  41688. function validateFunctions(value, selector) {
  41689. if (value.value[0].is === 'string') {return true;}
  41690. for (var i in value.value) {
  41691. for (var j in value.value[i].value) {
  41692. if (value.value[i].value[j].is !== 'call') {return false;}
  41693. var f = find(this.selector(selector).functions, function (x) {//NOSONAR
  41694. return x[0] === value.value[i].value[j].name;
  41695. });
  41696. if (!(f && f[1] === -1)) {
  41697. // This filter is unknown or given an incorrect number of arguments
  41698. if (!f || f[1] !== value.value[i].value[j].args.length) {return false;}
  41699. }
  41700. }
  41701. }
  41702. return true;
  41703. }
  41704. function validateKeyword(value, selector) {
  41705. if (typeof this.selector(selector).type === 'object') {
  41706. return this.selector(selector).type
  41707. .indexOf(value.value[0].value) !== -1;
  41708. } else {
  41709. // allow unquoted keywords as strings
  41710. return this.selector(selector).type === 'string';
  41711. }
  41712. }
  41713. var i;
  41714. if (!this.selector(selector)) {
  41715. return false;
  41716. } else if (value.value[0].is === 'keyword') {
  41717. return validateKeyword(value, selector);
  41718. } else if (value.value[0].is === 'undefined') {
  41719. // caught earlier in the chain - ignore here so that
  41720. // error is not overridden
  41721. return true;
  41722. } else if (this.selector(selector).type === 'numbers') {
  41723. for (i in value.value) {
  41724. if (value.value[i].is !== 'float') {
  41725. return false;
  41726. }
  41727. }
  41728. return true;
  41729. } else if (this.selector(selector).type === 'tags') {
  41730. if (!value.value) {return false;}
  41731. if (!value.value[0].value) {
  41732. return value.value[0].is === 'tag';
  41733. }
  41734. for (i = 0; i < value.value[0].value.length; i++) {
  41735. if (value.value[0].value[i].is !== 'tag') {return false;}
  41736. }
  41737. return true;
  41738. } else if (this.selector(selector).type == 'functions') {
  41739. // For backwards compatibility, you can specify a string for `functions`-compatible
  41740. // values, though they will not be validated.
  41741. return validateFunctions(value, selector);
  41742. } else if (this.selector(selector).type === 'expression') {
  41743. return true;
  41744. } else if (this.selector(selector).type === 'unsigned') {
  41745. if (value.value[0].is === 'float') {
  41746. value.value[0].round();
  41747. return true;
  41748. } else {
  41749. return false;
  41750. }
  41751. } else {
  41752. if (this.selector(selector).validate) {
  41753. var valid = false;
  41754. for (i = 0; i < value.value.length; i++) {
  41755. if (this.selector(selector).type === value.value[i].is &&
  41756. this._validateValue[this.selector(selector).validate](env, value.value[i].value)) {
  41757. return true;
  41758. }
  41759. }
  41760. return valid;
  41761. } else {
  41762. return this.selector(selector).type === value.value[0].is;
  41763. }
  41764. }
  41765. }
  41766. };
  41767. SuperMap.CartoCSS.Tree.Reference.setVersion("latest");
  41768. SuperMap.CartoCSS.Tree.Rule = class Rule {
  41769. constructor(name, value, index, filename) {
  41770. this.is = 'rule';
  41771. var parts = name.split('/');
  41772. this.name = parts.pop();
  41773. this.instance = parts.length ? parts[0] : '__default__';
  41774. this.value = (value instanceof SuperMap.CartoCSS.Tree.Value) ?
  41775. value : new SuperMap.CartoCSS.Tree.Value([value]);
  41776. this.index = index;
  41777. this.symbolizer = SuperMap.CartoCSS.Tree.Reference.symbolizer(this.name);
  41778. this.filename = filename;
  41779. this.variable = (name.charAt(0) === '@');
  41780. }
  41781. clone() {
  41782. var clone = Object.create(SuperMap.CartoCSS.Tree.Rule.prototype);
  41783. clone.name = this.name;
  41784. clone.value = this.value;
  41785. clone.index = this.index;
  41786. clone.instance = this.instance;
  41787. clone.symbolizer = this.symbolizer;
  41788. clone.filename = this.filename;
  41789. clone.variable = this.variable;
  41790. return clone;
  41791. }
  41792. updateID() {
  41793. return this.id = this.zoom + '#' + this.instance + '#' + this.name;
  41794. }
  41795. toString() {
  41796. return '[' + SuperMap.CartoCSS.Tree.Zoom.toString(this.zoom) + '] ' + this.name + ': ' + this.value;
  41797. }
  41798. ev(context) {
  41799. return new SuperMap.CartoCSS.Tree.Rule(this.name,
  41800. this.value.ev(context),
  41801. this.index,
  41802. this.filename);
  41803. }
  41804. };
  41805. SuperMap.CartoCSS.Tree.Ruleset = class Ruleset {
  41806. constructor(selectors, rules) {
  41807. this.is = 'ruleset';
  41808. this.selectors = selectors;
  41809. this.rules = rules;
  41810. // static cache of find() function
  41811. this._lookups = {};
  41812. }
  41813. ev(env) {
  41814. var i,
  41815. rule,
  41816. ruleset = new SuperMap.CartoCSS.Tree.Ruleset(this.selectors, this.rules.slice(0));
  41817. ruleset.root = this.root;
  41818. // push the current ruleset to the frames stack
  41819. env.frames.unshift(ruleset);
  41820. // Evaluate everything else
  41821. for (i = 0, rule; i < ruleset.rules.length; i++) {
  41822. rule = ruleset.rules[i];
  41823. ruleset.rules[i] = rule.ev ? rule.ev(env) : rule;
  41824. }
  41825. // Pop the stack
  41826. env.frames.shift();
  41827. return ruleset;
  41828. }
  41829. match(args) {
  41830. return !args || args.length === 0;
  41831. }
  41832. variables() {
  41833. if (this._variables) {
  41834. return this._variables;
  41835. } else {
  41836. return this._variables = this.rules.reduce(function (hash, r) {
  41837. if (r instanceof SuperMap.CartoCSS.Tree.Rule && r.variable === true) {
  41838. hash[r.name] = r;
  41839. }
  41840. return hash;
  41841. }, {});
  41842. }
  41843. }
  41844. variable(name) {
  41845. return this.variables()[name];
  41846. }
  41847. rulesets() {
  41848. if (this._rulesets) {
  41849. return this._rulesets;
  41850. } else {
  41851. return this._rulesets = this.rules.filter(function (r) {
  41852. return (r instanceof SuperMap.CartoCSS.Tree.Ruleset);
  41853. });
  41854. }
  41855. }
  41856. find(selector, self) {
  41857. self = self || this;
  41858. var rules = [], match,
  41859. key = selector.toString();
  41860. if (key in this._lookups) {
  41861. return this._lookups[key];
  41862. }
  41863. this.rulesets().forEach(function (rule) {
  41864. if (rule !== self) {
  41865. for (var j = 0; j < rule.selectors.length; j++) {
  41866. match = selector.match(rule.selectors[j]);
  41867. if (match) {
  41868. if (selector.elements.length > 1) {
  41869. Array.prototype.push.apply(rules, rule.find(
  41870. new SuperMap.CartoCSS.Tree.Selector(null, null, selector.elements.slice(1)), self));
  41871. } else {
  41872. rules.push(rule);
  41873. }
  41874. break;
  41875. }
  41876. }
  41877. }
  41878. });
  41879. return this._lookups[key] = rules;
  41880. }
  41881. // Zooms can use variables. This replaces SuperMap.CartoCSS.Tree.Zoom objects on selectors
  41882. // with simple bit-arrays that we can compare easily.
  41883. evZooms(env) {
  41884. for (var i = 0; i < this.selectors.length; i++) {
  41885. var zval = SuperMap.CartoCSS.Tree.Zoom.all;
  41886. for (var z = 0; z < this.selectors[i].zoom.length; z++) {
  41887. zval = this.selectors[i].zoom[z].ev(env).zoom;
  41888. }
  41889. this.selectors[i].zoom = zval;
  41890. }
  41891. }
  41892. flatten(result, parents, env) {
  41893. var selectors = [], i, j;
  41894. if (this.selectors.length === 0) {
  41895. env.frames = env.frames.concat(this.rules);
  41896. }
  41897. // evaluate zoom variables on this object.
  41898. this.evZooms(env);
  41899. for (i = 0; i < this.selectors.length; i++) {
  41900. var child = this.selectors[i];
  41901. if (!child.filters) {
  41902. // This is an invalid filterset.
  41903. continue;
  41904. }
  41905. if (parents.length) {
  41906. for (j = 0; j < parents.length; j++) {
  41907. var parent = parents[j];
  41908. var mergedFilters = parent.filters.cloneWith(child.filters);
  41909. if (mergedFilters === null) {
  41910. // Filters could be added, but they didn't change the
  41911. // filters. This means that we only have to clone when
  41912. // the zoom levels or the attachment is different too.
  41913. if (parent.zoom === child.zoom &&
  41914. parent.attachment === child.attachment &&
  41915. parent.elements.join() === child.elements.join()) {
  41916. selectors.push(parent);
  41917. continue;
  41918. } else {
  41919. mergedFilters = parent.filters;
  41920. }
  41921. } else if (!mergedFilters) {
  41922. // The merged filters are invalid, that means we don't
  41923. // have to clone.
  41924. continue;
  41925. }
  41926. var clone = Object.create(SuperMap.CartoCSS.Tree.Selector.prototype);
  41927. clone.filters = mergedFilters;
  41928. clone.zoom = child.zoom;
  41929. clone.elements = parent.elements.concat(child.elements);
  41930. if (parent.attachment && child.attachment) {
  41931. clone.attachment = parent.attachment + '/' + child.attachment;
  41932. } else {clone.attachment = child.attachment || parent.attachment;}
  41933. clone.conditions = parent.conditions + child.conditions;
  41934. clone.index = child.index;
  41935. selectors.push(clone);
  41936. }
  41937. } else {
  41938. selectors.push(child);
  41939. }
  41940. }
  41941. var rules = [];
  41942. for (i = 0; i < this.rules.length; i++) {
  41943. var rule = this.rules[i];
  41944. // Recursively flatten any nested rulesets
  41945. if (rule instanceof SuperMap.CartoCSS.Tree.Ruleset) {
  41946. rule.flatten(result, selectors, env);
  41947. } else if (rule instanceof SuperMap.CartoCSS.Tree.Rule) {
  41948. rules.push(rule);
  41949. } else if (rule instanceof SuperMap.CartoCSS.Tree.Invalid) {
  41950. env.error(rule);
  41951. }
  41952. }
  41953. var index = rules.length ? rules[0].index : false;
  41954. for (i = 0; i < selectors.length; i++) {
  41955. // For specificity sort, use the position of the first rule to allow
  41956. // defining attachments that are under current element as a descendant
  41957. // selector.
  41958. if (index !== false) {
  41959. selectors[i].index = index;
  41960. }
  41961. result.push(new SuperMap.CartoCSS.Tree.Definition(selectors[i], rules.slice()));
  41962. }
  41963. return result;
  41964. }
  41965. };
  41966. SuperMap.CartoCSS.Tree.Selector = class Selector {
  41967. constructor(filters, zoom, elements, attachment, conditions, index) {
  41968. this.elements = elements || [];
  41969. this.attachment = attachment;
  41970. this.filters = filters || {};
  41971. this.zoom = typeof zoom !== 'undefined' ? zoom : SuperMap.CartoCSS.Tree.Zoom.all;
  41972. this.conditions = conditions;
  41973. this.index = index;
  41974. }
  41975. specificity() {
  41976. return this.elements.reduce(function (memo, e) {
  41977. var spec = e.specificity();
  41978. memo[0] += spec[0];
  41979. memo[1] += spec[1];
  41980. return memo;
  41981. }, [0, 0, this.conditions, this.index]);
  41982. }
  41983. };
  41984. /*style:class Invalid ),*/
  41985. SuperMap.CartoCSS.Tree.URL = class URL {
  41986. constructor(val, paths) {
  41987. this.is = 'uri';
  41988. this.value = val;
  41989. this.paths = paths;
  41990. }
  41991. toString() {
  41992. return this.value.toString();
  41993. }
  41994. ev(ctx) {
  41995. return new SuperMap.CartoCSS.Tree.URL(this.value.ev(ctx), this.paths);
  41996. }
  41997. };
  41998. SuperMap.CartoCSS.Tree.Value = class Value {
  41999. constructor(value) {
  42000. this.is = 'value';
  42001. this.value = value;
  42002. }
  42003. ev(env) {
  42004. if (this.value.length === 1) {
  42005. return this.value[0].ev(env);
  42006. } else {
  42007. return new SuperMap.CartoCSS.Tree.Value(this.value.map(function (v) {
  42008. return v.ev(env);
  42009. }));
  42010. }
  42011. }
  42012. toJS(env) {
  42013. //var v = this.value[0].value[0];
  42014. var val = this.ev(env);
  42015. var v = val.toString();
  42016. if (val.is === "color" || val.is === 'uri' || val.is === 'string' || val.is === 'keyword') {
  42017. v = "'" + v + "'";
  42018. } else if (val.is === 'field') {
  42019. // replace [varuable] by ctx['variable']
  42020. v = v.replace(/\[(.*)\]/g, "attributes['\_match1']")
  42021. } else if (val.value && typeof val.value === "object") {
  42022. v = "[" + v + "]";
  42023. }
  42024. return "_value = " + v + ";";
  42025. }
  42026. toString(env, selector, sep, format) {
  42027. return this.value.map(function (e) {
  42028. return e.toString(env, format);
  42029. }).join(sep || ', ');
  42030. }
  42031. clone() {
  42032. var obj = Object.create(SuperMap.CartoCSS.Tree.Value.prototype);
  42033. if (Array.isArray(obj)) {obj.value = this.value.slice();} else {obj.value = this.value;}
  42034. obj.is = this.is;
  42035. return obj;
  42036. }
  42037. };
  42038. SuperMap.CartoCSS.Tree.Variable = class Variable {
  42039. constructor(name, index, filename) {
  42040. this.is = 'variable';
  42041. this.name = name;
  42042. this.index = index;
  42043. this.filename = filename;
  42044. }
  42045. toString() {
  42046. return this.name;
  42047. }
  42048. ev(env) {
  42049. if (this._css) {return this._css;}
  42050. var thisframe = env.frames.filter(function (f) {
  42051. return f.name === this.name;
  42052. }.bind(this));
  42053. if (thisframe.length) {
  42054. return thisframe[0].value.ev(env);
  42055. } else {
  42056. env.error({
  42057. message: 'variable ' + this.name + ' is undefined',
  42058. index: this.index,
  42059. type: 'runtime',
  42060. filename: this.filename
  42061. });
  42062. return {
  42063. is: 'undefined',
  42064. value: 'undefined'
  42065. };
  42066. }
  42067. }
  42068. };
  42069. SuperMap.CartoCSS.Tree.Zoom = class Zoom {
  42070. constructor(op, value, index) {
  42071. this.op = op;
  42072. this.value = value;
  42073. this.index = index;
  42074. }
  42075. setZoom(zoom) {
  42076. this.zoom = zoom;
  42077. return this;
  42078. }
  42079. ev(env) {
  42080. var value = parseInt(this.value.ev(env).toString(), 10);
  42081. if (value > SuperMap.CartoCSS.Tree.Zoom.maxZoom || value < 0) {
  42082. env.error({
  42083. message: 'Only zoom levels between 0 and ' +
  42084. SuperMap.CartoCSS.Tree.Zoom.maxZoom + ' supported.',
  42085. index: this.index
  42086. });
  42087. }
  42088. switch (this.op) {
  42089. case '=':
  42090. this.zoom = "zoom && zoom === " + value;
  42091. return this;
  42092. case '>':
  42093. this.zoom = "zoom && zoom > " + value;
  42094. break;
  42095. case '>=':
  42096. this.zoom = "zoom && zoom >= " + value;
  42097. break;
  42098. case '<':
  42099. this.zoom = "zoom && zoom < " + value;
  42100. break;
  42101. case '<=':
  42102. this.zoom = "zoom && zoom <= " + value;
  42103. break;
  42104. default:
  42105. return this;
  42106. break;
  42107. }
  42108. /*
  42109. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  42110. if (i >= start && i <= end) {
  42111. zoom |= (1 << i);
  42112. }
  42113. }
  42114. this.zoom = zoom;
  42115. this.zoom=value+this.op+"zoom";*/
  42116. return this;
  42117. }
  42118. toString() {
  42119. var str = '';
  42120. for (var i = 0; i <= SuperMap.CartoCSS.Tree.Zoom.maxZoom; i++) {
  42121. str += (this.zoom & (1 << i)) ? 'X' : '.';
  42122. }
  42123. return str;
  42124. }
  42125. };
  42126. // Covers all zoomlevels from 0 to 22
  42127. SuperMap.CartoCSS.Tree.Zoom.all = 23;
  42128. SuperMap.CartoCSS.Tree.Zoom.maxZoom = 22;
  42129. SuperMap.CartoCSS.Tree.Zoom.ranges = {
  42130. 0: 1000000000,
  42131. 1: 500000000,
  42132. 2: 200000000,
  42133. 3: 100000000,
  42134. 4: 50000000,
  42135. 5: 25000000,
  42136. 6: 12500000,
  42137. 7: 6500000,
  42138. 8: 3000000,
  42139. 9: 1500000,
  42140. 10: 750000,
  42141. 11: 400000,
  42142. 12: 200000,
  42143. 13: 100000,
  42144. 14: 50000,
  42145. 15: 25000,
  42146. 16: 12500,
  42147. 17: 5000,
  42148. 18: 2500,
  42149. 19: 1500,
  42150. 20: 750,
  42151. 21: 500,
  42152. 22: 250,
  42153. 23: 100
  42154. };
  42155. ;// CONCATENATED MODULE: ./src/common/style/ThemeStyle.js
  42156. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42157. * This program are made available under the terms of the Apache License, Version 2.0
  42158. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42159. /**
  42160. * @class SuperMap.ThemeStyle
  42161. * @classdesc 客户端专题图风格类。
  42162. * @category Visualization Theme
  42163. * @param {Object} options - 可选参数。
  42164. * @param {boolean} [options.fill=true] - 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  42165. * @param {string} [options.fillColor='#000000'] - 十六进制填充颜色。
  42166. * @param {number} [options.fillOpacity=1] - 填充不透明度。取值范围[0, 1]。
  42167. * @param {boolean} [options.stroke=false] - 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  42168. * @param {string} [options.strokeColor='#000000'] - 十六进制描边颜色。
  42169. * @param {number} [options.strokeOpacity=1] - 描边的不透明度。取值范围[0, 1]。
  42170. * @param {number} [options.strokeWidth=1] - 线宽度/描边宽度。
  42171. * @param {string} [options.strokeLinecap='butt'] - 线帽样式。strokeLinecap 有三种类型 “butt", "round", "square"。
  42172. * @param {string} [options.strokeLineJoin='iter'] - 线段连接样式。strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  42173. * @param {string} [options.strokeDashstyle='solid'] - 虚线类型。strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"。solid 表示实线。
  42174. * @param {number} [options.pointRadius=6] - 点半径,单位为像素。
  42175. * @param {number} [options.shadowBlur=0] - 阴影模糊度,(大于 0 有效;)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  42176. * @param {string} [options.shadowColor='#000000'] - 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  42177. * @param {number} [options.shadowOffsetX=0] - 阴影 X 方向偏移值。
  42178. * @param {number} [options.shadowOffsetY=0] - 阴影 Y 方向偏移值。
  42179. * @param {string} options.label - 专题要素附加文本标签内容。
  42180. * @param {string} [options.fontColor] - 附加文本字体颜色。
  42181. * @param {number} [options.fontSize=12] - 附加文本字体大小,单位是像素。
  42182. * @param {string} [options.fontStyle='normal'] - 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  42183. * @param {string} [options.fontVariant='normal'] - 附加文本字体变体。可设值:"normal", "small-caps"。
  42184. * @param {string} [options.fontWeight='normal'] - 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  42185. * @param {string} [options.fontFamily='arial,sans-serif'] - 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,
  42186. * 浏览器会使用它可识别的第一个可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称
  42187. * ("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  42188. * @param {string} [options.labelPosition='top'] - 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  42189. * @param {string} [options.labelAlign='center'] - 附加文本水平对齐。可以是 'left', 'right', 'center'。
  42190. * @param {string} [options.labelBaseline='middle'] - 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle' 。
  42191. * @param {number} [options.labelXOffset=0] - 附加文本在x轴方向的偏移量。
  42192. * @param {number} [options.labelYOffset=0] - 附加文本在y轴方向的偏移量。
  42193. */
  42194. class ThemeStyle {
  42195. constructor(options) {
  42196. options = options || {};
  42197. /**
  42198. * @member {boolean} [SuperMap.ThemeStyle.prototype.fill=true]
  42199. * @description 是否填充,不需要填充则设置为 false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  42200. */
  42201. this.fill = true;
  42202. /**
  42203. * @member {string} [SuperMap.ThemeStyle.prototype.fillColor="#000000"]
  42204. * @description 十六进制填充颜色。
  42205. */
  42206. this.fillColor = "#000000";
  42207. /**
  42208. * @member {number} [SuperMap.ThemeStyle.prototype.fillOpacity=1]
  42209. * @description 填充不透明度。取值范围[0, 1]。
  42210. */
  42211. this.fillOpacity = 1;
  42212. /**
  42213. * @member {boolean} [SuperMap.ThemeStyle.prototype.stroke=false]
  42214. * @description 是否描边,不需要描边则设置为false。如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染图层。
  42215. */
  42216. this.stroke = false;
  42217. /**
  42218. * @member {string} [SuperMap.ThemeStyle.prototype.strokeColor="#000000"]
  42219. * @description 十六进制描边颜色。
  42220. */
  42221. this.strokeColor = "#000000";
  42222. /**
  42223. * @member {number} [SuperMap.ThemeStyle.prototype.strokeOpacity=1]
  42224. * @description 描边的不透明度。取值范围[0, 1]。
  42225. */
  42226. this.strokeOpacity = 1;
  42227. /**
  42228. * @member {number} [SuperMap.ThemeStyle.prototype.strokeWidth=1]
  42229. * @description 线宽度/描边宽度。
  42230. */
  42231. this.strokeWidth = 1;
  42232. /**
  42233. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLinecap="butt"]
  42234. * @description 线帽样式;strokeLinecap 有三种类型 “butt", "round", "square" 。
  42235. */
  42236. this.strokeLinecap = "butt";
  42237. /**
  42238. * @member {string} [SuperMap.ThemeStyle.prototype.strokeLineJoin="miter"]
  42239. * @description 线段连接样式;strokeLineJoin 有三种类型 “miter", "round", "bevel"。
  42240. */
  42241. this.strokeLineJoin = "miter";
  42242. /**
  42243. * @member {string} [SuperMap.ThemeStyle.prototype.strokeDashstyle="solid"]
  42244. * @description 虚线类型; strokeDashstyle 有八种类型 “dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted";
  42245. * solid 表示实线。
  42246. */
  42247. this.strokeDashstyle = "solid";
  42248. /**
  42249. * @member {number} [SuperMap.ThemeStyle.prototype.pointRadius=6]
  42250. * @description 点半径。单位为像素。
  42251. */
  42252. this.pointRadius = 6;
  42253. /**
  42254. * @member {number} [SuperMap.ThemeStyle.prototype.shadowBlur=0]
  42255. * @description 阴影模糊度,(大于 0 有效)。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  42256. */
  42257. this.shadowBlur = 0;
  42258. /**
  42259. * @member {string} [SuperMap.ThemeStyle.prototype.shadowColor='#000000']
  42260. * @description 阴影颜色。注:请将 shadowColor 属性与 shadowBlur 属性一起使用,来创建阴影。
  42261. */
  42262. this.shadowColor = "#000000";
  42263. /**
  42264. * @member {number} [SuperMap.ThemeStyle.prototype.shadowOffsetX=0]
  42265. * @description 阴影 X 方向偏移值。
  42266. */
  42267. this.shadowOffsetX = 0;
  42268. /**
  42269. * @member {number} SuperMap.ThemeStyle.prototype.shadowOffsetY
  42270. * @description Y 方向偏移值。
  42271. */
  42272. this.shadowOffsetY = 0;
  42273. /**
  42274. * @member {string} [SuperMap.ThemeStyle.prototype.label]
  42275. * @description 专题要素附加文本标签内容。
  42276. */
  42277. this.label = "";
  42278. /**
  42279. * @member {boolean} [SuperMap.ThemeStyle.prototype.labelRect=false]
  42280. * @description 是否显示文本标签矩形背景。
  42281. */
  42282. this.labelRect = false;
  42283. /**
  42284. * @member {string} [SuperMap.ThemeStyle.prototype.fontColor]
  42285. * @description 附加文本字体颜色。
  42286. */
  42287. this.fontColor = "";
  42288. /**
  42289. * @member {number} [SuperMap.ThemeStyle.prototype.fontSize=12]
  42290. * @description 附加文本字体大小,单位是像素。
  42291. */
  42292. this.fontSize = 12;
  42293. /**
  42294. * @member {string} [SuperMap.ThemeStyle.prototype.fontStyle="normal"]
  42295. * @description 附加文本字体样式。可设值:"normal", "italic", "oblique"。
  42296. */
  42297. this.fontStyle = "normal";
  42298. /**
  42299. * @member {string} [SuperMap.ThemeStyle.prototype.fontVariant="normal"]
  42300. * @description 附加文本字体变体。可设值:"normal", "small-caps"。
  42301. */
  42302. this.fontVariant = "normal";
  42303. /**
  42304. * @member {string} [SuperMap.ThemeStyle.prototype.fontWeight="normal"]
  42305. * @description 附加文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"。
  42306. */
  42307. this.fontWeight = "normal";
  42308. /**
  42309. * @member {string} [SuperMap.ThemeStyle.prototype.fontFamily="arial,sans-serif"]
  42310. * @description 附加文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个
  42311. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。
  42312. */
  42313. this.fontFamily = "arial,sans-serif";
  42314. /**
  42315. * @member {string} [SuperMap.ThemeStyle.prototype.labelPosition='top']
  42316. * @description 附加文本位置, 可以是 'inside', 'left', 'right', 'top', 'bottom'。
  42317. */
  42318. this.labelPosition = "top";
  42319. /**
  42320. * @member {string} [SuperMap.ThemeStyle.prototype.labelAlign='center']
  42321. * @description 附加文本水平对齐。可以是 'left', 'right', 'center'。
  42322. */
  42323. this.labelAlign = "center";
  42324. /**
  42325. * @member {string} [SuperMap.ThemeStyle.prototype.labelBaseline='middle']
  42326. * @description 附加文本垂直对齐。 可以是 'top', 'bottom', 'middle'。
  42327. */
  42328. this.labelBaseline = "middle";
  42329. /**
  42330. * @member {number} [SuperMap.ThemeStyle.prototype.labelXOffset=0]
  42331. * @description 附加文本在 X 轴方向的偏移量。
  42332. */
  42333. this.labelXOffset = 0;
  42334. /**
  42335. * @member {number} [SuperMap.ThemeStyle.prototype.labelYOffset=0]
  42336. * @description 附加文本在 Y 轴方向的偏移量。
  42337. */
  42338. this.labelYOffset = 0;
  42339. Util.extend(this, options);
  42340. }
  42341. }
  42342. SuperMap.ThemeStyle = ThemeStyle;
  42343. ;// CONCATENATED MODULE: ./src/common/style/index.js
  42344. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42345. * This program are made available under the terms of the Apache License, Version 2.0
  42346. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42347. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeParameters.js
  42348. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42349. * This program are made available under the terms of the Apache License, Version 2.0
  42350. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42351. /**
  42352. * @class SuperMap.Feature.ShapeParameters
  42353. * @category Visualization Theme
  42354. * @classdesc 图形参数基类,此类不可实例化
  42355. */
  42356. class ShapeParameters {
  42357. /**
  42358. * @function SuperMap.Feature.ShapeParameters.prototype.constructor
  42359. * @description 图形参数对象。
  42360. * @returns {SuperMap.Feature.ShapeParameters} 图形参数对象。
  42361. */
  42362. constructor() {
  42363. /**
  42364. * @member {Array} [SuperMap.Feature.ShapeParameters.prototype.refOriginalPosition=[0,0]]
  42365. * @description 图形参考原点位置,图形的参考中心位置。
  42366. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  42367. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  42368. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  42369. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  42370. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  42371. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  42372. * refOriginalPosition 的值为 [0, 0] 时,图形的位置信息才是 canvas 绝对位置。
  42373. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  42374. */
  42375. this.refOriginalPosition = [0, 0];
  42376. /**
  42377. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataID
  42378. * @description 图形所关联数据的 ID(<{@link SuperMap.Feature.Vector}> 的 id)。
  42379. */
  42380. this.refDataID = null;
  42381. /**
  42382. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.isHoverByRefDataID
  42383. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  42384. */
  42385. this.isHoverByRefDataID = false;
  42386. /**
  42387. * @member {string} SuperMap.Feature.ShapeParameters.prototype.refDataHoverGroup
  42388. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  42389. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  42390. */
  42391. this.refDataHoverGroup = null;
  42392. /**
  42393. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.dataInfo
  42394. * @description 图形携带的附加数据。
  42395. */
  42396. this.dataInfo = null;
  42397. /**
  42398. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.clickable
  42399. * @description 是否可点击。
  42400. */
  42401. this.clickable = true;
  42402. /**
  42403. * @member {boolean} SuperMap.Feature.ShapeParameters.prototype.hoverable
  42404. * @description 是否可点击。
  42405. */
  42406. this.hoverable = true;
  42407. /**
  42408. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.style
  42409. * @description 图形样式对象,可设样式属性在子类中确定。
  42410. */
  42411. this.style = null;
  42412. /**
  42413. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.highlightStyle
  42414. * @description 高亮样式对象,可设样式属性与 style 的可设样式属性相同。
  42415. */
  42416. this.highlightStyle = {};
  42417. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters";
  42418. }
  42419. /**
  42420. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  42421. * @description 销毁对象。
  42422. */
  42423. destroy() {
  42424. this.refOriginalPosition = null;
  42425. this.refDataID = null;
  42426. this.isHoverByRefDataID = null;
  42427. this.refDataHoverGroup = null;
  42428. this.dataInfo = null;
  42429. this.clickable = null;
  42430. this.hoverable = null;
  42431. this.style = null;
  42432. this.highlightStyle = null;
  42433. }
  42434. }
  42435. SuperMap.Feature = SuperMap.Feature || {};
  42436. SuperMap.Feature.ShapeParameters = ShapeParameters;
  42437. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Point.js
  42438. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42439. * This program are made available under the terms of the Apache License, Version 2.0
  42440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42441. /**
  42442. * @class SuperMap.Feature.ShapeParameters.Point
  42443. * @category Visualization Theme
  42444. * @classdesc 点参数对象。
  42445. * @extends {SuperMap.Feature.ShapeParameters}
  42446. */
  42447. class Point_Point extends ShapeParameters {
  42448. /**
  42449. * @function SuperMap.Feature.ShapeParameters.Point.prototype.constructor
  42450. * @description 创建一个图形点参数对象。
  42451. * @param {number} x - 点 x 坐标,必设参数。
  42452. * @param {number} y - 点 y 坐标,必设参数。
  42453. * @returns {SuperMap.Feature.ShapeParameters.Point} 标签参数对象。
  42454. */
  42455. constructor(x, y) {
  42456. super(x, y);
  42457. /**
  42458. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.x
  42459. * @description 点 x 坐标。
  42460. */
  42461. this.x = !isNaN(x) ? x : 0;
  42462. /**
  42463. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.y
  42464. * @description 点 y 坐标。
  42465. */
  42466. this.y = !isNaN(y) ? y : 0;
  42467. /**
  42468. * @member {number} SuperMap.Feature.ShapeParameters.Point.prototype.r
  42469. * @description 点的半径。
  42470. */
  42471. this.r = 6;
  42472. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Point";
  42473. }
  42474. /**
  42475. * @function SuperMap.Feature.ShapeParameters.Point.prototype.destroy
  42476. * @description 销毁对象。
  42477. */
  42478. destroy() {
  42479. this.x = null;
  42480. this.y = null;
  42481. this.r = null;
  42482. super.destroy();
  42483. }
  42484. }
  42485. /**
  42486. * @typedef {Object} SuperMap.Feature.ShapeParameters.Point.style
  42487. * @property {number} pointRadius - 点的半径,默认值:6。
  42488. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42489. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42490. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42491. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42492. * @property {string} strokeColor - 十六进制描边颜色。
  42493. * @property {number} strokeWidth - 描边宽度,默认值 1。
  42494. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42495. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42496. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42497. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42498. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42499. */
  42500. SuperMap.Feature = SuperMap.Feature || {};
  42501. SuperMap.Feature.ShapeParameters.Point = Point_Point;
  42502. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Line.js
  42503. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42504. * This program are made available under the terms of the Apache License, Version 2.0
  42505. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42506. /**
  42507. * @class SuperMap.Feature.ShapeParameters.Line
  42508. * @category Visualization Theme
  42509. * @classdesc 线参数对象。
  42510. * @extends {SuperMap.Feature.ShapeParameters}
  42511. */
  42512. class Line_Line extends ShapeParameters {
  42513. /**
  42514. * @function SuperMap.Feature.ShapeParameters.Line.prototype.constructor
  42515. * @description 创建一个图形线参数对象。
  42516. * @param {Array} pointList - 线要素节点数组,二维数组,必设参数。
  42517. * @returns {SuperMap.Feature.ShapeParameters.Line} 圆形参数对象。
  42518. */
  42519. constructor(pointList) {
  42520. super(pointList);
  42521. /**
  42522. * @member {Array} SuperMap.Feature.ShapeParameters.Line.prototype.pointList
  42523. * @description 线要素节点数组,二维数组。
  42524. * 数组形如:
  42525. * (start code)
  42526. * [
  42527. * [10, 20], //节点
  42528. * [30, 40],
  42529. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  42530. * ]
  42531. * (end)
  42532. */
  42533. this.pointList = pointList;
  42534. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Line";
  42535. }
  42536. /**
  42537. * @function SuperMap.Feature.ShapeParameters.Line.prototype.destroy
  42538. * @description 销毁对象。
  42539. */
  42540. destroy() {
  42541. this.pointList = null;
  42542. super.destroy();
  42543. }
  42544. }
  42545. /**
  42546. * @typedef {Object} SuperMap.Feature.ShapeParameters.Line.style
  42547. * @property {string} strokeColor - 十六进制线颜色。
  42548. * @property {number} strokeWidth - 线宽度,默认值 1。
  42549. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  42550. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  42551. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  42552. * @property {number} strokeOpacity - 线的不透明度。取值范围[0, 1],默认值 1。
  42553. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42554. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42555. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42556. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42557. */
  42558. SuperMap.Feature = SuperMap.Feature || {};
  42559. SuperMap.Feature.ShapeParameters.Line = Line_Line;
  42560. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Polygon.js
  42561. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42562. * This program are made available under the terms of the Apache License, Version 2.0
  42563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42564. /**
  42565. * @class SuperMap.Feature.ShapeParameters.Polygon
  42566. * @category Visualization Theme
  42567. * @classdesc 面参数对象。
  42568. * @extends {SuperMap.Feature.ShapeParameters}
  42569. */
  42570. class Polygon_Polygon extends ShapeParameters {
  42571. /**
  42572. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.constructor
  42573. * @description 创建一个图形面参数对象。
  42574. * @param {Array} pointList - 横坐标,必设参数。
  42575. * @returns {SuperMap.Feature.ShapeParameters.Polygon} 标签参数对象。
  42576. */
  42577. constructor(pointList) {
  42578. super(pointList);
  42579. /**
  42580. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.pointList
  42581. * @description 面要素节点数组,二维数组。
  42582. * 数组形如:
  42583. * (start code)
  42584. * [
  42585. * [10, 20], //节点
  42586. * [30, 40],
  42587. * [25, 30] //最后一个节点和第一个节点不必相同,绘制时自动封闭
  42588. * ]
  42589. * (end)
  42590. */
  42591. this.pointList = pointList;
  42592. /**
  42593. * @member {Array} SuperMap.Feature.ShapeParameters.Polygon.prototype.holePolygonPointLists
  42594. * @description 岛洞面多边形顶点数组(三维数组)
  42595. */
  42596. this.holePolygonPointLists = null;
  42597. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Polygon";
  42598. }
  42599. /**
  42600. * @function SuperMap.Feature.ShapeParameters.Polygon.prototype.destroy
  42601. * @description 销毁对象。
  42602. */
  42603. destroy() {
  42604. this.pointList = null;
  42605. this.holePolygonPointLists = null;
  42606. super.destroy();
  42607. }
  42608. }
  42609. /**
  42610. * @typedef {Object} SuperMap.Feature.ShapeParameters.Polygon.style
  42611. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42612. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42613. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42614. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42615. * @property {string} strokeColor - 十六进制描边颜色。
  42616. * @property {number} strokeWidth - 描边宽度,默认值 1。
  42617. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42618. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  42619. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  42620. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  42621. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42622. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42623. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42624. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42625. */
  42626. SuperMap.Feature = SuperMap.Feature || {};
  42627. SuperMap.Feature.ShapeParameters.Polygon = Polygon_Polygon;
  42628. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Rectangle.js
  42629. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42630. * This program are made available under the terms of the Apache License, Version 2.0
  42631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42632. /**
  42633. * @class SuperMap.Feature.ShapeParameters.Rectangle
  42634. * @category Visualization Theme
  42635. * @classdesc 矩形参数对象。
  42636. * @extends {SuperMap.Feature.ShapeParameters}
  42637. */
  42638. class Rectangle_Rectangle extends ShapeParameters {
  42639. /**
  42640. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.constructor
  42641. * @description 创建一个图形矩形参数对象。
  42642. * @param {number} x - 矩形 x 坐标,必设参数。
  42643. * @param {number} y - 矩形 y 坐标,必设参数。
  42644. * @param {number} width - 矩形 width 坐标,必设参数。
  42645. * @param {number} height - 矩形 height 坐标,必设参数。
  42646. * @returns {SuperMap.Feature.ShapeParameters.Rectangle} 图形矩形参数对象。
  42647. */
  42648. constructor(x, y, width, height) {
  42649. super(x, y, width, height);
  42650. /**
  42651. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.x
  42652. * @description 左上角 x 坐标。
  42653. */
  42654. this.x = !isNaN(x) ? x : 0;
  42655. /**
  42656. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.y
  42657. * @description 左上角 y 坐标。
  42658. */
  42659. this.y = !isNaN(x) ? y : 0;
  42660. /**
  42661. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.width
  42662. * @description 宽度。
  42663. */
  42664. this.width = !isNaN(width) ? width : 0;
  42665. /**
  42666. * @member {number} SuperMap.Feature.ShapeParameters.Rectangle.prototype.height
  42667. * @description 高度。
  42668. */
  42669. this.height = !isNaN(height) ? height : 0;
  42670. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Rectangle";
  42671. }
  42672. /**
  42673. * @function SuperMap.Feature.ShapeParameters.Rectangle.prototype.destroy
  42674. * @description 销毁对象。
  42675. */
  42676. destroy() {
  42677. this.x = null;
  42678. this.y = null;
  42679. this.width = null;
  42680. this.height = null;
  42681. super.destroy();
  42682. }
  42683. }
  42684. /**
  42685. * @typedef {Object} SuperMap.Feature.ShapeParameters.Rectangle.style
  42686. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42687. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42688. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42689. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42690. * @property {string} strokeColor - 十六进制描边颜色。
  42691. * @property {number} strokeWidth - 描边宽度,默认值 1。
  42692. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42693. * @property {string} strokeLinecap - 线帽样式;strokeLinecap 有三种类型 :“butt", "round", "square"; 默认为"butt"。
  42694. * @property {string} strokeLineJoin - 线段连接样式;strokeLineJoin 有三种类型: “miter", "round", "bevel"; 默认为"miter"。
  42695. * @property {string} strokeDashstyle - 虚线类型; strokeDashstyle 有八种类型 :“dot",“dash",“dashdot",“longdash",“longdashdot",“solid", "dashed", "dotted"; 默认值 "solid"。solid 表示实线。
  42696. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42697. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42698. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42699. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42700. */
  42701. SuperMap.Feature = SuperMap.Feature || {};
  42702. SuperMap.Feature.ShapeParameters.Rectangle = Rectangle_Rectangle;
  42703. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Sector.js
  42704. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42705. * This program are made available under the terms of the Apache License, Version 2.0
  42706. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42707. /**
  42708. * @class SuperMap.Feature.ShapeParameters.Sector
  42709. * @category Visualization Theme
  42710. * @classdesc 扇形参数对象。
  42711. * @extends {SuperMap.Feature.ShapeParameters}
  42712. */
  42713. class Sector extends ShapeParameters {
  42714. /**
  42715. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.constructor
  42716. * @description 创建一个扇形参数对象。
  42717. * @param {number} x - 圆心 x 坐标,必设参数。
  42718. * @param {number} y - 圆心 y 坐标,必设参数。
  42719. * @param {number} r - 外圆半径,必设参数。
  42720. * @param {number} startAngle - 起始角度,必设参数。取值范围[0, 360)。
  42721. * @param {number} endAngle - 结束角度,必设参数。取值范围(0, 360]。
  42722. * @param {number} [r0=0] - 内圆半径,指定后将出现内弧,同时扇边长度为'r - r0'。取值范围[0, r)。
  42723. * @returns {SuperMap.Feature.ShapeParameters.Sector} 扇形参数对象。
  42724. */
  42725. constructor(x, y, r, startAngle, endAngle, r0, clockWise) {
  42726. super(x, y, r, startAngle, endAngle, r0, clockWise);
  42727. /**
  42728. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.x
  42729. * @description 圆心 x 坐标。
  42730. */
  42731. this.x = !isNaN(x) ? x : 0;
  42732. /**
  42733. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.Y
  42734. * @description 圆心 Y 坐标。
  42735. */
  42736. this.y = !isNaN(y) ? y : 0;
  42737. /**
  42738. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.r
  42739. * @description 外圆半径。
  42740. */
  42741. this.r = !isNaN(r) ? r : 0;
  42742. /**
  42743. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.startAngle
  42744. * @description 起始角度。取值范围[0, 360),默认值:null。
  42745. */
  42746. this.startAngle = !isNaN(startAngle) ? startAngle : 0;
  42747. /**
  42748. * @member {number} SuperMap.Feature.ShapeParameters.Sector.prototype.endAngle
  42749. * @description 结束角度。取值范围(0, 360],默认值:null。
  42750. */
  42751. this.endAngle = !isNaN(endAngle) ? endAngle : 0;
  42752. /**
  42753. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.r0=0]
  42754. * @description 内圆半径,指定后将出现内弧,同时扇边长度为 r 减 r0。取值范围[0, r)。
  42755. */
  42756. this.r0 = !isNaN(r0) ? r0 : 0;
  42757. /**
  42758. * @member {number} [SuperMap.Feature.ShapeParameters.Sector.prototype.clockWise=false]
  42759. * @description 是否是顺时针。默认值:false。
  42760. */
  42761. this.clockWise = clockWise;
  42762. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Sector";
  42763. }
  42764. /**
  42765. * @function SuperMap.Feature.ShapeParameters.Sector.prototype.destroy
  42766. * @description 销毁对象。
  42767. */
  42768. destroy() {
  42769. this.x = null;
  42770. this.y = null;
  42771. this.r = null;
  42772. this.startAngle = null;
  42773. this.endAngle = null;
  42774. this.r0 = null;
  42775. this.clockWise = null;
  42776. super.destroy();
  42777. }
  42778. }
  42779. /**
  42780. * @typedef {Object} SuperMap.Feature.ShapeParameters.Sector.style
  42781. * @property {boolean} fill - 是否填充,不需要填充则设置为false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42782. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42783. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42784. * @property {boolean} stroke - 是否描边,不需要描边则设置为 false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42785. * @property {string} strokeColor - 十六进制描边颜色。
  42786. * @property {number} strokeWidth - 描边宽度,默认值 1。
  42787. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42788. * @property {number} shadowBlur - 阴影模糊度,(大于 0 有效; 默认值 0)。
  42789. * @property {string} shadowColor - 阴影颜色; 默认值 '#000000'。
  42790. * @property {number} shadowOffsetX - 阴影 X 方向偏移值; 默认值 0。
  42791. * @property {number} shadowOffsetY - 阴影 Y 方向偏移值; 默认值 0。
  42792. */
  42793. SuperMap.Feature = SuperMap.Feature || {};
  42794. SuperMap.Feature.ShapeParameters.Sector = Sector;
  42795. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Label.js
  42796. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42797. * This program are made available under the terms of the Apache License, Version 2.0
  42798. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42799. /**
  42800. * @class SuperMap.Feature.ShapeParameters.Label
  42801. * @category Visualization Theme
  42802. * @classdesc 标签参数对象。
  42803. * @extent {SuperMap.Feature.ShapeParameters}
  42804. */
  42805. class Label extends ShapeParameters {
  42806. /**
  42807. * @function SuperMap.Feature.ShapeParameters.Label.prototype.constructor
  42808. * @description 创建一个标签参数对象。
  42809. * @param {number} x - 横坐标,必设参数。
  42810. * @param {number} y - 纵坐标,必设参数。
  42811. * @param {string} text - 图形中的附加文本,必设参数。
  42812. * @returns {SuperMap.Feature.ShapeParameters.Label} 标签参数对象。
  42813. */
  42814. constructor(x, y, text) {
  42815. super(x, y, text);
  42816. /**
  42817. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.x
  42818. * @description 标签 x 坐标。
  42819. */
  42820. this.x = x;
  42821. /**
  42822. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.y
  42823. * @description 标签 y 坐标。
  42824. */
  42825. this.y = y;
  42826. /**
  42827. * @member {number} SuperMap.Feature.ShapeParameters.Label.prototype.text
  42828. * @description 标签的文本内容。
  42829. */
  42830. this.text = text;
  42831. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Label";
  42832. }
  42833. /**
  42834. * @function SuperMap.Feature.ShapeParameters.Label.prototype.destroy
  42835. * @description 销毁对象。
  42836. */
  42837. destroy() {
  42838. this.x = null;
  42839. this.y = null;
  42840. this.text = null;
  42841. super.destroy();
  42842. }
  42843. }
  42844. /**
  42845. * @typedef {Object} SuperMap.Feature.ShapeParameters.Label.style
  42846. * @property {boolean} fill - 是否填充,不需要填充则设置为 false,默认值为 true。此属性与 stroke 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42847. * @property {string} fillColor - 十六进制填充颜色。默认值为 "#000000"。
  42848. * @property {number} fillOpacity - 填充不透明度。取值范围[0, 1],默认值 1。
  42849. * @property {boolean} stroke - 是否描边,不需要描边则设置为false,默认值为 false。此属性与 fill 不能同时为 false,如果 fill 与 stroke 同时为 false,将按 fill 与 stroke 的默认值渲染。
  42850. * @property {string} strokeColor - 十六进制描边颜色。
  42851. * @property {number} strokeOpacity - 描边的不透明度。取值范围[0, 1],默认值 1。
  42852. * @property {number} strokeWidth -描边宽度,默认值 1。
  42853. * @property {number} maxWidth - 最大宽度限制。默认值:null。
  42854. * @property {number} fontSize - 标签文本字体大小。默认值 12,单位是像素。
  42855. * @property {string} fontStyle - 标签文本字体样式。可设值:"normal", "italic", "oblique"; 默认值:"normal" 。
  42856. * @property {string} fontVariant - 标签文本字体变体。可设值:"normal", "small-caps"; 默认值:"normal" 。
  42857. * @property {string} fontWeight - 标签文本字体粗细。可设值:"normal", "bold", "bolder", "lighter"; 默认值:"normal" 。
  42858. * @property {string} fontFamily - 标签文本字体系列。fontFamily 值是字体族名称或/及类族名称的一个优先表,每个值逗号分割,浏览器会使用它可识别的第一个值。
  42859. * 可以使用具体的字体名称("times"、"courier"、"arial")或字体系列名称("serif"、"sans-serif"、"cursive"、"fantasy"、"monospace")。默认值:"arial,sans-serif".
  42860. * @property {string} labelBaseline - 标签文本垂直对齐, 可以是 'top', 'bottom', 'middle',默认值 'middle'。
  42861. * @property {string} labelAlign - 标签文本水平对齐。可以是 'left', 'right', 'center'; 默认值 'center'。
  42862. * @property {number} shadowBlur - 阴影模糊度,大于 0 有效。默认值:0。
  42863. * @property {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  42864. * @property {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  42865. * @property {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  42866. */
  42867. SuperMap.Feature = SuperMap.Feature || {};
  42868. SuperMap.Feature.ShapeParameters.Label = Label;
  42869. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Image.js
  42870. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42871. * This program are made available under the terms of the Apache License, Version 2.0
  42872. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42873. /**
  42874. * @class SuperMap.Feature.ShapeParameters.Image
  42875. * @category Visualization Theme
  42876. * @classdesc 图片参数对象。
  42877. * @extends {SuperMap.Feature.ShapeParameters}
  42878. */
  42879. class Image_Image extends ShapeParameters {
  42880. /**
  42881. * @function SuperMap.Feature.ShapeParameters.Image.prototype.constructor
  42882. * @description 创建一个图片参数对象。
  42883. * @param {number} x - 左上角横坐标,必设参数。
  42884. * @param {number} y - 左上角纵坐标,必设参数。
  42885. * @param {(string|Object)} image - 图片地址或Cavans对象,必设参数。
  42886. * @param {number} width - 绘制到画布上的宽度,默认为图片高度。
  42887. * @param {number} height - 绘制到画布上的高度,默认为图片高度。
  42888. * @param {number} sx - 从图片中裁剪的左上角横坐标。
  42889. * @param {number} sy - 从图片中裁剪的左上角纵坐标。
  42890. * @param {number} sWidth - 从图片中裁剪的宽度,默认为图片高度。
  42891. * @param {number} sHeight - 绘制到画布上的高度,默认为图片高度。
  42892. * @returns {SuperMap.Feature.ShapeParameters.Image} 圆形参数对象。
  42893. */
  42894. constructor(x, y, image, width, height, sx, sy, sWidth, sHeight) {
  42895. super(x, y, image, width, height, sx, sy, sWidth, sHeight);
  42896. /**
  42897. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.x
  42898. * @description 左上角横坐标,必设参数。
  42899. */
  42900. this.x = x;
  42901. /**
  42902. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.y
  42903. * @description 左上角纵坐标,必设参数。
  42904. */
  42905. this.y = y;
  42906. /**
  42907. * @member {(string|Object)} SuperMap.Feature.ShapeParameters.Image.prototype.image
  42908. * @description 图片地址。
  42909. */
  42910. this.image = image;
  42911. /**
  42912. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.width
  42913. * @description 绘制到画布上的宽度,默认为图片高度。
  42914. */
  42915. this.width = width;
  42916. /**
  42917. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.height
  42918. * @description 绘制到画布上的高度,默认为图片高度。
  42919. */
  42920. this.height = height;
  42921. /**
  42922. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sx
  42923. * @description 从图片中裁剪的左上角横坐标。
  42924. */
  42925. this.sx = sx;
  42926. /**
  42927. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sy
  42928. * @description 从图片中裁剪的左上角纵坐标。
  42929. */
  42930. this.sy = sy;
  42931. /**
  42932. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sWidth
  42933. * @description 从图片中裁剪的宽度,默认为图片高度。
  42934. */
  42935. this.sWidth = sWidth;
  42936. /**
  42937. * @member {number} SuperMap.Feature.ShapeParameters.Image.prototype.sHeight
  42938. * @description 绘制到画布上的高度,默认为图片高度。
  42939. */
  42940. this.sHeight = sHeight;
  42941. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Image";
  42942. }
  42943. /**
  42944. * @function SuperMap.Feature.ShapeParameters.Image.prototype.destroy
  42945. * @description 销毁对象。
  42946. */
  42947. destroy() {
  42948. this.x = null;
  42949. this.y = null;
  42950. this.image = null;
  42951. this.width = null;
  42952. this.height = null;
  42953. this.sx = null;
  42954. this.sy = null;
  42955. this.sWidth = null;
  42956. this.sHeight = null;
  42957. super.destroy();
  42958. }
  42959. }
  42960. SuperMap.Feature = SuperMap.Feature || {};
  42961. SuperMap.Feature.ShapeParameters.Image = Image_Image;
  42962. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Circle.js
  42963. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  42964. * This program are made available under the terms of the Apache License, Version 2.0
  42965. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  42966. /**
  42967. * @class SuperMap.Feature.ShapeParameters.Circle
  42968. * @classdesc 圆形参数对象。
  42969. * @category Visualization Theme
  42970. * @extends {SuperMap.Feature.ShapeParameters}
  42971. */
  42972. class Circle_Circle extends ShapeParameters {
  42973. /**
  42974. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.constructor
  42975. * @description 创建一个圆形参数对象。
  42976. * @param {number} x - 圆心 x 坐标,必设参数。
  42977. * @param {number} y - 圆心 y 坐标,必设参数。
  42978. * @param {number} r - 圆半径,必设参数。
  42979. * @returns {SuperMap.Feature.ShapeParameters.Circle} 圆形参数对象。
  42980. */
  42981. constructor(x, y, r) {
  42982. super(x, y, r);
  42983. /**
  42984. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.x
  42985. * @description 圆心 x 坐标。
  42986. */
  42987. this.x = !isNaN(x) ? x : 0;
  42988. /**
  42989. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.y
  42990. * @description 圆心 y 坐标。
  42991. */
  42992. this.y = !isNaN(y) ? y : 0;
  42993. /**
  42994. * @member {number} SuperMap.Feature.ShapeParameters.Circle.prototype.r
  42995. * @description 圆半径。
  42996. */
  42997. this.r = !isNaN(r) ? r : 0;
  42998. this.CLASS_NAME = "SuperMap.Feature.ShapeParameters.Circle";
  42999. }
  43000. /**
  43001. * @function SuperMap.Feature.ShapeParameters.Circle.prototype.destroy
  43002. * @description 销毁对象。
  43003. */
  43004. destroy() {
  43005. this.x = null;
  43006. this.y = null;
  43007. this.r = null;
  43008. super.destroy();
  43009. }
  43010. }
  43011. SuperMap.Feature = SuperMap.Feature || {};
  43012. SuperMap.Feature.ShapeParameters.Circle = Circle_Circle;
  43013. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Eventful.js
  43014. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43015. * This program are made available under the terms of the Apache License, Version 2.0
  43016. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43017. /**
  43018. * @class SuperMap.LevelRenderer.Eventful
  43019. * @category Visualization Theme
  43020. * @classdesc 事件分发器超类,所有支持事件处理的类均是此类的子类。
  43021. * 此类不可实例化。
  43022. * @private
  43023. */
  43024. class Eventful {
  43025. /**
  43026. * @function SuperMap.LevelRenderer.Eventful.prototype.constructor
  43027. * @description 构造函数。对象可以通过 onxxxx 绑定事件。
  43028. * 支持的事件:
  43029. * Symbolizer properties:
  43030. * onclick - {function} 默认值:null。
  43031. * onmouseover - {function} 默认值:null。
  43032. * onmouseout - {function} 默认值:null。
  43033. * onmousemove - {function} 默认值:null。
  43034. * onmousewheel - {function} 默认值:null。
  43035. * onmousedown - {function} 默认值:null。
  43036. * onmouseup - {function} 默认值:null。
  43037. * ondragstart - {function} 默认值:null。
  43038. * ondragend - {function} 默认值:null。
  43039. * ondragenter - {function} 默认值:null。
  43040. * ondragleave - {function} 默认值:null。
  43041. * ondragover - {function} 默认值:null。
  43042. * ondrop - {function} 默认值:null。
  43043. */
  43044. constructor() {
  43045. /**
  43046. * @member {Object} SuperMap.LevelRenderer.Eventful.prototype._handlers
  43047. * @description 事件处理对象(事件分发器)。
  43048. */
  43049. this._handlers = {};
  43050. this.CLASS_NAME = "SuperMap.LevelRenderer.Eventful";
  43051. }
  43052. /**
  43053. * @function {Object} SuperMap.LevelRenderer.Eventful.prototype.destroy
  43054. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  43055. */
  43056. destroy() {
  43057. this._handlers = null;
  43058. }
  43059. /**
  43060. * @function SuperMap.LevelRenderer.Eventful.prototype.one
  43061. * @description 单次触发绑定,dispatch后销毁。
  43062. * @param {string} event - 事件名。
  43063. * @param {boolean} handler - 响应函数。
  43064. * @param {Object} context - context。
  43065. * @returns {SuperMap.LevelRenderer.Eventful} this
  43066. */
  43067. one(event, handler, context) {
  43068. var _h = this._handlers;
  43069. if (!handler || !event) {
  43070. return this;
  43071. }
  43072. if (!_h[event]) {
  43073. _h[event] = [];
  43074. }
  43075. _h[event].push({
  43076. h: handler,
  43077. one: true,
  43078. ctx: context || this
  43079. });
  43080. return this;
  43081. }
  43082. /**
  43083. * @function SuperMap.LevelRenderer.Eventful.prototype.bind
  43084. * @description 绑定事件。
  43085. * @param {string} event - 事件名。
  43086. * @param {boolean} handler - 响应函数。
  43087. * @param {Object} context - context。
  43088. * @returns {SuperMap.LevelRenderer.Eventful} this
  43089. */
  43090. bind(event, handler, context) {
  43091. var _h = this._handlers;
  43092. if (!handler || !event) {
  43093. return this;
  43094. }
  43095. if (!_h[event]) {
  43096. _h[event] = [];
  43097. }
  43098. _h[event].push({
  43099. h: handler,
  43100. one: false,
  43101. ctx: context || this
  43102. });
  43103. return this;
  43104. }
  43105. /**
  43106. * @function SuperMap.LevelRenderer.Eventful.prototype.unbind
  43107. * @description 解绑事件。
  43108. * @param {string} event - 事件名。
  43109. * @param {boolean} handler - 响应函数。
  43110. * @returns {SuperMap.LevelRenderer.Eventful} this
  43111. */
  43112. unbind(event, handler) {
  43113. var _h = this._handlers;
  43114. if (!event) {
  43115. this._handlers = {};
  43116. return this;
  43117. }
  43118. if (handler) {
  43119. if (_h[event]) {
  43120. var newList = [];
  43121. for (var i = 0, l = _h[event].length; i < l; i++) {
  43122. if (_h[event][i]['h'] != handler) {
  43123. newList.push(_h[event][i]);
  43124. }
  43125. }
  43126. _h[event] = newList;
  43127. }
  43128. if (_h[event] && _h[event].length === 0) {
  43129. delete _h[event];
  43130. }
  43131. } else {
  43132. delete _h[event];
  43133. }
  43134. return this;
  43135. }
  43136. /**
  43137. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatch
  43138. * @description 事件分发。
  43139. * @param {string} type - 事件类型。
  43140. * @returns {SuperMap.LevelRenderer.Eventful} this
  43141. */
  43142. dispatch(type) {
  43143. if (this._handlers[type]) {
  43144. var args = arguments;
  43145. var argLen = args.length;
  43146. if (argLen > 3) {
  43147. args = Array.prototype.slice.call(args, 1);
  43148. }
  43149. var _h = this._handlers[type];
  43150. var len = _h.length;
  43151. for (var i = 0; i < len;) {
  43152. // Optimize advise from backbone
  43153. switch (argLen) {
  43154. case 1:
  43155. _h[i]['h'].call(_h[i]['ctx']);
  43156. break;
  43157. case 2:
  43158. _h[i]['h'].call(_h[i]['ctx'], args[1]);
  43159. break;
  43160. case 3:
  43161. _h[i]['h'].call(_h[i]['ctx'], args[1], args[2]);
  43162. break;
  43163. default:
  43164. // have more than 2 given arguments
  43165. _h[i]['h'].apply(_h[i]['ctx'], args);
  43166. break;
  43167. }
  43168. if (_h[i]['one']) {
  43169. _h.splice(i, 1);
  43170. len--;
  43171. } else {
  43172. i++;
  43173. }
  43174. }
  43175. }
  43176. return this;
  43177. }
  43178. /**
  43179. * @function SuperMap.LevelRenderer.Eventful.prototype.dispatchWithContext
  43180. * @description 带有context的事件分发,最后一个参数是事件回调的 context。
  43181. * @param {string} type - 事件类型。
  43182. * @returns {SuperMap.LevelRenderer.Eventful} this
  43183. */
  43184. dispatchWithContext(type) {
  43185. if (this._handlers[type]) {
  43186. var args = arguments;
  43187. var argLen = args.length;
  43188. if (argLen > 4) {
  43189. args = Array.prototype.slice.call(args, 1, args.length - 1);
  43190. }
  43191. var ctx = args[args.length - 1];
  43192. var _h = this._handlers[type];
  43193. var len = _h.length;
  43194. for (var i = 0; i < len;) {
  43195. // Optimize advise from backbone
  43196. switch (argLen) {
  43197. case 1:
  43198. _h[i]['h'].call(ctx);
  43199. break;
  43200. case 2:
  43201. _h[i]['h'].call(ctx, args[1]);
  43202. break;
  43203. case 3:
  43204. _h[i]['h'].call(ctx, args[1], args[2]);
  43205. break;
  43206. default:
  43207. // have more than 2 given arguments
  43208. _h[i]['h'].apply(ctx, args);
  43209. break;
  43210. }
  43211. if (_h[i]['one']) {
  43212. _h.splice(i, 1);
  43213. len--;
  43214. } else {
  43215. i++;
  43216. }
  43217. }
  43218. }
  43219. return this;
  43220. }
  43221. }
  43222. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Vector.js
  43223. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43224. * This program are made available under the terms of the Apache License, Version 2.0
  43225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43226. /**
  43227. * @private
  43228. * @class SuperMap.LevelRenderer.Tool.Vector
  43229. * @category Visualization Theme
  43230. * @classdesc LevelRenderer 二维向量类
  43231. *
  43232. */
  43233. class levelRenderer_Vector_Vector {
  43234. /**
  43235. * @function SuperMap.LevelRenderer.Tool.Vector.constructor
  43236. * @description 构造函数
  43237. */
  43238. constructor() {
  43239. this.ArrayCtor = typeof Float32Array === 'undefined'
  43240. ? Array
  43241. : Float32Array;
  43242. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Vector";
  43243. }
  43244. /**
  43245. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.create
  43246. * @description 创建一个向量。
  43247. *
  43248. * @param {number} x - x坐标
  43249. * @param {number} y - Y坐标
  43250. * @return {Vector2} 向量。
  43251. */
  43252. create(x, y) {
  43253. var ArrayCtor = this.ArrayCtor;
  43254. var out = new ArrayCtor(2);
  43255. out[0] = x || 0;
  43256. out[1] = y || 0;
  43257. return out;
  43258. }
  43259. /**
  43260. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.copy
  43261. * @description 复制一个向量。
  43262. *
  43263. * @param {Vector2} out - 基础向量。
  43264. * @param {Vector2} v - 向量。
  43265. * @return {Vector2} 克隆向量。
  43266. */
  43267. copy(out, v) {
  43268. out[0] = v[0];
  43269. out[1] = v[1];
  43270. return out;
  43271. }
  43272. /**
  43273. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.set
  43274. * @description 设置向量的两个项。
  43275. *
  43276. * @param {Vector2} out - 基础向量。
  43277. * @param {number} a - 项 a。
  43278. * @param {number} b - 项 b。
  43279. * @return {Vector2} 结果。
  43280. */
  43281. set(out, a, b) {
  43282. out[0] = a;
  43283. out[1] = b;
  43284. return out;
  43285. }
  43286. /**
  43287. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.add
  43288. * @description 向量相加。
  43289. *
  43290. * @param {Vector2} out - 基础向量。
  43291. * @param {Vector2} v1 - 向量 v1。
  43292. * @param {Vector2} v2 - 向量 v2。
  43293. * @return {Vector2} 结果。
  43294. */
  43295. add(out, v1, v2) {
  43296. out[0] = v1[0] + v2[0];
  43297. out[1] = v1[1] + v2[1];
  43298. return out;
  43299. }
  43300. /**
  43301. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scaleAndAdd
  43302. * @description 向量缩放后相加。
  43303. * @param {Vector2} out - 基础向量。
  43304. * @param {Vector2} v1 - 向量 v1。
  43305. * @param {Vector2} v2 - 向量 v2(缩放向量)。
  43306. * @param {number} a - 缩放参数。
  43307. * @return {Vector2} 结果。
  43308. */
  43309. scaleAndAdd(out, v1, v2, a) {
  43310. out[0] = v1[0] + v2[0] * a;
  43311. out[1] = v1[1] + v2[1] * a;
  43312. return out;
  43313. }
  43314. /**
  43315. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.sub
  43316. * @description 向量相减。
  43317. * @param {Vector2} out - 基础向量。
  43318. * @param {Vector2} v1 - 向量 v1。
  43319. * @param {Vector2} v2 - 向量 v2。
  43320. * @return {Vector2} 结果。
  43321. */
  43322. sub(out, v1, v2) {
  43323. out[0] = v1[0] - v2[0];
  43324. out[1] = v1[1] - v2[1];
  43325. return out;
  43326. }
  43327. /**
  43328. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.len
  43329. * @description 向量长度。
  43330. * @param {Vector2} v - 向量。
  43331. * @return {number} 向量长度。
  43332. */
  43333. len(v) {
  43334. return Math.sqrt(this.lenSquare(v));
  43335. }
  43336. /**
  43337. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lenSquare
  43338. * @description 向量长度平方。
  43339. * @param {Vector2} v - 向量。
  43340. * @return {number} 向量长度平方。
  43341. */
  43342. lenSquare(v) {
  43343. return v[0] * v[0] + v[1] * v[1];
  43344. }
  43345. /**
  43346. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.mul
  43347. * @description 向量乘法。
  43348. * @param {Vector2} out - 基础向量。
  43349. * @param {Vector2} v1 - 向量 v1。
  43350. * @param {Vector2} v2 - 向量 v2。
  43351. * @return {Vector2} 结果。
  43352. */
  43353. mul(out, v1, v2) {
  43354. out[0] = v1[0] * v2[0];
  43355. out[1] = v1[1] * v2[1];
  43356. return out;
  43357. }
  43358. /**
  43359. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.div
  43360. * @description 向量除法。
  43361. *
  43362. * @param {Vector2} out - 基础向量。
  43363. * @param {Vector2} v1 - 向量 v1。
  43364. * @param {Vector2} v2 - 向量 v2。
  43365. * @return {Vector2} 结果。
  43366. */
  43367. div(out, v1, v2) {
  43368. out[0] = v1[0] / v2[0];
  43369. out[1] = v1[1] / v2[1];
  43370. return out;
  43371. }
  43372. /**
  43373. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dot
  43374. * @description 向量点乘。
  43375. *
  43376. * @param {Vector2} v1 - 向量 v1。
  43377. * @param {Vector2} v2 - 向量 v2。
  43378. * @return {number} 向量点乘。
  43379. */
  43380. dot(v1, v2) {
  43381. return v1[0] * v2[0] + v1[1] * v2[1];
  43382. }
  43383. /**
  43384. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.scale
  43385. * @description 向量缩放。
  43386. *
  43387. * @param {Vector2} out - 基础向量。
  43388. * @param {Vector2} v - 向量v。
  43389. * @param {number} s -缩放参数。
  43390. * @return {Vector2} 结果。
  43391. */
  43392. scale(out, v, s) {
  43393. out[0] = v[0] * s;
  43394. out[1] = v[1] * s;
  43395. return out;
  43396. }
  43397. /**
  43398. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.normalize
  43399. * @description 向量归一化。
  43400. *
  43401. * @param {Vector2} out - 基础向量。
  43402. * @param {Vector2} v - 向量 v。
  43403. * @return {Vector2} 结果。
  43404. */
  43405. normalize(out, v) {
  43406. var d = this.len(v);
  43407. if (d === 0) {
  43408. out[0] = 0;
  43409. out[1] = 0;
  43410. } else {
  43411. out[0] = v[0] / d;
  43412. out[1] = v[1] / d;
  43413. }
  43414. return out;
  43415. }
  43416. /**
  43417. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distance
  43418. * @description 计算向量间距离。
  43419. *
  43420. * @param {Vector2} v1 - 向量 v1。
  43421. * @param {Vector2} v2 - 向量 v2。
  43422. * @return {number} 向量间距离。
  43423. */
  43424. distance(v1, v2) {
  43425. return Math.sqrt(
  43426. (v1[0] - v2[0]) * (v1[0] - v2[0])
  43427. + (v1[1] - v2[1]) * (v1[1] - v2[1])
  43428. );
  43429. }
  43430. /**
  43431. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distanceSquare
  43432. * @description 向量距离平方。
  43433. *
  43434. * @param {Vector2} v1 - 向量 v1。
  43435. * @param {Vector2} v2 - 向量 v2。
  43436. * @return {number} 向量距离平方。
  43437. */
  43438. distanceSquare(v1, v2) {
  43439. return (v1[0] - v2[0]) * (v1[0] - v2[0])
  43440. + (v1[1] - v2[1]) * (v1[1] - v2[1]);
  43441. }
  43442. /**
  43443. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.negate
  43444. * @description 求负向量。
  43445. *
  43446. * @param {Vector2} out - 基础向量。
  43447. * @param {Vector2} v - 向量 v。
  43448. * @return {Vector2} 负向量。
  43449. */
  43450. negate(out, v) {
  43451. out[0] = -v[0];
  43452. out[1] = -v[1];
  43453. return out;
  43454. }
  43455. /**
  43456. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lerp
  43457. * @description 两点之间线性插值。
  43458. *
  43459. * @param {Vector2} out - 基础向量。
  43460. * @param {Vector2} v1 - 向量 v1。
  43461. * @param {Vector2} v2 - 向量 v2。
  43462. * @param {number} t
  43463. * @return {Vector2} 结果。
  43464. */
  43465. lerp(out, v1, v2, t) {
  43466. out[0] = v1[0] + t * (v2[0] - v1[0]);
  43467. out[1] = v1[1] + t * (v2[1] - v1[1]);
  43468. return out;
  43469. }
  43470. /**
  43471. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.applyTransform
  43472. * @description 矩阵左乘向量。
  43473. *
  43474. * @param {Vector2} out - 基础向量。
  43475. * @param {Vector2} v1 - 向量 v1。
  43476. * @param {Vector2} v2 - 向量 v2。
  43477. * @return {Vector2} 结果。
  43478. */
  43479. applyTransform(out, v, m) {
  43480. var x = v[0];
  43481. var y = v[1];
  43482. out[0] = m[0] * x + m[2] * y + m[4];
  43483. out[1] = m[1] * x + m[3] * y + m[5];
  43484. return out;
  43485. }
  43486. /**
  43487. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.min
  43488. * @description 求两个向量最小值。
  43489. * @param {Vector2} out - 基础向量。
  43490. * @param {Vector2} v1 - 向量 v1。
  43491. * @param {Vector2} v2 - 向量 v2。
  43492. * @return {Vector2} 结果。
  43493. */
  43494. min(out, v1, v2) {
  43495. out[0] = Math.min(v1[0], v2[0]);
  43496. out[1] = Math.min(v1[1], v2[1]);
  43497. return out;
  43498. }
  43499. /**
  43500. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.max
  43501. * @description 求两个向量最大值。
  43502. *
  43503. * @param {Vector2} out - 基础向量。
  43504. * @param {Vector2} v1 - 向量 v1。
  43505. * @param {Vector2} v2 - 向量 v2。
  43506. * @return {Vector2} 结果。
  43507. */
  43508. max(out, v1, v2) {
  43509. out[0] = Math.max(v1[0], v2[0]);
  43510. out[1] = Math.max(v1[1], v2[1]);
  43511. return out;
  43512. }
  43513. /**
  43514. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.length
  43515. * @description 向量长度。
  43516. *
  43517. * @param {Vector2} v - 向量。
  43518. * @return {number} 向量长度。
  43519. */
  43520. length(v) {
  43521. return this.len(v);
  43522. }
  43523. /**
  43524. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.lengthSquare
  43525. * @description 向量长度平方。
  43526. *
  43527. * @param {Vector2} v - 向量。
  43528. * @return {number} 向量长度平方。
  43529. */
  43530. lengthSquare(v) {
  43531. return this.lenSquare(v);
  43532. }
  43533. /**
  43534. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.dist
  43535. * @description 计算向量间距离。
  43536. *
  43537. * @param {Vector2} v1 - 向量 v1。
  43538. * @param {Vector2} v2 - 向量 v2。
  43539. * @return {number} 向量间距离。
  43540. */
  43541. dist(v1, v2) {
  43542. return this.distance(v1, v2);
  43543. }
  43544. /**
  43545. * @function SuperMap.LevelRenderer.Tool.Vector.prototype.distSquare
  43546. * @description 向量距离平方。
  43547. *
  43548. * @param {Vector2} v1 - 向量 v1。
  43549. * @param {Vector2} v2 - 向量 v2。
  43550. * @return {number} 向量距离平方
  43551. */
  43552. distSquare(v1, v2) {
  43553. return this.distanceSquare(v1, v2);
  43554. }
  43555. }
  43556. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Curve.js
  43557. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  43558. * This program are made available under the terms of the Apache License, Version 2.0
  43559. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  43560. /**
  43561. * @class SuperMap.LevelRenderer.Tool.Curve
  43562. * @category Visualization Theme
  43563. * @classdesc LevelRenderer 工具-曲线
  43564. * @private
  43565. */
  43566. class Curve_Curve {
  43567. /**
  43568. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.constructor
  43569. * @description 构造函数。
  43570. */
  43571. constructor() {
  43572. /**
  43573. * @member {SuperMap.LevelRenderer.Tool.Vector} SuperMap.LevelRenderer.Tool.Curve.prototype.vector
  43574. * @description 矢量工具。
  43575. */
  43576. this.vector = new levelRenderer_Vector_Vector();
  43577. /**
  43578. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.EPSILON
  43579. * @description e。
  43580. */
  43581. this.EPSILON = 1e-4;
  43582. /**
  43583. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.THREE_SQRT
  43584. * @description 3 的平方根。
  43585. */
  43586. this.THREE_SQRT = Math.sqrt(3);
  43587. /**
  43588. * @member {number} SuperMap.LevelRenderer.Tool.Curve.prototype.ONE_THIRD
  43589. * @description 1/3。
  43590. */
  43591. this.ONE_THIRD = 1 / 3;
  43592. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Curve";
  43593. }
  43594. /*
  43595. * Method: evalCubicCoeff
  43596. *
  43597. * Parameters:
  43598. * a - {number} 值。
  43599. * b - {number} 值。
  43600. * c - {number} 值。
  43601. * d - {number} 值。
  43602. * t - {number} 值。
  43603. *
  43604. * Returns:
  43605. * {number}
  43606. */
  43607. /*
  43608. evalCubicCoeff: function(a, b, c, d, t){
  43609. return ((a * t + b) * t + c) * t + d;
  43610. },
  43611. */
  43612. /**
  43613. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isAroundZero
  43614. * @description 判断一个值是否趋于0,判断参考值:1e-4。
  43615. * @param {number} val - 值。
  43616. * @returns {boolean} 值是否趋于0。
  43617. */
  43618. isAroundZero(val) {
  43619. return val > -this.EPSILON && val < this.EPSILON;
  43620. }
  43621. /**
  43622. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.isNotAroundZero
  43623. * @description 判断一个值是否不趋于0,判断参考值:1e-4。
  43624. * @param {number} val - 值。
  43625. * @returns {boolean} 值是否不趋于0。
  43626. */
  43627. isNotAroundZero(val) {
  43628. return val > this.EPSILON || val < -this.EPSILON;
  43629. }
  43630. /**
  43631. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicAt
  43632. * @description 计算三次贝塞尔值
  43633. * @param {number} p0 - 点p0。
  43634. * @param {number} p1 - 点p1。
  43635. * @param {number} p2 - 点p2。
  43636. * @param {number} p3 - 点p3。
  43637. * @param {number} t - t值。
  43638. * @returns {number} 三次贝塞尔值。
  43639. */
  43640. cubicAt(p0, p1, p2, p3, t) {
  43641. var onet = 1 - t;
  43642. return onet * onet * (onet * p0 + 3 * t * p1)
  43643. + t * t * (t * p3 + 3 * onet * p2);
  43644. }
  43645. /**
  43646. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicDerivativeAt
  43647. * @description 计算三次贝塞尔导数值
  43648. * @param {number} p0 - 点p0。
  43649. * @param {number} p1 - 点p1。
  43650. * @param {number} p2 - 点p2。
  43651. * @param {number} p3 - 点p3。
  43652. * @param {number} t - t值。
  43653. * @returns {number} 三次贝塞尔导数值。
  43654. */
  43655. cubicDerivativeAt(p0, p1, p2, p3, t) {
  43656. var onet = 1 - t;
  43657. return 3 * (
  43658. ((p1 - p0) * onet + 2 * (p2 - p1) * t) * onet
  43659. + (p3 - p2) * t * t
  43660. );
  43661. }
  43662. /**
  43663. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  43664. * @description 计算三次贝塞尔方程根,使用盛金公式
  43665. * @param {number} p0 - 点p0。
  43666. * @param {number} p1 - 点p1。
  43667. * @param {number} p2 - 点p2。
  43668. * @param {number} p3 - 点p3。
  43669. * @param {number} val - 值。
  43670. * @param {Array.<number>} roots - 有效根数目。
  43671. * @returns {number} 有效根。
  43672. */
  43673. cubicRootAt(p0, p1, p2, p3, val, roots) {
  43674. // Evaluate roots of cubic functions
  43675. var a = p3 + 3 * (p1 - p2) - p0;
  43676. var b = 3 * (p2 - p1 * 2 + p0);
  43677. var c = 3 * (p1 - p0);
  43678. var d = p0 - val;
  43679. var A = b * b - 3 * a * c;
  43680. var B = b * c - 9 * a * d;
  43681. var C = c * c - 3 * b * d;
  43682. var n = 0;
  43683. if (this.isAroundZero(A) && this.isAroundZero(B)) {
  43684. if (this.isAroundZero(b)) {
  43685. roots[0] = 0;
  43686. } else {
  43687. let t1 = -c / b; //t1, t2, t3, b is not zero
  43688. if (t1 >= 0 && t1 <= 1) {
  43689. roots[n++] = t1;
  43690. }
  43691. }
  43692. } else {
  43693. var disc = B * B - 4 * A * C;
  43694. if (this.isAroundZero(disc)) {
  43695. var K = B / A;
  43696. let t1 = -b / a + K; // t1, a is not zero
  43697. let t2 = -K / 2; // t2, t3
  43698. if (t1 >= 0 && t1 <= 1) {
  43699. roots[n++] = t1;
  43700. }
  43701. if (t2 >= 0 && t2 <= 1) {
  43702. roots[n++] = t2;
  43703. }
  43704. } else if (disc > 0) {
  43705. let discSqrt = Math.sqrt(disc);
  43706. let Y1 = A * b + 1.5 * a * (-B + discSqrt);
  43707. let Y2 = A * b + 1.5 * a * (-B - discSqrt);
  43708. if (Y1 < 0) {
  43709. Y1 = -Math.pow(-Y1, this.ONE_THIRD);
  43710. } else {
  43711. Y1 = Math.pow(Y1, this.ONE_THIRD);
  43712. }
  43713. if (Y2 < 0) {
  43714. Y2 = -Math.pow(-Y2, this.ONE_THIRD);
  43715. } else {
  43716. Y2 = Math.pow(Y2, this.ONE_THIRD);
  43717. }
  43718. let t1 = (-b - (Y1 + Y2)) / (3 * a);
  43719. if (t1 >= 0 && t1 <= 1) {
  43720. roots[n++] = t1;
  43721. }
  43722. } else {
  43723. var T = (2 * A * b - 3 * a * B) / (2 * Math.sqrt(A * A * A));
  43724. var theta = Math.acos(T) / 3;
  43725. var ASqrt = Math.sqrt(A);
  43726. var tmp = Math.cos(theta);
  43727. let t1 = (-b - 2 * ASqrt * tmp) / (3 * a);
  43728. let t2 = (-b + ASqrt * (tmp + this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  43729. let t3 = (-b + ASqrt * (tmp - this.THREE_SQRT * Math.sin(theta))) / (3 * a);
  43730. if (t1 >= 0 && t1 <= 1) {
  43731. roots[n++] = t1;
  43732. }
  43733. if (t2 >= 0 && t2 <= 1) {
  43734. roots[n++] = t2;
  43735. }
  43736. if (t3 >= 0 && t3 <= 1) {
  43737. roots[n++] = t3;
  43738. }
  43739. }
  43740. }
  43741. return n;
  43742. }
  43743. /**
  43744. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicRootAt
  43745. * @description 计算三次贝塞尔方程极限值的位置
  43746. * @param {number} p0 - 点p0。
  43747. * @param {number} p1 - 点p1。
  43748. * @param {number} p2 - 点p2。
  43749. * @param {number} p3 - 点p3。
  43750. * @param {Array.<number>} extrema - 值。
  43751. * @returns {number} 有效数目。
  43752. */
  43753. cubicExtrema(p0, p1, p2, p3, extrema) {
  43754. var b = 6 * p2 - 12 * p1 + 6 * p0;
  43755. var a = 9 * p1 + 3 * p3 - 3 * p0 - 9 * p2;
  43756. var c = 3 * p1 - 3 * p0;
  43757. var n = 0;
  43758. if (this.isAroundZero(a)) {
  43759. if (this.isNotAroundZero(b)) {
  43760. let t1 = -c / b;
  43761. if (t1 >= 0 && t1 <= 1) {
  43762. extrema[n++] = t1;
  43763. }
  43764. }
  43765. } else {
  43766. var disc = b * b - 4 * a * c;
  43767. if (this.isAroundZero(disc)) {
  43768. extrema[0] = -b / (2 * a);
  43769. } else if (disc > 0) {
  43770. let discSqrt = Math.sqrt(disc);
  43771. let t1 = (-b + discSqrt) / (2 * a);
  43772. let t2 = (-b - discSqrt) / (2 * a);
  43773. if (t1 >= 0 && t1 <= 1) {
  43774. extrema[n++] = t1;
  43775. }
  43776. if (t2 >= 0 && t2 <= 1) {
  43777. extrema[n++] = t2;
  43778. }
  43779. }
  43780. }
  43781. return n;
  43782. }
  43783. /**
  43784. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicSubdivide
  43785. * @description 细分三次贝塞尔曲线
  43786. * @param {number} p0 - 点p0。
  43787. * @param {number} p1 - 点p1。
  43788. * @param {number} p2 - 点p2。
  43789. * @param {number} p3 - 点p3。
  43790. * @param {number} t - t值。
  43791. * @param {Array.<number>} out - 投射点。
  43792. * @returns {number} 投射点。
  43793. */
  43794. cubicSubdivide(p0, p1, p2, p3, t, out) {
  43795. var p01 = (p1 - p0) * t + p0;
  43796. var p12 = (p2 - p1) * t + p1;
  43797. var p23 = (p3 - p2) * t + p2;
  43798. var p012 = (p12 - p01) * t + p01;
  43799. var p123 = (p23 - p12) * t + p12;
  43800. var p0123 = (p123 - p012) * t + p012;
  43801. // Seg0
  43802. out[0] = p0;
  43803. out[1] = p01;
  43804. out[2] = p012;
  43805. out[3] = p0123;
  43806. // Seg1
  43807. out[4] = p0123;
  43808. out[5] = p123;
  43809. out[6] = p23;
  43810. out[7] = p3;
  43811. }
  43812. /**
  43813. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.cubicProjectPoint
  43814. * @description 投射点到三次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  43815. * @param {number} x0 - 点p0横坐标。
  43816. * @param {number} y0 - 点p0纵坐标。
  43817. * @param {number} x1 - 点p1横坐标。
  43818. * @param {number} y1 - 点p1纵坐标。
  43819. * @param {number} x2 - 点p2横坐标。
  43820. * @param {number} y2 - 点p2纵坐标。
  43821. * @param {number} x3 - 点p3横坐标。
  43822. * @param {number} y3 - 点p3纵坐标。
  43823. * @param {number} x - 点p横坐标。
  43824. * @param {number} y - 点p纵坐标。
  43825. * @param {Array.<number>} out - 投射点。
  43826. * @returns {number} 投射点。
  43827. */
  43828. cubicProjectPoint(x0, y0, x1, y1, x2, y2, x3, y3, x, y, out) {
  43829. // 临时变量
  43830. var _v0 = this.vector.create();
  43831. var _v1 = this.vector.create();
  43832. var _v2 = this.vector.create();
  43833. // var _v3 = vector.create();
  43834. // http://pomax.github.io/bezierinfo/#projections
  43835. var t;
  43836. var interval = 0.005;
  43837. var d = Infinity;
  43838. _v0[0] = x;
  43839. _v0[1] = y;
  43840. // 先粗略估计一下可能的最小距离的 t 值
  43841. // PENDING
  43842. for (let _t = 0; _t < 1; _t += 0.05) {
  43843. _v1[0] = this.cubicAt(x0, x1, x2, x3, _t);
  43844. _v1[1] = this.cubicAt(y0, y1, y2, y3, _t);
  43845. let d1 = this.vector.distSquare(_v0, _v1);
  43846. if (d1 < d) {
  43847. t = _t;
  43848. d = d1;
  43849. }
  43850. }
  43851. d = Infinity;
  43852. // At most 32 iteration
  43853. for (let i = 0; i < 32; i++) {
  43854. if (interval < this.EPSILON) {
  43855. break;
  43856. }
  43857. let prev = t - interval;
  43858. let next = t + interval;
  43859. // t - interval
  43860. _v1[0] = this.cubicAt(x0, x1, x2, x3, prev);
  43861. _v1[1] = this.cubicAt(y0, y1, y2, y3, prev);
  43862. let d1 = this.vector.distSquare(_v1, _v0);
  43863. if (prev >= 0 && d1 < d) {
  43864. t = prev;
  43865. d = d1;
  43866. } else {
  43867. // t + interval
  43868. _v2[0] = this.cubicAt(x0, x1, x2, x3, next);
  43869. _v2[1] = this.cubicAt(y0, y1, y2, y3, next);
  43870. let d2 = this.vector.distSquare(_v2, _v0);
  43871. if (next <= 1 && d2 < d) {
  43872. t = next;
  43873. d = d2;
  43874. } else {
  43875. interval *= 0.5;
  43876. }
  43877. }
  43878. }
  43879. // t
  43880. if (out) {
  43881. out[0] = this.cubicAt(x0, x1, x2, x3, t);
  43882. out[1] = this.cubicAt(y0, y1, y2, y3, t);
  43883. }
  43884. // console.log(interval, i);
  43885. return Math.sqrt(d);
  43886. }
  43887. /**
  43888. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  43889. * @description 计算二次方贝塞尔值。
  43890. * @param {number} p0 - 点p0。
  43891. * @param {number} p1 - 点p1。
  43892. * @param {number} p2 - 点p2。
  43893. * @param {number} t - t值。
  43894. * @returns {number} 二次方贝塞尔值。
  43895. */
  43896. quadraticAt(p0, p1, p2, t) {
  43897. var onet = 1 - t;
  43898. return onet * (onet * p0 + 2 * t * p1) + t * t * p2;
  43899. }
  43900. /**
  43901. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticAt
  43902. * @description 计算二次方贝塞尔导数值。
  43903. * @param {number} p0 - 点p0。
  43904. * @param {number} p1 - 点p1。
  43905. * @param {number} p2 - 点p2。
  43906. * @param {number} t - t值。
  43907. * @returns {number} 二次方贝塞尔导数值。
  43908. */
  43909. quadraticDerivativeAt(p0, p1, p2, t) {
  43910. return 2 * ((1 - t) * (p1 - p0) + t * (p2 - p1));
  43911. }
  43912. /**
  43913. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticRootAt
  43914. * @description 计算二次方贝塞尔方程根
  43915. * @param {number} p0 - 点p0。
  43916. * @param {number} p1 - 点p1。
  43917. * @param {number} p2 - 点p2。
  43918. * @param {number} val - 值。
  43919. * @param {Array.<number>} roots - 有效根数目。
  43920. * @returns {number} 有效根数目。
  43921. */
  43922. quadraticRootAt(p0, p1, p2, val, roots) {
  43923. var a = p0 - 2 * p1 + p2;
  43924. var b = 2 * (p1 - p0);
  43925. var c = p0 - val;
  43926. var n = 0;
  43927. if (this.isAroundZero(a)) {
  43928. if (this.isNotAroundZero(b)) {
  43929. var t1 = -c / b;
  43930. if (t1 >= 0 && t1 <= 1) {
  43931. roots[n++] = t1;
  43932. }
  43933. }
  43934. } else {
  43935. var disc = b * b - 4 * a * c;
  43936. if (this.isAroundZero(disc)) {
  43937. let t1 = -b / (2 * a);
  43938. if (t1 >= 0 && t1 <= 1) {
  43939. roots[n++] = t1;
  43940. }
  43941. } else if (disc > 0) {
  43942. let discSqrt = Math.sqrt(disc);
  43943. let t1 = (-b + discSqrt) / (2 * a);
  43944. let t2 = (-b - discSqrt) / (2 * a);
  43945. if (t1 >= 0 && t1 <= 1) {
  43946. roots[n++] = t1;
  43947. }
  43948. if (t2 >= 0 && t2 <= 1) {
  43949. roots[n++] = t2;
  43950. }
  43951. }
  43952. }
  43953. return n;
  43954. }
  43955. /**
  43956. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticExtremum
  43957. * @description 计算二次贝塞尔方程极限值
  43958. * @param {number} p0 - 点p0。
  43959. * @param {number} p1 - 点p1。
  43960. * @param {number} p2 - 点p2。
  43961. * @returns {number} 二次贝塞尔方程极限值。
  43962. */
  43963. quadraticExtremum(p0, p1, p2) {
  43964. var divider = p0 + p2 - 2 * p1;
  43965. if (divider === 0) {
  43966. // p1 is center of p0 and p2
  43967. return 0.5;
  43968. } else {
  43969. return (p0 - p1) / divider;
  43970. }
  43971. }
  43972. /**
  43973. * @function SuperMap.LevelRenderer.Tool.Curve.prototype.quadraticProjectPoint
  43974. * @description 投射点到二次贝塞尔曲线上,返回投射距离。投射点有可能会有一个或者多个,这里只返回其中距离最短的一个。
  43975. * @param {number} x0 - 点p0横坐标。
  43976. * @param {number} y0 - 点p0纵坐标。
  43977. * @param {number} x1 - 点p1横坐标。
  43978. * @param {number} y1 - 点p1纵坐标。
  43979. * @param {number} x2 - 点p2横坐标。
  43980. * @param {number} y2 - 点p2纵坐标。
  43981. * @param {number} x - 点p横坐标。
  43982. * @param {number} y - 点p纵坐标。
  43983. * @param {Array.<number>} out - 投射点。
  43984. * @returns {number} 投射距离。
  43985. */
  43986. quadraticProjectPoint(x0, y0, x1, y1, x2, y2, x, y, out) {
  43987. // 临时变量
  43988. var _v0 = this.vector.create();
  43989. var _v1 = this.vector.create();
  43990. var _v2 = this.vector.create();
  43991. // http://pomax.github.io/bezierinfo/#projections
  43992. var t;
  43993. var interval = 0.005;
  43994. var d = Infinity;
  43995. _v0[0] = x;
  43996. _v0[1] = y;
  43997. // 先粗略估计一下可能的最小距离的 t 值
  43998. // PENDING
  43999. for (let _t = 0; _t < 1; _t += 0.05) {
  44000. _v1[0] = this.quadraticAt(x0, x1, x2, _t);
  44001. _v1[1] = this.quadraticAt(y0, y1, y2, _t);
  44002. let d1 = this.vector.distSquare(_v0, _v1);
  44003. if (d1 < d) {
  44004. t = _t;
  44005. d = d1;
  44006. }
  44007. }
  44008. d = Infinity;
  44009. // At most 32 iteration
  44010. for (let i = 0; i < 32; i++) {
  44011. if (interval < this.EPSILON) {
  44012. break;
  44013. }
  44014. let prev = t - interval;
  44015. let next = t + interval;
  44016. // t - interval
  44017. _v1[0] = this.quadraticAt(x0, x1, x2, prev);
  44018. _v1[1] = this.quadraticAt(y0, y1, y2, prev);
  44019. let d1 = this.vector.distSquare(_v1, _v0);
  44020. if (prev >= 0 && d1 < d) {
  44021. t = prev;
  44022. d = d1;
  44023. } else {
  44024. // t + interval
  44025. _v2[0] = this.quadraticAt(x0, x1, x2, next);
  44026. _v2[1] = this.quadraticAt(y0, y1, y2, next);
  44027. let d2 = this.vector.distSquare(_v2, _v0);
  44028. if (next <= 1 && d2 < d) {
  44029. t = next;
  44030. d = d2;
  44031. } else {
  44032. interval *= 0.5;
  44033. }
  44034. }
  44035. }
  44036. // t
  44037. if (out) {
  44038. out[0] = this.quadraticAt(x0, x1, x2, t);
  44039. out[1] = this.quadraticAt(y0, y1, y2, t);
  44040. }
  44041. // console.log(interval, i);
  44042. return Math.sqrt(d);
  44043. }
  44044. }
  44045. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Area.js
  44046. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  44047. * This program are made available under the terms of the Apache License, Version 2.0
  44048. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  44049. /**
  44050. * @class SuperMap.LevelRenderer.Tool.Area
  44051. * @category Visualization Theme
  44052. * @classdesc LevelRenderer 工具-图形范围判断
  44053. * @private
  44054. */
  44055. class Area {
  44056. /**
  44057. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.constructor
  44058. * @description 构造函数。
  44059. */
  44060. constructor() {
  44061. /**
  44062. * @member {SuperMap.LevelRenderer.Tool.Util} SuperMap.LevelRenderer.Tool.Areal.prototype.util
  44063. * @description 基础工具对象。
  44064. */
  44065. this.util = new Util_Util();
  44066. /**
  44067. * @member {SuperMap.LevelRenderer.Tool.Curve} SuperMap.LevelRenderer.Tool.Areal.prototype.curve
  44068. * @description 曲线工具对象
  44069. */
  44070. this.curve = new Curve_Curve();
  44071. /**
  44072. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._ctx
  44073. * @description Cavans2D 渲染上下文
  44074. */
  44075. this._ctx = null;
  44076. /**
  44077. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCache
  44078. * @description 文本宽度缓存
  44079. */
  44080. this._textWidthCache = {};
  44081. /**
  44082. * @member {Object} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCache
  44083. * @description 文本高度缓存
  44084. */
  44085. this._textHeightCache = {};
  44086. /**
  44087. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textWidthCacheCounter
  44088. * @description 文本宽度缓存数量
  44089. */
  44090. this._textWidthCacheCounter = 0;
  44091. /**
  44092. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype._textHeightCacheCounter
  44093. * @description 文本高度缓存数量
  44094. */
  44095. this._textHeightCacheCounter = 0;
  44096. /**
  44097. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.TEXT_CACHE_MAX
  44098. * @description 文本最大缓存数量
  44099. */
  44100. this.TEXT_CACHE_MAX = 5000;
  44101. /**
  44102. * @member {number} SuperMap.LevelRenderer.Tool.Areal.prototype.PI2
  44103. * @description 2*PI 的值
  44104. */
  44105. this.PI2 = Math.PI * 2;
  44106. /**
  44107. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.roots
  44108. * @description 临时数组
  44109. */
  44110. this.roots = [-1, -1, -1];
  44111. /**
  44112. * @member {Array} SuperMap.LevelRenderer.Tool.Areal.prototype.extrema
  44113. * @description 临时数组
  44114. */
  44115. this.extrema = [-1, -1];
  44116. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Area";
  44117. }
  44118. /**
  44119. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.normalizeRadian
  44120. * @description 弧度标准化函数。
  44121. * @param {number} angle - 弧度值。
  44122. * @returns {number} 标准化后的弧度值。
  44123. */
  44124. normalizeRadian(angle) {
  44125. angle %= this.PI2;
  44126. if (angle < 0) {
  44127. angle += this.PI2;
  44128. }
  44129. return angle;
  44130. }
  44131. /**
  44132. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInside
  44133. * @description 包含判断。
  44134. * @param {Object} shape - 图形。
  44135. * @param {number} area - 目标区域。
  44136. * @param {number} x - 横坐标。
  44137. * @param {number} y - 纵坐标。
  44138. * @returns {boolean} 图形是否包含鼠标位置。
  44139. */
  44140. isInside(shape, area, x, y) {
  44141. if (!area || !shape) {
  44142. // 无参数或不支持类型
  44143. return false;
  44144. }
  44145. var zoneType = shape.type;
  44146. this._ctx = this._ctx || this.util.getContext();
  44147. // 未实现或不可用时则数学运算,主要是line,brokenLine,ring
  44148. var _mathReturn = this._mathMethod(shape, area, x, y);
  44149. if (typeof _mathReturn != 'undefined') {
  44150. return _mathReturn;
  44151. }
  44152. if (shape.buildPath && this._ctx.isPointInPath) {
  44153. return this._buildPathMethod(shape, this._ctx, area, x, y);
  44154. }
  44155. // 上面的方法都行不通时
  44156. switch (zoneType) {
  44157. case 'ellipse': // Todo,不精确
  44158. case 'smicellipse': // Todo,不精确
  44159. return true;
  44160. // 旋轮曲线 不准确
  44161. case 'trochoid':
  44162. var _r = area.location == 'out'
  44163. ? area.r1 + area.r2 + area.d
  44164. : area.r1 - area.r2 + area.d;
  44165. return this.isInsideCircle(area, x, y, _r);
  44166. // 玫瑰线 不准确
  44167. case 'rose' :
  44168. return this.isInsideCircle(area, x, y, area.maxr);
  44169. // 路径,椭圆,曲线等-----------------13
  44170. default:
  44171. return false; // Todo,暂不支持
  44172. }
  44173. }
  44174. /**
  44175. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._mathMethod
  44176. * @description 包含判断。用数学方法判断,三个方法中最快,但是支持的shape少。
  44177. * @param {Object} shape - 图形。
  44178. * @param {number} area - 目标区域。
  44179. * @param {number} x - 横坐标。
  44180. * @param {number} y - 纵坐标。
  44181. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  44182. */
  44183. _mathMethod(shape, area, x, y) {
  44184. var zoneType = shape.type;
  44185. // 在矩形内则部分图形需要进一步判断
  44186. switch (zoneType) {
  44187. // 贝塞尔曲线
  44188. case 'bezier-curve':
  44189. if (typeof(area.cpX2) === 'undefined') {
  44190. return this.isInsideQuadraticStroke(
  44191. area.xStart, area.yStart,
  44192. area.cpX1, area.cpY1,
  44193. area.xEnd, area.yEnd,
  44194. area.lineWidth, x, y
  44195. );
  44196. }
  44197. return this.isInsideCubicStroke(
  44198. area.xStart, area.yStart,
  44199. area.cpX1, area.cpY1,
  44200. area.cpX2, area.cpY2,
  44201. area.xEnd, area.yEnd,
  44202. area.lineWidth, x, y
  44203. );
  44204. // 线
  44205. case 'line':
  44206. return this.isInsideLine(
  44207. area.xStart, area.yStart,
  44208. area.xEnd, area.yEnd,
  44209. area.lineWidth, x, y
  44210. );
  44211. // 折线
  44212. case 'broken-line':
  44213. return this.isInsideBrokenLine(
  44214. area.pointList, area.lineWidth, x, y
  44215. );
  44216. // 扩展折线
  44217. case 'smicbroken-line': {
  44218. // SMIC-修改 - start
  44219. let icX = x;
  44220. let icY = y;
  44221. if (shape.refOriginalPosition) {
  44222. icX = x - shape.refOriginalPosition[0];
  44223. icY = y - shape.refOriginalPosition[1];
  44224. }
  44225. return this.isInsideBrokenLine(
  44226. area.pointList, area.lineWidth, icX, icY
  44227. );
  44228. }
  44229. //初始代码:
  44230. // return isInsideBrokenLine(
  44231. // area.pointList, area.lineWidth, x, y
  44232. // );
  44233. // SMIC-修改 - end
  44234. // 圆环
  44235. case 'ring':
  44236. return this.isInsideRing(
  44237. area.x, area.y, area.r0, area.r, x, y
  44238. );
  44239. case 'smicring': {
  44240. let areaX = area.x;
  44241. let areaY = area.y;
  44242. if (shape.refOriginalPosition) {
  44243. areaX = area.x + shape.refOriginalPosition[0];
  44244. areaY = area.y + shape.refOriginalPosition[1];
  44245. }
  44246. return this.isInsideRing(
  44247. areaX, areaY, area.r0, area.r, x, y
  44248. );
  44249. }
  44250. // 圆形
  44251. case 'circle':
  44252. return this.isInsideCircle(
  44253. area.x, area.y, area.r, x, y
  44254. );
  44255. // 扩展-点
  44256. case 'smicpoint': {
  44257. // SMIC-修改 - start
  44258. let icX = x;
  44259. let icY = y;
  44260. if (shape.refOriginalPosition) {
  44261. icX = x - shape.refOriginalPosition[0];
  44262. icY = y - shape.refOriginalPosition[1];
  44263. }
  44264. return this.isInsideCircle(
  44265. area.x, area.y, area.r, icX, icY
  44266. );
  44267. }
  44268. //初始代码:
  44269. // 无
  44270. // SMIC-修改 - end
  44271. // 扇形
  44272. case 'sector': {
  44273. let startAngle = area.startAngle * Math.PI / 180;
  44274. let endAngle = area.endAngle * Math.PI / 180;
  44275. if (!area.clockWise) {
  44276. startAngle = -startAngle;
  44277. endAngle = -endAngle;
  44278. }
  44279. return this.isInsideSector(
  44280. area.x, area.y, area.r0, area.r,
  44281. startAngle, endAngle,
  44282. !area.clockWise,
  44283. x, y
  44284. );
  44285. }
  44286. //初始代码:
  44287. // 无
  44288. // SMIC-增加 - end
  44289. // 扇形
  44290. case 'smicsector': {
  44291. let startAngle = area.startAngle * Math.PI / 180;
  44292. let endAngle = area.endAngle * Math.PI / 180;
  44293. if (!area.clockWise) {
  44294. startAngle = -startAngle;
  44295. endAngle = -endAngle;
  44296. }
  44297. let areaX = area.x;
  44298. let areaY = area.y;
  44299. if (shape.refOriginalPosition) {
  44300. areaX = area.x + shape.refOriginalPosition[0];
  44301. areaY = area.y + shape.refOriginalPosition[1];
  44302. }
  44303. return this.isInsideSector(
  44304. areaX, areaY, area.r0, area.r,
  44305. startAngle, endAngle,
  44306. !area.clockWise,
  44307. x, y
  44308. );
  44309. }
  44310. // 多边形
  44311. case 'path':
  44312. return this.isInsidePath(
  44313. area.pathArray, Math.max(area.lineWidth, 5),
  44314. area.brushType, x, y
  44315. );
  44316. case 'polygon':
  44317. case 'star':
  44318. case 'smicstar':
  44319. case 'isogon':
  44320. case 'smicisogon':
  44321. return this.isInsidePolygon(area.pointList, x, y);
  44322. // 扩展多边形
  44323. case 'smicpolygon': {
  44324. // SMIC-修改 - start
  44325. let icX = x;
  44326. let icY = y;
  44327. if (shape.refOriginalPosition) {
  44328. icX = x - shape.refOriginalPosition[0];
  44329. icY = y - shape.refOriginalPosition[1];
  44330. }
  44331. //岛洞面
  44332. if (shape.holePolygonPointLists && shape.holePolygonPointLists.length > 0) {
  44333. var isOnBase = this.isInsidePolygon(area.pointList, icX, icY);
  44334. // 遍历岛洞子面
  44335. var holePLS = shape.holePolygonPointLists;
  44336. var isOnHole = false;
  44337. for (var i = 0, holePLSen = holePLS.length; i < holePLSen; i++) {
  44338. var holePL = holePLS[i];
  44339. var isOnSubHole = this.isInsidePolygon(holePL, icX, icY);
  44340. if (isOnSubHole === true) {
  44341. isOnHole = true;
  44342. }
  44343. }
  44344. // 捕获判断
  44345. return isOnBase === true && isOnHole === false;
  44346. } else {
  44347. return this.isInsidePolygon(area.pointList, icX, icY);
  44348. }
  44349. }
  44350. // 初始代码:
  44351. // 无
  44352. // SMIC-修改 - end
  44353. // 文本
  44354. case 'text':
  44355. var rect = area.__rect || shape.getRect(area);
  44356. return this.isInsideRect(
  44357. rect.x, rect.y, rect.width, rect.height, x, y
  44358. );
  44359. // 扩展文本
  44360. case 'smictext':
  44361. //用文本背景矩形判断
  44362. var textBg = shape.getTextBackground(area);
  44363. return this.isInsidePolygon(textBg, x, y);
  44364. //初始代码:
  44365. // 无
  44366. // SMIC-修改 - end
  44367. // 矩形
  44368. case 'rectangle':
  44369. case 'image':
  44370. // 图片
  44371. return this.isInsideRect(
  44372. area.x, area.y, area.width, area.height, x, y
  44373. );
  44374. case 'smicimage': {
  44375. let areaX = area.x;
  44376. let areaY = area.y;
  44377. if (shape.refOriginalPosition) {
  44378. areaX = area.x + shape.refOriginalPosition[0];
  44379. areaY = area.y + shape.refOriginalPosition[1];
  44380. }
  44381. return this.isInsideRect(
  44382. areaX, areaY, area.width, area.height, x, y
  44383. );
  44384. }
  44385. //// 扩展矩形
  44386. //case 'smicpolygon':
  44387. // // SMIC-修改 - start
  44388. // var icX = x;
  44389. // var icY = y;
  44390. // if(shape.refOriginalPosition) {
  44391. // icX = x - shape.refOriginalPosition[0];
  44392. // icY = y - shape.refOriginalPosition[1];
  44393. // }
  44394. // return this.isInsideRect(
  44395. // area.x, area.y, area.width, area.height, icX, icY
  44396. // );
  44397. //初始代码:
  44398. // 无
  44399. // SMIC-修改 - end
  44400. }
  44401. }
  44402. /**
  44403. * @function SuperMap.LevelRenderer.Tool.Areal.prototype._buildPathMethod
  44404. * @description 包含判断。通过buildPath方法来判断,三个方法中较快,但是不支持线条类型的 shape。
  44405. * @param {Object} shape - 图形。
  44406. * @param {Object} context - 上下文。
  44407. * @param {number} area - 目标区域。
  44408. * @param {number} x - 横坐标。
  44409. * @param {number} y - 纵坐标。
  44410. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形中。
  44411. */
  44412. _buildPathMethod(shape, context, area, x, y) {
  44413. // 图形类实现路径创建了则用类的path
  44414. context.beginPath();
  44415. shape.buildPath(context, area);
  44416. context.closePath();
  44417. return context.isPointInPath(x, y);
  44418. }
  44419. /**
  44420. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isOutside
  44421. * @description 图形是否不包含鼠标位置。
  44422. * @param {Object} shape - 图形。
  44423. * @param {number} area - 目标区域。
  44424. * @param {number} x - 横坐标。
  44425. * @param {number} y - 纵坐标。
  44426. * @returns {boolean} 图形是否不包含鼠标位置, true表示坐标处在图形外。
  44427. */
  44428. isOutside(shape, area, x, y) {
  44429. return !this.isInside(shape, area, x, y);
  44430. }
  44431. /**
  44432. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideLine
  44433. * @description 线段包含判断。
  44434. * @param {number} x0 - 线起始点横坐标。
  44435. * @param {number} y0 - 线起始点纵坐标。
  44436. * @param {number} x1 - 线终点横坐标。
  44437. * @param {number} y1 - 线终点纵坐标。
  44438. * @param {number} lineWidth - 线宽。
  44439. * @param {number} x - 鼠标位置横坐标。
  44440. * @param {number} y - 鼠标位置纵坐标。
  44441. * @returns {boolean} 图形是否包含鼠标位置,true表示坐标处在图形内。
  44442. */
  44443. isInsideLine(x0, y0, x1, y1, lineWidth, x, y) {
  44444. if (lineWidth === 0) {
  44445. return false;
  44446. }
  44447. var _l = Math.max(lineWidth, 5);
  44448. var _a = 0;
  44449. var _b = 0;
  44450. // Quick reject
  44451. if (
  44452. (y > y0 + _l && y > y1 + _l)
  44453. || (y < y0 - _l && y < y1 - _l)
  44454. || (x > x0 + _l && x > x1 + _l)
  44455. || (x < x0 - _l && x < x1 - _l)
  44456. ) {
  44457. return false;
  44458. }
  44459. if (x0 !== x1) {
  44460. _a = (y0 - y1) / (x0 - x1);
  44461. _b = (x0 * y1 - x1 * y0) / (x0 - x1);
  44462. } else {
  44463. return Math.abs(x - x0) <= _l / 2;
  44464. }
  44465. var tmp = _a * x - y + _b;
  44466. var _s = tmp * tmp / (_a * _a + 1);
  44467. return _s <= _l / 2 * _l / 2;
  44468. }
  44469. /**
  44470. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCubicStroke
  44471. * @description 三次贝塞尔曲线描边包含判断。
  44472. * @param {number} x0 - 点1横坐标。
  44473. * @param {number} y0 - 点1纵坐标。
  44474. * @param {number} x1 - 点2横坐标。
  44475. * @param {number} y1 - 点2纵坐标。
  44476. * @param {number} x2 - 点3纵坐标。
  44477. * @param {number} y2 - 点3纵坐标。
  44478. * @param {number} lineWidth - 线宽。
  44479. * @param {number} x - 鼠标位置横坐标。
  44480. * @param {number} y - 鼠标位置纵坐标。
  44481. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44482. */
  44483. isInsideCubicStroke(x0, y0, x1, y1, x2, y2, x3, y3, lineWidth, x, y) {
  44484. if (lineWidth === 0) {
  44485. return false;
  44486. }
  44487. var _l = Math.max(lineWidth, 5);
  44488. // Quick reject
  44489. if (
  44490. (y > y0 + _l && y > y1 + _l && y > y2 + _l && y > y3 + _l)
  44491. || (y < y0 - _l && y < y1 - _l && y < y2 - _l && y < y3 - _l)
  44492. || (x > x0 + _l && x > x1 + _l && x > x2 + _l && x > x3 + _l)
  44493. || (x < x0 - _l && x < x1 - _l && x < x2 - _l && x < x3 - _l)
  44494. ) {
  44495. return false;
  44496. }
  44497. var d = this.curve.cubicProjectPoint(
  44498. x0, y0, x1, y1, x2, y2, x3, y3,
  44499. x, y, null
  44500. );
  44501. return d <= _l / 2;
  44502. }
  44503. /**
  44504. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideQuadraticStroke
  44505. * @description 二次贝塞尔曲线描边包含判断。
  44506. * @param {number} x0 - 点1横坐标。
  44507. * @param {number} y0 - 点1纵坐标。
  44508. * @param {number} x1 - 点2横坐标。
  44509. * @param {number} y1 - 点2纵坐标。
  44510. * @param {number} x2 - 点3纵坐标。
  44511. * @param {number} y2 - 点3纵坐标。
  44512. * @param {number} lineWidth - 线宽。
  44513. * @param {number} x - 鼠标位置横坐标。
  44514. * @param {number} y - 鼠标位置纵坐标。
  44515. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44516. */
  44517. isInsideQuadraticStroke(x0, y0, x1, y1, x2, y2, lineWidth, x, y) {
  44518. if (lineWidth === 0) {
  44519. return false;
  44520. }
  44521. var _l = Math.max(lineWidth, 5);
  44522. // Quick reject
  44523. if (
  44524. (y > y0 + _l && y > y1 + _l && y > y2 + _l)
  44525. || (y < y0 - _l && y < y1 - _l && y < y2 - _l)
  44526. || (x > x0 + _l && x > x1 + _l && x > x2 + _l)
  44527. || (x < x0 - _l && x < x1 - _l && x < x2 - _l)
  44528. ) {
  44529. return false;
  44530. }
  44531. var d = this.curve.quadraticProjectPoint(
  44532. x0, y0, x1, y1, x2, y2,
  44533. x, y, null
  44534. );
  44535. return d <= _l / 2;
  44536. }
  44537. /**
  44538. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideArcStroke
  44539. * @description 圆弧描边包含判断。
  44540. * @param {number} cx - 圆心横坐标。
  44541. * @param {number} cy - 圆心纵坐标。
  44542. * @param {number} r - 圆半径。
  44543. * @param {number} startAngle - 起始角度。
  44544. * @param {number} endAngle - 终止角度。
  44545. * @param {number} anticlockwise - 顺时针还是逆时针。
  44546. * @param {number} lineWidth - 线宽。
  44547. * @param {number} x - 鼠标位置横坐标。
  44548. * @param {number} y - 鼠标位置纵坐标。
  44549. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44550. */
  44551. isInsideArcStroke(cx, cy, r, startAngle, endAngle, anticlockwise, lineWidth, x, y) {
  44552. var PI2 = this.PI2;
  44553. if (lineWidth === 0) {
  44554. return false;
  44555. }
  44556. var _l = Math.max(lineWidth, 5);
  44557. x -= cx;
  44558. y -= cy;
  44559. var d = Math.sqrt(x * x + y * y);
  44560. if ((d - _l > r) || (d + _l < r)) {
  44561. return false;
  44562. }
  44563. if (Math.abs(startAngle - endAngle) >= PI2) {
  44564. // Is a circle
  44565. return true;
  44566. }
  44567. if (anticlockwise) {
  44568. var tmp = startAngle;
  44569. startAngle = this.normalizeRadian(endAngle);
  44570. endAngle = this.normalizeRadian(tmp);
  44571. } else {
  44572. startAngle = this.normalizeRadian(startAngle);
  44573. endAngle = this.normalizeRadian(endAngle);
  44574. }
  44575. if (startAngle > endAngle) {
  44576. endAngle += PI2;
  44577. }
  44578. var angle = Math.atan2(y, x);
  44579. if (angle < 0) {
  44580. angle += PI2;
  44581. }
  44582. return (angle >= startAngle && angle <= endAngle)
  44583. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle);
  44584. }
  44585. /**
  44586. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideBrokenLine
  44587. * @description 图形 BrokenLine 是否包含鼠标位置, true表示坐标处在图形内。
  44588. * @param {Array} points - 曲线点对象。
  44589. * @param {number} lineWidth - 线宽。
  44590. * @param {number} x - 鼠标位置横坐标。
  44591. * @param {number} y - 鼠标位置纵坐标。
  44592. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44593. */
  44594. isInsideBrokenLine(points, lineWidth, x, y) {
  44595. var _lineWidth = Math.max(lineWidth, 10);
  44596. for (var i = 0, l = points.length - 1; i < l; i++) {
  44597. var x0 = points[i][0];
  44598. var y0 = points[i][1];
  44599. var x1 = points[i + 1][0];
  44600. var y1 = points[i + 1][1];
  44601. if (this.isInsideLine(x0, y0, x1, y1, _lineWidth, x, y)) {
  44602. return true;
  44603. }
  44604. }
  44605. return false;
  44606. }
  44607. /**
  44608. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRing
  44609. * @description 图形 Ring 是否包含鼠标位置, true表示坐标处在图形内。
  44610. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44611. */
  44612. isInsideRing(cx, cy, r0, r, x, y) {
  44613. var d = (x - cx) * (x - cx) + (y - cy) * (y - cy);
  44614. return (d < r * r) && (d > r0 * r0);
  44615. }
  44616. /**
  44617. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideRect
  44618. * @description 图形 Rect 是否包含鼠标位置, true表示坐标处在图形内。
  44619. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44620. */
  44621. isInsideRect(x0, y0, width, height, x, y) {
  44622. return x >= x0 && x <= (x0 + width) && y >= y0 && y <= (y0 + height);
  44623. }
  44624. /**
  44625. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideCircle
  44626. * @description 图形 Circle 是否包含鼠标位置, true表示坐标处在图形内。
  44627. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44628. */
  44629. isInsideCircle(x0, y0, r, x, y) {
  44630. return (x - x0) * (x - x0) + (y - y0) * (y - y0) < r * r;
  44631. }
  44632. /**
  44633. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsideSector
  44634. * @description 图形 Sector 是否包含鼠标位置, true表示坐标处在图形内。
  44635. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44636. */
  44637. isInsideSector(cx, cy, r0, r, startAngle, endAngle, anticlockwise, x, y) {
  44638. return this.isInsideArcStroke(cx, cy, (r0 + r) / 2, startAngle, endAngle, anticlockwise, r - r0, x, y);
  44639. }
  44640. /**
  44641. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePolygon
  44642. * @description 图形 Polygon 是否包含鼠标位置, true表示坐标处在图形内。与 canvas 一样采用 non-zero winding rule
  44643. * @returns {boolean} 图形是否包含鼠标位置, true表示坐标处在图形内。
  44644. */
  44645. isInsidePolygon(points, x, y) {
  44646. var N = points.length;
  44647. var w = 0;
  44648. for (var i = 0, j = N - 1; i < N; i++) {
  44649. var x0 = points[j][0];
  44650. var y0 = points[j][1];
  44651. var x1 = points[i][0];
  44652. var y1 = points[i][1];
  44653. w += this.windingLine(x0, y0, x1, y1, x, y);
  44654. j = i;
  44655. }
  44656. return w !== 0;
  44657. }
  44658. /**
  44659. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingLine
  44660. */
  44661. windingLine(x0, y0, x1, y1, x, y) {
  44662. if ((y > y0 && y > y1) || (y < y0 && y < y1)) {
  44663. return 0;
  44664. }
  44665. if (y1 == y0) {
  44666. return 0;
  44667. }
  44668. var dir = y1 < y0 ? 1 : -1;
  44669. var t = (y - y0) / (y1 - y0);
  44670. var x_ = t * (x1 - x0) + x0;
  44671. return x_ > x ? dir : 0;
  44672. }
  44673. /**
  44674. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.swapExtrema
  44675. */
  44676. swapExtrema() {
  44677. var tmp = this.extrema[0];
  44678. this.extrema[0] = this.extrema[1];
  44679. this.extrema[1] = tmp;
  44680. }
  44681. /**
  44682. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingCubic
  44683. */
  44684. windingCubic(x0, y0, x1, y1, x2, y2, x3, y3, x, y) {
  44685. var curve = this.curve;
  44686. var roots = this.roots;
  44687. var extrema = this.extrema;
  44688. // Quick reject
  44689. if (
  44690. (y > y0 && y > y1 && y > y2 && y > y3)
  44691. || (y < y0 && y < y1 && y < y2 && y < y3)
  44692. ) {
  44693. return 0;
  44694. }
  44695. var nRoots = curve.cubicRootAt(y0, y1, y2, y3, y, roots);
  44696. if (nRoots === 0) {
  44697. return 0;
  44698. } else {
  44699. var w = 0;
  44700. var nExtrema = -1;
  44701. var y0_, y1_;
  44702. for (var i = 0; i < nRoots; i++) {
  44703. var t = roots[i];
  44704. var x_ = curve.cubicAt(x0, x1, x2, x3, t);
  44705. if (x_ < x) { // Quick reject
  44706. continue;
  44707. }
  44708. if (nExtrema < 0) {
  44709. nExtrema = curve.cubicExtrema(y0, y1, y2, y3, extrema);
  44710. if (extrema[1] < extrema[0] && nExtrema > 1) {
  44711. this.swapExtrema();
  44712. }
  44713. y0_ = curve.cubicAt(y0, y1, y2, y3, extrema[0]);
  44714. if (nExtrema > 1) {
  44715. y1_ = curve.cubicAt(y0, y1, y2, y3, extrema[1]);
  44716. }
  44717. }
  44718. if (nExtrema == 2) {
  44719. // 分成三段单调函数
  44720. if (t < extrema[0]) {
  44721. w += y0_ < y0 ? 1 : -1;
  44722. } else if (t < extrema[1]) {
  44723. w += y1_ < y0_ ? 1 : -1;
  44724. } else {
  44725. w += y3 < y1_ ? 1 : -1;
  44726. }
  44727. } else {
  44728. // 分成两段单调函数
  44729. if (t < extrema[0]) {
  44730. w += y0_ < y0 ? 1 : -1;
  44731. } else {
  44732. w += y3 < y0_ ? 1 : -1;
  44733. }
  44734. }
  44735. }
  44736. return w;
  44737. }
  44738. }
  44739. /**
  44740. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingQuadratic
  44741. */
  44742. windingQuadratic(x0, y0, x1, y1, x2, y2, x, y) {
  44743. var curve = this.curve;
  44744. var roots = this.roots;
  44745. // Quick reject
  44746. if (
  44747. (y > y0 && y > y1 && y > y2)
  44748. || (y < y0 && y < y1 && y < y2)
  44749. ) {
  44750. return 0;
  44751. }
  44752. var nRoots = curve.quadraticRootAt(y0, y1, y2, y, roots);
  44753. if (nRoots === 0) {
  44754. return 0;
  44755. } else {
  44756. var t = curve.quadraticExtremum(y0, y1, y2);
  44757. if (t >= 0 && t <= 1) {
  44758. var w = 0;
  44759. var y_ = curve.quadraticAt(y0, y1, y2, t);
  44760. for (let i = 0; i < nRoots; i++) {
  44761. let x_ = curve.quadraticAt(x0, x1, x2, roots[i]);
  44762. if (x_ > x) {
  44763. continue;
  44764. }
  44765. if (roots[i] < t) {
  44766. w += y_ < y0 ? 1 : -1;
  44767. } else {
  44768. w += y2 < y_ ? 1 : -1;
  44769. }
  44770. }
  44771. return w;
  44772. } else {
  44773. let x_ = curve.quadraticAt(x0, x1, x2, roots[0]);
  44774. if (x_ > x) {
  44775. return 0;
  44776. }
  44777. return y2 < y0 ? 1 : -1;
  44778. }
  44779. }
  44780. }
  44781. /**
  44782. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.windingArc
  44783. * // TODO Arc 旋转
  44784. */
  44785. windingArc(cx, cy, r, startAngle, endAngle, anticlockwise, x, y) {
  44786. var roots = this.roots;
  44787. var PI2 = this.PI2;
  44788. y -= cy;
  44789. if (y > r || y < -r) {
  44790. return 0;
  44791. }
  44792. let tmp = Math.sqrt(r * r - y * y);
  44793. roots[0] = -tmp;
  44794. roots[1] = tmp;
  44795. if (Math.abs(startAngle - endAngle) >= PI2) {
  44796. // Is a circle
  44797. startAngle = 0;
  44798. endAngle = PI2;
  44799. var dir = anticlockwise ? 1 : -1;
  44800. if (x >= roots[0] + cx && x <= roots[1] + cx) {
  44801. return dir;
  44802. } else {
  44803. return 0;
  44804. }
  44805. }
  44806. if (anticlockwise) {
  44807. let tmp = startAngle;
  44808. startAngle = this.normalizeRadian(endAngle);
  44809. endAngle = this.normalizeRadian(tmp);
  44810. } else {
  44811. startAngle = this.normalizeRadian(startAngle);
  44812. endAngle = this.normalizeRadian(endAngle);
  44813. }
  44814. if (startAngle > endAngle) {
  44815. endAngle += PI2;
  44816. }
  44817. var w = 0;
  44818. for (let i = 0; i < 2; i++) {
  44819. var x_ = roots[i];
  44820. if (x_ + cx > x) {
  44821. let angle = Math.atan2(y, x_);
  44822. let dir = anticlockwise ? 1 : -1;
  44823. if (angle < 0) {
  44824. angle = PI2 + angle;
  44825. }
  44826. if (
  44827. (angle >= startAngle && angle <= endAngle)
  44828. || (angle + PI2 >= startAngle && angle + PI2 <= endAngle)
  44829. ) {
  44830. if (angle > Math.PI / 2 && angle < Math.PI * 1.5) {
  44831. dir = -dir;
  44832. }
  44833. w += dir;
  44834. }
  44835. }
  44836. }
  44837. return w;
  44838. }
  44839. /**
  44840. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.isInsidePath
  44841. * @description 与 canvas 一样采用 non-zero winding rule
  44842. */
  44843. isInsidePath(pathArray, lineWidth, brushType, x, y) {
  44844. var w = 0;
  44845. var xi = 0;
  44846. var yi = 0;
  44847. var x0 = 0;
  44848. var y0 = 0;
  44849. var beginSubpath = true;
  44850. var firstCmd = true;
  44851. brushType = brushType || 'fill';
  44852. var hasStroke = brushType === 'stroke' || brushType === 'both';
  44853. var hasFill = brushType === 'fill' || brushType === 'both';
  44854. // var roots = [-1, -1, -1];
  44855. for (var i = 0; i < pathArray.length; i++) {
  44856. var seg = pathArray[i];
  44857. var p = seg.points;
  44858. // Begin a new subpath
  44859. if (beginSubpath || seg.command === 'M') {
  44860. if (i > 0) {
  44861. // Close previous subpath
  44862. if (hasFill) {
  44863. w += this.windingLine(xi, yi, x0, y0, x, y);
  44864. }
  44865. if (w !== 0) {
  44866. return true;
  44867. }
  44868. }
  44869. x0 = p[p.length - 2];
  44870. y0 = p[p.length - 1];
  44871. beginSubpath = false;
  44872. if (firstCmd && seg.command !== 'A') {
  44873. // 如果第一个命令不是M, 是lineTo, bezierCurveTo
  44874. // 等绘制命令的话,是会从该绘制的起点开始算的
  44875. // Arc 会在之后做单独处理所以这里忽略
  44876. firstCmd = false;
  44877. xi = x0;
  44878. yi = y0;
  44879. }
  44880. }
  44881. switch (seg.command) {
  44882. case 'M':
  44883. xi = p[0];
  44884. yi = p[1];
  44885. break;
  44886. case 'L':
  44887. if (hasStroke) {
  44888. if (this.isInsideLine(
  44889. xi, yi, p[0], p[1], lineWidth, x, y
  44890. )) {
  44891. return true;
  44892. }
  44893. }
  44894. if (hasFill) {
  44895. w += this.windingLine(xi, yi, p[0], p[1], x, y);
  44896. }
  44897. xi = p[0];
  44898. yi = p[1];
  44899. break;
  44900. case 'C':
  44901. if (hasStroke) {
  44902. if (this.isInsideCubicStroke(
  44903. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5],
  44904. lineWidth, x, y
  44905. )) {
  44906. return true;
  44907. }
  44908. }
  44909. if (hasFill) {
  44910. w += this.windingCubic(
  44911. xi, yi, p[0], p[1], p[2], p[3], p[4], p[5], x, y
  44912. );
  44913. }
  44914. xi = p[4];
  44915. yi = p[5];
  44916. break;
  44917. case 'Q':
  44918. if (hasStroke) {
  44919. if (this.isInsideQuadraticStroke(
  44920. xi, yi, p[0], p[1], p[2], p[3],
  44921. lineWidth, x, y
  44922. )) {
  44923. return true;
  44924. }
  44925. }
  44926. if (hasFill) {
  44927. w += this.windingQuadratic(
  44928. xi, yi, p[0], p[1], p[2], p[3], x, y
  44929. );
  44930. }
  44931. xi = p[2];
  44932. yi = p[3];
  44933. break;
  44934. case 'A':
  44935. // TODO Arc 旋转
  44936. // TODO Arc 判断的开销比较大
  44937. var cx = p[0];
  44938. var cy = p[1];
  44939. var rx = p[2];
  44940. var ry = p[3];
  44941. var theta = p[4];
  44942. var dTheta = p[5];
  44943. var x1 = Math.cos(theta) * rx + cx;
  44944. var y1 = Math.sin(theta) * ry + cy;
  44945. // 不是直接使用 arc 命令
  44946. if (!firstCmd) {
  44947. w += this.windingLine(xi, yi, x1, y1);
  44948. } else {
  44949. firstCmd = false;
  44950. // 第一个命令起点还未定义
  44951. x0 = x1;
  44952. y0 = y1;
  44953. }
  44954. // zr 使用scale来模拟椭圆, 这里也对x做一定的缩放
  44955. var _x = (x - cx) * ry / rx + cx;
  44956. if (hasStroke) {
  44957. if (this.isInsideArcStroke(
  44958. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  44959. lineWidth, _x, y
  44960. )) {
  44961. return true;
  44962. }
  44963. }
  44964. if (hasFill) {
  44965. w += this.windingArc(
  44966. cx, cy, ry, theta, theta + dTheta, 1 - p[7],
  44967. _x, y
  44968. );
  44969. }
  44970. xi = Math.cos(theta + dTheta) * rx + cx;
  44971. yi = Math.sin(theta + dTheta) * ry + cy;
  44972. break;
  44973. case 'z':
  44974. if (hasStroke) {
  44975. if (this.isInsideLine(
  44976. xi, yi, x0, y0, lineWidth, x, y
  44977. )) {
  44978. return true;
  44979. }
  44980. }
  44981. beginSubpath = true;
  44982. break;
  44983. }
  44984. }
  44985. if (hasFill) {
  44986. w += this.windingLine(xi, yi, x0, y0, x, y);
  44987. }
  44988. return w !== 0;
  44989. }
  44990. /**
  44991. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextWidth
  44992. * @description 测算多行文本宽度
  44993. */
  44994. getTextWidth(text, textFont) {
  44995. var key = text + ':' + textFont;
  44996. if (this._textWidthCache[key]) {
  44997. return this._textWidthCache[key];
  44998. }
  44999. this._ctx = this._ctx || this.util.getContext();
  45000. this._ctx.save();
  45001. if (textFont) {
  45002. this._ctx.font = textFont;
  45003. }
  45004. text = (text + '').split('\n');
  45005. var width = 0;
  45006. for (var i = 0, l = text.length; i < l; i++) {
  45007. width = Math.max(
  45008. this._ctx.measureText(text[i]).width,
  45009. width
  45010. );
  45011. }
  45012. this._ctx.restore();
  45013. this._textWidthCache[key] = width;
  45014. if (++this._textWidthCacheCounter > this.TEXT_CACHE_MAX) {
  45015. // 内存释放
  45016. this._textWidthCacheCounter = 0;
  45017. this._textWidthCache = {};
  45018. }
  45019. return width;
  45020. }
  45021. /**
  45022. * @function SuperMap.LevelRenderer.Tool.Areal.prototype.getTextHeight
  45023. * @description 测算多行文本高度
  45024. */
  45025. getTextHeight(text, textFont) {
  45026. var key = text + ':' + textFont;
  45027. if (this._textHeightCache[key]) {
  45028. return this._textHeightCache[key];
  45029. }
  45030. this._ctx = this._ctx || this.util.getContext();
  45031. this._ctx.save();
  45032. if (textFont) {
  45033. this._ctx.font = textFont;
  45034. }
  45035. text = (text + '').split('\n');
  45036. // 比较粗暴
  45037. //var height = (this._ctx.measureText('国').width + 2) * text.length; //打包不支持中文,替换掉
  45038. var height = (this._ctx.measureText('ZH').width + 2) * text.length;
  45039. this._ctx.restore();
  45040. this._textHeightCache[key] = height;
  45041. if (++this._textHeightCacheCounter > this.TEXT_CACHE_MAX) {
  45042. // 内存释放
  45043. this._textHeightCacheCounter = 0;
  45044. this._textHeightCache = {};
  45045. }
  45046. return height;
  45047. }
  45048. }
  45049. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/ComputeBoundingBox.js
  45050. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45051. * This program are made available under the terms of the Apache License, Version 2.0
  45052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45053. /**
  45054. * @class SuperMap.LevelRenderer.Tool.ComputeBoundingBox
  45055. * @category Visualization Theme
  45056. * @classdesc LevelRenderer 工具-图形 Bounds 计算
  45057. * @private
  45058. */
  45059. class ComputeBoundingBox {
  45060. /**
  45061. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.constructor
  45062. * @description 构造函数。
  45063. */
  45064. constructor() {
  45065. if (arguments.length === 3) {
  45066. this.computeBoundingBox(arguments);
  45067. }
  45068. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.ComputeBoundingBox";
  45069. }
  45070. /**
  45071. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.computeBoundingBox
  45072. * @description 从顶点数组中计算出最小包围盒,写入'min'和'max'中。
  45073. * @param {Array.<Object>} points - 顶点数组。
  45074. * @param {Array} min - 最小
  45075. * @param {Array} max - 最大
  45076. */
  45077. computeBoundingBox(points, min, max) {
  45078. if (points.length === 0) {
  45079. return;
  45080. }
  45081. var left = points[0][0];
  45082. var right = points[0][0];
  45083. var top = points[0][1];
  45084. var bottom = points[0][1];
  45085. for (var i = 1; i < points.length; i++) {
  45086. var p = points[i];
  45087. if (p[0] < left) {
  45088. left = p[0];
  45089. }
  45090. if (p[0] > right) {
  45091. right = p[0];
  45092. }
  45093. if (p[1] < top) {
  45094. top = p[1];
  45095. }
  45096. if (p[1] > bottom) {
  45097. bottom = p[1];
  45098. }
  45099. }
  45100. min[0] = left;
  45101. min[1] = top;
  45102. max[0] = right;
  45103. max[1] = bottom;
  45104. }
  45105. /**
  45106. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.cubeBezier
  45107. * @description 从三阶贝塞尔曲线(p0, p1, p2, p3)中计算出最小包围盒,写入'min'和'max'中。原:computeCubeBezierBoundingBox。
  45108. * @param {Array.<number>} p0 - 三阶贝塞尔曲线p0点
  45109. * @param {Array.<number>} p1 - 三阶贝塞尔曲线p1点
  45110. * @param {Array.<number>} p2 - 三阶贝塞尔曲线p2点
  45111. * @param {Array.<number>} p3 - 三阶贝塞尔曲线p3点
  45112. * @param {Array.<number>} min - 最小
  45113. * @param {Array.<number>} max - 最大
  45114. */
  45115. cubeBezier(p0, p1, p2, p3, min, max) {
  45116. var curve = new Curve_Curve();
  45117. var xDim = [];
  45118. curve.cubicExtrema(p0[0], p1[0], p2[0], p3[0], xDim);
  45119. for (let i = 0; i < xDim.length; i++) {
  45120. xDim[i] = curve.cubicAt(p0[0], p1[0], p2[0], p3[0], xDim[i]);
  45121. }
  45122. var yDim = [];
  45123. curve.cubicExtrema(p0[1], p1[1], p2[1], p3[1], yDim);
  45124. for (let i = 0; i < yDim.length; i++) {
  45125. yDim[i] = curve.cubicAt(p0[1], p1[1], p2[1], p3[1], yDim[i]);
  45126. }
  45127. xDim.push(p0[0], p3[0]);
  45128. yDim.push(p0[1], p3[1]);
  45129. var left = Math.min.apply(null, xDim);
  45130. var right = Math.max.apply(null, xDim);
  45131. var top = Math.min.apply(null, yDim);
  45132. var bottom = Math.max.apply(null, yDim);
  45133. min[0] = left;
  45134. min[1] = top;
  45135. max[0] = right;
  45136. max[1] = bottom;
  45137. }
  45138. /**
  45139. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.quadraticBezier
  45140. * @description 从二阶贝塞尔曲线(p0, p1, p2)中计算出最小包围盒,写入'min'和'max'中。原:computeQuadraticBezierBoundingBox。
  45141. * @param {Array.<number>} p0 - 二阶贝塞尔曲线p0点
  45142. * @param {Array.<number>} p1 - 二阶贝塞尔曲线p1点
  45143. * @param {Array.<number>} p2 - 二阶贝塞尔曲线p2点
  45144. * @param {Array.<number>} min - 最小
  45145. * @param {Array.<number>} max - 最大
  45146. */
  45147. quadraticBezier(p0, p1, p2, min, max) {
  45148. var curve = new Curve_Curve();
  45149. // Find extremities, where derivative in x dim or y dim is zero
  45150. var t1 = curve.quadraticExtremum(p0[0], p1[0], p2[0]);
  45151. var t2 = curve.quadraticExtremum(p0[1], p1[1], p2[1]);
  45152. t1 = Math.max(Math.min(t1, 1), 0);
  45153. t2 = Math.max(Math.min(t2, 1), 0);
  45154. var ct1 = 1 - t1;
  45155. var ct2 = 1 - t2;
  45156. var x1 = ct1 * ct1 * p0[0]
  45157. + 2 * ct1 * t1 * p1[0]
  45158. + t1 * t1 * p2[0];
  45159. var y1 = ct1 * ct1 * p0[1]
  45160. + 2 * ct1 * t1 * p1[1]
  45161. + t1 * t1 * p2[1];
  45162. var x2 = ct2 * ct2 * p0[0]
  45163. + 2 * ct2 * t2 * p1[0]
  45164. + t2 * t2 * p2[0];
  45165. var y2 = ct2 * ct2 * p0[1]
  45166. + 2 * ct2 * t2 * p1[1]
  45167. + t2 * t2 * p2[1];
  45168. min[0] = Math.min(p0[0], p2[0], x1, x2);
  45169. min[1] = Math.min(p0[1], p2[1], y1, y2);
  45170. max[0] = Math.max(p0[0], p2[0], x1, x2);
  45171. max[1] = Math.max(p0[1], p2[1], y1, y2);
  45172. }
  45173. /**
  45174. * @function SuperMap.LevelRenderer.Tool.ComputeBoundingBox.prototype.arc
  45175. * @description 从圆弧中计算出最小包围盒,写入'min'和'max'中。原:computeArcBoundingBox。
  45176. * @param {number} x - 圆弧中心点 x
  45177. * @param {number} y - 圆弧中心点 y
  45178. * @param {number} r - 圆弧半径
  45179. * @param {number} startAngle - 圆弧开始角度
  45180. * @param {number} endAngle - 圆弧结束角度
  45181. * @param {number} anticlockwise - 是否是顺时针
  45182. * @param {number} min - 最小
  45183. * @param {number} max - 最大
  45184. */
  45185. arc(x, y, r, startAngle, endAngle, anticlockwise, min, max) {
  45186. var vec2 = new levelRenderer_Vector_Vector();
  45187. var start = vec2.create();
  45188. var end = vec2.create();
  45189. var extremity = vec2.create();
  45190. start[0] = Math.cos(startAngle) * r + x;
  45191. start[1] = Math.sin(startAngle) * r + y;
  45192. end[0] = Math.cos(endAngle) * r + x;
  45193. end[1] = Math.sin(endAngle) * r + y;
  45194. vec2.min(min, start, end);
  45195. vec2.max(max, start, end);
  45196. // Thresh to [0, Math.PI * 2]
  45197. startAngle = startAngle % (Math.PI * 2);
  45198. if (startAngle < 0) {
  45199. startAngle = startAngle + Math.PI * 2;
  45200. }
  45201. endAngle = endAngle % (Math.PI * 2);
  45202. if (endAngle < 0) {
  45203. endAngle = endAngle + Math.PI * 2;
  45204. }
  45205. if (startAngle > endAngle && !anticlockwise) {
  45206. endAngle += Math.PI * 2;
  45207. } else if (startAngle < endAngle && anticlockwise) {
  45208. startAngle += Math.PI * 2;
  45209. }
  45210. if (anticlockwise) {
  45211. var tmp = endAngle;
  45212. endAngle = startAngle;
  45213. startAngle = tmp;
  45214. }
  45215. // var number = 0;
  45216. // var step = (anticlockwise ? -Math.PI : Math.PI) / 2;
  45217. for (var angle = 0; angle < endAngle; angle += Math.PI / 2) {
  45218. if (angle > startAngle) {
  45219. extremity[0] = Math.cos(angle) * r + x;
  45220. extremity[1] = Math.sin(angle) * r + y;
  45221. vec2.min(min, extremity, min);
  45222. vec2.max(max, extremity, max);
  45223. }
  45224. }
  45225. }
  45226. }
  45227. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Env.js
  45228. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45229. * This program are made available under the terms of the Apache License, Version 2.0
  45230. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45231. /**
  45232. * @class SuperMap.LevelRenderer.Tool.Env
  45233. * @category Visualization Theme
  45234. * @classdesc 环境识别
  45235. * @private
  45236. */
  45237. class Env {
  45238. constructor() {
  45239. // Zepto.js
  45240. // (c) 2010-2013 Thomas Fuchs
  45241. // Zepto.js may be freely distributed under the MIT license.
  45242. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Env";
  45243. var me = this;
  45244. function detect(ua) {
  45245. var os = me.os = {};
  45246. var browser = me.browser = {};
  45247. var webkit = ua.match(/Web[kK]it[\/]{0,1}([\d.]+)/);
  45248. var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
  45249. var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
  45250. var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/);
  45251. var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
  45252. var webos = ua.match(/(webOS|hpwOS)[\s\/]([\d.]+)/);
  45253. var touchpad = webos && ua.match(/TouchPad/);
  45254. var kindle = ua.match(/Kindle\/([\d.]+)/);
  45255. var silk = ua.match(/Silk\/([\d._]+)/);
  45256. var blackberry = ua.match(/(BlackBerry).*Version\/([\d.]+)/);
  45257. var bb10 = ua.match(/(BB10).*Version\/([\d.]+)/);
  45258. var rimtabletos = ua.match(/(RIM\sTablet\sOS)\s([\d.]+)/);
  45259. var playbook = ua.match(/PlayBook/);
  45260. var chrome = ua.match(/Chrome\/([\d.]+)/) || ua.match(/CriOS\/([\d.]+)/);
  45261. var firefox = ua.match(/Firefox\/([\d.]+)/);
  45262. var ie = ua.match(/MSIE ([\d.]+)/);
  45263. var safari = webkit && ua.match(/Mobile\//) && !chrome;
  45264. var webview = ua.match(/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/) && !chrome;
  45265. // Todo: clean this up with a better OS/browser seperation:
  45266. // - discern (more) between multiple browsers on android
  45267. // - decide if kindle fire in silk mode is android or not
  45268. // - Firefox on Android doesn't specify the Android version
  45269. // - possibly devide in os, device and browser hashes
  45270. /*eslint-disable*/
  45271. if (browser.webkit = !!webkit) {
  45272. browser.version = webkit[1];
  45273. }
  45274. if (android) {
  45275. os.android = true;
  45276. os.version = android[2];
  45277. }
  45278. if (iphone && !ipod) {
  45279. os.ios = os.iphone = true;
  45280. os.version = iphone[2].replace(/_/g, '.');
  45281. }
  45282. if (ipad) {
  45283. os.ios = os.ipad = true;
  45284. os.version = ipad[2].replace(/_/g, '.');
  45285. }
  45286. if (ipod) {
  45287. os.ios = os.ipod = true;
  45288. os.version = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
  45289. }
  45290. if (webos) {
  45291. os.webos = true;
  45292. os.version = webos[2];
  45293. }
  45294. if (touchpad) {
  45295. os.touchpad = true;
  45296. }
  45297. if (blackberry) {
  45298. os.blackberry = true;
  45299. os.version = blackberry[2];
  45300. }
  45301. if (bb10) {
  45302. os.bb10 = true;
  45303. os.version = bb10[2];
  45304. }
  45305. if (rimtabletos) {
  45306. os.rimtabletos = true;
  45307. os.version = rimtabletos[2];
  45308. }
  45309. if (playbook) {
  45310. browser.playbook = true;
  45311. }
  45312. if (kindle) {
  45313. os.kindle = true;
  45314. os.version = kindle[1];
  45315. }
  45316. if (silk) {
  45317. browser.silk = true;
  45318. browser.version = silk[1];
  45319. }
  45320. if (!silk && os.android && ua.match(/Kindle Fire/)) {
  45321. browser.silk = true;
  45322. }
  45323. if (chrome) {
  45324. browser.chrome = true;
  45325. browser.version = chrome[1];
  45326. }
  45327. if (firefox) {
  45328. browser.firefox = true;
  45329. browser.version = firefox[1];
  45330. }
  45331. if (ie) {
  45332. browser.ie = true;
  45333. browser.version = ie[1];
  45334. }
  45335. if (safari && (ua.match(/Safari/) || !!os.ios)) {
  45336. browser.safari = true;
  45337. }
  45338. if (webview) {
  45339. browser.webview = true;
  45340. }
  45341. if (ie) {
  45342. browser.ie = true;
  45343. browser.version = ie[1];
  45344. }
  45345. os.tablet = !!(ipad || playbook || (android && !ua.match(/Mobile/)) ||
  45346. (firefox && ua.match(/Tablet/)) || (ie && !ua.match(/Phone/) && ua.match(/Touch/)));
  45347. os.phone = !!(!os.tablet && !os.ipod && (android || iphone || webos || blackberry || bb10 ||
  45348. (chrome && ua.match(/Android/)) || (chrome && ua.match(/CriOS\/([\d.]+)/)) ||
  45349. (firefox && ua.match(/Mobile/)) || (ie && ua.match(/Touch/))));
  45350. return {
  45351. browser: browser,
  45352. os: os,
  45353. // 原生canvas支持
  45354. canvasSupported: document.createElement('canvas').getContext ? true : false
  45355. };
  45356. }
  45357. return detect(navigator.userAgent);
  45358. }
  45359. destory() {
  45360. return true;
  45361. }
  45362. }
  45363. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Event.js
  45364. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45365. * This program are made available under the terms of the Apache License, Version 2.0
  45366. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45367. /**
  45368. * @class SuperMap.LevelRenderer.Tool.Event
  45369. * @category Visualization Theme
  45370. * @classdesc LevelRenderer 工具-事件辅助类
  45371. * @private
  45372. */
  45373. class Event_Event {
  45374. /**
  45375. * @function SuperMap.LevelRenderer.Tool.Event.prototype.constructor
  45376. * @description 构造函数。
  45377. */
  45378. constructor() {
  45379. /**
  45380. * @member {function} SuperMap.LevelRenderer.Tool.Event.prototype.stop
  45381. * @description 停止冒泡和阻止默认行为
  45382. */
  45383. this.stop = typeof window.addEventListener === 'function'
  45384. ? function (e) {
  45385. e.preventDefault();
  45386. e.stopPropagation();
  45387. e.cancelBubble = true;
  45388. }
  45389. : function (e) {
  45390. e.returnValue = false;
  45391. e.cancelBubble = true;
  45392. };
  45393. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Event";
  45394. }
  45395. /**
  45396. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getX
  45397. * @description 提取鼠标(手指)x坐标。
  45398. * @param {Event} e - 事件。
  45399. * @returns {number} 鼠标(手指)x坐标。
  45400. */
  45401. getX(e) {
  45402. return typeof e.zrenderX != 'undefined' && e.zrenderX
  45403. || typeof e.offsetX != 'undefined' && e.offsetX
  45404. || typeof e.layerX != 'undefined' && e.layerX
  45405. || typeof e.clientX != 'undefined' && e.clientX;
  45406. }
  45407. /**
  45408. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getY
  45409. * @description 提取鼠标(手指)y坐标。
  45410. * @param {Event} e - 事件。
  45411. * @returns {number} 鼠标(手指)y坐标。
  45412. */
  45413. getY(e) {
  45414. return typeof e.zrenderY != 'undefined' && e.zrenderY
  45415. || typeof e.offsetY != 'undefined' && e.offsetY
  45416. || typeof e.layerY != 'undefined' && e.layerY
  45417. || typeof e.clientY != 'undefined' && e.clientY;
  45418. }
  45419. /**
  45420. * @function SuperMap.LevelRenderer.Tool.Event.prototype.getDelta
  45421. * @description 提取鼠标滚轮变化。
  45422. * @param {Event} e - 事件。
  45423. * @returns {number} 滚轮变化,正值说明滚轮是向上滚动,如果是负值说明滚轮是向下滚动。
  45424. */
  45425. getDelta(e) {
  45426. return typeof e.zrenderDelta != 'undefined' && e.zrenderDelta
  45427. || typeof e.wheelDelta != 'undefined' && e.wheelDelta
  45428. || typeof e.detail != 'undefined' && -e.detail;
  45429. }
  45430. }
  45431. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Http.js
  45432. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45433. * This program are made available under the terms of the Apache License, Version 2.0
  45434. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45435. /**
  45436. * @private
  45437. * @class SuperMap.LevelRenderer.Tool.Http
  45438. * @category Visualization Theme
  45439. * @classdesc LevelRenderer 工具-Http
  45440. */
  45441. class Http {
  45442. /**
  45443. * @function SuperMap.LevelRenderer.Tool.Http.constructor
  45444. * @description 构造函数。
  45445. */
  45446. constructor() {
  45447. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Http"
  45448. }
  45449. /**
  45450. * @function SuperMap.LevelRenderer.Tool.Http.prototype.get
  45451. * @description get请求。
  45452. * @param {(string|IHTTPGetOption)} url - 请求url
  45453. * @param {function} onsuccess - 请求成功函数
  45454. * @param {function} onerror - 请求失败函数
  45455. * @param {Object} opts - 额外参数
  45456. * @returns {number} cos值
  45457. */
  45458. get(url, onsuccess, onerror) {
  45459. if (typeof(url) === 'object') {
  45460. var obj = url;
  45461. url = obj.url;
  45462. onsuccess = obj.onsuccess;
  45463. onerror = obj.onerror;
  45464. }
  45465. var xhr = window.XMLHttpRequest
  45466. ? new XMLHttpRequest()
  45467. : new window.ActiveXObject('Microsoft.XMLHTTP');
  45468. xhr.open('GET', url, true);
  45469. xhr.onreadystatechange = function () {
  45470. if (xhr.readyState == 4) {
  45471. if (xhr.status >= 200 && xhr.status < 300 || xhr.status === 304) {
  45472. onsuccess && onsuccess(xhr.responseText);
  45473. } else {
  45474. onerror && onerror();
  45475. }
  45476. xhr.onreadystatechange = new Function();
  45477. xhr = null;
  45478. }
  45479. };
  45480. xhr.send(null);
  45481. }
  45482. }
  45483. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Config.js
  45484. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45485. * This program are made available under the terms of the Apache License, Version 2.0
  45486. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45487. class Config {
  45488. }
  45489. /**
  45490. * @enum EVENT
  45491. * @description 事件
  45492. * @type {Object}
  45493. * @private
  45494. */
  45495. Config.EVENT = {
  45496. //窗口大小变化
  45497. RESIZE: 'resize',
  45498. //鼠标按钮被(手指)按下,事件对象是:目标图形元素或空
  45499. CLICK: 'click',
  45500. //双击事件
  45501. DBLCLICK: 'dblclick',
  45502. //鼠标滚轮变化,事件对象是:目标图形元素或空
  45503. MOUSEWHEEL: 'mousewheel',
  45504. //鼠标(手指)被移动,事件对象是:目标图形元素或空
  45505. MOUSEMOVE: 'mousemove',
  45506. //鼠标移到某图形元素之上,事件对象是:目标图形元素
  45507. MOUSEOVER: 'mouseover',
  45508. //鼠标从某图形元素移开,事件对象是:目标图形元素
  45509. MOUSEOUT: 'mouseout',
  45510. //鼠标按钮(手指)被按下,事件对象是:目标图形元素或空
  45511. MOUSEDOWN: 'mousedown',
  45512. //鼠标按键(手指)被松开,事件对象是:目标图形元素或空
  45513. MOUSEUP: 'mouseup',
  45514. //全局离开,MOUSEOUT触发比较频繁,一次离开优化绑定
  45515. GLOBALOUT: 'globalout',
  45516. // 一次成功元素拖拽的行为事件过程是:
  45517. // dragstart > dragenter > dragover [> dragleave] > drop > dragend
  45518. //开始拖拽时触发,事件对象是:被拖拽图形元素
  45519. DRAGSTART: 'dragstart',
  45520. //拖拽完毕时触发(在drop之后触发),事件对象是:被拖拽图形元素
  45521. DRAGEND: 'dragend',
  45522. //拖拽图形元素进入目标图形元素时触发,事件对象是:目标图形元素
  45523. DRAGENTER: 'dragenter',
  45524. //拖拽图形元素在目标图形元素上移动时触发,事件对象是:目标图形元素
  45525. DRAGOVER: 'dragover',
  45526. //拖拽图形元素离开目标图形元素时触发,事件对象是:目标图形元素
  45527. DRAGLEAVE: 'dragleave',
  45528. //拖拽图形元素放在目标图形元素内时触发,事件对象是:目标图形元素
  45529. DROP: 'drop',
  45530. //touch end - start < delay is click
  45531. touchClickDelay: 300
  45532. };
  45533. /**
  45534. * @enum catchBrushException
  45535. * @description 是否异常捕获
  45536. * @type {boolean}
  45537. * @private
  45538. */
  45539. Config.catchBrushException = false;
  45540. /**
  45541. * @enum debugMode
  45542. * @description debug 日志选项:catchBrushException 为 true 下有效。
  45543. * 0 : 不生成debug数据,发布用
  45544. * 1 : 异常抛出,调试用
  45545. * 2 : 控制台输出,调试用
  45546. * @type {boolean}
  45547. * @private
  45548. */
  45549. Config.debugMode = 0;
  45550. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Log.js
  45551. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45552. * This program are made available under the terms of the Apache License, Version 2.0
  45553. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45554. /**
  45555. * @private
  45556. * @class SuperMap.LevelRenderer.Tool.Log
  45557. * @category Visualization Theme
  45558. * @classdesc LevelRenderer 工具-日志
  45559. */
  45560. class Log {
  45561. /**
  45562. * @function SuperMap.LevelRenderer.Tool.Log.constructor
  45563. * @description 构造函数。
  45564. */
  45565. constructor() {
  45566. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Log";
  45567. return function () {
  45568. if (Config.debugMode === 0) {
  45569. return;
  45570. } else if (Config.debugMode == 1) {
  45571. for (let k in arguments) {
  45572. throw new Error(arguments[k]);
  45573. }
  45574. } else if (Config.debugMode > 1) {
  45575. for (let k in arguments) {
  45576. console.log(arguments[k]);
  45577. }
  45578. }
  45579. };
  45580. /* for debug
  45581. return function(mes) {
  45582. document.getElementById('wrong-message').innerHTML =
  45583. mes + ' ' + (new Date() - 0)
  45584. + '<br/>'
  45585. + document.getElementById('wrong-message').innerHTML;
  45586. };
  45587. */
  45588. }
  45589. destory() {
  45590. return true;
  45591. }
  45592. }
  45593. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Math.js
  45594. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45595. * This program are made available under the terms of the Apache License, Version 2.0
  45596. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45597. /**
  45598. * @private
  45599. * @class SuperMap.LevelRenderer.Tool.Math
  45600. * @category Visualization Theme
  45601. * @classdesc LevelRenderer 工具-数学辅助类
  45602. */
  45603. class MathTool {
  45604. /**
  45605. * @function SuperMap.LevelRenderer.Tool.Math.constructor
  45606. * @description 构造函数。
  45607. */
  45608. constructor() {
  45609. /**
  45610. * @member {number} SuperMap.LevelRenderer.Tool.Math._radians
  45611. * @description 角度与弧度转化参数
  45612. */
  45613. this._radians = window.Math.PI / 180;
  45614. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Math";
  45615. }
  45616. /**
  45617. * @function SuperMap.LevelRenderer.Tool.Math.prototype.sin
  45618. * @description 正弦函数。
  45619. * @param {number} angle - 弧度(角度)参数。
  45620. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  45621. * @returns {number} sin 值。
  45622. */
  45623. sin(angle, isDegrees) {
  45624. return window.Math.sin(isDegrees ? angle * this._radians : angle);
  45625. }
  45626. /**
  45627. * @function SuperMap.LevelRenderer.Tool.Math.prototype.cos
  45628. * @description 余弦函数。
  45629. * @param {number} angle - 弧度(角度)参数。
  45630. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  45631. * @returns {number} cos 值。
  45632. */
  45633. cos(angle, isDegrees) {
  45634. return window.Math.cos(isDegrees ? angle * this._radians : angle);
  45635. }
  45636. /**
  45637. * @function SuperMap.LevelRenderer.Tool.Math.prototype.degreeToRadian
  45638. * @description 角度转弧度。
  45639. * @param {number} angle - 弧度(角度)参数。
  45640. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  45641. * @returns {number} 弧度值。
  45642. */
  45643. degreeToRadian(angle) {
  45644. return angle * this._radians;
  45645. }
  45646. /**
  45647. * @function SuperMap.LevelRenderer.Tool.Math.prototype.radianToDegree
  45648. * @description 弧度转角度。
  45649. * @param {number} angle - 弧度(角度)参数。
  45650. * @param {boolean} [isDegrees=false] - angle参数是否为角度计算,angle为以弧度计量的角度。
  45651. * @returns {number} 角度。
  45652. */
  45653. radianToDegree(angle) {
  45654. return angle / this._radians;
  45655. }
  45656. }
  45657. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Matrix.js
  45658. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45659. * This program are made available under the terms of the Apache License, Version 2.0
  45660. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45661. /**
  45662. * @private
  45663. * @class SuperMap.LevelRenderer.Tool.Matrix
  45664. * @category Visualization Theme
  45665. * @classdesc LevelRenderer 工具-3x2矩阵操作类
  45666. */
  45667. class Matrix {
  45668. /**
  45669. * @function SuperMap.LevelRenderer.Tool.Matrix.constructor
  45670. * @description 构造函数。
  45671. */
  45672. constructor() {
  45673. /**
  45674. * @member {Object} SuperMap.LevelRenderer.Tool.Matrix.prototype.ArrayCtor
  45675. * @description 数组类型控制
  45676. */
  45677. this.ArrayCtor = typeof Float32Array === 'undefined'
  45678. ? Array
  45679. : Float32Array;
  45680. this.CLASS_NAME = "SuperMap.LevelRenderer.Tool.Matrix";
  45681. }
  45682. /**
  45683. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.create
  45684. * @description 创建一个单位矩阵。
  45685. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  45686. */
  45687. create() {
  45688. var ArrayCtor = this.ArrayCtor;
  45689. var out = new ArrayCtor(6);
  45690. this.identity(out);
  45691. return out;
  45692. }
  45693. /**
  45694. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.identity
  45695. * @description 设置矩阵为单位矩阵。
  45696. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45697. * @returns {(Float32Array|Array.<number>)} 单位矩阵。
  45698. */
  45699. identity(out) {
  45700. out[0] = 1;
  45701. out[1] = 0;
  45702. out[2] = 0;
  45703. out[3] = 1;
  45704. out[4] = 0;
  45705. out[5] = 0;
  45706. return out;
  45707. }
  45708. /**
  45709. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.copy
  45710. * @description 复制矩阵。
  45711. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45712. * @returns {(Float32Array|Array.<number>)} 克隆矩阵。
  45713. */
  45714. copy(out, m) {
  45715. out[0] = m[0];
  45716. out[1] = m[1];
  45717. out[2] = m[2];
  45718. out[3] = m[3];
  45719. out[4] = m[4];
  45720. out[5] = m[5];
  45721. return out;
  45722. }
  45723. /**
  45724. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  45725. * @description 矩阵相乘。
  45726. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45727. * @param {(Float32Array|Array.<number>)} m1 - 矩阵m1。
  45728. * @param {(Float32Array|Array.<number>)} m2- 矩阵m2。
  45729. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45730. */
  45731. mul(out, m1, m2) {
  45732. out[0] = m1[0] * m2[0] + m1[2] * m2[1];
  45733. out[1] = m1[1] * m2[0] + m1[3] * m2[1];
  45734. out[2] = m1[0] * m2[2] + m1[2] * m2[3];
  45735. out[3] = m1[1] * m2[2] + m1[3] * m2[3];
  45736. out[4] = m1[0] * m2[4] + m1[2] * m2[5] + m1[4];
  45737. out[5] = m1[1] * m2[4] + m1[3] * m2[5] + m1[5];
  45738. return out;
  45739. }
  45740. /**
  45741. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mul
  45742. * @description 平移变换。
  45743. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45744. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45745. * @param {(Float32Array|Array.<number>)} v- 平移参数。
  45746. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45747. */
  45748. translate(out, a, v) {
  45749. out[0] = a[0];
  45750. out[1] = a[1];
  45751. out[2] = a[2];
  45752. out[3] = a[3];
  45753. out[4] = a[4] + v[0];
  45754. out[5] = a[5] + v[1];
  45755. return out;
  45756. }
  45757. /**
  45758. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.rotate
  45759. * @description 平移变换。
  45760. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45761. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45762. * @param {(Float32Array|Array.<number>)} rad - 旋转参数。
  45763. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45764. */
  45765. rotate(out, a, rad) {
  45766. var aa = a[0];
  45767. var ac = a[2];
  45768. var atx = a[4];
  45769. var ab = a[1];
  45770. var ad = a[3];
  45771. var aty = a[5];
  45772. var st = Math.sin(rad);
  45773. var ct = Math.cos(rad);
  45774. out[0] = aa * ct + ab * st;
  45775. out[1] = -aa * st + ab * ct;
  45776. out[2] = ac * ct + ad * st;
  45777. out[3] = -ac * st + ct * ad;
  45778. out[4] = ct * atx + st * aty;
  45779. out[5] = ct * aty - st * atx;
  45780. return out;
  45781. }
  45782. /**
  45783. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.scale
  45784. * @description 缩放变换。
  45785. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45786. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45787. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  45788. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45789. */
  45790. scale(out, a, v) {
  45791. var vx = v[0];
  45792. var vy = v[1];
  45793. out[0] = a[0] * vx;
  45794. out[1] = a[1] * vy;
  45795. out[2] = a[2] * vx;
  45796. out[3] = a[3] * vy;
  45797. out[4] = a[4] * vx;
  45798. out[5] = a[5] * vy;
  45799. return out;
  45800. }
  45801. /**
  45802. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.invert
  45803. * @description 求逆矩阵。
  45804. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45805. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45806. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45807. */
  45808. invert(out, a) {
  45809. var aa = a[0];
  45810. var ac = a[2];
  45811. var atx = a[4];
  45812. var ab = a[1];
  45813. var ad = a[3];
  45814. var aty = a[5];
  45815. var det = aa * ad - ab * ac;
  45816. if (!det) {
  45817. return null;
  45818. }
  45819. det = 1.0 / det;
  45820. out[0] = ad * det;
  45821. out[1] = -ab * det;
  45822. out[2] = -ac * det;
  45823. out[3] = aa * det;
  45824. out[4] = (ac * aty - ad * atx) * det;
  45825. out[5] = (ab * atx - aa * aty) * det;
  45826. return out;
  45827. }
  45828. /**
  45829. * @function SuperMap.LevelRenderer.Tool.Matrix.prototype.mulVector
  45830. * @description 矩阵左乘向量。
  45831. * @param {(Float32Array|Array.<number>)} out - 单位矩阵。
  45832. * @param {(Float32Array|Array.<number>)} a - 矩阵。
  45833. * @param {(Float32Array|Array.<number>)} v - 缩放参数。
  45834. * @returns {(Float32Array|Array.<number>)} 结果矩阵。
  45835. */
  45836. mulVector(out, a, v) {
  45837. var aa = a[0];
  45838. var ac = a[2];
  45839. var atx = a[4];
  45840. var ab = a[1];
  45841. var ad = a[3];
  45842. var aty = a[5];
  45843. out[0] = v[0] * aa + v[1] * ac + atx;
  45844. out[1] = v[0] * ab + v[1] * ad + aty;
  45845. return out;
  45846. }
  45847. }
  45848. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SUtil.js
  45849. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  45850. * This program are made available under the terms of the Apache License, Version 2.0
  45851. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  45852. class SUtil_SUtil {
  45853. /**
  45854. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothBezier
  45855. * @description 贝塞尔平滑曲线。
  45856. * @private
  45857. * @param {Array} points - 线段顶点数组。
  45858. * @param {number} smooth - 平滑等级, 0-1。
  45859. * @param {boolean} isLoop - isLoop。
  45860. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  45861. * @param {Array} [originalPosition=[0, 0]] - 参考原点。
  45862. * @return {Array} 生成的平滑节点数组。
  45863. */
  45864. static SUtil_smoothBezier(points, smooth, isLoop, constraint, originalPosition) {
  45865. if (!originalPosition || originalPosition !== 2) {
  45866. originalPosition = [0, 0];
  45867. }
  45868. var __OP = originalPosition;
  45869. var cps = [];
  45870. var v = [];
  45871. var v1 = [];
  45872. var v2 = [];
  45873. var hasConstraint = !!constraint;
  45874. var min, max;
  45875. if (hasConstraint) {
  45876. min = [Infinity, Infinity];
  45877. max = [-Infinity, -Infinity];
  45878. let len = points.length;
  45879. for (let i = 0; i < len; i++) {
  45880. SUtil_SUtil.Util_vector.min(min, min, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45881. SUtil_SUtil.Util_vector.max(max, max, [points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45882. }
  45883. // 与指定的包围盒做并集
  45884. SUtil_SUtil.Util_vector.min(min, min, constraint[0]);
  45885. SUtil_SUtil.Util_vector.max(max, max, constraint[1]);
  45886. }
  45887. let len = points.length;
  45888. for (let i = 0; i < len; i++) {
  45889. let point = [points[i][0] + __OP[0], points[i][1] + __OP[1]];
  45890. let prevPoint;
  45891. let nextPoint;
  45892. if (isLoop) {
  45893. prevPoint = [points[i ? i - 1 : len - 1][0] + __OP[0], points[i ? i - 1 : len - 1][1] + __OP[1]];
  45894. nextPoint = [points[(i + 1) % len][0] + __OP[0], points[(i + 1) % len][1] + __OP[1]];
  45895. } else {
  45896. if (i === 0 || i === len - 1) {
  45897. cps.push([points[i][0] + __OP[0], points[i][1] + __OP[1]]);
  45898. continue;
  45899. } else {
  45900. prevPoint = [points[i - 1][0] + __OP[0], points[i - 1][1] + __OP[1]];
  45901. nextPoint = [points[i + 1][0] + __OP[0], points[i + 1][1] + __OP[1]];
  45902. }
  45903. }
  45904. SUtil_SUtil.Util_vector.sub(v, nextPoint, prevPoint);
  45905. // use degree to scale the handle length
  45906. SUtil_SUtil.Util_vector.scale(v, v, smooth);
  45907. let d0 = SUtil_SUtil.Util_vector.distance(point, prevPoint);
  45908. let d1 = SUtil_SUtil.Util_vector.distance(point, nextPoint);
  45909. let sum = d0 + d1;
  45910. if (sum !== 0) {
  45911. d0 /= sum;
  45912. d1 /= sum;
  45913. }
  45914. SUtil_SUtil.Util_vector.scale(v1, v, -d0);
  45915. SUtil_SUtil.Util_vector.scale(v2, v, d1);
  45916. let cp0 = SUtil_SUtil.Util_vector.add([], point, v1);
  45917. let cp1 = SUtil_SUtil.Util_vector.add([], point, v2);
  45918. if (hasConstraint) {
  45919. SUtil_SUtil.Util_vector.max(cp0, cp0, min);
  45920. SUtil_SUtil.Util_vector.min(cp0, cp0, max);
  45921. SUtil_SUtil.Util_vector.max(cp1, cp1, min);
  45922. SUtil_SUtil.Util_vector.min(cp1, cp1, max);
  45923. }
  45924. cps.push(cp0);
  45925. cps.push(cp1);
  45926. }
  45927. if (isLoop) {
  45928. cps.push(cps.shift());
  45929. }
  45930. return cps;
  45931. }
  45932. /**
  45933. * @function SuperMap.LevelRenderer.SUtil.SUtil_smoothSpline
  45934. * @description 插值折线。
  45935. * @private
  45936. * @param {Array} points - 线段顶点数组。
  45937. * @param {boolean} isLoop - isLoop。
  45938. * @param {Array} constraint - 将计算出来的控制点约束在一个包围盒内,比如 [[0, 0], [100, 100]], 这个包围盒会与整个折线的包围盒做一个并集用来约束控制点。
  45939. * @param {Array} originalPosition - 参考原点。默认值:[0, 0]。
  45940. * @return {Array} 生成的平滑节点数组。
  45941. */
  45942. static SUtil_smoothSpline(points, isLoop, constraint, originalPosition) {
  45943. if (!originalPosition || originalPosition !== 2) {
  45944. originalPosition = [0, 0];
  45945. }
  45946. var __OP = originalPosition;
  45947. var len = points.length;
  45948. var ret = [];
  45949. var distance = 0;
  45950. for (let i = 1; i < len; i++) {
  45951. 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]]);
  45952. }
  45953. var segs = distance / 5;
  45954. segs = segs < len ? len : segs;
  45955. for (let i = 0; i < segs; i++) {
  45956. let pos = i / (segs - 1) * (isLoop ? len : len - 1);
  45957. let idx = Math.floor(pos);
  45958. let w = pos - idx;
  45959. let p0;
  45960. let p1 = [points[idx % len][0] + __OP[0], points[idx % len][1] + __OP[1]];
  45961. let p2;
  45962. let p3;
  45963. if (!isLoop) {
  45964. p0 = [points[idx === 0 ? idx : idx - 1][0] + __OP[0], points[idx === 0 ? idx : idx - 1][1] + __OP[1]];
  45965. p2 = [points[idx > len - 2 ? len - 1 : idx + 1][0] + __OP[0], points[idx > len - 2 ? len - 1 : idx + 1][1] + __OP[1]];
  45966. p3 = [points[idx > len - 3 ? len - 1 : idx + 2][0] + __OP[0], points[idx > len - 3 ? len - 1 : idx + 2][1] + __OP[1]];
  45967. } else {
  45968. p0 = [points[(idx - 1 + len) % len][0] + __OP[0], points[(idx - 1 + len) % len][1] + __OP[1]];
  45969. p2 = [points[(idx + 1) % len][0] + __OP[0], points[(idx + 1) % len][1] + __OP[1]];
  45970. p3 = [points[(idx + 2) % len][0] + __OP[0], points[(idx + 2) % len][1] + __OP[1]];
  45971. }
  45972. let w2 = w * w;
  45973. let w3 = w * w2;
  45974. ret.push([
  45975. interpolate(p0[0], p1[0], p2[0], p3[0], w, w2, w3),
  45976. interpolate(p0[1], p1[1], p2[1], p3[1], w, w2, w3)
  45977. ]);
  45978. }
  45979. return ret;
  45980. // inner Function
  45981. function interpolate(p0, p1, p2, p3, t, t2, t3) {
  45982. var v0 = (p2 - p0) * 0.5;
  45983. var v1 = (p3 - p1) * 0.5;
  45984. return (2 * (p1 - p2) + v0 + v1) * t3
  45985. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  45986. + v0 * t + p1;
  45987. }
  45988. }
  45989. /**
  45990. * @function SuperMap.LevelRenderer.SUtil.SUtil_dashedLineTo
  45991. * @description 虚线 lineTo。
  45992. */
  45993. static SUtil_dashedLineTo(ctx, x1, y1, x2, y2, dashLength, customDashPattern) {
  45994. // http://msdn.microsoft.com/en-us/library/ie/dn265063(v=vs.85).aspx
  45995. var dashPattern = [5, 5];
  45996. dashLength = typeof dashLength != 'number'
  45997. ? 5
  45998. : dashLength;
  45999. if (ctx.setLineDash) {
  46000. dashPattern[0] = dashLength;
  46001. dashPattern[1] = dashLength;
  46002. if (customDashPattern && (customDashPattern instanceof Array)) {
  46003. ctx.setLineDash(customDashPattern);
  46004. } else {
  46005. ctx.setLineDash(dashPattern);
  46006. }
  46007. // ctx.setLineDash(dashPattern);
  46008. ctx.moveTo(x1, y1);
  46009. ctx.lineTo(x2, y2);
  46010. return;
  46011. }
  46012. var dx = x2 - x1;
  46013. var dy = y2 - y1;
  46014. var numDashes = Math.floor(
  46015. Math.sqrt(dx * dx + dy * dy) / dashLength
  46016. );
  46017. dx = dx / numDashes;
  46018. dy = dy / numDashes;
  46019. var flag = true;
  46020. for (var i = 0; i < numDashes; ++i) {
  46021. if (flag) {
  46022. ctx.moveTo(x1, y1);
  46023. } else {
  46024. ctx.lineTo(x1, y1);
  46025. }
  46026. flag = !flag;
  46027. x1 += dx;
  46028. y1 += dy;
  46029. }
  46030. ctx.lineTo(x2, y2);
  46031. }
  46032. }
  46033. // 把所有工具对象放到全局静态变量上,以便直接调用工具方法,
  46034. // 避免使用工具时频繁的创建工具对象带来的性能消耗。
  46035. SUtil_SUtil.Util_area = new Area();
  46036. SUtil_SUtil.Util_color = new Color();
  46037. SUtil_SUtil.Util_computeBoundingBox = new ComputeBoundingBox();
  46038. SUtil_SUtil.Util_curve = new Curve_Curve();
  46039. SUtil_SUtil.Util_env = new Env();
  46040. SUtil_SUtil.Util_event = new Event_Event();
  46041. SUtil_SUtil.Util_http = new Http();
  46042. SUtil_SUtil.Util_log = new Log();
  46043. SUtil_SUtil.Util_math = new MathTool();
  46044. SUtil_SUtil.Util_matrix = new Matrix();
  46045. SUtil_SUtil.Util = new Util_Util();
  46046. SUtil_SUtil.Util_vector = new levelRenderer_Vector_Vector();
  46047. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Transformable.js
  46048. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46049. * This program are made available under the terms of the Apache License, Version 2.0
  46050. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46051. /**
  46052. * @private
  46053. * @class SuperMap.LevelRenderer.Transformable
  46054. * @category Visualization Theme
  46055. * @classdesc 可变换超类,所有支持 Canvas Transform 变换操作的类均是此类的子类。此类不可实例化。
  46056. */
  46057. class Transformable {
  46058. /**
  46059. * @function SuperMap.LevelRenderer.Transformable.constructor
  46060. * @description 构造函数。
  46061. */
  46062. constructor() {
  46063. /**
  46064. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.position
  46065. * @description 平移, 默认值:[0, 0]。
  46066. */
  46067. this.position = [0, 0];
  46068. /**
  46069. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.rotation
  46070. * @description 旋转,可以通过数组二三项指定旋转的原点, 默认值:[0, 0, 0]。
  46071. */
  46072. this.rotation = [0, 0, 0];
  46073. /**
  46074. * @member {Array.<number>} SuperMap.LevelRenderer.Transformable.prototype.scale
  46075. * @description 缩放,可以通过数组三四项指定缩放的原点, 默认值:[1, 1, 0, 0]。
  46076. */
  46077. this.scale = [1, 1, 0, 0];
  46078. /**
  46079. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needLocalTransform
  46080. * @description 是否变换。默认值:false。
  46081. */
  46082. this.needLocalTransform = false;
  46083. /**
  46084. * @member {boolean} SuperMap.LevelRenderer.Transformable.prototype.needTransform
  46085. * @description 是否有坐标变换。默认值:false。
  46086. */
  46087. this.needTransform = false;
  46088. this.CLASS_NAME = "SuperMap.LevelRenderer.Transformable";
  46089. /**
  46090. * @function SuperMap.LevelRenderer.Transformable.prototype.lookAt
  46091. * @description 设置图形的朝向。
  46092. */
  46093. this.lookAt = (function () {
  46094. var v = SUtil_SUtil.Util_vector.create();
  46095. // {Array.<Number>|Float32Array} target
  46096. return function (target) {
  46097. if (!this.transform) {
  46098. this.transform = SUtil_SUtil.Util_matrix.create();
  46099. }
  46100. var m = this.transform;
  46101. SUtil_SUtil.Util_vector.sub(v, target, this.position);
  46102. if (isAroundZero(v[0]) && isAroundZero(v[1])) {
  46103. return;
  46104. }
  46105. SUtil_SUtil.Util_vector.normalize(v, v);
  46106. // Y Axis
  46107. // TODO Scale origin ?
  46108. m[2] = v[0] * this.scale[1];
  46109. m[3] = v[1] * this.scale[1];
  46110. // X Axis
  46111. m[0] = v[1] * this.scale[0];
  46112. m[1] = -v[0] * this.scale[0];
  46113. // Position
  46114. m[4] = this.position[0];
  46115. m[5] = this.position[1];
  46116. this.decomposeTransform();
  46117. function isAroundZero(val) {
  46118. var EPSILON = 5e-5;
  46119. return val > -EPSILON && val < EPSILON;
  46120. }
  46121. };
  46122. })();
  46123. }
  46124. /**
  46125. * @function SuperMap.LevelRenderer.Transformable.prototype.destroy
  46126. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46127. */
  46128. destroy() {
  46129. this.position = null;
  46130. this.rotation = null;
  46131. this.scale = null;
  46132. this.needLocalTransform = null;
  46133. this.needTransform = null;
  46134. }
  46135. /**
  46136. * @function SuperMap.LevelRenderer.Transformable.prototype.updateNeedTransform
  46137. * @description 更新 needLocalTransform
  46138. */
  46139. updateNeedTransform() {
  46140. this.needLocalTransform = isNotAroundZero(this.rotation[0])
  46141. || isNotAroundZero(this.position[0])
  46142. || isNotAroundZero(this.position[1])
  46143. || isNotAroundZero(this.scale[0] - 1)
  46144. || isNotAroundZero(this.scale[1] - 1);
  46145. function isNotAroundZero(val) {
  46146. var EPSILON = 5e-5;
  46147. return val > EPSILON || val < -EPSILON;
  46148. }
  46149. }
  46150. /**
  46151. * @function SuperMap.LevelRenderer.Transformable.prototype.updateTransform
  46152. * @description 判断是否需要有坐标变换,更新 needTransform 属性。如果有坐标变换, 则从 position, rotation, scale 以及父节点的 transform 计算出自身的 transform 矩阵
  46153. */
  46154. updateTransform() {
  46155. this.updateNeedTransform();
  46156. if (this.parent) {
  46157. this.needTransform = this.needLocalTransform || this.parent.needTransform;
  46158. } else {
  46159. this.needTransform = this.needLocalTransform;
  46160. }
  46161. if (!this.needTransform) {
  46162. return;
  46163. }
  46164. var origin = [0, 0];
  46165. var m = this.transform || SUtil_SUtil.Util_matrix.create();
  46166. SUtil_SUtil.Util_matrix.identity(m);
  46167. if (this.needLocalTransform) {
  46168. if (
  46169. isNotAroundZero(this.scale[0])
  46170. || isNotAroundZero(this.scale[1])
  46171. ) {
  46172. origin[0] = -this.scale[2] || 0;
  46173. origin[1] = -this.scale[3] || 0;
  46174. let haveOrigin = isNotAroundZero(origin[0])
  46175. || isNotAroundZero(origin[1]);
  46176. if (haveOrigin) {
  46177. SUtil_SUtil.Util_matrix.translate(
  46178. m, m, origin
  46179. );
  46180. }
  46181. SUtil_SUtil.Util_matrix.scale(m, m, this.scale);
  46182. if (haveOrigin) {
  46183. origin[0] = -origin[0];
  46184. origin[1] = -origin[1];
  46185. SUtil_SUtil.Util_matrix.translate(
  46186. m, m, origin
  46187. );
  46188. }
  46189. }
  46190. if (this.rotation instanceof Array) {
  46191. if (this.rotation[0] !== 0) {
  46192. origin[0] = -this.rotation[1] || 0;
  46193. origin[1] = -this.rotation[2] || 0;
  46194. let haveOrigin = isNotAroundZero(origin[0])
  46195. || isNotAroundZero(origin[1]);
  46196. if (haveOrigin) {
  46197. SUtil_SUtil.Util_matrix.translate(
  46198. m, m, origin
  46199. );
  46200. }
  46201. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation[0]);
  46202. if (haveOrigin) {
  46203. origin[0] = -origin[0];
  46204. origin[1] = -origin[1];
  46205. SUtil_SUtil.Util_matrix.translate(
  46206. m, m, origin
  46207. );
  46208. }
  46209. }
  46210. } else {
  46211. if (this.rotation !== 0) {
  46212. SUtil_SUtil.Util_matrix.rotate(m, m, this.rotation);
  46213. }
  46214. }
  46215. if (
  46216. isNotAroundZero(this.position[0]) || isNotAroundZero(this.position[1])
  46217. ) {
  46218. SUtil_SUtil.Util_matrix.translate(m, m, this.position);
  46219. }
  46220. }
  46221. // 保存这个变换矩阵
  46222. this.transform = m;
  46223. // 应用父节点变换
  46224. if (this.parent && this.parent.needTransform) {
  46225. if (this.needLocalTransform) {
  46226. SUtil_SUtil.Util_matrix.mul(this.transform, this.parent.transform, this.transform);
  46227. } else {
  46228. SUtil_SUtil.Util_matrix.copy(this.transform, this.parent.transform);
  46229. }
  46230. }
  46231. function isNotAroundZero(val) {
  46232. var EPSILON = 5e-5;
  46233. return val > EPSILON || val < -EPSILON;
  46234. }
  46235. }
  46236. /**
  46237. * @function SuperMap.LevelRenderer.Transformable.prototype.setTransform
  46238. * @description 将自己的 transform 应用到 context 上。
  46239. *
  46240. * @param {Context2D} ctx - Context2D 上下文。
  46241. */
  46242. setTransform(ctx) {
  46243. if (this.needTransform) {
  46244. var m = this.transform;
  46245. ctx.transform(
  46246. m[0], m[1],
  46247. m[2], m[3],
  46248. m[4], m[5]
  46249. );
  46250. }
  46251. }
  46252. /**
  46253. * @function SuperMap.LevelRenderer.Transformable.prototype.decomposeTransform
  46254. * @description 分解`transform`矩阵到`position`, `rotation`, `scale` 。
  46255. */
  46256. decomposeTransform() {
  46257. if (!this.transform) {
  46258. return;
  46259. }
  46260. var m = this.transform;
  46261. var sx = m[0] * m[0] + m[1] * m[1];
  46262. var position = this.position;
  46263. var scale = this.scale;
  46264. var rotation = this.rotation;
  46265. if (isNotAroundZero(sx - 1)) {
  46266. sx = Math.sqrt(sx);
  46267. }
  46268. var sy = m[2] * m[2] + m[3] * m[3];
  46269. if (isNotAroundZero(sy - 1)) {
  46270. sy = Math.sqrt(sy);
  46271. }
  46272. position[0] = m[4];
  46273. position[1] = m[5];
  46274. scale[0] = sx;
  46275. scale[1] = sy;
  46276. scale[2] = scale[3] = 0;
  46277. rotation[0] = Math.atan2(-m[1] / sy, m[0] / sx);
  46278. rotation[1] = rotation[2] = 0;
  46279. function isNotAroundZero(val) {
  46280. var EPSILON = 5e-5;
  46281. return val > EPSILON || val < -EPSILON;
  46282. }
  46283. }
  46284. }
  46285. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Shape.js
  46286. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  46287. * This program are made available under the terms of the Apache License, Version 2.0
  46288. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  46289. /**
  46290. * @private
  46291. * @class SuperMap.LevelRenderer.Shape
  46292. * @category Visualization Theme
  46293. * @classdesc 图形(shape)基类。
  46294. * @extends SuperMap.LevelRenderer.Eventful
  46295. * @extends SuperMap.LevelRenderer.Transformable
  46296. */
  46297. class Shape_Shape extends SuperMap.mixin(Eventful, Transformable) {
  46298. /**
  46299. * @function SuperMap.LevelRenderer.Shape.constructor
  46300. * @description 构造函数。
  46301. *
  46302. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  46303. *
  46304. */
  46305. constructor(options) {
  46306. super(options);
  46307. options = options || {};
  46308. /**
  46309. * @member {string} SuperMap.LevelRenderer.Shape.prototype.id
  46310. * @description 唯一标识。
  46311. */
  46312. this.id = null;
  46313. /**
  46314. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style
  46315. * @description 基础绘制样式。
  46316. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46317. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  46318. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  46319. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46320. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  46321. * @param {number} style.opacity - 绘制透明度。默认值:1。
  46322. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46323. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  46324. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  46325. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46326. * @param {string} style.text - 图形中的附加文本。默认值:""。
  46327. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  46328. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46329. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46330. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46331. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46332. *
  46333. */
  46334. this.style = {};
  46335. /**
  46336. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.style.__rect
  46337. * @description 包围图形的最小矩形盒子。
  46338. *
  46339. * @param {number} x - 左上角顶点x轴坐标。
  46340. * @param {number} y - 左上角顶点y轴坐标。
  46341. * @param {number} width - 包围盒矩形宽度。
  46342. * @param {number} height - 包围盒矩形高度。
  46343. */
  46344. /**
  46345. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.highlightStyle
  46346. * @description 高亮样式。
  46347. *
  46348. * @param {string} highlightStyle.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  46349. * @param {string} highlightStyle.color - 填充颜色。默认值:"#000000'"。
  46350. * @param {string} highlightStyle.strokeColor - 描边颜色。默认值:"#000000'"。
  46351. * @param {string} highlightStyle.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  46352. * @param {number} highlightStyle.lineWidth - 描边宽度。默认值:1。
  46353. * @param {number} highlightStyle.opacity - 绘制透明度。默认值:1。
  46354. * @param {number} highlightStyle.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  46355. * @param {number} highlightStyle.shadowColor - 阴影颜色。默认值:"#000000'"。
  46356. * @param {number} highlightStyle.shadowOffsetX - 阴影横向偏移。默认值:0。
  46357. * @param {number} highlightStyle.shadowOffsetY - 阴影纵向偏移。默认值:0。
  46358. * @param {string} highlightStyle.text - 图形中的附加文本。默认值:""。
  46359. * @param {string} highlightStyle.textColor - 文本颜色。默认值:"#000000'"。
  46360. * @param {string} highlightStyle.textFont - 附加文本样式。示例:'bold 18px verdana'。
  46361. * @param {string} highlightStyle.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  46362. * @param {string} highlightStyle.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  46363. * @param {string} highlightStyle.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  46364. */
  46365. this.highlightStyle = null;
  46366. /**
  46367. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.parent
  46368. * @description 父节点,只读属性。<SuperMap.LevelRenderer.Group>
  46369. */
  46370. this.parent = null;
  46371. /**
  46372. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.__dirty
  46373. * @description {boolean}
  46374. */
  46375. this.__dirty = true;
  46376. /**
  46377. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.__clipShapes
  46378. * @description {Array}
  46379. *
  46380. */
  46381. this.__clipShapes = [];
  46382. /**
  46383. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.invisible
  46384. * @description 图形是否可见,为 true 时不绘制图形,但是仍能触发鼠标事件。默认值:false。
  46385. */
  46386. this.invisible = false;
  46387. /**
  46388. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.ignore
  46389. * @description 图形是否忽略,为 true 时忽略图形的绘制以及事件触发。默认值:false。
  46390. */
  46391. this.ignore = false;
  46392. /**
  46393. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.zlevel
  46394. * @description z 层 level,决定绘画在哪层 canvas 中。默认值:0。
  46395. */
  46396. this.zlevel = 0;
  46397. /**
  46398. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.draggable
  46399. * @description 是否可拖拽。默认值:false。
  46400. */
  46401. this.draggable = false;
  46402. /**
  46403. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.clickable
  46404. * @description 是否可点击。默认值:false。
  46405. */
  46406. this.clickable = false;
  46407. /**
  46408. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.hoverable
  46409. * @description 是否可以 hover。默认值:true。
  46410. */
  46411. this.hoverable = true;
  46412. /**
  46413. * @member {number} SuperMap.LevelRenderer.Shape.prototype.z
  46414. * @description z值,跟zlevel一样影响shape绘制的前后顺序,z值大的shape会覆盖在z值小的上面,但是并不会创建新的canvas,所以优先级低于zlevel,而且频繁改动的开销比zlevel小很多。默认值:0。
  46415. */
  46416. this.z = 0;
  46417. //地理扩展
  46418. /**
  46419. * @member {Array} SuperMap.LevelRenderer.Shape.prototype.refOriginalPosition
  46420. * @description 图形参考原点位置,图形的参考中心位置。
  46421. * refOriginalPosition 是长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  46422. *
  46423. * refOriginalPosition 表示图形的参考中心,通常情况下,图形是使用 canvas 的原点位置作为位置参考,
  46424. * 但 refOriginalPosition 可以改变图形的参考位置,例如: refOriginalPosition = [80, 80],
  46425. * 图形圆的 style.x = 20, style.y = 20,那么圆在 canvas 中的实际位置是 [100, 100]。
  46426. *
  46427. * 图形(Shape) 的所有位置相关属性都是以 refOriginalPosition 为参考中心,
  46428. * 也就是说图形的所有位置信息在 canvas 中都是以 refOriginalPosition 为参考的相对位置,只有
  46429. * refOriginalPosition 的值为 [0, 0] 时,形的位置信息才是 canvas 绝对位置。
  46430. *
  46431. * 图形的位置信息通常有:style.pointList,style.x,style.y。
  46432. *
  46433. * refOriginalPosition。默认值是: [0, 0]。
  46434. */
  46435. this.refOriginalPosition = [0, 0];
  46436. /**
  46437. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataID
  46438. * @description 图形所关联数据的 ID。
  46439. *
  46440. */
  46441. this.refDataID = null;
  46442. /**
  46443. * @member {boolean} SuperMap.LevelRenderer.Shape.prototype.isHoverByRefDataID
  46444. * @description 是否根据 refDataID 进行高亮。用于同时高亮所有 refDataID 相同的图形。
  46445. *
  46446. */
  46447. this.isHoverByRefDataID = false;
  46448. /**
  46449. * @member {string} SuperMap.LevelRenderer.Shape.prototype.refDataHoverGroup
  46450. * @description 高亮图形组的组名。此属性在 refDataID 有效且 isHoverByRefDataID 为 true 时生效。
  46451. * 一旦设置此属性,且属性值有效,只有关联同一个数据的图形且此属性相同的图形才会高亮。
  46452. *
  46453. */
  46454. this.refDataHoverGroup = null;
  46455. /**
  46456. * @member {Object} SuperMap.LevelRenderer.Shape.prototype.dataInfo
  46457. * @description 图形的数据信息。
  46458. *
  46459. */
  46460. this.dataInfo = null;
  46461. Util.extend(this, options);
  46462. this.id = this.id || Util.createUniqueID("smShape_");
  46463. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape";
  46464. /**
  46465. * @function SuperMap.LevelRenderer.Shape.prototype.getTansform
  46466. * @description 变换鼠标位置到 shape 的局部坐标空间
  46467. *
  46468. */
  46469. this.getTansform = (function () {
  46470. var invTransform = [];
  46471. return function (x, y) {
  46472. var originPos = [x, y];
  46473. // 对鼠标的坐标也做相同的变换
  46474. if (this.needTransform && this.transform) {
  46475. SUtil_SUtil.Util_matrix.invert(invTransform, this.transform);
  46476. SUtil_SUtil.Util_matrix.mulVector(originPos, invTransform, [x, y, 1]);
  46477. if (x == originPos[0] && y == originPos[1]) {
  46478. // 避免外部修改导致的 needTransform 不准确
  46479. this.updateNeedTransform();
  46480. }
  46481. }
  46482. return originPos;
  46483. };
  46484. })();
  46485. }
  46486. /**
  46487. * @function SuperMap.LevelRenderer.Shape.prototype.destroy
  46488. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  46489. */
  46490. destroy() {
  46491. this.id = null;
  46492. this.style = null;
  46493. this.highlightStyle = null;
  46494. this.parent = null;
  46495. this.__dirty = null;
  46496. this.__clipShapes = null;
  46497. this.invisible = null;
  46498. this.ignore = null;
  46499. this.zlevel = null;
  46500. this.draggable = null;
  46501. this.clickable = null;
  46502. this.hoverable = null;
  46503. this.z = null;
  46504. this.refOriginalPosition = null;
  46505. this.refDataID = null;
  46506. this.refDataHoverGroup = null;
  46507. this.isHoverByRefDataID = null;
  46508. this.dataInfo = null;
  46509. super.destroy();
  46510. }
  46511. /**
  46512. * @function SuperMap.LevelRenderer.Shape.prototype.brush
  46513. * @description 绘制图形。
  46514. *
  46515. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46516. * @param {boolean} isHighlight - 是否使用高亮属性。
  46517. * @param {Function} updateCallback - 需要异步加载资源的 shape 可以通过这个 callback(e),让painter更新视图,base.brush 没用,需要的话重载 brush。
  46518. */
  46519. brush(ctx, isHighlight) {
  46520. var style = this.beforeBrush(ctx, isHighlight);
  46521. ctx.beginPath();
  46522. this.buildPath(ctx, style);
  46523. switch (style.brushType) {
  46524. /* jshint ignore:start */
  46525. case 'both':
  46526. this.setCtxGlobalAlpha(ctx, "fill", style);
  46527. ctx.fill();
  46528. if (style.lineWidth > 0) {
  46529. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46530. ctx.stroke();
  46531. }
  46532. this.setCtxGlobalAlpha(ctx, "reset", style);
  46533. break;
  46534. case 'stroke':
  46535. this.setCtxGlobalAlpha(ctx, "stroke", style);
  46536. style.lineWidth > 0 && ctx.stroke();
  46537. this.setCtxGlobalAlpha(ctx, "reset", style);
  46538. break;
  46539. /* jshint ignore:end */
  46540. default:
  46541. this.setCtxGlobalAlpha(ctx, "fill", style);
  46542. ctx.fill();
  46543. this.setCtxGlobalAlpha(ctx, "reset", style);
  46544. break;
  46545. }
  46546. this.drawText(ctx, style, this.style);
  46547. this.afterBrush(ctx);
  46548. }
  46549. /**
  46550. * @function SuperMap.LevelRenderer.Shape.prototype.beforeBrush
  46551. * @description 具体绘制操作前的一些公共操作。
  46552. *
  46553. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46554. * @param {boolean} isHighlight - 是否使用高亮属性。
  46555. * @return {Object} 处理后的样式。
  46556. */
  46557. beforeBrush(ctx, isHighlight) {
  46558. var style = this.style;
  46559. if (this.brushTypeOnly) {
  46560. style.brushType = this.brushTypeOnly;
  46561. }
  46562. if (isHighlight) {
  46563. // 根据style扩展默认高亮样式
  46564. style = this.getHighlightStyle(
  46565. style,
  46566. this.highlightStyle || {},
  46567. this.brushTypeOnly
  46568. );
  46569. }
  46570. if (this.brushTypeOnly == 'stroke') {
  46571. style.strokeColor = style.strokeColor || style.color;
  46572. }
  46573. ctx.save();
  46574. this.doClip(ctx);
  46575. this.setContext(ctx, style);
  46576. // 设置transform
  46577. this.setTransform(ctx);
  46578. return style;
  46579. }
  46580. /**
  46581. * @function SuperMap.LevelRenderer.Shape.prototype.afterBrush
  46582. * @description 绘制后的处理。
  46583. *
  46584. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46585. *
  46586. */
  46587. afterBrush(ctx) {
  46588. ctx.restore();
  46589. }
  46590. /**
  46591. * @function SuperMap.LevelRenderer.Shape.prototype.setContext
  46592. * @description 设置 fillStyle, strokeStyle, shadow 等通用绘制样式。
  46593. *
  46594. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46595. * @param {Object} style - 样式。
  46596. *
  46597. */
  46598. setContext(ctx, style) {
  46599. var STYLE_CTX_MAP = [
  46600. ['color', 'fillStyle'],
  46601. ['strokeColor', 'strokeStyle'],
  46602. ['opacity', 'globalAlpha'],
  46603. ['lineCap', 'lineCap'],
  46604. ['lineJoin', 'lineJoin'],
  46605. ['miterLimit', 'miterLimit'],
  46606. ['lineWidth', 'lineWidth'],
  46607. ['shadowBlur', 'shadowBlur'],
  46608. ['shadowColor', 'shadowColor'],
  46609. ['shadowOffsetX', 'shadowOffsetX'],
  46610. ['shadowOffsetY', 'shadowOffsetY']
  46611. ];
  46612. for (var i = 0, len = STYLE_CTX_MAP.length; i < len; i++) {
  46613. var styleProp = STYLE_CTX_MAP[i][0];
  46614. var styleValue = style[styleProp];
  46615. var ctxProp = STYLE_CTX_MAP[i][1];
  46616. if (typeof styleValue != 'undefined') {
  46617. ctx[ctxProp] = styleValue;
  46618. }
  46619. }
  46620. }
  46621. /**
  46622. * @function SuperMap.LevelRenderer.Shape.prototype.doClip
  46623. *
  46624. */
  46625. doClip(ctx) {
  46626. var clipShapeInvTransform = SUtil_SUtil.Util_matrix.create();
  46627. if (this.__clipShapes) {
  46628. for (var i = 0; i < this.__clipShapes.length; i++) {
  46629. var clipShape = this.__clipShapes[i];
  46630. if (clipShape.needTransform) {
  46631. let m = clipShape.transform;
  46632. SUtil_SUtil.Util_matrix.invert(clipShapeInvTransform, m);
  46633. ctx.transform(
  46634. m[0], m[1],
  46635. m[2], m[3],
  46636. m[4], m[5]
  46637. );
  46638. }
  46639. ctx.beginPath();
  46640. clipShape.buildPath(ctx, clipShape.style);
  46641. ctx.clip();
  46642. // Transform back
  46643. if (clipShape.needTransform) {
  46644. let m = clipShapeInvTransform;
  46645. ctx.transform(
  46646. m[0], m[1],
  46647. m[2], m[3],
  46648. m[4], m[5]
  46649. );
  46650. }
  46651. }
  46652. }
  46653. }
  46654. /**
  46655. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightStyle
  46656. * @description 根据默认样式扩展高亮样式
  46657. *
  46658. * @param {Object} style - 样式。
  46659. * @param {Object} highlightStyle - 高亮样式。
  46660. * @param {string} brushTypeOnly - brushTypeOnly。
  46661. *
  46662. */
  46663. getHighlightStyle(style, highlightStyle, brushTypeOnly) {
  46664. var newStyle = {};
  46665. for (let k in style) {
  46666. newStyle[k] = style[k];
  46667. }
  46668. var highlightColor = SUtil_SUtil.Util_color.getHighlightColor();
  46669. // 根据highlightStyle扩展
  46670. if (style.brushType != 'stroke') {
  46671. // 带填充则用高亮色加粗边线
  46672. newStyle.strokeColor = highlightColor;
  46673. // SMIC-方法修改 - start
  46674. newStyle.lineWidth = (style.lineWidth || 1);
  46675. // 原始代码
  46676. // newStyle.lineWidth = (style.lineWidth || 1)
  46677. // + this.getHighlightZoom();
  46678. // 修改代码1
  46679. // if(!style.lineType || style.lineType === "solid"){
  46680. // newStyle.lineWidth = (style.lineWidth || 1)
  46681. // + this.getHighlightZoom();
  46682. // }
  46683. // else{
  46684. // newStyle.lineWidth = (style.lineWidth || 1);
  46685. // }
  46686. // SMIC-方法修改 - end
  46687. newStyle.brushType = 'both';
  46688. } else {
  46689. if (brushTypeOnly != 'stroke') {
  46690. // 描边型的则用原色加工高亮
  46691. newStyle.strokeColor = highlightColor;
  46692. // SMIC-方法修改 - start
  46693. newStyle.lineWidth = (style.lineWidth || 1);
  46694. // 原始代码
  46695. // newStyle.lineWidth = (style.lineWidth || 1)
  46696. // + this.getHighlightZoom();
  46697. // 修改代码1
  46698. // if(!style.lineType || style.lineType === "solid"){
  46699. // newStyle.lineWidth = (style.lineWidth || 1)
  46700. // + this.getHighlightZoom();
  46701. // }
  46702. // else{
  46703. // newStyle.lineWidth = (style.lineWidth || 1);
  46704. // }
  46705. // SMIC-方法修改 - end
  46706. } else {
  46707. // 线型的则用原色加工高亮
  46708. newStyle.strokeColor = highlightStyle.strokeColor
  46709. || SUtil_SUtil.Util_color.mix(
  46710. style.strokeColor,
  46711. SUtil_SUtil.Util_color.toRGB(highlightColor)
  46712. );
  46713. }
  46714. }
  46715. // 可自定义覆盖默认值
  46716. for (let k in highlightStyle) {
  46717. if (typeof highlightStyle[k] != 'undefined') {
  46718. newStyle[k] = highlightStyle[k];
  46719. }
  46720. }
  46721. return newStyle;
  46722. }
  46723. /**
  46724. * @function SuperMap.LevelRenderer.Shape.prototype.getHighlightZoom
  46725. * @description 高亮放大效果参数,当前统一设置为6,如有需要差异设置,通过 this.type 判断实例类型
  46726. *
  46727. */
  46728. getHighlightZoom() {
  46729. return this.type != 'text' ? 6 : 2;
  46730. }
  46731. /**
  46732. * @function SuperMap.LevelRenderer.Shape.prototype.drift
  46733. * @description 移动位置
  46734. *
  46735. * @param {Object} dx - 横坐标变化。
  46736. * @param {Object} dy - 纵坐标变化。
  46737. *
  46738. */
  46739. drift(dx, dy) {
  46740. this.position[0] += dx;
  46741. this.position[1] += dy;
  46742. }
  46743. /**
  46744. * @function SuperMap.LevelRenderer.Shape.prototype.buildPath
  46745. * @description 构建绘制的Path。子类必须重新实现此方法。
  46746. *
  46747. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46748. * @param {Object} style - 样式。
  46749. */
  46750. buildPath(ctx, style) { // eslint-disable-line no-unused-vars
  46751. SUtil_SUtil.Util_log('buildPath not implemented in ' + this.type);
  46752. }
  46753. /**
  46754. * @function SuperMap.LevelRenderer.Shape.prototype.getRect
  46755. * @description 计算返回包围盒矩形。子类必须重新实现此方法。
  46756. *
  46757. * @param {Object} style - 样式。
  46758. */
  46759. getRect(style) { // eslint-disable-line no-unused-vars
  46760. SUtil_SUtil.Util_log('getRect not implemented in ' + this.type);
  46761. }
  46762. /**
  46763. * @function SuperMap.LevelRenderer.Shape.prototype.isCover
  46764. * @description 判断鼠标位置是否在图形内。
  46765. *
  46766. * @param {number} x - x。
  46767. * @param {number} y - y。
  46768. */
  46769. isCover(x, y) {
  46770. var originPos = this.getTansform(x, y);
  46771. x = originPos[0];
  46772. y = originPos[1];
  46773. // 快速预判并保留判断矩形
  46774. var rect = this.style.__rect;
  46775. if (!rect) {
  46776. rect = this.style.__rect = this.getRect(this.style);
  46777. }
  46778. if (x >= rect.x
  46779. && x <= (rect.x + rect.width)
  46780. && y >= rect.y
  46781. && y <= (rect.y + rect.height)
  46782. ) {
  46783. // 矩形内
  46784. return SUtil_SUtil.Util_area.isInside(this, this.style, x, y);
  46785. }
  46786. return false;
  46787. }
  46788. /**
  46789. * @function SuperMap.LevelRenderer.Shape.prototype.drawText
  46790. * @description 绘制附加文本。
  46791. *
  46792. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  46793. * @param {string} style - 样式。
  46794. * @param {string} normalStyle - normalStyle 默认样式,用于定位文字显示。
  46795. */
  46796. drawText(ctx, style, normalStyle) {
  46797. if (typeof(style.text) == 'undefined' || style.text === false) {
  46798. return;
  46799. }
  46800. // 字体颜色策略
  46801. var textColor = style.textColor || style.color || style.strokeColor;
  46802. ctx.fillStyle = textColor;
  46803. // 文本与图形间空白间隙
  46804. var dd = 10;
  46805. var al; // 文本水平对齐
  46806. var bl; // 文本垂直对齐
  46807. var tx; // 文本横坐标
  46808. var ty; // 文本纵坐标
  46809. var textPosition = style.textPosition // 用户定义
  46810. || this.textPosition // shape默认
  46811. || 'top'; // 全局默认
  46812. // Smic 方法修改 -start
  46813. var __OP = [];
  46814. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  46815. __OP = [0, 0];
  46816. } else {
  46817. __OP = this.refOriginalPosition;
  46818. }
  46819. //原代码:
  46820. // Smic 方法修改 -end
  46821. switch (textPosition) {
  46822. case 'inside':
  46823. case 'top':
  46824. case 'bottom':
  46825. case 'left':
  46826. case 'right':
  46827. if (this.getRect) {
  46828. var rect = (normalStyle || style).__rect
  46829. || this.getRect(normalStyle || style);
  46830. switch (textPosition) {
  46831. case 'inside':
  46832. tx = rect.x + rect.width / 2;
  46833. ty = rect.y + rect.height / 2;
  46834. al = 'center';
  46835. bl = 'middle';
  46836. if (style.brushType != 'stroke'
  46837. && textColor == style.color
  46838. ) {
  46839. ctx.fillStyle = '#fff';
  46840. }
  46841. break;
  46842. case 'left':
  46843. tx = rect.x - dd;
  46844. ty = rect.y + rect.height / 2;
  46845. al = 'end';
  46846. bl = 'middle';
  46847. break;
  46848. case 'right':
  46849. tx = rect.x + rect.width + dd;
  46850. ty = rect.y + rect.height / 2;
  46851. al = 'start';
  46852. bl = 'middle';
  46853. break;
  46854. case 'top':
  46855. tx = rect.x + rect.width / 2;
  46856. ty = rect.y - dd;
  46857. al = 'center';
  46858. bl = 'bottom';
  46859. break;
  46860. case 'bottom':
  46861. tx = rect.x + rect.width / 2;
  46862. ty = rect.y + rect.height + dd;
  46863. al = 'center';
  46864. bl = 'top';
  46865. break;
  46866. }
  46867. }
  46868. break;
  46869. case 'start':
  46870. case 'end':
  46871. var xStart = 0;
  46872. var xEnd = 0;
  46873. var yStart = 0;
  46874. var yEnd = 0;
  46875. if (typeof style.pointList != 'undefined') {
  46876. var pointList = style.pointList;
  46877. if (pointList.length < 2) {
  46878. // 少于2个点就不画了~
  46879. return;
  46880. }
  46881. var length = pointList.length;
  46882. switch (textPosition) {
  46883. // Smic 方法修改 -start
  46884. case 'start':
  46885. xStart = pointList[0][0] + __OP[0];
  46886. xEnd = pointList[1][0] + __OP[0];
  46887. yStart = pointList[0][1] + __OP[1];
  46888. yEnd = pointList[1][1] + __OP[1];
  46889. break;
  46890. case 'end':
  46891. xStart = pointList[length - 2][0] + __OP[0];
  46892. xEnd = pointList[length - 1][0] + __OP[0];
  46893. yStart = pointList[length - 2][1] + __OP[1];
  46894. yEnd = pointList[length - 1][1] + __OP[1];
  46895. break;
  46896. //原代码:
  46897. /*
  46898. case 'start':
  46899. xStart = pointList[0][0];
  46900. xEnd = pointList[1][0];
  46901. yStart = pointList[0][1];
  46902. yEnd = pointList[1][1];
  46903. break;
  46904. case 'end':
  46905. xStart = pointList[length - 2][0];
  46906. xEnd = pointList[length - 1][0];
  46907. yStart = pointList[length - 2][1];
  46908. yEnd = pointList[length - 1][1];
  46909. break;
  46910. */
  46911. // Smic 方法修改 -end
  46912. }
  46913. } else {
  46914. // Smic 方法修改 -start
  46915. xStart = (style.xStart + __OP[0]) || 0;
  46916. xEnd = (style.xEnd + __OP[0]) || 0;
  46917. yStart = (style.yStart + __OP[1]) || 0;
  46918. yEnd = (style.yEnd + __OP[1]) || 0;
  46919. //原代码:
  46920. /*
  46921. xStart = style.xStart || 0;
  46922. xEnd = style.xEnd || 0;
  46923. yStart = style.yStart || 0;
  46924. yEnd = style.yEnd || 0;
  46925. */
  46926. // Smic 方法修改 -end
  46927. }
  46928. switch (textPosition) {
  46929. case 'start':
  46930. al = xStart < xEnd ? 'end' : 'start';
  46931. bl = yStart < yEnd ? 'bottom' : 'top';
  46932. tx = xStart;
  46933. ty = yStart;
  46934. break;
  46935. case 'end':
  46936. al = xStart < xEnd ? 'start' : 'end';
  46937. bl = yStart < yEnd ? 'top' : 'bottom';
  46938. tx = xEnd;
  46939. ty = yEnd;
  46940. break;
  46941. }
  46942. dd -= 4;
  46943. if (xStart && xEnd && xStart != xEnd) {
  46944. tx -= (al == 'end' ? dd : -dd);
  46945. } else {
  46946. al = 'center';
  46947. }
  46948. if (yStart != yEnd) {
  46949. ty -= (bl == 'bottom' ? dd : -dd);
  46950. } else {
  46951. bl = 'middle';
  46952. }
  46953. break;
  46954. case 'specific':
  46955. tx = style.textX || 0;
  46956. ty = style.textY || 0;
  46957. al = 'start';
  46958. bl = 'middle';
  46959. break;
  46960. }
  46961. // Smic 方法修改 -start
  46962. if (style.labelXOffset && !isNaN(style.labelXOffset)) {
  46963. tx += style.labelXOffset;
  46964. }
  46965. if (style.labelYOffset && !isNaN(style.labelYOffset)) {
  46966. ty += style.labelYOffset;
  46967. }
  46968. //原代码:
  46969. // Smic 方法修改 -end
  46970. if (tx != null && ty != null) {
  46971. Shape_Shape._fillText(
  46972. ctx,
  46973. style.text,
  46974. tx, ty,
  46975. style.textFont,
  46976. style.textAlign || al,
  46977. style.textBaseline || bl
  46978. );
  46979. }
  46980. }
  46981. /**
  46982. * @function SuperMap.LevelRenderer.Shape.prototype.modSelf
  46983. * @description 图形发生改变
  46984. */
  46985. modSelf() {
  46986. this.__dirty = true;
  46987. if (this.style) {
  46988. this.style.__rect = null;
  46989. }
  46990. if (this.highlightStyle) {
  46991. this.highlightStyle.__rect = null;
  46992. }
  46993. }
  46994. /**
  46995. * @function SuperMap.LevelRenderer.Shape.prototype.isSilent
  46996. * @description 图形是否会触发事件,通过 bind 绑定的事件
  46997. */
  46998. isSilent() {
  46999. return !(
  47000. this.hoverable || this.draggable || this.clickable
  47001. || this.onmousemove || this.onmouseover || this.onmouseout
  47002. || this.onmousedown || this.onmouseup || this.onclick
  47003. || this.ondragenter || this.ondragover || this.ondragleave
  47004. || this.ondrop
  47005. );
  47006. }
  47007. /**
  47008. * @function SuperMap.LevelRenderer.Shape.prototype.setCtxGlobalAlpha
  47009. * @description 设置 Cavans 上下文全局透明度
  47010. *
  47011. * @param {Object} _ctx - Cavans 上下文
  47012. * @param {string} type - one of 'stroke', 'fill', or 'reset'
  47013. * @param {Object} style - Symbolizer hash
  47014. */
  47015. setCtxGlobalAlpha(_ctx, type, style) {
  47016. if (type === "fill") {
  47017. _ctx.globalAlpha = typeof(style["fillOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['fillOpacity'];
  47018. } else if (type === "stroke") {
  47019. _ctx.globalAlpha = typeof(style["strokeOpacity"]) === "undefined" ? (typeof(style["opacity"]) === "undefined" ? 1 : style['opacity']) : style['strokeOpacity'];
  47020. } else {
  47021. _ctx.globalAlpha = typeof(style["opacity"]) === "undefined" ? 1 : style['opacity'];
  47022. }
  47023. }
  47024. /**
  47025. * @function SuperMap.LevelRenderer.Shape.prototype._fillText
  47026. * @description 填充文本
  47027. */
  47028. static _fillText(ctx, text, x, y, textFont, textAlign, textBaseline) {
  47029. if (textFont) {
  47030. ctx.font = textFont;
  47031. }
  47032. ctx.textAlign = textAlign;
  47033. ctx.textBaseline = textBaseline;
  47034. var rect = Shape_Shape._getTextRect(
  47035. text, x, y, textFont, textAlign, textBaseline
  47036. );
  47037. text = (text + '').split('\n');
  47038. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  47039. switch (textBaseline) {
  47040. case 'top':
  47041. y = rect.y;
  47042. break;
  47043. case 'bottom':
  47044. y = rect.y + lineHeight;
  47045. break;
  47046. default:
  47047. y = rect.y + lineHeight / 2;
  47048. }
  47049. for (var i = 0, l = text.length; i < l; i++) {
  47050. ctx.fillText(text[i], x, y);
  47051. y += lineHeight;
  47052. }
  47053. }
  47054. /**
  47055. * @function SuperMap.LevelRenderer.Shape._getTextRect
  47056. * @description 返回矩形区域,用于局部刷新和文字定位
  47057. *
  47058. * @param {string} text - text。
  47059. * @param {number} x - x。
  47060. * @param {number} y - y。
  47061. * @param {string} textFont - textFont。
  47062. * @param {string} textAlign - textAlign。
  47063. * @param {string} textBaseline - textBaseline。
  47064. * @return {Object} 矩形区域。
  47065. */
  47066. static _getTextRect(text, x, y, textFont, textAlign, textBaseline) {
  47067. var width = SUtil_SUtil.Util_area.getTextWidth(text, textFont);
  47068. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', textFont);
  47069. text = (text + '').split('\n');
  47070. switch (textAlign) {
  47071. case 'end':
  47072. case 'right':
  47073. x -= width;
  47074. break;
  47075. case 'center':
  47076. x -= (width / 2);
  47077. break;
  47078. }
  47079. switch (textBaseline) {
  47080. case 'top':
  47081. break;
  47082. case 'bottom':
  47083. y -= lineHeight * text.length;
  47084. break;
  47085. default:
  47086. y -= lineHeight * text.length / 2;
  47087. }
  47088. return {
  47089. x: x,
  47090. y: y,
  47091. width: width,
  47092. height: lineHeight * text.length
  47093. };
  47094. }
  47095. }
  47096. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPoint.js
  47097. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47098. * This program are made available under the terms of the Apache License, Version 2.0
  47099. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47100. /**
  47101. * @private
  47102. * @class SuperMap.LevelRenderer.Shape.SmicPoint
  47103. * @category Visualization Theme
  47104. * @classdesc 点。
  47105. * @extends SuperMap.LevelRenderer.Shape
  47106. * @example
  47107. * var shape = new SuperMap.LevelRenderer.Shape.SmicPoint({
  47108. * style: {
  47109. * x: 100,
  47110. * y: 100,
  47111. * r: 40,
  47112. * brushType: 'both',
  47113. * color: 'blue',
  47114. * strokeColor: 'red',
  47115. * lineWidth: 3,
  47116. * text: 'point'
  47117. * }
  47118. * });
  47119. * levelRenderer.addShape(shape);
  47120. *
  47121. *
  47122. */
  47123. class SmicPoint extends Shape_Shape {
  47124. /**
  47125. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.style
  47126. * @description 绘制样式。
  47127. *
  47128. * @param {number} style.x - 圆心x坐标,必设参数。
  47129. * @param {number} style.y - 圆心y坐标,必设参数。
  47130. * @param {number} style.r - 半径,必设参数。
  47131. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47132. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47133. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47134. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47135. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47136. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47137. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47138. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47139. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47140. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47141. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47142. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47143. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47144. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47145. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47146. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47147. */
  47148. //打开接口 style
  47149. /**
  47150. * @function SuperMap.LevelRenderer.Shape.SmicPoint.constructor
  47151. * @description 构造函数。
  47152. *
  47153. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47154. *
  47155. */
  47156. constructor(options) {
  47157. super(options);
  47158. /**
  47159. * @member {string} SuperMap.LevelRenderer.Shape.SmicPoint.prototype.type
  47160. * @description 图形类型。
  47161. */
  47162. this.type = 'smicpoint';
  47163. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47164. this.refOriginalPosition = [0, 0];
  47165. }
  47166. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPoint";
  47167. }
  47168. /**
  47169. * @function cdestroy
  47170. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47171. */
  47172. destroy() {
  47173. this.type = null;
  47174. super.destroy();
  47175. }
  47176. /**
  47177. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.buildPath
  47178. * @description 创建点触。
  47179. *
  47180. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47181. * @param {Object} style - style。
  47182. *
  47183. */
  47184. buildPath(ctx, style) {
  47185. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47186. this.refOriginalPosition = [0, 0];
  47187. }
  47188. var __OP = this.refOriginalPosition;
  47189. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, true);
  47190. return;
  47191. }
  47192. /**
  47193. * @function SuperMap.LevelRenderer.Shape.SmicPoint.prototype.getRect
  47194. * @description 计算返回点的包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  47195. *
  47196. * @param {Object} style - style
  47197. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47198. */
  47199. getRect(style) {
  47200. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47201. this.refOriginalPosition = [0, 0];
  47202. }
  47203. var __OP = this.refOriginalPosition;
  47204. if (style.__rect) {
  47205. return style.__rect;
  47206. }
  47207. var lineWidth;
  47208. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  47209. lineWidth = style.lineWidth || 1;
  47210. } else {
  47211. lineWidth = 0;
  47212. }
  47213. style.__rect = {
  47214. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  47215. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  47216. width: style.r * 2 + lineWidth,
  47217. height: style.r * 2 + lineWidth
  47218. };
  47219. return style.__rect;
  47220. }
  47221. }
  47222. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicText.js
  47223. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47224. * This program are made available under the terms of the Apache License, Version 2.0
  47225. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47226. /**
  47227. * @private
  47228. * @class SuperMap.LevelRenderer.Shape.SmicText
  47229. * @category Visualization Theme
  47230. * @extends {SuperMap.LevelRenderer.Shape}
  47231. * @example
  47232. * var shape = new SuperMap.LevelRenderer.Shape.SmicText({
  47233. * style: {
  47234. * text: 'Label',
  47235. * x: 100,
  47236. * y: 100,
  47237. * textFont: '14px Arial'
  47238. * }
  47239. * });
  47240. * levelRenderer.addShape(shape);
  47241. *
  47242. */
  47243. class SmicText extends Shape_Shape {
  47244. /**
  47245. * @member {Object} SuperMap.LevelRenderer.Shape.SmicText.prototype.style
  47246. * @description 绘制样式。
  47247. *
  47248. * @param {number} style.x - 横坐标,必设参数。
  47249. * @param {number} style.y - 纵坐标,必设参数。
  47250. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47251. * @param {number} style.maxWidth - 最大宽度限制。默认值:null。
  47252. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47253. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47254. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47255. * @param {string} style.brushType -画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47256. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47257. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47258. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47259. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47260. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47261. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47262. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47263. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47264. */
  47265. //打开接口 style
  47266. /**
  47267. * @function SuperMap.LevelRenderer.Shape.SmicText.constructor
  47268. * @description 构造函数。
  47269. *
  47270. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47271. *
  47272. */
  47273. constructor(options) {
  47274. super(options);
  47275. /**
  47276. * @member {string} SuperMap.LevelRenderer.Shape.SmicText.prototype.type
  47277. * @description 图形类型.
  47278. */
  47279. this.type = 'smictext';
  47280. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47281. this.refOriginalPosition = [0, 0];
  47282. }
  47283. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicText";
  47284. }
  47285. /**
  47286. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.destroy
  47287. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47288. */
  47289. destroy() {
  47290. this.type = null;
  47291. super.destroy();
  47292. }
  47293. /**
  47294. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.brush
  47295. * @description 笔触。
  47296. *
  47297. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47298. * @param {boolean} isHighlight - 是否使用高亮属性。
  47299. *
  47300. */
  47301. brush(ctx, isHighlight) {
  47302. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47303. this.refOriginalPosition = [0, 0];
  47304. }
  47305. var __OP = this.refOriginalPosition;
  47306. var style = this.style;
  47307. if (isHighlight) {
  47308. // 根据style扩展默认高亮样式
  47309. style = this.getHighlightStyle(
  47310. style, this.highlightStyle || {}
  47311. );
  47312. }
  47313. if (typeof(style.text) == 'undefined' || style.text === false) {
  47314. return;
  47315. }
  47316. ctx.save();
  47317. this.doClip(ctx);
  47318. this.setContext(ctx, style);
  47319. // 设置transform
  47320. this.setTransform(ctx);
  47321. if (style.textFont) {
  47322. ctx.font = style.textFont;
  47323. }
  47324. ctx.textAlign = style.textAlign || 'start';
  47325. ctx.textBaseline = style.textBaseline || 'middle';
  47326. var text = (style.text + '').split('\n');
  47327. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  47328. var rect = this.getRectNoRotation(style);
  47329. // var x = style.x;
  47330. var x = style.x + __OP[0];
  47331. var y;
  47332. if (style.textBaseline == 'top') {
  47333. y = rect.y;
  47334. } else if (style.textBaseline == 'bottom') {
  47335. y = rect.y + lineHeight;
  47336. } else {
  47337. y = rect.y + lineHeight / 2;
  47338. }
  47339. var ox = style.x + __OP[0];
  47340. var oy = style.y + __OP[1];
  47341. //文本绘制
  47342. for (var i = 0, l = text.length; i < l; i++) {
  47343. //是否渲染矩形背景及颜色
  47344. if (style.labelRect) {
  47345. //+4,-2是为了让文字距边框左右边缘有点间隔
  47346. ctx.fillRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  47347. ctx.fillStyle = style.strokeColor;
  47348. ctx.strokeRect(rect.x - 2, rect.y, rect.width + 4, rect.height);
  47349. ctx.fillStyle = style.textColor;
  47350. }
  47351. switch (style.brushType) {
  47352. case 'stroke':
  47353. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47354. if (style.textRotation && style.textRotation !== 0) {
  47355. ctx.save();
  47356. ctx.translate(ox, oy);
  47357. ctx.rotate(style.textRotation * Math.PI / 180);
  47358. if (style.textBaseline == 'top') {
  47359. if (style.maxWidth) {
  47360. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  47361. } else {
  47362. ctx.strokeText(text[i], 0, lineHeight * i);
  47363. }
  47364. } else if (style.textBaseline == 'bottom') {
  47365. if (style.maxWidth) {
  47366. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  47367. } else {
  47368. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  47369. }
  47370. } else {
  47371. if (style.maxWidth) {
  47372. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  47373. } else {
  47374. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  47375. }
  47376. }
  47377. ctx.restore();
  47378. } else {
  47379. if (style.maxWidth) {
  47380. ctx.strokeText(text[i], x, y, style.maxWidth);
  47381. } else {
  47382. ctx.strokeText(text[i], x, y);
  47383. }
  47384. }
  47385. this.setCtxGlobalAlpha(ctx, "reset", style);
  47386. break;
  47387. case 'both':
  47388. if (style.textRotation && style.textRotation !== 0) {
  47389. ctx.save();
  47390. ctx.translate(ox, oy);
  47391. ctx.rotate(style.textRotation * Math.PI / 180);
  47392. if (style.textBaseline == 'top') {
  47393. if (style.maxWidth) {
  47394. this.setCtxGlobalAlpha(ctx, "fill", style);
  47395. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  47396. this.setCtxGlobalAlpha(ctx, "reset", style);
  47397. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47398. ctx.strokeText(text[i], 0, lineHeight * i, style.maxWidth);
  47399. this.setCtxGlobalAlpha(ctx, "reset", style);
  47400. } else {
  47401. this.setCtxGlobalAlpha(ctx, "fill", style);
  47402. ctx.fillText(text[i], 0, lineHeight * i);
  47403. this.setCtxGlobalAlpha(ctx, "reset", style);
  47404. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47405. ctx.strokeText(text[i], 0, lineHeight * i);
  47406. this.setCtxGlobalAlpha(ctx, "reset", style);
  47407. }
  47408. } else if (style.textBaseline == 'bottom') {
  47409. if (style.maxWidth) {
  47410. this.setCtxGlobalAlpha(ctx, "fill", style);
  47411. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  47412. this.setCtxGlobalAlpha(ctx, "reset", style);
  47413. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47414. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  47415. this.setCtxGlobalAlpha(ctx, "reset", style);
  47416. } else {
  47417. this.setCtxGlobalAlpha(ctx, "fill", style);
  47418. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  47419. this.setCtxGlobalAlpha(ctx, "reset", style);
  47420. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47421. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height);
  47422. this.setCtxGlobalAlpha(ctx, "reset", style);
  47423. }
  47424. } else {
  47425. if (style.maxWidth) {
  47426. this.setCtxGlobalAlpha(ctx, "fill", style);
  47427. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  47428. this.setCtxGlobalAlpha(ctx, "reset", style);
  47429. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47430. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  47431. this.setCtxGlobalAlpha(ctx, "reset", style);
  47432. } else {
  47433. this.setCtxGlobalAlpha(ctx, "fill", style);
  47434. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  47435. this.setCtxGlobalAlpha(ctx, "reset", style);
  47436. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47437. ctx.strokeText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  47438. this.setCtxGlobalAlpha(ctx, "reset", style);
  47439. }
  47440. }
  47441. ctx.restore();
  47442. } else {
  47443. if (style.maxWidth) {
  47444. this.setCtxGlobalAlpha(ctx, "fill", style);
  47445. ctx.fillText(text[i], x, y, style.maxWidth);
  47446. this.setCtxGlobalAlpha(ctx, "reset", style);
  47447. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47448. ctx.strokeText(text[i], x, y, style.maxWidth);
  47449. this.setCtxGlobalAlpha(ctx, "reset", style);
  47450. } else {
  47451. this.setCtxGlobalAlpha(ctx, "fill", style);
  47452. ctx.fillText(text[i], x, y);
  47453. this.setCtxGlobalAlpha(ctx, "reset", style);
  47454. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47455. ctx.strokeText(text[i], x, y);
  47456. this.setCtxGlobalAlpha(ctx, "reset", style);
  47457. }
  47458. }
  47459. break;
  47460. default:
  47461. //fill or others
  47462. this.setCtxGlobalAlpha(ctx, "fill", style);
  47463. if (style.textRotation && style.textRotation !== 0) {
  47464. ctx.save();
  47465. ctx.translate(ox, oy);
  47466. ctx.rotate(style.textRotation * Math.PI / 180);
  47467. if (style.textBaseline == 'top') {
  47468. if (style.maxWidth) {
  47469. ctx.fillText(text[i], 0, lineHeight * i, style.maxWidth);
  47470. } else {
  47471. ctx.fillText(text[i], 0, lineHeight * i);
  47472. }
  47473. } else if (style.textBaseline == 'bottom') {
  47474. if (style.maxWidth) {
  47475. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height, style.maxWidth);
  47476. } else {
  47477. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height);
  47478. }
  47479. } else {
  47480. if (style.maxWidth) {
  47481. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2, style.maxWidth);
  47482. } else {
  47483. ctx.fillText(text[i], 0, lineHeight * (i + 1) - rect.height / 2 - lineHeight / 2);
  47484. }
  47485. }
  47486. ctx.restore();
  47487. } else {
  47488. if (style.maxWidth) {
  47489. ctx.fillText(text[i], x, y, style.maxWidth);
  47490. } else {
  47491. ctx.fillText(text[i], x, y);
  47492. }
  47493. }
  47494. this.setCtxGlobalAlpha(ctx, "reset", style);
  47495. }
  47496. y += lineHeight;
  47497. }
  47498. ctx.restore();
  47499. return;
  47500. }
  47501. /**
  47502. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRect
  47503. * @description 返回文字包围盒矩形
  47504. */
  47505. getRect(style) {
  47506. if (style.__rect) {
  47507. return style.__rect;
  47508. }
  47509. var left, top, right, bottom
  47510. var tbg = this.getTextBackground(style, true);
  47511. for (var i = 0, len = tbg.length; i < len; i++) {
  47512. var poi = tbg[i];
  47513. //用第一个点初始化
  47514. if (i == 0) {
  47515. left = poi[0];
  47516. right = poi[0];
  47517. top = poi[1];
  47518. bottom = poi[1];
  47519. } else {
  47520. if (poi[0] < left) {
  47521. left = poi[0]
  47522. }
  47523. if (poi[0] > right) {
  47524. right = poi[0]
  47525. }
  47526. if (poi[1] < top) {
  47527. top = poi[1]
  47528. }
  47529. if (poi[1] > bottom) {
  47530. bottom = poi[1]
  47531. }
  47532. }
  47533. }
  47534. style.__rect = {
  47535. x: left,
  47536. y: top,
  47537. width: right - left,
  47538. height: bottom - top
  47539. };
  47540. return style.__rect;
  47541. }
  47542. /**
  47543. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRectNoRotation
  47544. * @description 返回忽略旋转和maxWidth时文字包围盒矩形
  47545. */
  47546. getRectNoRotation(style) {
  47547. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47548. this.refOriginalPosition = [0, 0];
  47549. }
  47550. var __OP = this.refOriginalPosition;
  47551. var lineHeight = SUtil_SUtil.Util_area.getTextHeight('ZH', style.textFont);
  47552. var width = SUtil_SUtil.Util_area.getTextWidth(style.text, style.textFont);
  47553. var height = SUtil_SUtil.Util_area.getTextHeight(style.text, style.textFont);
  47554. //处理文字位置,注:文本的绘制是由此 rect 决定
  47555. var textX = style.x + __OP[0]; // 默认start == left
  47556. if (style.textAlign == 'end' || style.textAlign == 'right') {
  47557. textX -= width;
  47558. } else if (style.textAlign == 'center') {
  47559. textX -= (width / 2);
  47560. }
  47561. var textY;
  47562. if (style.textBaseline == 'top') {
  47563. // textY = style.y;
  47564. textY = style.y + __OP[1];
  47565. } else if (style.textBaseline == 'bottom') {
  47566. textY = (style.y + __OP[1]) - height;
  47567. } else {
  47568. // middle
  47569. textY = (style.y + __OP[1]) - height / 2;
  47570. }
  47571. var isWidthChangeByMaxWidth = false;
  47572. var widthBeforeChangeByMaxWidth;
  47573. //处理 maxWidth
  47574. if (style.maxWidth) {
  47575. var maxWidth = parseInt(style.maxWidth);
  47576. if (maxWidth < width) {
  47577. widthBeforeChangeByMaxWidth = width;
  47578. isWidthChangeByMaxWidth = true;
  47579. width = maxWidth;
  47580. }
  47581. textX = style.x + __OP[0];
  47582. if (style.textAlign == 'end' || style.textAlign == 'right') {
  47583. textX -= width;
  47584. } else if (style.textAlign == 'center') {
  47585. textX -= (width / 2);
  47586. }
  47587. }
  47588. //处理斜体字
  47589. if (style.textFont) {
  47590. var textFont = style.textFont;
  47591. var textFontStr = textFont.toLowerCase()
  47592. if (textFontStr.indexOf("italic") > -1) {
  47593. if (isWidthChangeByMaxWidth === true) {
  47594. width += (lineHeight / 3) * (width / widthBeforeChangeByMaxWidth);
  47595. } else {
  47596. width += lineHeight / 3;
  47597. }
  47598. }
  47599. }
  47600. var rect = {
  47601. x: textX,
  47602. y: textY,
  47603. width: width,
  47604. height: height
  47605. };
  47606. return rect;
  47607. }
  47608. /**
  47609. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getTextBackground
  47610. * @description 获取文本背景框范围
  47611. *
  47612. * @param {Object} style - 样式。
  47613. * @param {boolean} redo - 是否强制重新计算 textBackground。
  47614. */
  47615. getTextBackground(style, redo) {
  47616. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47617. this.refOriginalPosition = [0, 0];
  47618. }
  47619. var __OP = this.refOriginalPosition;
  47620. if ((!redo) && style.__textBackground) {
  47621. return style.__textBackground;
  47622. }
  47623. //不旋转时矩形框
  47624. var rect = this.getRectNoRotation(style);
  47625. //旋转中心点
  47626. var ox = style.x + __OP[0];
  47627. var oy = style.y + __OP[1];
  47628. //背景框
  47629. var background = [];
  47630. if (style.textRotation && style.textRotation !== 0) {
  47631. let textRotation = style.textRotation;
  47632. let ltPoi = this.getRotatedLocation(rect.x, rect.y, ox, oy, textRotation);
  47633. let rtPoi = this.getRotatedLocation(rect.x + rect.width, rect.y, ox, oy, textRotation);
  47634. let rbPoi = this.getRotatedLocation(rect.x + rect.width, rect.y + rect.height, ox, oy, textRotation);
  47635. let lbPoi = this.getRotatedLocation(rect.x, rect.y + rect.height, ox, oy, textRotation);
  47636. background.push(ltPoi);
  47637. background.push(rtPoi);
  47638. background.push(rbPoi);
  47639. background.push(lbPoi);
  47640. } else {
  47641. let ltPoi = [rect.x, rect.y];
  47642. let rtPoi = [rect.x + rect.width, rect.y];
  47643. let rbPoi = [rect.x + rect.width, rect.y + rect.height];
  47644. let lbPoi = [rect.x, rect.y + rect.height];
  47645. background.push(ltPoi);
  47646. background.push(rtPoi);
  47647. background.push(rbPoi);
  47648. background.push(lbPoi);
  47649. }
  47650. style.__textBackground = background;
  47651. return style.__textBackground;
  47652. }
  47653. /**
  47654. * @function SuperMap.LevelRenderer.Shape.SmicText.prototype.getRotatedLocation
  47655. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)
  47656. *
  47657. * @param {number} x - 旋转点横坐标。
  47658. * @param {number} y - 旋转点纵坐标。
  47659. * @param {number} rx - 旋转中心点横坐标。
  47660. * @param {number} ry - 旋转中心点纵坐标。
  47661. * @param {number} angle - 旋转角度(度)。
  47662. * @return {Array} 旋转后的坐标位置,长度为 2 的一维数组,数组第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  47663. */
  47664. getRotatedLocation(x, y, rx, ry, angle) {
  47665. var loc = new Array(), x0, y0;
  47666. y = -y;
  47667. ry = -ry;
  47668. angle = -angle;//顺时针旋转
  47669. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  47670. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  47671. loc[0] = x0;
  47672. loc[1] = -y0;
  47673. return loc;
  47674. }
  47675. }
  47676. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicCircle.js
  47677. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47678. * This program are made available under the terms of the Apache License, Version 2.0
  47679. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47680. /**
  47681. * @private
  47682. * @class SuperMap.LevelRenderer.Shape.SmicCircle
  47683. * @category Visualization Theme
  47684. * @classdesc 圆形
  47685. * @extends SuperMap.LevelRenderer.Shape
  47686. * @example
  47687. * var shape = new SuperMap.LevelRenderer.Shape.SmicCircle({
  47688. * style: {
  47689. * x: 100,
  47690. * y: 100,
  47691. * r: 60,
  47692. * brushType: "both",
  47693. * color: "blue",
  47694. * strokeColor: "red",
  47695. * lineWidth: 3,
  47696. * text: "Circle"
  47697. * }
  47698. * });
  47699. * levelRenderer.addShape(shape);
  47700. *
  47701. *
  47702. */
  47703. class SmicCircle extends Shape_Shape {
  47704. /**
  47705. * @member {Object} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.style
  47706. * @description 绘制样式。
  47707. *
  47708. * @param {number} x - 圆心x坐标,必设参数
  47709. * @param {number} y - 圆心y坐标,必设参数
  47710. * @param {number} r - 半径,必设参数
  47711. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47712. * @param {string} color - 填充颜色,默认值"#000000"
  47713. * @param {string} strokeColor - 描边颜色,默认值为'#000000'
  47714. * @param {string} lineCape — 线帽样式,可以是 butt, round, square,默认是butt
  47715. * @param {number} lineWidth - 描边宽度、默认是1
  47716. * @param {number} opacity - 绘制透明度、默认是1,不透明
  47717. * @param {number} shadowBlur - 阴影模糊度,大于0有效,默认是0
  47718. * @param {string} shadowColor - 阴影颜色,默认是'#000000'
  47719. * @param {number} shadowOffsetX - 阴影横向偏移,默认是0
  47720. * @param {number} shadowOffsetY - 阴影纵向偏移,默认是0
  47721. * @param {string} text - 图形中的附加文本,默认是0
  47722. * @param {string} textColor - 文本颜色,默认是'#000000'
  47723. * @param {string} textFont - 附加文本样式,eg:'bold 18px verdana'
  47724. * @param {string} textPosition - 附加文本位置, 可以是 inside, left, right, top, bottom
  47725. * @param {string} textAlign - 默认根据textPosition自动设置,附加文本水平对齐。可以是start, end, left, right, center
  47726. * @param {string} textBaseline 默认根据textPosition自动设置,附加文本垂直对齐。可以是top, bottom, middle, alphabetic, hanging, ideographic
  47727. */
  47728. //打开接口 style
  47729. /**
  47730. * @function SuperMap.LevelRenderer.Shape.SmicCircle.constructor
  47731. * @description 构造函数。
  47732. *
  47733. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47734. *
  47735. */
  47736. constructor(options) {
  47737. super(options);
  47738. /**
  47739. * @member {string} SuperMap.LevelRenderer.Shape.SmicCircle.prototype.type
  47740. * @description 图形类型。
  47741. */
  47742. this.type = 'smiccircle';
  47743. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47744. this.refOriginalPosition = [0, 0];
  47745. }
  47746. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicCircle";
  47747. }
  47748. /**
  47749. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.destroy
  47750. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47751. */
  47752. destroy() {
  47753. this.type = null;
  47754. super.destroy();
  47755. }
  47756. /**
  47757. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.buildPath
  47758. * @description 创建图形路径。
  47759. *
  47760. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47761. * @param {Object} style - style。
  47762. *
  47763. */
  47764. buildPath(ctx, style) {
  47765. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47766. this.refOriginalPosition = [0, 0];
  47767. }
  47768. var __OP = this.refOriginalPosition;
  47769. var x = style.x + __OP[0]; // 圆心x
  47770. var y = style.y + __OP[1]; // 圆心y
  47771. ctx.moveTo(x + style.r, y);
  47772. ctx.arc(x, y, style.r, 0, Math.PI * 2, true);
  47773. return true;
  47774. }
  47775. /**
  47776. * @function SuperMap.LevelRenderer.Shape.SmicCircle.prototype.getRect
  47777. * @description 返回圆形包围盒矩形
  47778. *
  47779. * @param {Object} style - style
  47780. * @return {Object} 边框对象。包含属性:x,y,width,height。
  47781. *
  47782. */
  47783. getRect(style) {
  47784. if (style.__rect) {
  47785. return style.__rect;
  47786. }
  47787. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47788. this.refOriginalPosition = [0, 0];
  47789. }
  47790. var __OP = this.refOriginalPosition;
  47791. var x = style.x + __OP[0]; // 圆心x
  47792. var y = style.y + __OP[1]; // 圆心y
  47793. var r = style.r; // 圆r
  47794. var lineWidth;
  47795. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  47796. lineWidth = style.lineWidth || 1;
  47797. } else {
  47798. lineWidth = 0;
  47799. }
  47800. style.__rect = {
  47801. x: Math.round(x - r - lineWidth / 2),
  47802. y: Math.round(y - r - lineWidth / 2),
  47803. width: r * 2 + lineWidth,
  47804. height: r * 2 + lineWidth
  47805. };
  47806. return style.__rect;
  47807. }
  47808. }
  47809. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicPolygon.js
  47810. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  47811. * This program are made available under the terms of the Apache License, Version 2.0
  47812. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  47813. /**
  47814. * @private
  47815. * @class SuperMap.LevelRenderer.Shape.SmicPolygon
  47816. * @category Visualization Theme
  47817. * @classdesc 多边形。
  47818. * @extends SuperMap.LevelRenderer.Shape
  47819. * @example
  47820. * var shape = new SuperMap.LevelRenderer.Shape.SmicPolygon({
  47821. * style: {
  47822. * // 100x100 的正方形
  47823. * pointList: [[0, 0], [100, 0], [100, 100], [0, 100]],
  47824. * color: 'blue'
  47825. * }
  47826. * });
  47827. * levelRenderer.addShape(shape);
  47828. *
  47829. */
  47830. class SmicPolygon extends Shape_Shape {
  47831. /**
  47832. * @member {Object} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.style
  47833. * @description 绘制样式。
  47834. *
  47835. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  47836. * (code)
  47837. * (start code)
  47838. * [
  47839. * [10, 20], //单个节点
  47840. * [30, 40],
  47841. * [25, 30]
  47842. * ]
  47843. * (end)
  47844. * @param {string} style.smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  47845. * @param {number} style.smoothConstraint - 平滑约束。
  47846. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  47847. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  47848. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  47849. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  47850. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  47851. * @param {number} style.opacity - 绘制透明度。默认值:1。
  47852. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  47853. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  47854. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  47855. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  47856. * @param {string} style.text - 图形中的附加文本。默认值:""。
  47857. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  47858. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  47859. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  47860. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  47861. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  47862. */
  47863. //打开接口 style
  47864. /**
  47865. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.constructor
  47866. * @description 构造函数。
  47867. *
  47868. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  47869. *
  47870. */
  47871. constructor(options) {
  47872. super(options);
  47873. /**
  47874. * @member {string} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.type
  47875. * @description 图形类型.
  47876. */
  47877. this.type = 'smicpolygon';
  47878. /**
  47879. * @member {Array} SuperMap.LevelRenderer.Shape.SmicPolygon.prototype._holePolygonPointList
  47880. * @description 岛洞面多边形顶点数组(三维数组)
  47881. *
  47882. */
  47883. this.holePolygonPointLists = null;
  47884. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47885. this.refOriginalPosition = [0, 0];
  47886. }
  47887. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicPolygon";
  47888. }
  47889. /**
  47890. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.destroy
  47891. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  47892. */
  47893. destroy() {
  47894. this.type = null;
  47895. this.holePolygonPointLists = null;
  47896. super.destroy();
  47897. }
  47898. /**
  47899. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.brush
  47900. * @description 笔触。
  47901. *
  47902. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  47903. * @param {boolean} isHighlight - 是否使用高亮属性。
  47904. *
  47905. */
  47906. brush(ctx, isHighlight) {
  47907. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  47908. this.refOriginalPosition = [0, 0];
  47909. }
  47910. var style = this.style;
  47911. if (isHighlight) {
  47912. // 根据style扩展默认高亮样式
  47913. style = this.getHighlightStyle(
  47914. style,
  47915. this.highlightStyle || {}
  47916. );
  47917. }
  47918. ctx.save();
  47919. this.setContext(ctx, style);
  47920. // 设置 transform
  47921. this.setTransform(ctx);
  47922. // 先 fill 再stroke
  47923. var hasPath = false;
  47924. if (style.brushType == 'fill' || style.brushType == 'both' || typeof style.brushType == 'undefined') { // 默认为fill
  47925. ctx.beginPath();
  47926. if (style.lineType == 'dashed'
  47927. || style.lineType == 'dotted'
  47928. || style.lineType == 'dot'
  47929. || style.lineType == 'dash'
  47930. || style.lineType == 'dashdot'
  47931. || style.lineType == 'longdash'
  47932. || style.lineType == 'longdashdot'
  47933. ) {
  47934. // 特殊处理,虚线围不成path,实线再build一次
  47935. this.buildPath(ctx, {
  47936. lineType: 'solid',
  47937. lineWidth: style.lineWidth,
  47938. pointList: style.pointList
  47939. }
  47940. );
  47941. } else {
  47942. this.buildPath(ctx, style);
  47943. hasPath = true; // 这个path能用
  47944. }
  47945. ctx.closePath();
  47946. this.setCtxGlobalAlpha(ctx, "fill", style);
  47947. ctx.fill();
  47948. this.setCtxGlobalAlpha(ctx, "reset", style);
  47949. }
  47950. if (style.lineWidth > 0 && (style.brushType == 'stroke' || style.brushType == 'both')) {
  47951. if (!hasPath) {
  47952. ctx.beginPath();
  47953. this.buildPath(ctx, style);
  47954. }
  47955. this.setCtxGlobalAlpha(ctx, "stroke", style);
  47956. ctx.stroke();
  47957. this.setCtxGlobalAlpha(ctx, "reset", style);
  47958. }
  47959. this.drawText(ctx, style, this.style);
  47960. //岛洞
  47961. var hpStyle = Util.cloneObject(style);
  47962. if (hpStyle.pointList) {
  47963. if (this.holePolygonPointLists && this.holePolygonPointLists.length > 0) {
  47964. var holePLS = this.holePolygonPointLists;
  47965. var holePLSen = holePLS.length;
  47966. for (var i = 0; i < holePLSen; i++) {
  47967. var holePL = holePLS[i];
  47968. //岛洞面
  47969. hpStyle.pointList = holePL;
  47970. ctx.globalCompositeOperation = "destination-out";
  47971. // 先 fill 再stroke
  47972. hasPath = false;
  47973. if (hpStyle.brushType == 'fill' || hpStyle.brushType == 'both' || typeof hpStyle.brushType == 'undefined') { // 默认为fill
  47974. ctx.beginPath();
  47975. if (hpStyle.lineType == 'dashed'
  47976. || hpStyle.lineType == 'dotted'
  47977. || hpStyle.lineType == 'dot'
  47978. || hpStyle.lineType == 'dash'
  47979. || hpStyle.lineType == 'dashdot'
  47980. || hpStyle.lineType == 'longdash'
  47981. || hpStyle.lineType == 'longdashdot'
  47982. ) {
  47983. // 特殊处理,虚线围不成path,实线再build一次
  47984. this.buildPath(ctx, {
  47985. lineType: 'solid',
  47986. lineWidth: hpStyle.lineWidth,
  47987. pointList: hpStyle.pointList
  47988. }
  47989. );
  47990. } else {
  47991. this.buildPath(ctx, hpStyle);
  47992. hasPath = true; // 这个path能用
  47993. }
  47994. ctx.closePath();
  47995. this.setCtxGlobalAlpha(ctx, "fill", hpStyle);
  47996. ctx.fill();
  47997. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  47998. }
  47999. if (hpStyle.lineWidth > 0 && (hpStyle.brushType == 'stroke' || hpStyle.brushType == 'both')) {
  48000. if (!hasPath) {
  48001. ctx.beginPath();
  48002. this.buildPath(ctx, hpStyle);
  48003. }
  48004. //如果描边,先回复 globalCompositeOperation 默认值再描边。
  48005. ctx.globalCompositeOperation = "source-over";
  48006. this.setCtxGlobalAlpha(ctx, "stroke", hpStyle);
  48007. ctx.stroke();
  48008. this.setCtxGlobalAlpha(ctx, "reset", hpStyle);
  48009. } else {
  48010. ctx.globalCompositeOperation = "source-over";
  48011. }
  48012. }
  48013. }
  48014. }
  48015. ctx.restore();
  48016. return;
  48017. }
  48018. /**
  48019. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.buildPath
  48020. * @description 创建多边形路径。
  48021. *
  48022. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48023. * @param {Object} style - style。
  48024. *
  48025. */
  48026. buildPath(ctx, style) {
  48027. if (style.showShadow) {
  48028. ctx.shadowBlur = style.shadowBlur;
  48029. ctx.shadowColor = style.shadowColor;
  48030. ctx.shadowOffsetX = style.shadowOffsetX;
  48031. ctx.shadowOffsetY = style.shadowOffsetY;
  48032. }
  48033. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48034. this.refOriginalPosition = [0, 0];
  48035. }
  48036. var __OP = this.refOriginalPosition;
  48037. // 虽然能重用 brokenLine,但底层图形基于性能考虑,重复代码减少调用吧
  48038. var pointList = style.pointList;
  48039. if (pointList.length < 2) {
  48040. // 少于2个点就不画了~
  48041. return;
  48042. }
  48043. if (style.smooth && style.smooth !== 'spline') {
  48044. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, true, style.smoothConstraint, __OP);
  48045. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48046. var cp1;
  48047. var cp2;
  48048. var p;
  48049. var len = pointList.length;
  48050. for (var i = 0; i < len; i++) {
  48051. cp1 = controlPoints[i * 2];
  48052. cp2 = controlPoints[i * 2 + 1];
  48053. p = [pointList[(i + 1) % len][0] + __OP[0], pointList[(i + 1) % len][1] + __OP[1]];
  48054. ctx.bezierCurveTo(
  48055. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  48056. );
  48057. }
  48058. } else {
  48059. if (style.smooth === 'spline') {
  48060. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, true, null, __OP);
  48061. }
  48062. if (!style.lineType || style.lineType == 'solid') {
  48063. // 默认为实线
  48064. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48065. for (let i = 1; i < pointList.length; i++) {
  48066. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  48067. }
  48068. ctx.lineTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48069. } else if (style.lineType === 'dashed'
  48070. || style.lineType === 'dotted'
  48071. || style.lineType === 'dot'
  48072. || style.lineType === 'dash'
  48073. || style.lineType === 'longdash'
  48074. ) {
  48075. // SMIC-方法修改 - start
  48076. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  48077. style._dashLength = dashLengthForStyle;
  48078. let dashLength = (style.lineWidth || 1);
  48079. let pattern1 = dashLength;
  48080. let pattern2 = dashLength;
  48081. //dashed
  48082. if (style.lineType === 'dashed') {
  48083. pattern1 *= 5;
  48084. pattern2 *= 5;
  48085. if (style.lineCap && style.lineCap !== "butt") {
  48086. pattern1 -= dashLength;
  48087. pattern2 += dashLength;
  48088. }
  48089. }
  48090. //dotted
  48091. if (style.lineType === 'dotted') {
  48092. if (style.lineCap && style.lineCap !== "butt") {
  48093. pattern1 = 1;
  48094. pattern2 += dashLength;
  48095. }
  48096. }
  48097. //dot
  48098. if (style.lineType === 'dot') {
  48099. pattern2 *= 4;
  48100. if (style.lineCap && style.lineCap !== "butt") {
  48101. pattern1 = 1;
  48102. pattern2 += dashLength;
  48103. }
  48104. }
  48105. //dash
  48106. if (style.lineType === 'dash') {
  48107. pattern1 *= 4;
  48108. pattern2 *= 4;
  48109. if (style.lineCap && style.lineCap !== "butt") {
  48110. pattern1 -= dashLength;
  48111. pattern2 += dashLength;
  48112. }
  48113. }
  48114. //longdash
  48115. if (style.lineType === 'longdash') {
  48116. pattern1 *= 8;
  48117. pattern2 *= 4;
  48118. if (style.lineCap && style.lineCap !== "butt") {
  48119. pattern1 -= dashLength;
  48120. pattern2 += dashLength;
  48121. }
  48122. }
  48123. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48124. for (let i = 1; i < pointList.length; i++) {
  48125. SUtil_SUtil.SUtil_dashedLineTo(
  48126. ctx,
  48127. pointList[i - 1][0] + __OP[0],
  48128. pointList[i - 1][1] + __OP[1],
  48129. pointList[i][0] + __OP[0],
  48130. pointList[i][1] + __OP[1],
  48131. dashLength,
  48132. [pattern1, pattern2]
  48133. );
  48134. }
  48135. SUtil_SUtil.SUtil_dashedLineTo(
  48136. ctx,
  48137. pointList[pointList.length - 1][0] + __OP[0],
  48138. pointList[pointList.length - 1][1] + __OP[1],
  48139. pointList[0][0] + __OP[0],
  48140. pointList[0][1] + __OP[1],
  48141. dashLength,
  48142. [pattern1, pattern2]
  48143. );
  48144. } else if (style.lineType === 'dashdot'
  48145. || style.lineType === 'longdashdot'
  48146. ) {
  48147. let dashLengthForStyle = style._dashLength || (style.lineWidth || 1) * (style.lineType == 'dashed' ? 5 : 1);
  48148. style._dashLength = dashLengthForStyle;
  48149. let dashLength = (style.lineWidth || 1);
  48150. let pattern1 = dashLength;
  48151. let pattern2 = dashLength;
  48152. let pattern3 = dashLength;
  48153. let pattern4 = dashLength;
  48154. //dashdot
  48155. if (style.lineType === 'dashdot') {
  48156. pattern1 *= 4;
  48157. pattern2 *= 4;
  48158. pattern4 *= 4;
  48159. if (style.lineCap && style.lineCap !== "butt") {
  48160. pattern1 -= dashLength;
  48161. pattern2 += dashLength;
  48162. pattern3 = 1;
  48163. pattern4 += dashLength;
  48164. }
  48165. }
  48166. //longdashdot
  48167. if (style.lineType === 'longdashdot') {
  48168. pattern1 *= 8;
  48169. pattern2 *= 4;
  48170. pattern4 *= 4;
  48171. if (style.lineCap && style.lineCap !== "butt") {
  48172. pattern1 -= dashLength;
  48173. pattern2 += dashLength;
  48174. pattern3 = 1;
  48175. pattern4 += dashLength;
  48176. }
  48177. }
  48178. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48179. for (let i = 1; i < pointList.length; i++) {
  48180. SUtil_SUtil.SUtil_dashedLineTo(
  48181. ctx,
  48182. pointList[i - 1][0] + __OP[0],
  48183. pointList[i - 1][1] + __OP[1],
  48184. pointList[i][0] + __OP[0],
  48185. pointList[i][1] + __OP[1],
  48186. dashLength,
  48187. [pattern1, pattern2, pattern3, pattern4]
  48188. );
  48189. }
  48190. SUtil_SUtil.SUtil_dashedLineTo(
  48191. ctx,
  48192. pointList[pointList.length - 1][0] + __OP[0],
  48193. pointList[pointList.length - 1][1] + __OP[1],
  48194. pointList[0][0] + __OP[0],
  48195. pointList[0][1] + __OP[1],
  48196. dashLength,
  48197. [pattern1, pattern2, pattern3, pattern4]
  48198. );
  48199. }
  48200. }
  48201. return;
  48202. }
  48203. /**
  48204. * @function SuperMap.LevelRenderer.Shape.SmicPolygon.prototype.getRect
  48205. * @description 计算返回多边形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  48206. *
  48207. * @param {Object} style - style
  48208. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48209. *
  48210. */
  48211. getRect(style, refOriginalPosition) {
  48212. var __OP;
  48213. if (!refOriginalPosition) {
  48214. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48215. this.refOriginalPosition = [0, 0];
  48216. }
  48217. __OP = this.refOriginalPosition;
  48218. } else {
  48219. __OP = refOriginalPosition;
  48220. }
  48221. if (style.__rect) {
  48222. return style.__rect;
  48223. }
  48224. var minX = Number.MAX_VALUE;
  48225. var maxX = Number.MIN_VALUE;
  48226. var minY = Number.MAX_VALUE;
  48227. var maxY = Number.MIN_VALUE;
  48228. var pointList = style.pointList;
  48229. for (var i = 0, l = pointList.length; i < l; i++) {
  48230. if (pointList[i][0] + __OP[0] < minX) {
  48231. minX = pointList[i][0] + __OP[0];
  48232. }
  48233. if (pointList[i][0] + __OP[0] > maxX) {
  48234. maxX = pointList[i][0] + __OP[0];
  48235. }
  48236. if (pointList[i][1] + __OP[1] < minY) {
  48237. minY = pointList[i][1] + __OP[1];
  48238. }
  48239. if (pointList[i][1] + __OP[1] > maxY) {
  48240. maxY = pointList[i][1] + __OP[1];
  48241. }
  48242. }
  48243. var lineWidth;
  48244. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  48245. lineWidth = style.lineWidth || 1;
  48246. } else {
  48247. lineWidth = 0;
  48248. }
  48249. style.__rect = {
  48250. x: Math.round(minX - lineWidth / 2),
  48251. y: Math.round(minY - lineWidth / 2),
  48252. width: maxX - minX + lineWidth,
  48253. height: maxY - minY + lineWidth
  48254. };
  48255. return style.__rect;
  48256. }
  48257. }
  48258. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicBrokenLine.js
  48259. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48260. * This program are made available under the terms of the Apache License, Version 2.0
  48261. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48262. /**
  48263. * @private
  48264. * @class SuperMap.LevelRenderer.Shape.SmicBrokenLine
  48265. * @category Visualization Theme
  48266. * @classdesc 折线(ic)。
  48267. * @extends SuperMap.LevelRenderer.Shape
  48268. * @example
  48269. * var shape = new SuperMap.LevelRenderer.Shape.SmicBrokenLine({
  48270. * style: {
  48271. * pointList: [[0, 0], [100, 100], [100, 0]],
  48272. * smooth: 'bezier',
  48273. * strokeColor: 'purple'
  48274. * }
  48275. * });
  48276. * levelRenderer.addShape(shape);
  48277. *
  48278. *
  48279. */
  48280. class SmicBrokenLine extends Shape_Shape {
  48281. /**
  48282. * @member {Object} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.style
  48283. * @description 绘制样式。
  48284. *
  48285. * @param {Array} pointList - 节点数组,二维数组。默认值:null,必设参数。其形式如下:
  48286. * (code)
  48287. * (start code)
  48288. * [
  48289. * [10, 20], //单个节点
  48290. * [30, 40],
  48291. * [25, 30]
  48292. * ]
  48293. * (end)
  48294. * @param {string} smooth - 是否做平滑插值, 平滑算法可以选择 "bezier", "spline"。默认值:"";
  48295. * @param {number} smoothConstraint - 平滑约束。
  48296. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  48297. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  48298. * @param {number} lineWidth - 描边宽度。默认值:1。
  48299. * @param {number} opacity - 绘制透明度。默认值:1。
  48300. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  48301. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  48302. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  48303. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  48304. * @param {string} text - 图形中的附加文本。默认值:""。
  48305. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  48306. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  48307. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  48308. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  48309. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  48310. */
  48311. //打开接口 style
  48312. /**
  48313. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.constructor
  48314. * @description 构造函数。
  48315. *
  48316. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  48317. *
  48318. */
  48319. constructor(options) {
  48320. super(options);
  48321. /**
  48322. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.brushTypeOnly
  48323. * @description 线条只能描边。
  48324. */
  48325. this.brushTypeOnly = 'stroke';
  48326. /**
  48327. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.textPosition
  48328. * @description 文本位置。
  48329. */
  48330. this.textPosition = 'end';
  48331. /**
  48332. * @member {string} SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.type
  48333. * @description 图形类型.
  48334. */
  48335. this.type = 'smicbroken-line';
  48336. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48337. this.refOriginalPosition = [0, 0];
  48338. }
  48339. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicBrokenLine";
  48340. }
  48341. /**
  48342. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.destroy
  48343. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  48344. */
  48345. destroy() {
  48346. this.brushTypeOnly = null;
  48347. this.textPosition = null;
  48348. this.type = null;
  48349. super.destroy();
  48350. }
  48351. /**
  48352. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.buildPath
  48353. * @description 创建折线路径。
  48354. *
  48355. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48356. * @param {Object} style - style。
  48357. *
  48358. */
  48359. buildPath(ctx, style) {
  48360. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48361. this.refOriginalPosition = [0, 0];
  48362. }
  48363. var __OP = this.refOriginalPosition;
  48364. var pointList = style.pointList;
  48365. if (pointList.length < 2) {
  48366. // 少于2个点就不画了~
  48367. return;
  48368. }
  48369. var len = Math.min(style.pointList.length, Math.round(style.pointListLength || style.pointList.length));
  48370. if (style.smooth && style.smooth !== 'spline') {
  48371. var controlPoints = SUtil_SUtil.SUtil_smoothBezier(pointList, style.smooth, false, style.smoothConstraint, __OP);
  48372. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48373. var cp1;
  48374. var cp2;
  48375. var p;
  48376. for (let i = 0; i < len - 1; i++) {
  48377. cp1 = controlPoints[i * 2];
  48378. cp2 = controlPoints[i * 2 + 1];
  48379. p = [pointList[i + 1][0] + __OP[0], pointList[i + 1][1] + __OP[1]];
  48380. ctx.bezierCurveTo(
  48381. cp1[0], cp1[1], cp2[0], cp2[1], p[0], p[1]
  48382. );
  48383. }
  48384. } else {
  48385. if (style.smooth === 'spline') {
  48386. pointList = SUtil_SUtil.SUtil_smoothSpline(pointList, null, null, __OP);
  48387. len = pointList.length;
  48388. }
  48389. if (!style.lineType || style.lineType === 'solid') {
  48390. // 默认为实线
  48391. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48392. for (let i = 1; i < len; i++) {
  48393. ctx.lineTo(pointList[i][0] + __OP[0], pointList[i][1] + __OP[1]);
  48394. }
  48395. } else if (style.lineType === 'dashed'
  48396. || style.lineType === 'dotted'
  48397. || style.lineType === 'dot'
  48398. || style.lineType === 'dash'
  48399. || style.lineType === 'longdash'
  48400. ) {
  48401. let dashLength = (style.lineWidth || 1);
  48402. let pattern1 = dashLength;
  48403. let pattern2 = dashLength;
  48404. //dashed
  48405. if (style.lineType === 'dashed') {
  48406. pattern1 *= 5;
  48407. pattern2 *= 5;
  48408. if (style.lineCap && style.lineCap !== "butt") {
  48409. pattern1 -= dashLength;
  48410. pattern2 += dashLength;
  48411. }
  48412. }
  48413. //dotted
  48414. if (style.lineType === 'dotted') {
  48415. if (style.lineCap && style.lineCap !== "butt") {
  48416. pattern1 = 1;
  48417. pattern2 += dashLength;
  48418. }
  48419. }
  48420. //dot
  48421. if (style.lineType === 'dot') {
  48422. pattern2 *= 4;
  48423. if (style.lineCap && style.lineCap !== "butt") {
  48424. pattern1 = 1;
  48425. pattern2 += dashLength;
  48426. }
  48427. }
  48428. //dash
  48429. if (style.lineType === 'dash') {
  48430. pattern1 *= 4;
  48431. pattern2 *= 4;
  48432. if (style.lineCap && style.lineCap !== "butt") {
  48433. pattern1 -= dashLength;
  48434. pattern2 += dashLength;
  48435. }
  48436. }
  48437. //longdash
  48438. if (style.lineType === 'longdash') {
  48439. pattern1 *= 8;
  48440. pattern2 *= 4;
  48441. if (style.lineCap && style.lineCap !== "butt") {
  48442. pattern1 -= dashLength;
  48443. pattern2 += dashLength;
  48444. }
  48445. }
  48446. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48447. for (var i = 1; i < len; i++) {
  48448. SUtil_SUtil.SUtil_dashedLineTo(
  48449. ctx,
  48450. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  48451. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  48452. dashLength,
  48453. [pattern1, pattern2]
  48454. );
  48455. }
  48456. } else if (style.lineType === 'dashdot'
  48457. || style.lineType === 'longdashdot'
  48458. ) {
  48459. let dashLength = (style.lineWidth || 1);
  48460. let pattern1 = dashLength;
  48461. let pattern2 = dashLength;
  48462. let pattern3 = dashLength;
  48463. let pattern4 = dashLength;
  48464. //dashdot
  48465. if (style.lineType === 'dashdot') {
  48466. pattern1 *= 4;
  48467. pattern2 *= 4;
  48468. pattern4 *= 4;
  48469. if (style.lineCap && style.lineCap !== "butt") {
  48470. pattern1 -= dashLength;
  48471. pattern2 += dashLength;
  48472. pattern3 = 1;
  48473. pattern4 += dashLength;
  48474. }
  48475. }
  48476. //longdashdot
  48477. if (style.lineType === 'longdashdot') {
  48478. pattern1 *= 8;
  48479. pattern2 *= 4;
  48480. pattern4 *= 4;
  48481. if (style.lineCap && style.lineCap !== "butt") {
  48482. pattern1 -= dashLength;
  48483. pattern2 += dashLength;
  48484. pattern3 = 1;
  48485. pattern4 += dashLength;
  48486. }
  48487. }
  48488. dashLength = (style.lineWidth || 1)
  48489. * (style.lineType === 'dashed' ? 5 : 1);
  48490. ctx.moveTo(pointList[0][0] + __OP[0], pointList[0][1] + __OP[1]);
  48491. for (let i = 1; i < len; i++) {
  48492. SUtil_SUtil.SUtil_dashedLineTo(
  48493. ctx,
  48494. pointList[i - 1][0] + __OP[0], pointList[i - 1][1] + __OP[1],
  48495. pointList[i][0] + __OP[0], pointList[i][1] + __OP[1],
  48496. dashLength,
  48497. [pattern1, pattern2, pattern3, pattern4]
  48498. );
  48499. }
  48500. }
  48501. }
  48502. return;
  48503. }
  48504. /**
  48505. * @function SuperMap.LevelRenderer.Shape.SmicBrokenLine.prototype.getRect
  48506. * @description 计算返回折线包围盒矩形。该包围盒是直接从四个控制点计算,并非最小包围盒。
  48507. *
  48508. * @param {Object} style - style
  48509. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48510. */
  48511. getRect(style) {
  48512. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48513. this.refOriginalPosition = [0, 0];
  48514. }
  48515. var __OP = this.refOriginalPosition;
  48516. return SmicPolygon.prototype.getRect.apply(this, [style, __OP]);
  48517. }
  48518. }
  48519. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicImage.js
  48520. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48521. * This program are made available under the terms of the Apache License, Version 2.0
  48522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48523. /**
  48524. * @private
  48525. * @class SuperMap.LevelRenderer.Shape.SmicImage
  48526. * @category Visualization Theme
  48527. * @classdesc 图片绘制。
  48528. * @extends SuperMap.LevelRenderer.Shape
  48529. * @example
  48530. * var shape = new SuperMap.LevelRenderer.Shape.SmicImage({
  48531. * style: {
  48532. * image: 'test.jpg',
  48533. * x: 100,
  48534. * y: 100
  48535. * }
  48536. * });
  48537. * levelRenderer.addShape(shape);
  48538. *
  48539. *
  48540. */
  48541. class SmicImage extends Shape_Shape {
  48542. /**
  48543. * @member {Object} SuperMap.LevelRenderer.Shape.SmicImage.prototype.style
  48544. * @description 绘制样式。
  48545. *
  48546. * @param {number} style.x - 左上角横坐标,必设参数。
  48547. * @param {number} style.y - 左上角纵坐标,必设参数。
  48548. * @param {(string/Cavans)} style.image - 图片地址或cavans对象,必设参数。
  48549. * @param {number} style.width - 绘制到画布上的宽度,默认为图片高度。
  48550. * @param {number} style.height - 绘制到画布上的高度,默认为图片高度。
  48551. * @param {number} style.sx - 从图片中裁剪的左上角横坐标。
  48552. * @param {number} style.sy - 从图片中裁剪的左上角纵坐标。
  48553. * @param {number} style.sWidth - 从图片中裁剪的宽度,默认为图片高度。
  48554. * @param {number} style.sHeight - 绘制到画布上的高度,默认为图片高度。
  48555. * @param {number} style.opacity - 绘制透明度。默认值:1。
  48556. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  48557. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  48558. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  48559. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  48560. * @param {string} style.text - 图形中的附加文本。默认值:""。
  48561. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  48562. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  48563. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  48564. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  48565. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  48566. */
  48567. //打开接口 style
  48568. /**
  48569. * @function SuperMap.LevelRenderer.Shape.SmicImage.constructor
  48570. * @description 构造函数。
  48571. *
  48572. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  48573. *
  48574. */
  48575. constructor(options) {
  48576. super(options);
  48577. /**
  48578. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype.type
  48579. * @description 图形类型。
  48580. */
  48581. this.type = 'smicimage';
  48582. /**
  48583. * @member {string} SuperMap.LevelRenderer.Shape.SmicImage.prototype._imageCache
  48584. * @description 图片缓存。
  48585. */
  48586. this._imageCache = {};
  48587. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48588. this.refOriginalPosition = [0, 0];
  48589. }
  48590. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicImage";
  48591. }
  48592. /**
  48593. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.destroy
  48594. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  48595. */
  48596. destroy() {
  48597. this.type = null;
  48598. this._imageCache = null;
  48599. super.destroy();
  48600. }
  48601. /**
  48602. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.buildPath
  48603. * @description 创建图片。
  48604. *
  48605. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48606. * @param {Object} style - style。
  48607. *
  48608. */
  48609. brush(ctx, isHighlight, refresh) {
  48610. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48611. this.refOriginalPosition = [0, 0];
  48612. }
  48613. var __OP = this.refOriginalPosition;
  48614. var style = this.style || {};
  48615. if (isHighlight) {
  48616. // 根据style扩展默认高亮样式
  48617. style = this.getHighlightStyle(
  48618. style, this.highlightStyle || {}
  48619. );
  48620. }
  48621. var image = style.image;
  48622. var me = this;
  48623. if (typeof(image) === 'string') {
  48624. var src = image;
  48625. if (this._imageCache[src]) {
  48626. image = this._imageCache[src];
  48627. } else {
  48628. image = new Image();
  48629. image.onload = function () {
  48630. image.onload = null;
  48631. clearTimeout(SmicImage._refreshTimeout);
  48632. SmicImage._needsRefresh.push(me);
  48633. // 防止因为缓存短时间内触发多次onload事件
  48634. SmicImage._refreshTimeout = setTimeout(function () {
  48635. refresh && refresh(SmicImage._needsRefresh);
  48636. // 清空 needsRefresh
  48637. SmicImage._needsRefresh = [];
  48638. }, 10);
  48639. };
  48640. image.src = src;
  48641. this._imageCache[src] = image;
  48642. }
  48643. }
  48644. if (image) {
  48645. // 图片已经加载完成
  48646. if (image.nodeName.toUpperCase() == 'IMG') {
  48647. if (window.ActiveXObject) {
  48648. if (image.readyState != 'complete') {
  48649. return;
  48650. }
  48651. } else {
  48652. if (!image.complete) {
  48653. return;
  48654. }
  48655. }
  48656. }
  48657. // Else is canvas
  48658. var width = style.width || image.width;
  48659. var height = style.height || image.height;
  48660. var x = style.x + __OP[0];
  48661. var y = style.y + __OP[1];
  48662. // 图片加载失败
  48663. if (!image.width || !image.height) {
  48664. return;
  48665. }
  48666. ctx.save();
  48667. this.doClip(ctx);
  48668. this.setContext(ctx, style);
  48669. // 设置transform
  48670. this.setTransform(ctx);
  48671. if (style.sWidth && style.sHeight) {
  48672. let sx = (style.sx + __OP[0]) || 0;
  48673. let sy = (style.sy + __OP[1]) || 0;
  48674. ctx.drawImage(
  48675. image,
  48676. sx, sy, style.sWidth, style.sHeight,
  48677. x, y, width, height
  48678. );
  48679. } else if (style.sx && style.sy) {
  48680. let sx = style.sx + __OP[0];
  48681. let sy = style.sy + __OP[1];
  48682. var sWidth = width - sx;
  48683. var sHeight = height - sy;
  48684. ctx.drawImage(
  48685. image,
  48686. sx, sy, sWidth, sHeight,
  48687. x, y, width, height
  48688. );
  48689. } else {
  48690. ctx.drawImage(image, x, y, width, height);
  48691. }
  48692. // 如果没设置宽和高的话自动根据图片宽高设置
  48693. if (!style.width) {
  48694. style.width = width;
  48695. }
  48696. if (!style.height) {
  48697. style.height = height;
  48698. }
  48699. if (!this.style.width) {
  48700. this.style.width = width;
  48701. }
  48702. if (!this.style.height) {
  48703. this.style.height = height;
  48704. }
  48705. this.drawText(ctx, style, this.style);
  48706. ctx.restore();
  48707. }
  48708. }
  48709. /**
  48710. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.getRect
  48711. * @description 计算返回图片的包围盒矩形。
  48712. *
  48713. * @param {Object} style - style
  48714. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48715. */
  48716. getRect(style) {
  48717. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48718. this.refOriginalPosition = [0, 0];
  48719. }
  48720. var __OP = this.refOriginalPosition;
  48721. return {
  48722. x: style.x + __OP[0],
  48723. y: style.y + __OP[1],
  48724. width: style.width,
  48725. height: style.height
  48726. };
  48727. }
  48728. /**
  48729. * @function SuperMap.LevelRenderer.Shape.SmicImage.prototype.clearCache
  48730. * @description 清除图片缓存。
  48731. *
  48732. * @param {Object} style - style
  48733. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48734. *
  48735. */
  48736. clearCache() {
  48737. this._imageCache = {};
  48738. }
  48739. }
  48740. SmicImage._needsRefresh = [];
  48741. SmicImage._refreshTimeout = null;
  48742. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRectangle.js
  48743. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48744. * This program are made available under the terms of the Apache License, Version 2.0
  48745. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48746. /**
  48747. * @private
  48748. * @class SuperMap.LevelRenderer.Shape.SmicRectangle
  48749. * @category Visualization Theme
  48750. * @classdesc 矩形。
  48751. * @extends SuperMap.LevelRenderer.Shape
  48752. * @example
  48753. * var shape = new SuperMap.LevelRenderer.Shape.SmicRectangle({
  48754. * style: {
  48755. * x: 0,
  48756. * y: 0,
  48757. * width: 100,
  48758. * height: 100,
  48759. * radius: 20
  48760. * }
  48761. * });
  48762. * levelRenderer.addShape(shape);
  48763. *
  48764. */
  48765. class SmicRectangle extends Shape_Shape {
  48766. /**
  48767. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.style
  48768. * @description 绘制样式。
  48769. *
  48770. * @param {number} style.x - 左上角 x 坐标,必设参数。
  48771. * @param {number} style.y - 左上角 y 坐标,必设参数。
  48772. * @param {number} style.width - 宽度,必设参数。
  48773. * @param {number} style.height - 高度,必设参数。
  48774. * @param {Array} style.radius - 矩形圆角,可以用数组分别指定四个角的圆角,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 则 radius为 [r1、r2、r3、r4 ]。
  48775. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  48776. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  48777. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  48778. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  48779. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  48780. * @param {number} style.opacity - 绘制透明度。默认值:1。
  48781. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  48782. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  48783. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  48784. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  48785. * @param {string} style.text - 图形中的附加文本。默认值:""。
  48786. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  48787. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  48788. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  48789. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  48790. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  48791. */
  48792. //打开接口 style
  48793. /**
  48794. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.constructor
  48795. * @description 构造函数。
  48796. *
  48797. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  48798. *
  48799. */
  48800. constructor(options) {
  48801. super(options);
  48802. /**
  48803. * @member {string} SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.type
  48804. * @description 图形类型.
  48805. */
  48806. this.type = 'smicrectangle';
  48807. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48808. this.refOriginalPosition = [0, 0];
  48809. }
  48810. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRectangle";
  48811. }
  48812. /**
  48813. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.destroy
  48814. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  48815. */
  48816. destroy() {
  48817. this.type = null;
  48818. super.destroy();
  48819. }
  48820. /**
  48821. * APIMethod: _buildRadiusPath
  48822. * 创建矩形的圆角路径。
  48823. *
  48824. * Parameters:
  48825. * ctx - {CanvasRenderingContext2D} Context2D 上下文。
  48826. * style - {Object} style。
  48827. *
  48828. */
  48829. _buildRadiusPath(ctx, style) {
  48830. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48831. this.refOriginalPosition = [0, 0];
  48832. }
  48833. var __OP = this.refOriginalPosition;
  48834. // 左上、右上、右下、左下角的半径依次为r1、r2、r3、r4
  48835. // r缩写为1 相当于 [1, 1, 1, 1]
  48836. // r缩写为[1] 相当于 [1, 1, 1, 1]
  48837. // r缩写为[1, 2] 相当于 [1, 2, 1, 2]
  48838. // r缩写为[1, 2, 3] 相当于 [1, 2, 3, 2]
  48839. var x = style.x + __OP[0];
  48840. var y = style.y + __OP[1];
  48841. var width = style.width;
  48842. var height = style.height;
  48843. var r = style.radius;
  48844. var r1;
  48845. var r2;
  48846. var r3;
  48847. var r4;
  48848. if (typeof r === 'number') {
  48849. r1 = r2 = r3 = r4 = r;
  48850. } else if (r instanceof Array) {
  48851. if (r.length === 1) {
  48852. r1 = r2 = r3 = r4 = r[0];
  48853. } else if (r.length === 2) {
  48854. r1 = r3 = r[0];
  48855. r2 = r4 = r[1];
  48856. } else if (r.length === 3) {
  48857. r1 = r[0];
  48858. r2 = r4 = r[1];
  48859. r3 = r[2];
  48860. } else {
  48861. r1 = r[0];
  48862. r2 = r[1];
  48863. r3 = r[2];
  48864. r4 = r[3];
  48865. }
  48866. } else {
  48867. r1 = r2 = r3 = r4 = 0;
  48868. }
  48869. var total;
  48870. if (r1 + r2 > width) {
  48871. total = r1 + r2;
  48872. r1 *= width / total;
  48873. r2 *= width / total;
  48874. }
  48875. if (r3 + r4 > width) {
  48876. total = r3 + r4;
  48877. r3 *= width / total;
  48878. r4 *= width / total;
  48879. }
  48880. if (r2 + r3 > height) {
  48881. total = r2 + r3;
  48882. r2 *= height / total;
  48883. r3 *= height / total;
  48884. }
  48885. if (r1 + r4 > height) {
  48886. total = r1 + r4;
  48887. r1 *= height / total;
  48888. r4 *= height / total;
  48889. }
  48890. ctx.moveTo(x + r1, y);
  48891. ctx.lineTo(x + width - r2, y);
  48892. r2 !== 0 && ctx.quadraticCurveTo(
  48893. x + width, y, x + width, y + r2
  48894. );
  48895. ctx.lineTo(x + width, y + height - r3);
  48896. r3 !== 0 && ctx.quadraticCurveTo(
  48897. x + width, y + height, x + width - r3, y + height
  48898. );
  48899. ctx.lineTo(x + r4, y + height);
  48900. r4 !== 0 && ctx.quadraticCurveTo(
  48901. x, y + height, x, y + height - r4
  48902. );
  48903. ctx.lineTo(x, y + r1);
  48904. r1 !== 0 && ctx.quadraticCurveTo(x, y, x + r1, y);
  48905. }
  48906. /**
  48907. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.buildPath
  48908. * @description 创建矩形路径。
  48909. *
  48910. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  48911. * @param {Object} style - style。
  48912. *
  48913. */
  48914. buildPath(ctx, style) {
  48915. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48916. this.refOriginalPosition = [0, 0];
  48917. }
  48918. var __OP = this.refOriginalPosition;
  48919. if (!style.radius) {
  48920. ctx.moveTo(style.x + __OP[0], style.y + __OP[1]);
  48921. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]));
  48922. ctx.lineTo((style.x + __OP[0]) + style.width, (style.y + __OP[1]) + style.height);
  48923. ctx.lineTo((style.x + __OP[0]), (style.y + __OP[1]) + style.height);
  48924. ctx.lineTo(style.x + __OP[0], style.y + __OP[1]);
  48925. // ctx.rect(style.x, style.y, style.width, style.height);
  48926. } else {
  48927. this._buildRadiusPath(ctx, style);
  48928. }
  48929. ctx.closePath();
  48930. return;
  48931. }
  48932. /**
  48933. * @function SuperMap.LevelRenderer.Shape.SmicRectangle.prototype.getRect
  48934. * @description 计算返回矩形包围盒矩阵。该包围盒是直接从四个控制点计算,并非最小包围盒。
  48935. *
  48936. * @param {Object} style - style
  48937. * @return {Object} 边框对象。包含属性:x,y,width,height。
  48938. */
  48939. getRect(style) {
  48940. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  48941. this.refOriginalPosition = [0, 0];
  48942. }
  48943. var __OP = this.refOriginalPosition;
  48944. if (style.__rect) {
  48945. return style.__rect;
  48946. }
  48947. var lineWidth;
  48948. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  48949. lineWidth = style.lineWidth || 1;
  48950. } else {
  48951. lineWidth = 0;
  48952. }
  48953. style.__rect = {
  48954. x: Math.round((style.x + __OP[0]) - lineWidth / 2),
  48955. y: Math.round((style.y + __OP[1]) - lineWidth / 2),
  48956. width: style.width + lineWidth,
  48957. height: style.height + lineWidth
  48958. };
  48959. return style.__rect;
  48960. }
  48961. }
  48962. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicSector.js
  48963. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  48964. * This program are made available under the terms of the Apache License, Version 2.0
  48965. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  48966. /**
  48967. * @private
  48968. * @class SuperMap.LevelRenderer.Shape.SmicSector
  48969. * @category Visualization Theme
  48970. * @classdesc 扇形。
  48971. * @extends SuperMap.LevelRenderer.Shape
  48972. * @example
  48973. * var shape = new SuperMap.LevelRenderer.Shape.SmicSector({
  48974. * style: {
  48975. * x: 100,
  48976. * y: 100,
  48977. * r: 60,
  48978. * r0: 30,
  48979. * startAngle: 0,
  48980. * endEngle: 180
  48981. * }
  48982. * });
  48983. * levelRenderer.addShape(shape);
  48984. *
  48985. *
  48986. */
  48987. class SmicSector extends Shape_Shape {
  48988. /**
  48989. * @member {Object} SuperMap.LevelRenderer.Shape.SmicSector.prototype.style
  48990. * @description 绘制样式。
  48991. *
  48992. * @param {number} style.x - 圆心 x 坐标,必设参数。
  48993. * @param {number} style.y - 圆心 y 坐标,必设参数。
  48994. * @param {number} style.r - 外圆半径,必设参数。
  48995. * @param {number} style.r0 - 内圆半径,指定后将出现内弧,同时扇边长度为`r - r0`。取值范围[0, r),默认值:0。
  48996. * @param {number} style.startAngle - 起始角度,必设参数。取值范围[0, 360)。
  48997. * @param {number} style.endAngle - 结束角度,必设参数。取值范围(0, 360。
  48998. * @param {boolean} style.clockWise - 是否是顺时针。默认值:false。
  48999. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  49000. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  49001. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  49002. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  49003. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  49004. * @param {number} style.opacity - 绘制透明度。默认值:1。
  49005. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  49006. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  49007. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  49008. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  49009. * @param {string} style.text - 图形中的附加文本。默认值:""。
  49010. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  49011. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  49012. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  49013. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  49014. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  49015. */
  49016. //打开接口 style
  49017. /**
  49018. * @function SuperMap.LevelRenderer.Shape.SmicSector.constructor
  49019. * @description 构造函数。
  49020. *
  49021. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  49022. *
  49023. */
  49024. constructor(options) {
  49025. super(options);
  49026. /**
  49027. * @member {string} SuperMap.LevelRenderer.Shape.SmicSector.protptype.type
  49028. * @description 图形类型。
  49029. */
  49030. this.type = 'smicsector';
  49031. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  49032. this.refOriginalPosition = [0, 0];
  49033. }
  49034. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicSector";
  49035. }
  49036. /**
  49037. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.destroy
  49038. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  49039. */
  49040. destroy() {
  49041. this.type = null;
  49042. super.destroy();
  49043. }
  49044. /**
  49045. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.buildPath
  49046. * @description 创建扇形路径。
  49047. *
  49048. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  49049. * @param {Object} style - style。
  49050. *
  49051. */
  49052. buildPath(ctx, style) {
  49053. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  49054. this.refOriginalPosition = [0, 0];
  49055. }
  49056. var __OP = this.refOriginalPosition;
  49057. var x = style.x + __OP[0]; // 圆心x
  49058. var y = style.y + __OP[1]; // 圆心y
  49059. var r0 = style.r0 || 0; // 形内半径[0,r)
  49060. var r = style.r; // 扇形外半径(0,r]
  49061. var startAngle = style.startAngle; // 起始角度[0,360)
  49062. var endAngle = style.endAngle; // 结束角度(0,360]
  49063. var clockWise = style.clockWise || false;
  49064. startAngle = SUtil_SUtil.Util_math.degreeToRadian(startAngle);
  49065. endAngle = SUtil_SUtil.Util_math.degreeToRadian(endAngle);
  49066. if (!clockWise) {
  49067. // 扇形默认是逆时针方向,Y轴向上
  49068. // 这个跟arc的标准不一样,为了兼容echarts
  49069. startAngle = -startAngle;
  49070. endAngle = -endAngle;
  49071. }
  49072. var unitX = SUtil_SUtil.Util_math.cos(startAngle);
  49073. var unitY = SUtil_SUtil.Util_math.sin(startAngle);
  49074. ctx.moveTo(
  49075. unitX * r0 + x,
  49076. unitY * r0 + y
  49077. );
  49078. ctx.lineTo(
  49079. unitX * r + x,
  49080. unitY * r + y
  49081. );
  49082. ctx.arc(x, y, r, startAngle, endAngle, !clockWise);
  49083. ctx.lineTo(
  49084. SUtil_SUtil.Util_math.cos(endAngle) * r0 + x,
  49085. SUtil_SUtil.Util_math.sin(endAngle) * r0 + y
  49086. );
  49087. if (r0 !== 0) {
  49088. ctx.arc(x, y, r0, endAngle, startAngle, clockWise);
  49089. }
  49090. ctx.closePath();
  49091. return;
  49092. }
  49093. /**
  49094. * @function SuperMap.LevelRenderer.Shape.SmicSector.prototype.getRect
  49095. * @description 返回扇形包围盒矩形
  49096. *
  49097. * @param {Object} style - style
  49098. * @return {Object} 边框对象。包含属性:x,y,width,height。
  49099. *
  49100. */
  49101. getRect(style) {
  49102. if (style.__rect) {
  49103. return style.__rect;
  49104. }
  49105. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  49106. this.refOriginalPosition = [0, 0];
  49107. }
  49108. var __OP = this.refOriginalPosition;
  49109. var min0 = SUtil_SUtil.Util_vector.create();
  49110. var min1 = SUtil_SUtil.Util_vector.create();
  49111. var max0 = SUtil_SUtil.Util_vector.create();
  49112. var max1 = SUtil_SUtil.Util_vector.create();
  49113. var x = style.x + __OP[0]; // 圆心x
  49114. var y = style.y + __OP[1]; // 圆心y
  49115. var r0 = style.r0 || 0; // 形内半径[0,r)
  49116. var r = style.r; // 扇形外半径(0,r]
  49117. var startAngle = SUtil_SUtil.Util_math.degreeToRadian(style.startAngle);
  49118. var endAngle = SUtil_SUtil.Util_math.degreeToRadian(style.endAngle);
  49119. var clockWise = style.clockWise;
  49120. if (!clockWise) {
  49121. startAngle = -startAngle;
  49122. endAngle = -endAngle;
  49123. }
  49124. if (r0 > 1) {
  49125. SUtil_SUtil.Util_computeBoundingBox.arc(
  49126. x, y, r0, startAngle, endAngle, !clockWise, min0, max0
  49127. );
  49128. } else {
  49129. min0[0] = max0[0] = x;
  49130. min0[1] = max0[1] = y;
  49131. }
  49132. SUtil_SUtil.Util_computeBoundingBox.arc(
  49133. x, y, r, startAngle, endAngle, !clockWise, min1, max1
  49134. );
  49135. SUtil_SUtil.Util_vector.min(min0, min0, min1);
  49136. SUtil_SUtil.Util_vector.max(max0, max0, max1);
  49137. style.__rect = {
  49138. x: min0[0],
  49139. y: min0[1],
  49140. width: max0[0] - min0[0],
  49141. height: max0[1] - min0[1]
  49142. };
  49143. return style.__rect;
  49144. }
  49145. }
  49146. ;// CONCATENATED MODULE: ./src/common/overlay/feature/ShapeFactory.js
  49147. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49148. * This program are made available under the terms of the Apache License, Version 2.0
  49149. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49150. /**
  49151. * @class SuperMap.Feature.ShapeFactory
  49152. * @category Visualization Theme
  49153. * @classdesc 图形工厂类。
  49154. * 目前支持创建的图形有:<br>
  49155. * 用于统计专题图:<br>
  49156. * 点 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Point}> <br>
  49157. * 线 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Line}> <br>
  49158. * 面 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Polygon}> <br>
  49159. * 矩形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Rectangle}> <br>
  49160. * 扇形 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Sector}> <br>
  49161. * 标签 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Label}> <br>
  49162. * 图片 - 参数对象 <{@link SuperMap.Feature.ShapeParameters.Image}> <br>
  49163. * 用于符号专题图:<br>
  49164. * 圆形 - 参数对象:<{@link SuperMap.Feature.ShapeParameters.Cilcle}>
  49165. */
  49166. class ShapeFactory {
  49167. /**
  49168. * @function SuperMap.Feature.ShapeFactory.prototype.constructor
  49169. * @description 构建图形工厂对象。
  49170. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象,可选参数。
  49171. * @returns {SuperMap.Feature.ShapeFactory} 返回图形工厂类对象。
  49172. */
  49173. constructor(shapeParameters) {
  49174. /**
  49175. * @member {Object} SuperMap.Feature.ShapeParameters.prototype.shapeParameters
  49176. * @description 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。必设参数,默认值 null。
  49177. */
  49178. this.shapeParameters = shapeParameters;
  49179. this.CLASS_NAME = "SuperMap.Feature.ShapeFactory";
  49180. }
  49181. /**
  49182. * @function SuperMap.Feature.ShapeParameters.prototype.destroy
  49183. * @description 销毁图形工厂类对象。
  49184. */
  49185. destroy() {
  49186. this.shapeParameters = null;
  49187. }
  49188. /**
  49189. * @function SuperMap.Feature.ShapeParameters.prototype.createShape
  49190. * @description 创建一个图形。具体图形由 shapeParameters 决定。
  49191. * @param {Object} shapeParameters - 图形参数对象,<{@link SuperMap.Feature.ShapeParameters}> 子类对象。
  49192. * 此参数可选,如果使用此参数(不为 null),shapeParameters 属性值将被修改为参数的值,然后再使用 shapeParameters 属性值创建图形;
  49193. * 如果不使用此参数,createShape 方法将直接使用 shapeParameters 属性创建图形。
  49194. * @returns {Object} 图形对象(或 null - 图形创建失败)。
  49195. */
  49196. createShape(shapeParameters) {
  49197. if (shapeParameters) {
  49198. this.shapeParameters = shapeParameters;
  49199. }
  49200. if (!this.shapeParameters) {
  49201. return null;
  49202. }
  49203. var sps = this.shapeParameters;
  49204. if (sps instanceof Point_Point) { // 点
  49205. //设置style
  49206. let style = new Object();
  49207. style["x"] = sps.x;
  49208. style["y"] = sps.y;
  49209. style["r"] = sps.r;
  49210. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y']);
  49211. //创建图形
  49212. let shape = new SmicPoint();
  49213. shape.style = ShapeFactory.transformStyle(style);
  49214. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49215. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'style', 'highlightStyle']);
  49216. return shape;
  49217. } else if (sps instanceof Line_Line) { // 线
  49218. //检查参数 pointList 是否存在
  49219. if (!sps.pointList) {
  49220. return null;
  49221. }
  49222. // 设置style
  49223. let style = new Object();
  49224. style["pointList"] = sps.pointList;
  49225. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  49226. // 创建图形
  49227. let shape = new SmicBrokenLine();
  49228. shape.style = ShapeFactory.transformStyle(style);
  49229. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49230. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', 'highlightStyle']);
  49231. return shape;
  49232. } else if (sps instanceof Polygon_Polygon) { // 面
  49233. //检查参数 pointList 是否存在
  49234. if (!sps.pointList) {
  49235. return null;
  49236. }
  49237. //设置style
  49238. let style = new Object();
  49239. style["pointList"] = sps.pointList;
  49240. style = Util.copyAttributesWithClip(style, sps.style, ['pointList']);
  49241. //创建图形
  49242. let shape = new SmicPolygon();
  49243. shape.style = ShapeFactory.transformStyle(style);
  49244. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49245. Util.copyAttributesWithClip(shape, sps, ['pointList', 'style', "highlightStyle"]);
  49246. return shape;
  49247. } else if (sps instanceof Rectangle_Rectangle) { // 矩形
  49248. //检查参数 pointList 是否存在
  49249. if (!sps.x && !sps.y & !sps.width & !sps.height) {
  49250. return null;
  49251. }
  49252. //设置style
  49253. let style = new Object();
  49254. style["x"] = sps.x;
  49255. style["y"] = sps.y;
  49256. style["width"] = sps.width;
  49257. style["height"] = sps.height;
  49258. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'width', 'height']);
  49259. //创建图形
  49260. let shape = new SmicRectangle();
  49261. shape.style = ShapeFactory.transformStyle(style);
  49262. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49263. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'width', 'height', 'style', 'highlightStyle']);
  49264. return shape;
  49265. } else if (sps instanceof Sector) { // 扇形
  49266. //设置style
  49267. let style = new Object();
  49268. style["x"] = sps.x;
  49269. style["y"] = sps.y;
  49270. style["r"] = sps.r;
  49271. style["startAngle"] = sps.startAngle;
  49272. style["endAngle"] = sps.endAngle;
  49273. if (sps["r0"]) {
  49274. style["r0"] = sps.r0
  49275. }
  49276. if (sps["clockWise"]) {
  49277. style["clockWise"] = sps.clockWise
  49278. }
  49279. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle']);
  49280. //创建图形
  49281. let shape = new SmicSector();
  49282. shape.style = ShapeFactory.transformStyle(style);
  49283. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49284. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'startAngle', 'endAngle', 'r0', 'endAngle', 'style', 'highlightStyle']);
  49285. return shape;
  49286. } else if (sps instanceof Label) { // 标签
  49287. //设置style
  49288. let style = new Object();
  49289. style["x"] = sps.x;
  49290. style["y"] = sps.y;
  49291. style["text"] = sps.text;
  49292. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'text']);
  49293. //创建图形
  49294. let shape = new SmicText();
  49295. shape.style = ShapeFactory.transformStyle(style);
  49296. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49297. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'text', 'style', 'highlightStyle']);
  49298. return shape;
  49299. } else if (sps instanceof Image_Image) { // 图片
  49300. //设置style
  49301. let style = new Object();
  49302. style["x"] = sps.x;
  49303. style["y"] = sps.y;
  49304. if (sps["image"]) {
  49305. style["image"] = sps.image;
  49306. }
  49307. if (sps["width"]) {
  49308. style["width"] = sps.width;
  49309. }
  49310. if (sps["height"]) {
  49311. style["height"] = sps.height;
  49312. }
  49313. if (sps["sx"]) {
  49314. style["sx"] = sps.sx;
  49315. }
  49316. if (sps["sy"]) {
  49317. style["sy"] = sps.sy;
  49318. }
  49319. if (sps["sWidth"]) {
  49320. style["sWidth"] = sps.sWidth
  49321. }
  49322. if (sps["sHeight"]) {
  49323. style["sHeight"] = sps.sHeight
  49324. }
  49325. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'image', 'width', 'height', 'sx', 'sy', 'sWidth', 'sHeight']);
  49326. //创建图形
  49327. let shape = new SmicImage();
  49328. shape.style = ShapeFactory.transformStyle(style);
  49329. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49330. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'image', 'width', 'height', 'style', 'highlightStyle']);
  49331. return shape;
  49332. } else if (sps instanceof Circle_Circle) { //圆形 用于符号专题图
  49333. //设置stytle
  49334. let style = new Object();
  49335. style["x"] = sps.x;
  49336. style["r"] = sps.r;
  49337. style["y"] = sps.y;
  49338. style = Util.copyAttributesWithClip(style, sps.style, ['x', 'y', 'r']);
  49339. //创建图形
  49340. let shape = new SmicCircle();
  49341. shape.style = ShapeFactory.transformStyle(style);
  49342. shape.highlightStyle = ShapeFactory.transformStyle(sps.highlightStyle);
  49343. Util.copyAttributesWithClip(shape, sps, ['x', 'y', 'r', 'style', 'highlightStyle', 'lineWidth', 'text', 'textPosition']);
  49344. return shape;
  49345. }
  49346. return null
  49347. }
  49348. /**
  49349. * @function SuperMap.Feature.ShapeParameters.prototype.transformStyle
  49350. * @description 将用户 feature.style (类 Svg style 标准) 的样式,转换为 levelRenderer 的样式标准(类 CSS-Canvas 样式)
  49351. * @param {Object} style - 用户 style。
  49352. * @returns {Object} 符合 levelRenderer 的 style。
  49353. */
  49354. static transformStyle(style) {
  49355. var newStyle = {};
  49356. //字体 ["font-style", "font-variant", "font-weight", "font-size / line-height", "font-family"];
  49357. var fontStr = ["normal", "normal", "normal", "12", "arial,sans-serif"];
  49358. //画笔类型 ["fill", "stroke"];
  49359. var brushType = [true, false];
  49360. for (var ss in style) {
  49361. switch (ss) {
  49362. case "fill":
  49363. brushType[0] = style[ss];
  49364. break;
  49365. case "fillColor":
  49366. newStyle["color"] = style[ss];
  49367. break;
  49368. case "stroke":
  49369. brushType[1] = style[ss];
  49370. break;
  49371. case "strokeWidth":
  49372. newStyle["lineWidth"] = style[ss];
  49373. break;
  49374. case "strokeLinecap":
  49375. newStyle["lineCap"] = style[ss];
  49376. break;
  49377. case "strokeLineJoin":
  49378. newStyle["lineJoin"] = style[ss];
  49379. break;
  49380. case "strokeDashstyle":
  49381. newStyle["lineType"] = style[ss];
  49382. break;
  49383. case "pointRadius":
  49384. newStyle["r"] = style[ss];
  49385. break;
  49386. case "label":
  49387. newStyle["text"] = style[ss];
  49388. break;
  49389. case "labelRect":
  49390. newStyle["labelRect"] = style[ss];
  49391. break;
  49392. case "fontColor":
  49393. newStyle["textColor"] = style[ss];
  49394. break;
  49395. case "fontStyle":
  49396. fontStr[0] = style[ss];
  49397. break;
  49398. case "fontVariant":
  49399. fontStr[1] = style[ss];
  49400. break;
  49401. case "fontWeight":
  49402. fontStr[2] = style[ss];
  49403. break;
  49404. case "fontSize":
  49405. var unit = "";
  49406. if (style[ss] && style[ss].toString().indexOf("px") < 0) {
  49407. unit = "px";
  49408. }
  49409. fontStr[3] = style[ss] + unit;
  49410. break;
  49411. case "fontFamily":
  49412. fontStr[4] = style[ss];
  49413. break;
  49414. case "fontOpacity":
  49415. newStyle["opacity"] = style[ss];
  49416. break;
  49417. case "labelPosition":
  49418. newStyle["textPosition"] = style[ss];
  49419. break;
  49420. case "labelAlign":
  49421. newStyle["textAlign"] = style[ss];
  49422. break;
  49423. case "labelBaseline":
  49424. newStyle["textBaseline"] = style[ss];
  49425. break;
  49426. case "labelRotation":
  49427. newStyle["textRotation"] = style[ss];
  49428. break;
  49429. default:
  49430. newStyle[ss] = style[ss];
  49431. break;
  49432. }
  49433. }
  49434. //拼接字体字符串
  49435. newStyle["textFont"] = fontStr.join(" ");
  49436. //画笔类型
  49437. if (brushType[0] === true && brushType[1] === false) {
  49438. newStyle["brushType"] = "fill";
  49439. } else if (brushType[0] === false && brushType[1] === true) {
  49440. newStyle["brushType"] = "stroke";
  49441. } else if (brushType[0] === true && brushType[1] === true) {
  49442. newStyle["brushType"] = "both";
  49443. } else {
  49444. newStyle["brushType"] = "fill";
  49445. }
  49446. //默认线宽 1
  49447. if (newStyle["lineWidth"] == null) {
  49448. newStyle["lineWidth"] = 1;
  49449. }
  49450. return newStyle;
  49451. }
  49452. /**
  49453. * @function SuperMap.Feature.ShapeParameters.prototype.Background
  49454. * @description 创建一个矩形背景框图形对象。
  49455. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  49456. * @param {Array.<number>} box - 框区域,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  49457. * @param {Object} setting - 图表配置参数,必设参数。本函数中图形配置对象 setting 可设属性:
  49458. * @param {Object} setting.backgroundStyle - 背景样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Rectangle#style>。
  49459. * @param {Array} [setting.backgroundRadius=[0,0,0,0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  49460. * @returns {Object} 背景框图形,一个可视化图形(矩形)对象。
  49461. */
  49462. static Background(shapeFactory, box, setting) {
  49463. var sets = setting ? setting : {};
  49464. // 背景框图形参数对象
  49465. var bgSP = new Rectangle_Rectangle(box[0], box[3], Math.abs(box[2] - box[0]), Math.abs(box[3] - box[1]));
  49466. // 默认样式
  49467. bgSP.style = {
  49468. fillColor: "#f3f3f3"
  49469. };
  49470. // 设置用户 style
  49471. if (sets.backgroundStyle) {
  49472. Util.copyAttributesWithClip(bgSP.style, sets.backgroundStyle);
  49473. }
  49474. // 设置背景框圆角参数
  49475. if (sets.backgroundRadius) {
  49476. bgSP.style["radius"] = sets.backgroundRadius;
  49477. }
  49478. // 禁止背景框响应事件
  49479. bgSP.clickable = false;
  49480. bgSP.hoverable = false;
  49481. return shapeFactory.createShape(bgSP);
  49482. }
  49483. /**
  49484. * @function SuperMap.Feature.ShapeParameters.prototype.GraphAxis
  49485. * @description 创建一个统计图表坐标轴图形对象组。
  49486. * @param {SuperMap.Feature.ShapeFactory} shapeFactory - 图形工厂对象,必设参数。
  49487. * @param {Array.<number>} dataViewBox - 统计图表模型的数据视图框,长度为 4 的一维数组,像素坐标,[left, bottom, right, top],必设参数。
  49488. * @param {Object} setting - 图表配置参数,必设参数。
  49489. * @param {Object} setting.axisStyle - 坐标轴样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  49490. * @param {boolean} [setting.axisUseArrow=false] - 坐标轴是否使用箭头。
  49491. * @param {number} [setting.axisYTick=0] - y 轴刻度数量,0表示不使用箭头。
  49492. * @param {Array.<string>} setting.axisYLabels - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  49493. * @param {Object} setting.axisYLabelsStyle - y 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  49494. * @param {Array.<number>} [setting.axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正,默认值:0。
  49495. * @param {Array.<string>} setting.axisXLabels - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  49496. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xPositions 数量相同(即标签个数与数据个数相等时), 按照 xPositions 提供的位置在水平方向上排布标签,否则沿数据视图框下面条边等距排布标签。
  49497. * @param {Object} setting.axisXLabelsStyle - x 轴上的标签组样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Label#style>。
  49498. * @param {Array.<number>} [setting.axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:0。
  49499. * @param {boolean} setting.useXReferenceLine - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  49500. * @param {Object} setting.xReferenceLineStyle - 水平参考线样式,此样式对象对象可设属性:<SuperMap.Feature.ShapeParameters.Line#style>。
  49501. * @param {number} [setting.axis3DParameter=0] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  49502. * @param {Object} xShapeInfo - X 方向上的图形信息对象,包含两个属性。
  49503. * @param {Array.<number>} xShapeInfo.xPositions - 图形在 x 轴方向上的像素坐标值,是一个一维数组,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  49504. * @param {number} xShapeInfo.width - 图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  49505. * @returns {Array.<Object>} 统计图表坐标轴图形对象数组。
  49506. */
  49507. static GraphAxis(shapeFactory, dataViewBox, setting, xShapeInfo) {
  49508. var dvb = dataViewBox;
  49509. var sets = setting ? setting : {};
  49510. // 参考线图形对象组
  49511. var refLines = [];
  49512. //坐标轴箭头对象组
  49513. var arrows = [];
  49514. // 是否使用参水平考线,默认不使用
  49515. var isAddRefLine = sets.useXReferenceLine ? sets.useXReferenceLine : false;
  49516. // y 轴上的刻度
  49517. var axisytick = (sets.axisYTick && !isNaN(sets.axisYTick)) ? sets.axisYTick : 0;
  49518. // 坐标轴节点数组
  49519. var pois = [];
  49520. //z 轴箭头数组
  49521. var zArrowPois = [];
  49522. // x,y 轴主干节点数组
  49523. var xMainPois = [];
  49524. if (axisytick == 0) {
  49525. xMainPois.push([dvb[0], dvb[3] - 5]);
  49526. xMainPois.push([dvb[0], dvb[1]]);
  49527. // 3D 坐标轴 第三象限平分线
  49528. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  49529. let axis3DParameter = parseInt(sets.axis3DParameter);
  49530. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  49531. // 添加 3D 轴节点
  49532. if (sets.axisUseArrow) { // 添加 3D 轴箭头节点坐标
  49533. //箭头坐标
  49534. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  49535. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  49536. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  49537. //3D轴
  49538. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49539. } else {
  49540. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49541. }
  49542. xMainPois.push([dvb[0], dvb[1]]);
  49543. }
  49544. xMainPois.push([dvb[2] + 5, dvb[1]]);
  49545. } else {
  49546. // 单位刻度长度
  49547. var unitTick = Math.abs(dvb[1] - dvb[3]) / axisytick;
  49548. // 刻度 y 坐标
  49549. var thckY = dvb[3];
  49550. xMainPois.push([dvb[0], thckY - 5]);
  49551. for (var i = 0; i < axisytick; i++) {
  49552. xMainPois.push([dvb[0], thckY]);
  49553. xMainPois.push([dvb[0] - 5, thckY]);
  49554. xMainPois.push([dvb[0], thckY]);
  49555. // 参考线
  49556. if (isAddRefLine) {
  49557. // 参考线参数对象
  49558. var refLineSP = new Line_Line([
  49559. [dvb[0], thckY],
  49560. [dvb[2], thckY]
  49561. ]);
  49562. // 参考线默认样式对象
  49563. refLineSP.style = {
  49564. strokeColor: "#cfcfcf",
  49565. strokeLinecap: "butt",
  49566. strokeLineJoin: "round",
  49567. strokeWidth: 1
  49568. };
  49569. // 禁止事件
  49570. refLineSP.clickable = false;
  49571. refLineSP.hoverable = false;
  49572. // 用户style
  49573. if (sets.xReferenceLineStyle) {
  49574. Util.copyAttributesWithClip(refLineSP.style, sets.xReferenceLineStyle);
  49575. }
  49576. // 生成参考线图形对象
  49577. refLines.push(shapeFactory.createShape(refLineSP))
  49578. }
  49579. // y 刻度增量
  49580. thckY += unitTick;
  49581. }
  49582. xMainPois.push([dvb[0], dvb[1]]);
  49583. // 3D 坐标轴 第三象限平分线
  49584. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  49585. let axis3DParameter = parseInt(sets.axis3DParameter);
  49586. let axis3DPoi = [dvb[0] - axis3DParameter, dvb[1] + axis3DParameter];
  49587. /*
  49588. // 箭头计算过程
  49589. var axis3DPoiRef = [axis3DPoi[0] + 7, axis3DPoi[1] - 7]; // 7 是 10 为斜边 cos(45度)时邻边的值
  49590. var axis3DPoiLT = [axis3DPoiRef[0] - 4, axis3DPoiRef[1] - 4];
  49591. var axis3DPoiRB = [axis3DPoiRef[0] + 4, axis3DPoiRef[1] + 4];
  49592. if(sets.axisUseArrow){
  49593. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49594. xMainPois.push([axis3DPoiLT[0], axis3DPoiLT[1]]);
  49595. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49596. xMainPois.push([axis3DPoiRB[0], axis3DPoiRB[1]]);
  49597. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49598. }
  49599. else{
  49600. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49601. }
  49602. */
  49603. // 添加 3D 轴节点
  49604. if (sets.axisUseArrow) { // 添加 3D 轴和箭头坐标
  49605. //箭头坐标
  49606. zArrowPois.push([axis3DPoi[0] + 1.5, axis3DPoi[1] - 7.5]);
  49607. zArrowPois.push([axis3DPoi[0] - 1, axis3DPoi[1] + 1]);
  49608. zArrowPois.push([axis3DPoi[0] + 7.5, axis3DPoi[1] - 1.5]);
  49609. //3D轴
  49610. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49611. } else {
  49612. xMainPois.push([axis3DPoi[0], axis3DPoi[1]]);
  49613. }
  49614. xMainPois.push([dvb[0], dvb[1]]);
  49615. }
  49616. xMainPois.push([dvb[2] + 5, dvb[1]]);
  49617. }
  49618. // 坐标轴箭头
  49619. if (sets.axisUseArrow) {
  49620. // x 轴箭头节点数组
  49621. var xArrowPois = [
  49622. [dvb[2] + 5, dvb[1] + 4],
  49623. [dvb[2] + 13, dvb[1]],
  49624. [dvb[2] + 5, dvb[1] - 4]
  49625. ];
  49626. // y 轴箭头节点数组
  49627. var yArrowPois = [
  49628. [dvb[0] - 4, dvb[3] - 5],
  49629. [dvb[0], dvb[3] - 13],
  49630. [dvb[0] + 4, dvb[3] - 5]
  49631. ];
  49632. //x轴箭头
  49633. var xSP = new Polygon_Polygon(xArrowPois);
  49634. xSP.style = {fillColor: "#008acd"};
  49635. Util.copyAttributesWithClip(xSP.style, sets.axisStyle);
  49636. arrows.push(shapeFactory.createShape(xSP));
  49637. //y轴箭头
  49638. var ySP = new Polygon_Polygon(yArrowPois);
  49639. ySP.style = {fillColor: "#008acd"};
  49640. Util.copyAttributesWithClip(ySP.style, sets.axisStyle);
  49641. arrows.push(shapeFactory.createShape(ySP));
  49642. // z轴箭头 坐标轴箭头是否要使用
  49643. if (sets.axis3DParameter && !isNaN(sets.axis3DParameter) && sets.axis3DParameter >= 15) {
  49644. var zSP = new Polygon_Polygon(zArrowPois);
  49645. zSP.style = {fillColor: "#008acd"};
  49646. Util.copyAttributesWithClip(zSP.style, sets.axisStyle);
  49647. arrows.push(shapeFactory.createShape(zSP));
  49648. }
  49649. }
  49650. //不带箭头的坐标轴
  49651. pois = xMainPois;
  49652. // 坐标轴参数对象
  49653. var axisSP = new Line_Line(pois);
  49654. // 坐标轴默认style
  49655. axisSP.style = {
  49656. strokeLinecap: "butt",
  49657. strokeLineJoin: "round",
  49658. strokeColor: "#008acd",
  49659. strokeWidth: 1
  49660. };
  49661. // 用户 style
  49662. if (sets.axisStyle) {
  49663. Util.copyAttributesWithClip(axisSP.style, sets.axisStyle);
  49664. }
  49665. // 禁止事件
  49666. axisSP.clickable = false;
  49667. axisSP.hoverable = false;
  49668. // 创建坐标轴图形对象
  49669. var axisMain = [shapeFactory.createShape(axisSP)];
  49670. // Y 轴标签
  49671. var yLabels = [];
  49672. if (sets.axisYLabels && sets.axisYLabels.length && sets.axisYLabels.length > 0) {
  49673. var axisYLabels = sets.axisYLabels;
  49674. let len = axisYLabels.length;
  49675. // 标签偏移量
  49676. var ylOffset = [0, 0];
  49677. if (sets.axisYLabelsOffset && sets.axisYLabelsOffset.length) {
  49678. ylOffset = sets.axisYLabelsOffset;
  49679. }
  49680. if (len == 1) {
  49681. // 标签参数对象
  49682. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], dvb[3] + ylOffset[1], axisYLabels[0]);
  49683. labelYSP.style = {
  49684. labelAlign: "right"
  49685. };
  49686. // 用户 style
  49687. if (sets.axisYLabelsStyle) {
  49688. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  49689. }
  49690. // 禁止事件
  49691. labelYSP.clickable = false;
  49692. labelYSP.hoverable = false;
  49693. // 制作标签
  49694. yLabels.push(shapeFactory.createShape(labelYSP));
  49695. } else {
  49696. var labelY = dvb[3];
  49697. // y 轴标签单位距离
  49698. var yUnit = Math.abs(dvb[1] - dvb[3]) / (len - 1);
  49699. for (var j = 0; j < len; j++) {
  49700. // 标签参数对象
  49701. let labelYSP = new Label(dvb[0] - 5 + ylOffset[0], labelY + ylOffset[1], axisYLabels[j]);
  49702. labelYSP.style = {
  49703. labelAlign: "right"
  49704. };
  49705. // 用户 style
  49706. if (sets.axisYLabelsStyle) {
  49707. Util.copyAttributesWithClip(labelYSP.style, sets.axisYLabelsStyle);
  49708. }
  49709. // 禁止事件
  49710. labelYSP.clickable = false;
  49711. labelYSP.hoverable = false;
  49712. // 制作标签
  49713. yLabels.push(shapeFactory.createShape(labelYSP));
  49714. // y 轴标签 y 方向增量
  49715. labelY += yUnit;
  49716. }
  49717. }
  49718. }
  49719. // X 轴标签
  49720. var xLabels = [];
  49721. if (sets.axisXLabels && sets.axisXLabels.length && sets.axisXLabels.length > 0) {
  49722. let axisXLabels = sets.axisXLabels;
  49723. let len = axisXLabels.length;
  49724. // 标签偏移量
  49725. let xlOffset = [0, 0];
  49726. if (sets.axisXLabelsOffset && sets.axisXLabelsOffset.length) {
  49727. xlOffset = sets.axisXLabelsOffset;
  49728. }
  49729. // 标签个数与数据字段个数相等等时,标签在 x 轴均匀排列
  49730. if (xShapeInfo && xShapeInfo.xPositions && xShapeInfo.xPositions.length && xShapeInfo.xPositions.length == len) {
  49731. let xsCenter = xShapeInfo.xPositions;
  49732. for (let K = 0; K < len; K++) {
  49733. // 标签参数对象
  49734. let labelXSP = new Label(xsCenter[K] + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[K]);
  49735. // 默认 style
  49736. labelXSP.style = {
  49737. labelAlign: "center",
  49738. labelBaseline: "top"
  49739. };
  49740. // 用户 style
  49741. if (sets.axisXLabelsStyle) {
  49742. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49743. }
  49744. // 禁止事件
  49745. labelXSP.clickable = false;
  49746. labelXSP.hoverable = false;
  49747. // 创建标签对象
  49748. xLabels.push(shapeFactory.createShape(labelXSP));
  49749. }
  49750. } else {
  49751. if (len == 1) {
  49752. // 标签参数对象
  49753. let labelXSP = new Label(dvb[0] - 5 + xlOffset[0], dvb[1] + xlOffset[0], axisXLabels[0]);
  49754. // 默认 style
  49755. labelXSP.style = {
  49756. labelAlign: "center",
  49757. labelBaseline: "top"
  49758. };
  49759. // 用户 style
  49760. if (sets.axisXLabelsStyle) {
  49761. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49762. }
  49763. // 禁止事件
  49764. labelXSP.clickable = false;
  49765. labelXSP.hoverable = false;
  49766. // 创建标签对象
  49767. xLabels.push(shapeFactory.createShape(labelXSP));
  49768. } else {
  49769. let labelX = dvb[0];
  49770. // x 轴标签单位距离
  49771. let xUnit = Math.abs(dvb[2] - dvb[0]) / (len - 1);
  49772. for (let m = 0; m < len; m++) {
  49773. // 标签参数对象
  49774. let labelXSP = new Label(labelX + xlOffset[0], dvb[1] + xlOffset[1], axisXLabels[m]);
  49775. // 默认 style
  49776. labelXSP.style = {
  49777. labelAlign: "center",
  49778. labelBaseline: "top"
  49779. };
  49780. // 用户 style
  49781. if (sets.axisXLabelsStyle) {
  49782. Util.copyAttributesWithClip(labelXSP.style, sets.axisXLabelsStyle);
  49783. }
  49784. // 禁止事件
  49785. labelXSP.clickable = false;
  49786. labelXSP.hoverable = false;
  49787. // 创建标签对象
  49788. xLabels.push(shapeFactory.createShape(labelXSP));
  49789. // x 轴标签 x 方向增量
  49790. labelX += xUnit;
  49791. }
  49792. }
  49793. }
  49794. }
  49795. // 组装并返回构成坐标轴的图形
  49796. return ((refLines.concat(axisMain)).concat(yLabels)).concat(xLabels).concat(arrows);
  49797. }
  49798. /**
  49799. * @function SuperMap.Feature.ShapeParameters.prototype.ShapeStyleTool
  49800. * @description 一个图形 style 处理工具。此工具将指定的默认 style,通用 style,按 styleGroup 取得的 style 和按数据值 value 范围取得的 style 进行合并,得到图形最终的 style。
  49801. * @param {Object} defaultStyle - 默认style,此样式对象可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。
  49802. * @param {Object} style - 图形对象基础 style,此参数控制图形的基础样式,可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。优先级低于 styleGroup,styleByCodomain。
  49803. * @param {Array.<Object>} styleGroup - 一个 style 数组,优先级低于 styleByCodomain,高于 style。此数组每个元素是样式对象,
  49804. * 其可设属性根据图形类型参考 <{@link SuperMap.Feature.ShapeParameters}> 子类对象的 style 属性。通过 index 参数从 styleGroup 中取 style。
  49805. * @param {Array.<Object>} styleByCodomain - 按数据(参数 value)所在值域范围控制数据的可视化对象样式。
  49806. * (start code)
  49807. * // styleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  49808. * // start: 值域值下限(包含);
  49809. * // end: 值域值上限(不包含);
  49810. * // style: 数据可视化图形的 style,其可设属性根据图形类型参考 <SuperMap.Feature.ShapeParameters> 子类对象的 style 属性。。
  49811. * // dataStyleByCodomain 数组形如:
  49812. * [
  49813. * {
  49814. * start:0,
  49815. * end:250,
  49816. * style:{
  49817. * fillColor:"#00CD00"
  49818. * }
  49819. * },
  49820. * {
  49821. * start:250,
  49822. * end:500,
  49823. * style:{
  49824. * fillColor:"#00EE00"
  49825. * }
  49826. * },
  49827. * {
  49828. * start:500,
  49829. * end:750,
  49830. * style:{
  49831. * fillColor:"#00FF7F"
  49832. * }
  49833. * },
  49834. * {
  49835. * start:750,
  49836. * end:1500,
  49837. * style:{
  49838. * fillColor:"#00FF00"
  49839. * }
  49840. * }
  49841. * ]
  49842. * (end)
  49843. * @param {number} index - styleGroup 的索引值,用于取出 styleGroup 指定的 style。
  49844. * @param {number} value - 数据值,用于取出 styleByCodomain 指定的 style。
  49845. * @returns {Object} 合并后的样式 (style) 对象。
  49846. */
  49847. static ShapeStyleTool(defaultStyle, style, styleGroup, styleByCodomain, index, value) {
  49848. // 用 defaultStyle 初始化 style 对象
  49849. var finalStyle = defaultStyle ? defaultStyle : {};
  49850. // 基础 style
  49851. if (style) {
  49852. Util.copyAttributesWithClip(finalStyle, style);
  49853. }
  49854. // 按索引赋 style
  49855. if (styleGroup && styleGroup.length && typeof(index) !== "undefined" && !isNaN(index) && index >= 0) {
  49856. if (styleGroup[index]) {
  49857. Util.copyAttributesWithClip(finalStyle, styleGroup[index]);
  49858. }
  49859. }
  49860. // 按值域赋 style
  49861. if (styleByCodomain && styleByCodomain.length && typeof(value) !== "undefined") {
  49862. var dsc = styleByCodomain;
  49863. var dscLen = dsc.length;
  49864. var v = parseFloat(value);
  49865. for (var i = 0; i < dscLen; i++) {
  49866. if (dsc[i].start <= v && v < dsc[i].end) {
  49867. Util.copyAttributesWithClip(finalStyle, dsc[i].style);
  49868. break;
  49869. }
  49870. }
  49871. }
  49872. return finalStyle;
  49873. }
  49874. }
  49875. SuperMap.Feature = SuperMap.Feature || {};
  49876. SuperMap.Feature.ShapeFactory = ShapeFactory;
  49877. ;// CONCATENATED MODULE: ./src/common/overlay/feature/Theme.js
  49878. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49879. * This program are made available under the terms of the Apache License, Version 2.0
  49880. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49881. /**
  49882. * @class SuperMap.Feature.Theme
  49883. * @category Visualization Theme
  49884. * @classdesc 专题要素基类,此类不可实例化。
  49885. */
  49886. class Theme_Theme {
  49887. /**
  49888. * @function SuperMap.Feature.Theme.prototype.constructor
  49889. * @description 构造函数。
  49890. * @param {Object} data - 用户数据,用于生成可视化 shape,必设参数。
  49891. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层,必设参数。
  49892. * @returns {SuperMap.Feature.Theme} 返回一个专题要素。
  49893. */
  49894. constructor(data, layer) {
  49895. if (!data) {
  49896. return;
  49897. }
  49898. // layer 必须已经添加到地图, 且已初始化渲染器
  49899. if (!layer || !layer.map || !layer.renderer) {
  49900. return;
  49901. }
  49902. /**
  49903. * @member {string} SuperMap.Feature.Theme.prototype.id
  49904. * @description 专题要素唯一标识。
  49905. */
  49906. this.id = Util.createUniqueID(this.CLASS_NAME + "_");
  49907. /**
  49908. * @member {SuperMap.LonLat} SuperMap.Feature.Theme.prototype.lonlat
  49909. * @description 专题要素地理参考位置。子类中必须根据用户数据(或地理位置参数)对其赋值。
  49910. */
  49911. this.lonlat = null;
  49912. /**
  49913. * @member {Array} SuperMap.Feature.Theme.prototype.location
  49914. * @description 专题要素像素参考位置。通常由地理参考位置决定。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49915. */
  49916. this.location = [];
  49917. /**
  49918. * @readonly
  49919. * @member {Object} SuperMap.Feature.Theme.prototype.data
  49920. * @description 用户数据,用于生成可视化 shape,可在子类中规定数据格式或类型,如:<SuperMap.Feature.Vector>。
  49921. */
  49922. this.data = data;
  49923. /**
  49924. * @readonly
  49925. * @member {Array} SuperMap.Feature.Theme.prototype.shapes
  49926. * @description 构成此专题要素的可视化图形对象数组,数组顺序控制渲染。
  49927. */
  49928. this.shapes = [];
  49929. /**
  49930. * @readonly
  49931. * @member {SuperMap.Layer.Theme} SuperMap.Feature.Theme.prototype.layer
  49932. * @description 此专题要素所在专题图层。
  49933. */
  49934. this.layer = layer;
  49935. this.CLASS_NAME = "SuperMap.Feature.Theme";
  49936. }
  49937. /**
  49938. * @function SuperMap.Feature.Theme.prototype.destroy
  49939. * @description 销毁专题要素。
  49940. */
  49941. destroy() {
  49942. this.data = null;
  49943. this.id = null;
  49944. this.lonlat = null;
  49945. this.location = null;
  49946. this.shapes = null;
  49947. this.layer = null;
  49948. }
  49949. /**
  49950. * @function SuperMap.Feature.Theme.prototype.getLocalXY
  49951. * @description 地理坐标转为像素坐标。
  49952. * @param {(SuperMap.Geometry.Point|SuperMap.Geometry.GeoText|SuperMap.LonLat)} coordinate - 地理坐标点。
  49953. * @returns {Array} 长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  49954. */
  49955. getLocalXY(coordinate) {
  49956. var resolution = this.layer.map.getResolution();
  49957. var extent = this.layer.map.getExtent();
  49958. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  49959. let x = (coordinate.x / resolution + (-extent.left / resolution));
  49960. let y = ((extent.top / resolution) - coordinate.y / resolution);
  49961. return [x, y];
  49962. } else if (coordinate instanceof LonLat) {
  49963. let x = (coordinate.lon / resolution + (-extent.left / resolution));
  49964. let y = ((extent.top / resolution) - coordinate.lat / resolution);
  49965. return [x, y];
  49966. } else {
  49967. return null;
  49968. }
  49969. }
  49970. }
  49971. SuperMap.Feature = SuperMap.Feature || {};
  49972. SuperMap.Feature.Theme = Theme_Theme;
  49973. ;// CONCATENATED MODULE: ./src/common/overlay/Graph.js
  49974. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  49975. * This program are made available under the terms of the Apache License, Version 2.0
  49976. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  49977. /**
  49978. * @class SuperMap.Feature.Theme.Graph
  49979. * @classdesc 统计专题要素基类。
  49980. * @category Visualization Theme
  49981. * @description 此类定义了统计专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  49982. * 统计专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.Graph.setting> 的基础属性只有 7 个,
  49983. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  49984. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  49985. * @extends SuperMap.Feature.Theme
  49986. * @param {SuperMap.Feature.Vector} data - 用户数据。
  49987. * @param {SuperMap.Layer.Theme} layer - 此专题要素所在图层。
  49988. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  49989. * @param {Object} setting - 图表配置对象。
  49990. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  49991. */
  49992. class Graph extends Theme_Theme {
  49993. constructor(data, layer, fields, setting, lonlat, options) {
  49994. super(data, layer, fields, setting, lonlat, options);
  49995. /**
  49996. * @member {SuperMap.Feature.ShapeFactory} SuperMap.Feature.Theme.Graph.prototype.shapeFactory
  49997. * @description 内置的图形工厂对象,调用其 createShape 方法创建图形。
  49998. */
  49999. this.shapeFactory = new ShapeFactory();
  50000. /**
  50001. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.shapeParameters
  50002. * @description 当前图形参数对象,<SuperMap.Feature.ShapeParameters> 的子类对象。
  50003. */
  50004. this.shapeParameters = null;
  50005. /**
  50006. * @member {boolean} [SuperMap.Feature.Theme.Graph.prototype.RelativeCoordinate]
  50007. * @description 图形是否已经计算了相对坐标。
  50008. */
  50009. this.RelativeCoordinate = false;
  50010. /**
  50011. * @member {Object} SuperMap.Feature.Theme.Graph.prototype.setting
  50012. * @description 图表配置对象,该对象控制着图表的可视化显示。
  50013. * @param {number} width - 专题要素(图表)宽度。
  50014. * @param {number} height - 专题要素(图表)高度。
  50015. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50016. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50017. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50018. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox
  50019. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50020. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。
  50021. * 如果不设置此参数,在取数据值时不对数据做小数位处理。
  50022. *
  50023. */
  50024. this.setting = null;
  50025. /**
  50026. * @readonly
  50027. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPoint
  50028. * @description 专题要素(图表)原点,图表左上角点像素坐标,是长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  50029. */
  50030. this.origonPoint = null;
  50031. /**
  50032. * @readonly
  50033. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.chartBox
  50034. * @description 专题要素(图表)区域,即图表框,长度为 4 的一维数组,数组的 4 个元素依次表示图表框左端 x 坐标值、
  50035. * 下端 y坐标值、 右端 x坐标值、 上端 y 坐标值;[left, bottom, right, top]。
  50036. */
  50037. this.chartBox = null;
  50038. /**
  50039. * @readonly
  50040. * @member {SuperMap.Bounds} SuperMap.Feature.Theme.Graph.prototype.chartBounds
  50041. * @description 图表 Bounds 随着 lonlat、XOffset、YOffset 更新,注意 chartBounds 是图表像素范围,不是地理范围。
  50042. */
  50043. this.chartBounds = null;
  50044. /**
  50045. * @readonly
  50046. * @member {number} SuperMap.Feature.Theme.Graph.prototype.width
  50047. * @description 专题要素(图表)宽度 。
  50048. */
  50049. this.width = null;
  50050. /**
  50051. * @readonly
  50052. * @member {number} SuperMap.Feature.Theme.Graph.prototype.height
  50053. * @description 专题要素(图表)高度 。
  50054. */
  50055. this.height = null;
  50056. /**
  50057. * @readonly
  50058. * @member {number} SuperMap.Feature.Theme.Graph.prototype.XOffset
  50059. * @description 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50060. */
  50061. this.XOffset = 0;
  50062. /**
  50063. * @readonly
  50064. * @member {number} SuperMap.Feature.Theme.Graph.prototype.YOffset
  50065. * @description 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50066. */
  50067. this.YOffset = 0;
  50068. /**
  50069. * @readonly
  50070. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBParameter
  50071. * @description 数据视图框参数,长度为 4 的一维数组(数组元素值 >= 0),[leftOffset, bottomOffset, rightOffset, topOffset],chartBox 内偏距值。
  50072. * 此属性用于指定数据视图框 dataViewBox 的范围。
  50073. */
  50074. this.DVBParameter = null;
  50075. /**
  50076. * @readonly
  50077. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataViewBox
  50078. * @description 数据视图框,长度为 4 的一维数组,[left, bottom, right, top]。
  50079. * dataViewBox 是统计专题要素最核心的内容,它负责解释数据在一个像素区域里的数据可视化含义,
  50080. * 这种含义用可视化图形表达出来,这些表示数据的图形和一些辅助图形组合在一起构成统计专题图表。
  50081. */
  50082. this.dataViewBox = null;
  50083. /**
  50084. * @readonly
  50085. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCodomain
  50086. * @description 数据视图框的内允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50087. * dataViewBox 中允许的数据范围,对数据溢出值域范围情况的处理需要在 assembleShapes 中进行。
  50088. */
  50089. this.DVBCodomain = null;
  50090. /**
  50091. * @readonly
  50092. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBCenterPoint
  50093. * @description 数据视图框中心点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  50094. */
  50095. this.DVBCenterPoint = null;
  50096. /**
  50097. * @readonly
  50098. * @member {string} SuperMap.Feature.Theme.Graph.prototype.DVBUnitValue
  50099. * @description 单位值。在 assembleShapes() 中初始化其具体意义,例如:饼图的 DVBUnitValue 可以定义为"360/数据总和",
  50100. * 折线图的 DVBUnitValue 可以定义为 "DVBCodomain/DVBHeight"。
  50101. */
  50102. this.DVBUnitValue = null;
  50103. /**
  50104. * @readonly
  50105. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.DVBOrigonPoint
  50106. * @description 数据视图框原点,数据视图框左上角点,长度为 2 的一维数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  50107. */
  50108. this.DVBOrigonPoint = null;
  50109. /**
  50110. * @readonly
  50111. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBWidth
  50112. * @description 数据视图框宽度。
  50113. */
  50114. this.DVBWidth = null;
  50115. /**
  50116. * @readonly
  50117. * @member {number} SuperMap.Feature.Theme.Graph.prototype.DVBHeight
  50118. * @description 数据视图框高度。
  50119. */
  50120. this.DVBHeight = null;
  50121. /**
  50122. * @readonly
  50123. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.origonPointOffset
  50124. * @description 数据视图框原点相对于图表框的原点偏移量,长度为 2 的一维数组,第一个元素表示 x 偏移量,第二个元素表示 y 偏移量。
  50125. */
  50126. this.origonPointOffset = null;
  50127. /**
  50128. * @readonly
  50129. * @member {Array.<string>} SuperMap.Feature.Theme.Graph.prototype.fields
  50130. * @description 数据{SuperMap.Feature.Vector}属性字段。
  50131. */
  50132. this.fields = fields || [];
  50133. /**
  50134. * @readonly
  50135. * @member {Array.<number>} SuperMap.Feature.Theme.Graph.prototype.dataValues
  50136. * @description 图表展示的数据值,通过 fields 从数据 feature 属性中获得。
  50137. */
  50138. this.dataValues = null;
  50139. // 图表位置
  50140. if (lonlat) {
  50141. this.lonlat = lonlat;
  50142. } else {
  50143. // 默认使用 bounds 中心
  50144. this.lonlat = this.data.geometry.getBounds().getCenterLonLat();
  50145. }
  50146. // 配置项检测与赋值
  50147. if (setting && setting.width && setting.height && setting.codomain) {
  50148. this.setting = setting;
  50149. }
  50150. this.CLASS_NAME = "SuperMap.Feature.Theme.Graph";
  50151. }
  50152. /**
  50153. * @function SuperMap.Feature.Theme.Graph.prototype.destroy
  50154. * @description 销毁专题要素。
  50155. */
  50156. destroy() {
  50157. this.shapeFactory = null;
  50158. this.shapeParameters = null;
  50159. this.width = null;
  50160. this.height = null;
  50161. this.origonPoint = null;
  50162. this.chartBox = null;
  50163. this.dataViewBox = null;
  50164. this.chartBounds = null;
  50165. this.DVBParameter = null;
  50166. this.DVBOrigonPoint = null;
  50167. this.DVBCenterPoint = null;
  50168. this.DVBWidth = null;
  50169. this.DVBHeight = null;
  50170. this.DVBCodomain = null;
  50171. this.DVBUnitValue = null;
  50172. this.origonPointOffset = null;
  50173. this.XOffset = null;
  50174. this.YOffset = null;
  50175. this.fields = null;
  50176. this.dataValues = null;
  50177. this.setting = null;
  50178. super.destroy();
  50179. }
  50180. /**
  50181. * @function SuperMap.Feature.Theme.Graph.prototype.initBaseParameter
  50182. * @description 初始化专题要素(图表)基础参数。在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  50183. * 调用此函数关系到 setting 对象的以下属性。
  50184. * @param {number} width - 专题要素(图表)宽度。
  50185. * @param {number} height - 专题要素(图表)高度。
  50186. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50187. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50188. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50189. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox。
  50190. * (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  50191. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50192. * @returns {boolean} 初始化参数是否成功。
  50193. */
  50194. initBaseParameter() {
  50195. // 参数初始化是否成功
  50196. var isSuccess = true;
  50197. // setting 属性是否已成功赋值
  50198. if (!this.setting) {
  50199. return false;
  50200. }
  50201. var sets = this.setting;
  50202. // 检测 setting 的必设参数
  50203. if (!(sets.width && sets.height && sets.codomain)) {
  50204. return false;
  50205. }
  50206. // 数据
  50207. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  50208. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  50209. this.dataValues = dataEffective ? dataEffective : [];
  50210. // 基础参数 width, height, codomain
  50211. this.width = parseFloat(sets.width);
  50212. this.height = parseFloat(sets.height);
  50213. this.DVBCodomain = sets.codomain;
  50214. // 图表偏移
  50215. // if(sets.XOffset) {this.XOffset = sets.XOffset};
  50216. // if(sets.YOffset) {this.YOffset = sets.YOffset};
  50217. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  50218. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  50219. // 其他默认值
  50220. this.origonPoint = [];
  50221. this.chartBox = [];
  50222. this.dataViewBox = [];
  50223. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  50224. this.DVBOrigonPoint = [];
  50225. this.DVBCenterPoint = [];
  50226. this.origonPointOffset = [];
  50227. // 图表位置
  50228. this.resetLocation();
  50229. // 专题要素宽度 w
  50230. var w = this.width;
  50231. // 专题要素高度 h
  50232. var h = this.height;
  50233. // 专题要素像素位置 loc
  50234. var loc = this.location;
  50235. // 专题要素像素位置 loc
  50236. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  50237. // 专题要素原点(左上角)
  50238. var op = this.origonPoint;
  50239. // 图表框([left, bottom, right, top])
  50240. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  50241. // 图表框
  50242. var cb = this.chartBox;
  50243. // 数据视图框参数,它是图表框各方向对应的内偏距
  50244. var dbbP = this.DVBParameter;
  50245. // 数据视图框 ([left, bottom, right, top])
  50246. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  50247. // 数据视图框
  50248. var dvb = this.dataViewBox;
  50249. //检查数据视图框是否合法
  50250. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  50251. return false;
  50252. }
  50253. // 数据视图框原点
  50254. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  50255. // 数据视图框宽度
  50256. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  50257. // 数据视图框高度
  50258. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  50259. // 数据视图框中心点
  50260. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2]
  50261. // 数据视图框原点与图表框的原点偏移量
  50262. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  50263. return isSuccess;
  50264. }
  50265. /**
  50266. * @function SuperMap.Feature.Theme.Graph.prototype.resetLocation
  50267. * @description 根据地理位置 lonlat 重置专题要素(图表)位置。
  50268. * @param {SuperMap.LonLat} lonlat - 专题要素新的像素中心位置。
  50269. * @returns {Array.<number>} - 新专题要素像素参考位置。长度为 2 的数组,第一个元素表示 x 坐标,第二个元素表示 y 坐标。
  50270. */
  50271. resetLocation(lonlat) {
  50272. if (lonlat) {
  50273. this.lonlat = lonlat;
  50274. }
  50275. // 获取地理位置对应的像素坐标 newLocalLX
  50276. var newLocalLX = this.getLocalXY(this.lonlat);
  50277. // 处理偏移量 XOffset, YOffset
  50278. newLocalLX[0] += this.XOffset;
  50279. newLocalLX[1] += this.YOffset;
  50280. // 将图形位置赋予 location 属性(注意 location 属性表示的是专题要素中心位置)
  50281. this.location = newLocalLX;
  50282. // 更新图表像素 Bounds
  50283. var w = this.width;
  50284. var h = this.height;
  50285. var loc = this.location;
  50286. this.chartBounds = new Bounds(loc[0] - w / 2, loc[1] + h / 2, loc[0] + w / 2, loc[1] - h / 2);
  50287. //重新计算当前渐变色
  50288. this.resetLinearGradient();
  50289. return loc;
  50290. }
  50291. /**
  50292. * @function SuperMap.Feature.Theme.Graph.prototype.resetLinearGradient
  50293. * @description resetLocation 中调用 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图渐变色 所以子类实现此方法)。
  50294. */
  50295. resetLinearGradient() {
  50296. //子类实现此方法
  50297. }
  50298. /**
  50299. * @function SuperMap.Feature.Theme.Graph.prototype.shapesConvertToRelativeCoordinate
  50300. * @description 将(构成图表)图形的节点转为相对坐标表示,此函数必须且只能在 assembleShapes() 结束时调用。
  50301. */
  50302. shapesConvertToRelativeCoordinate() {
  50303. var shapes = this.shapes;
  50304. var shapeROP = this.location;
  50305. for (var i = 0, len = shapes.length; i < len; i++) {
  50306. shapes[i].refOriginalPosition = shapeROP;
  50307. var style = shapes[i].style;
  50308. for (var sty in style) {
  50309. switch (sty) {
  50310. case "pointList":
  50311. var pl = style[sty];
  50312. for (var j = 0, len2 = pl.length; j < len2; j++) {
  50313. pl[j][0] -= shapeROP[0];
  50314. pl[j][1] -= shapeROP[1];
  50315. }
  50316. break;
  50317. case "x":
  50318. style[sty] -= shapeROP[0];
  50319. break;
  50320. case "y":
  50321. style[sty] -= shapeROP[1];
  50322. break;
  50323. default:
  50324. break;
  50325. }
  50326. }
  50327. }
  50328. this.RelativeCoordinate = true;
  50329. }
  50330. /**
  50331. * @function SuperMap.Feature.Theme.Graph.prototype.assembleShapes
  50332. * @description 图形装配函数。抽象方法,可视化子类必须实现此方法。<br>
  50333. * 重写此方法的步骤:<br>
  50334. * 1. 图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。<br>
  50335. * 2. 调用 initBaseParameter() 方法初始化模型属性值,此步骤必须执行,只有当 initBaseParameter 返回 true 时才可以允许进行后续步骤。<br>
  50336. * 3. 计算图形参数,制作图形,图形组合。在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。<br>
  50337. * 4. 调用 shapesConvertToRelativeCoordinate() 方法,将图形的坐标值转为相对坐标,此步骤必须执行。
  50338. * @example
  50339. * //子类实现 assembleShapes() 接口的步骤示例:
  50340. * assembleShapes: function(){
  50341. * // 第一步:图表的某些特殊配置项(setting)处理,例如多数图表模型需要重新指定 dataViewBoxParameter 的默认值。此步骤是非必须过程。
  50342. *
  50343. * // 图表配置对象
  50344. * var sets = this.setting;
  50345. * // 默认数据视图框,这里展示在使用坐标轴和不使用坐标轴情况下对数据视图框参数赋予不同的默认值
  50346. * if(!sets.dataViewBoxParameter){
  50347. * if(typeof(sets.useAxis) === "undefined" || sets.useAxis){
  50348. * sets.dataViewBoxParameter = [45, 15, 15, 15];
  50349. * }
  50350. * else{
  50351. * sets.dataViewBoxParameter = [5, 5, 5, 5];
  50352. * }
  50353. * }
  50354. *
  50355. * // 第二步:初始化图表模型基本参数,只有在图表模型基本参数初始化成功时才可模型相关属性,如 this.dataViewBox、 this.DVBCodomain等。此步骤是必须过程。
  50356. * if(!this.initBaseParameter()) return;
  50357. *
  50358. * // 第三步:用图形组装图表,在组装图表过程中,应该特别注意数据视图框单位值的定义、数据值溢出值域范围的处理和图形大小自适应。
  50359. * // 定义图表数据视图框中单位值的含义,下面行代码表示将数据视图框单位值定义为数据视图框高度上每像素代表的数据值
  50360. * this.DVBUnitValue = (this.codomain[1] - this.codomain[0])/this.DVBHeight;
  50361. * var uv = this.DVBUnitValue;
  50362. *
  50363. * // 图形参数计算代码......
  50364. *
  50365. * // 关于图形装配,实际上就是利用图形工程对象 this.shapeFactory 的 createShape() 方法通过图形参数对象创建可视化的图形对象,并把这些图形对象按序添加到模型的图形库(his.shapes)中。下面的代码演示创建一个面图形参数对象,并允许通过图形配置对象设置图形的 style 和 highlightStyle,
  50366. * var barParams = new SuperMap.Feature.ShapeParameters.Polygon(poiLists);
  50367. * barParams.style = sets.barStyle? sets.barStyle:{fillColor: "lightblue"};
  50368. * barParams.highlightStyle = sets.barHoverStyle? sets.barHoverStyle:{fillColor: "blue"};
  50369. * // 图形携带数据ID信息
  50370. * barParams.refDataID = this.data.id;
  50371. * // 创建图形并添加到图表图形数组中
  50372. * this.shapes.push(this.shapeFactory.createShape(barParams));
  50373. *
  50374. * // 第四步:调用 shapesConvertToRelativeCoordinate() 方法,将图形库(his.shapes)中的图形转为由相对坐标表示的图形,客户端统计专题图模块从结构上要求可视化图形使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数。此步骤是必须过程。
  50375. * this.shapesConvertToRelativeCoordinate();
  50376. * },
  50377. */
  50378. assembleShapes() {
  50379. //子类必须实现此方法
  50380. }
  50381. /**
  50382. * @function SuperMap.Feature.Theme.Graph.prototype.getLocalXY
  50383. * @description 地理坐标转为像素坐标。
  50384. * @param {SuperMap.Lonlat} lonlat - 带转换的地理坐标。
  50385. * @returns 屏幕像素坐标。
  50386. */
  50387. getLocalXY(lonlat) {
  50388. return this.layer.getLocalXY(lonlat);
  50389. }
  50390. }
  50391. /**
  50392. * @function SuperMap.Feature.Theme.getDataValues
  50393. * @description 根据字段名数组获取指定数据(feature)的属性值数组。属性值类型必须为 Number。
  50394. * @param {SuperMap.Feature.Vector} data - 数据。
  50395. * @param {Array.<string>} [fields] - 字段名数组。
  50396. * @param {number} [decimalNumber] - 小数位处理参数,对获取到的属性数据值进行小数位处理。
  50397. * @returns {Array.<string>} 字段名数组对应的属性数据值数组。
  50398. */
  50399. Theme_Theme.getDataValues = function (data, fields, decimalNumber) {
  50400. if (!data.attributes) {
  50401. return false;
  50402. }
  50403. var fieldsValue = [];
  50404. var attrs = data.attributes;
  50405. for (var i = 0; i < fields.length; i++) {
  50406. for (var field in attrs) {
  50407. if (field !== fields[i]) {
  50408. continue
  50409. }
  50410. // 数字转换判断
  50411. try {
  50412. if (!isNaN(decimalNumber) && decimalNumber >= 0) {
  50413. fieldsValue.push(parseFloat(attrs[field].toString()).toFixed(decimalNumber));
  50414. } else {
  50415. fieldsValue.push(parseFloat(attrs[field].toString()));
  50416. }
  50417. } catch (e) {
  50418. throw new Error("not a number")
  50419. }
  50420. }
  50421. }
  50422. if (fieldsValue.length === fields.length) {
  50423. return fieldsValue;
  50424. } else {
  50425. return false;
  50426. }
  50427. };
  50428. SuperMap.Feature.Theme.Graph = Graph;
  50429. ;// CONCATENATED MODULE: ./src/common/overlay/Bar.js
  50430. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50431. * This program are made available under the terms of the Apache License, Version 2.0
  50432. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50433. /**
  50434. * @class SuperMap.Feature.Theme.Bar
  50435. * @classdesc 柱状图 。
  50436. * @category Visualization Theme
  50437. * @example
  50438. * // barStyleByCodomain参数用法如下:
  50439. * // barStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50440. * // start: 值域值下限(包含);
  50441. * // end: 值域值上限(不包含);
  50442. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50443. * // barStyleByCodomain 数组形如:
  50444. * [
  50445. * {
  50446. * start:0,
  50447. * end:250,
  50448. * style:{
  50449. * fillColor:"#00CD00"
  50450. * }
  50451. * },
  50452. * {
  50453. * start:250,
  50454. * end:500,
  50455. * style:{
  50456. * fillColor:"#00EE00"
  50457. * }
  50458. * },
  50459. * {
  50460. * start:500,
  50461. * end:750,
  50462. * style:{
  50463. * fillColor:"#00FF7F"
  50464. * }
  50465. * },
  50466. * {
  50467. * start:750,
  50468. * end:1500,
  50469. * style:{
  50470. * fillColor:"#00FF00"
  50471. * }
  50472. * }
  50473. * ]
  50474. * @extends SuperMap.Feature.Theme.Graph
  50475. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50476. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50477. * @param {Array.<string>} fields - data 属性中的参与此图表生成的属性字段名称。
  50478. * @param {SuperMap.Feature.Theme.Bar.setting} setting - 图表配置对象。
  50479. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  50480. */
  50481. class Bar extends Graph {
  50482. constructor(data, layer, fields, setting, lonlat) {
  50483. super(data, layer, fields, setting, lonlat);
  50484. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar";
  50485. }
  50486. /**
  50487. * @function SuperMap.Feature.Theme.Bar.prototype.destroy
  50488. * @override
  50489. */
  50490. destroy() {
  50491. super.destroy();
  50492. }
  50493. /**
  50494. * @function SuperMap.Feature.Theme.Bar.prototype.assembleShapes
  50495. * @description 图表图形装配函数。
  50496. */
  50497. assembleShapes() {
  50498. //默认渐变颜色数组
  50499. var deafaultColors = [["#00FF00", "#00CD00"], ["#00CCFF", "#5E87A2"], ["#00FF66", "#669985"], ["#CCFF00", "#94A25E"], ["#FF9900", "#A2945E"]];
  50500. //默认阴影
  50501. var deafaultShawdow = {
  50502. showShadow: true,
  50503. shadowBlur: 8,
  50504. shadowColor: "rgba(100,100,100,0.8)",
  50505. shadowOffsetX: 2,
  50506. shadowOffsetY: 2
  50507. };
  50508. // 图表配置对象
  50509. var sets = this.setting;
  50510. if (!sets.barLinearGradient) {
  50511. sets.barLinearGradient = deafaultColors;
  50512. }
  50513. // 默认数据视图框
  50514. if (!sets.dataViewBoxParameter) {
  50515. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50516. sets.dataViewBoxParameter = [45, 15, 15, 15];
  50517. } else {
  50518. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50519. }
  50520. }
  50521. // 重要步骤:初始化参数
  50522. if (!this.initBaseParameter()) {
  50523. return;
  50524. }
  50525. // 值域
  50526. var codomain = this.DVBCodomain;
  50527. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50528. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50529. // 数据视图域
  50530. var dvb = this.dataViewBox;
  50531. // 用户数据值
  50532. var fv = this.dataValues;
  50533. if (fv.length < 1) {
  50534. return;
  50535. } // 没有数据
  50536. // 数据溢出值域范围处理
  50537. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  50538. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50539. return;
  50540. }
  50541. }
  50542. // 获取 x 轴上的图形信息
  50543. var xShapeInfo = this.calculateXShapeInfo();
  50544. if (!xShapeInfo) {
  50545. return;
  50546. }
  50547. // 每个柱条 x 位置
  50548. var xsLoc = xShapeInfo.xPositions;
  50549. // 柱条宽度
  50550. var xsWdith = xShapeInfo.width;
  50551. // 背景框,默认启用
  50552. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50553. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  50554. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50555. }
  50556. // 坐标轴, 默认启用
  50557. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50558. // 添加坐标轴图形数组
  50559. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50560. }
  50561. for (var i = 0; i < fv.length; i++) {
  50562. // 计算柱条 top 边的 y 轴坐标值
  50563. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  50564. // 柱条节点数组
  50565. var poiLists = [
  50566. [xsLoc[i] - xsWdith / 2, dvb[1] - 1],
  50567. [xsLoc[i] + xsWdith / 2, dvb[1] - 1],
  50568. [xsLoc[i] + xsWdith / 2, yPx],
  50569. [xsLoc[i] - xsWdith / 2, yPx]
  50570. ];
  50571. // 柱条参数对象(一个面参数对象)
  50572. var barParams = new Polygon_Polygon(poiLists);
  50573. // 柱条 阴影 style
  50574. if (typeof(sets.showShadow) === "undefined" || sets.showShadow) {
  50575. if (sets.barShadowStyle) {
  50576. var sss = sets.barShadowStyle;
  50577. if (sss.shadowBlur) {
  50578. deafaultShawdow.shadowBlur = sss.shadowBlur;
  50579. }
  50580. if (sss.shadowColor) {
  50581. deafaultShawdow.shadowColor = sss.shadowColor;
  50582. }
  50583. if (sss.shadowOffsetX) {
  50584. deafaultShawdow.shadowOffsetX = sss.shadowOffsetX;
  50585. }
  50586. if (sss.shadowOffsetY) {
  50587. deafaultShawdow.shadowOffsetY = sss.shadowOffsetY;
  50588. }
  50589. }
  50590. barParams.style = {};
  50591. Util.copyAttributesWithClip(barParams.style, deafaultShawdow);
  50592. }
  50593. // 图形携带的数据信息
  50594. barParams.refDataID = this.data.id;
  50595. barParams.dataInfo = {
  50596. field: this.fields[i],
  50597. value: fv[i]
  50598. };
  50599. // 柱条 hover click
  50600. if (typeof(sets.barHoverAble) !== "undefined") {
  50601. barParams.hoverable = sets.barHoverAble;
  50602. }
  50603. if (typeof(sets.barClickAble) !== "undefined") {
  50604. barParams.clickable = sets.barClickAble;
  50605. }
  50606. // 创建柱条并添加到图表图形数组中
  50607. this.shapes.push(this.shapeFactory.createShape(barParams));
  50608. }
  50609. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  50610. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  50611. this.shapesConvertToRelativeCoordinate();
  50612. }
  50613. /**
  50614. * @function SuperMap.Feature.Theme.Bar.prototype.calculateXShapeInfo
  50615. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  50616. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  50617. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50618. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50619. * 本函数中图形配置对象 setting 可设属性:
  50620. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  50621. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  50622. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  50623. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  50624. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  50625. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  50626. *
  50627. */
  50628. calculateXShapeInfo() {
  50629. var dvb = this.dataViewBox; // 数据视图框
  50630. var sets = this.setting; // 图表配置对象
  50631. var fvc = this.dataValues.length; // 数组值个数
  50632. if (fvc < 1) {
  50633. return null;
  50634. }
  50635. var xBlank; // x 轴空白间隔参数
  50636. var xShapePositions = []; // x 轴上图形的位置
  50637. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  50638. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  50639. // x 轴空白间隔参数处理
  50640. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  50641. xBlank = sets.xShapeBlank;
  50642. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1]);
  50643. if (xsLen <= fvc) {
  50644. return null;
  50645. }
  50646. xShapeWidth = xsLen / fvc
  50647. } else {
  50648. // 默认使用等距离空白间隔,空白间隔为图形宽度
  50649. xShapeWidth = dvbWidth / (2 * fvc + 1);
  50650. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  50651. }
  50652. // 图形 x 轴上的位置计算
  50653. var xOffset = 0
  50654. for (var i = 0; i < fvc; i++) {
  50655. if (i == 0) {
  50656. xOffset = xBlank[0] + xShapeWidth / 2;
  50657. } else {
  50658. xOffset += (xShapeWidth + xBlank[1]);
  50659. }
  50660. xShapePositions.push(dvb[0] + xOffset);
  50661. }
  50662. return {
  50663. "xPositions": xShapePositions,
  50664. "width": xShapeWidth
  50665. };
  50666. }
  50667. /**
  50668. * @function SuperMap.Feature.Theme.Bar.prototype.resetLinearGradient
  50669. * @description 图表的相对坐标存在的时候,重新计算渐变的颜色(目前用于二维柱状图 所以子类实现此方法)。
  50670. */
  50671. resetLinearGradient() {
  50672. if (this.RelativeCoordinate) {
  50673. var shpelength = this.shapes.length;
  50674. var barLinearGradient = this.setting.barLinearGradient;
  50675. var index = -1;
  50676. for (var i = 0; i < shpelength; i++) {
  50677. var shape = this.shapes[i];
  50678. if (shape.CLASS_NAME === "SuperMap.LevelRenderer.Shape.SmicPolygon") {
  50679. var style = shape.style;
  50680. //计算出当前的绝对 x y
  50681. var x1 = this.location[0] + style.pointList[0][0];
  50682. var x2 = this.location[0] + style.pointList[1][0];
  50683. //渐变颜色
  50684. index++;
  50685. //以防定义的颜色数组不够用
  50686. if (index >= barLinearGradient.length) {
  50687. index = index % barLinearGradient.length;
  50688. }
  50689. var color1 = barLinearGradient[index][0];
  50690. var color2 = barLinearGradient[index][1];
  50691. //颜色
  50692. var zcolor = new Color();
  50693. var linearGradient = zcolor.getLinearGradient(x1, 0, x2, 0,
  50694. [[0, color1], [1, color2]]);
  50695. //赋值
  50696. shape.style.color = linearGradient;
  50697. }
  50698. }
  50699. }
  50700. }
  50701. }
  50702. /**
  50703. * @typedef {Object} SuperMap.Feature.Theme.Bar.setting
  50704. * @property {number} width - 专题要素(图表)宽度。
  50705. * @property {number} height - 专题要素(图表)高度。
  50706. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  50707. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  50708. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  50709. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)
  50710. * 在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];
  50711. * 不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  50712. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  50713. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  50714. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  50715. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  50716. * 则 backgroundRadius 为 [r1、r2、r3、r4]。
  50717. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  50718. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  50719. * @property {boolean} [showShadow=true] - 阴影开关。
  50720. * @property {Object} [barShadowStyle] - 阴影样式,如:{shadowBlur : 8, shadowOffsetX: 2 , shadowOffsetY : 2,shadowColor : "rgba(100,100,100,0.8)"}
  50721. * @property {Array.<string>} [barLinearGradient] - 按字段设置柱条样式[渐变开始颜色,渐变终止颜色] 与 themeLayer.themeFields 中的字段一一对应),
  50722. * 如:[["#00FF00","#00CD00"],["#00CCFF","#5E87A2"],["#00FF66","#669985"],["#CCFF00","#94A25E"],["#FF9900","#A2945E"]]
  50723. * @property {boolean} [useAxis=true] - 是否使用坐标轴。</br>
  50724. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  50725. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  50726. * @property {number} [axisYTick=0] - y 轴刻度数量。
  50727. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  50728. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  50729. * @property {Array.<number>} [axisYLabelsOffset=[0,0]] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  50730. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  50731. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  50732. * @property {Array.<number>} [axisXLabelsOffset=[0,0]] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  50733. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  50734. * @property {SuperMap.Feature.ShapeParameters.Line.style} xReferenceLineStyle - 水平参考线样式。
  50735. * @property {Object} barStyle - 柱状图柱条基础 style,此参数控制柱条基础样式,优先级低于 barStyleByFields 和 barStyleByCodomain。
  50736. * @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。
  50737. * @property {Array.<SuperMap.Feature.ShapeParameters.Polygon.style>} barStyleByCodomain - 按柱条代表的数据值所在值域范围控制柱条样式,优先级高于 barStyle 和 barStyleByFields。
  50738. * @property {Object} [barHoverStyle] - 柱条 hover 状态时的样式,barHoverAble 为 true 时有效。
  50739. * @property {Object} [barHoverAble] - 是否允许柱条使用 hover 状态,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50740. * @property {Object} [barClickAble] - 是否允许柱条被点击,默认允许。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  50741. */
  50742. SuperMap.Feature.Theme.Bar = Bar;
  50743. ;// CONCATENATED MODULE: ./src/common/overlay/Bar3D.js
  50744. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  50745. * This program are made available under the terms of the Apache License, Version 2.0
  50746. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  50747. /**
  50748. * @class SuperMap.Feature.Theme.Bar3D
  50749. * @classdesc 三维柱状图 。
  50750. * @category Visualization Theme
  50751. * @extends SuperMap.Feature.Theme.Graph
  50752. * @param {SuperMap.Feature.Vector} data - 用户数据。
  50753. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  50754. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  50755. * @param {SuperMap.Feature.Theme.Bar3D.setting} setting - 图表配置对象。
  50756. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  50757. *
  50758. *
  50759. * @example
  50760. * // barFaceStyleByCodomain 用法示例如下:
  50761. * // barFaceStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50762. * // start: 值域值下限(包含);
  50763. * // end: 值域值上限(不包含);
  50764. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50765. * // barFaceStyleByCodomain 数组形如:
  50766. * [
  50767. * {
  50768. * start:0,
  50769. * end:250,
  50770. * style:{
  50771. * fillColor:"#00CD00"
  50772. * }
  50773. * },
  50774. * {
  50775. * start:250,
  50776. * end:500,
  50777. * style:{
  50778. * fillColor:"#00EE00"
  50779. * }
  50780. * },
  50781. * {
  50782. * start:500,
  50783. * end:750,
  50784. * style:{
  50785. * fillColor:"#00FF7F"
  50786. * }
  50787. * },
  50788. * {
  50789. * start:750,
  50790. * end:1500,
  50791. * style:{
  50792. * fillColor:"#00FF00"
  50793. * }
  50794. * }
  50795. * ]
  50796. *
  50797. * @example
  50798. * // barSideStyleByCodomain 用法示例如下:
  50799. * // barSideStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50800. * // start: 值域值下限(包含);
  50801. * // end: 值域值上限(不包含);
  50802. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50803. * // barSideStyleByCodomain 数组形如:
  50804. * [
  50805. * {
  50806. * start:0,
  50807. * end:250,
  50808. * style:{
  50809. * fillColor:"#00CD00"
  50810. * }
  50811. * },
  50812. * {
  50813. * start:250,
  50814. * end:500,
  50815. * style:{
  50816. * fillColor:"#00EE00"
  50817. * }
  50818. * },
  50819. * {
  50820. * start:500,
  50821. * end:750,
  50822. * style:{
  50823. * fillColor:"#00FF7F"
  50824. * }
  50825. * },
  50826. * {
  50827. * start:750,
  50828. * end:1500,
  50829. * style:{
  50830. * fillColor:"#00FF00"
  50831. * }
  50832. * }
  50833. * ]
  50834. *
  50835. * @example
  50836. * // barTopStyleByCodomain 用法示例如下:
  50837. * // barTopStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  50838. * // start: 值域值下限(包含);
  50839. * // end: 值域值上限(不包含);
  50840. * // style: 数据可视化图形的 style,这个样式对象的可设属性:<SuperMap.Feature.ShapeParameters.Polygon.style> 。
  50841. * // barTopStyleByCodomain 数组形如:
  50842. * [
  50843. * {
  50844. * start:0,
  50845. * end:250,
  50846. * style:{
  50847. * fillColor:"#00CD00"
  50848. * }
  50849. * },
  50850. * {
  50851. * start:250,
  50852. * end:500,
  50853. * style:{
  50854. * fillColor:"#00EE00"
  50855. * }
  50856. * },
  50857. * {
  50858. * start:500,
  50859. * end:750,
  50860. * style:{
  50861. * fillColor:"#00FF7F"
  50862. * }
  50863. * },
  50864. * {
  50865. * start:750,
  50866. * end:1500,
  50867. * style:{
  50868. * fillColor:"#00FF00"
  50869. * }
  50870. * }
  50871. * ]
  50872. */
  50873. class Bar3D extends Graph {
  50874. constructor(data, layer, fields, setting, lonlat) {
  50875. super(data, layer, fields, setting, lonlat);
  50876. this.CLASS_NAME = "SuperMap.Feature.Theme.Bar3D";
  50877. }
  50878. /**
  50879. * @function SuperMap.Feature.Theme.Bar3D.prototype.destroy
  50880. * @override
  50881. */
  50882. destroy() {
  50883. super.destroy();
  50884. }
  50885. /**
  50886. * @function SuperMap.Feature.Theme.Bar3D.prototype.assembleShapes
  50887. * @description 图形装配实现(扩展接口)。
  50888. */
  50889. assembleShapes() {
  50890. // 图表配置对象
  50891. var sets = this.setting;
  50892. // 默认数据视图框
  50893. if (!sets.dataViewBoxParameter) {
  50894. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50895. sets.dataViewBoxParameter = [45, 25, 20, 20];
  50896. } else {
  50897. sets.dataViewBoxParameter = [5, 5, 5, 5];
  50898. }
  50899. }
  50900. // 3d 柱图的坐标轴默认使用坐标轴箭头
  50901. sets.axisUseArrow = (typeof(sets.axisUseArrow) !== "undefined") ? sets.axisUseArrow : true;
  50902. sets.axisXLabelsOffset = (typeof(sets.axisXLabelsOffset) !== "undefined") ? sets.axisXLabelsOffset : [-10, 10];
  50903. // 重要步骤:初始化参数
  50904. if (!this.initBaseParameter()) {
  50905. return;
  50906. }
  50907. // 值域
  50908. var codomain = this.DVBCodomain;
  50909. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  50910. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  50911. // 数据视图域
  50912. var dvb = this.dataViewBox;
  50913. // 用户数据值
  50914. var fv = this.dataValues;
  50915. if (fv.length < 1) {
  50916. return;
  50917. } // 没有数据
  50918. // 数据溢出值域范围处理
  50919. for (let i = 0, fvLen = fv.length; i < fvLen; i++) {
  50920. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  50921. return;
  50922. }
  50923. }
  50924. // 获取 x 轴上的图形信息
  50925. var xShapeInfo = this.calculateXShapeInfo();
  50926. if (!xShapeInfo) {
  50927. return;
  50928. }
  50929. // 每个柱条 x 位置
  50930. var xsLoc = xShapeInfo.xPositions;
  50931. // 柱条宽度
  50932. var xsWdith = xShapeInfo.width;
  50933. // 坐标轴, 默认启用
  50934. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  50935. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  50936. }
  50937. // 坐标轴
  50938. if (!sets.axis3DParameter || isNaN(sets.axis3DParameter) || sets.axis3DParameter < 15) {
  50939. sets.axis3DParameter = 20;
  50940. }
  50941. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  50942. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  50943. }
  50944. // 3d 偏移量, 默认值 10;
  50945. var offset3d = (sets.bar3DParameter && !isNaN(sets.bar3DParameter)) ? sets.bar3DParameter : 10;
  50946. for (let i = 0; i < fv.length; i++) {
  50947. // 无 3d 偏移量时的柱面顶部 y 坐标
  50948. var yPx = dvb[1] - (fv[i] - codomain[0]) / this.DVBUnitValue;
  50949. // 无 3d 偏移量时的柱面的左、右端 x 坐标
  50950. var iPoiL = xsLoc[i] - xsWdith / 2;
  50951. var iPoiR = xsLoc[i] + xsWdith / 2;
  50952. // 3d 柱顶面节点
  50953. var bar3DTopPois = [
  50954. [iPoiL, yPx],
  50955. [iPoiR, yPx],
  50956. [iPoiR - offset3d, yPx + offset3d],
  50957. [iPoiL - offset3d, yPx + offset3d]
  50958. ];
  50959. // 3d 柱侧面节点
  50960. var bar3DSidePois = [
  50961. [iPoiR, yPx],
  50962. [iPoiR - offset3d, yPx + offset3d],
  50963. [iPoiR - offset3d, dvb[1] + offset3d],
  50964. [iPoiR, dvb[1]]
  50965. ];
  50966. // 3d 柱正面节点
  50967. var bar3DFacePois = [
  50968. [iPoiL - offset3d, dvb[1] + offset3d],
  50969. [iPoiR - offset3d, dvb[1] + offset3d],
  50970. [iPoiR - offset3d, yPx + offset3d],
  50971. [iPoiL - offset3d, yPx + offset3d]
  50972. ];
  50973. if (offset3d <= 0) { // offset3d <= 0 时正面不偏移
  50974. bar3DFacePois = [
  50975. [iPoiL, dvb[1]],
  50976. [iPoiR, dvb[1]],
  50977. [iPoiR, yPx],
  50978. [iPoiL, yPx]
  50979. ];
  50980. }
  50981. // 新建 3d 柱面顶面、侧面、正面图形参数对象
  50982. var polyTopSP = new Polygon_Polygon(bar3DTopPois);
  50983. var polySideSP = new Polygon_Polygon(bar3DSidePois);
  50984. var polyFaceSP = new Polygon_Polygon(bar3DFacePois);
  50985. // 侧面、正面图形 style 默认值
  50986. sets.barSideStyle = sets.barSideStyle ? sets.barSideStyle : sets.barFaceStyle;
  50987. sets.barSideStyleByFields = sets.barSideStyleByFields ? sets.barSideStyleByFields : sets.barFaceStyleByFields;
  50988. sets.barSideStyleByCodomain = sets.barSideStyleByCodomain ? sets.barSideStyleByCodomain : sets.barFaceStyleByCodomain;
  50989. sets.barTopStyle = sets.barTopStyle ? sets.barTopStyle : sets.barFaceStyle;
  50990. sets.barTopStyleByFields = sets.barTopStyleByFields ? sets.barTopStyleByFields : sets.barFaceStyleByFields;
  50991. sets.barTopStyleByCodomain = sets.barTopStyleByCodomain ? sets.barTopStyleByCodomain : sets.barFaceStyleByCodomain;
  50992. // 顶面、侧面、正面图形 style
  50993. polyFaceSP.style = ShapeFactory.ShapeStyleTool({
  50994. stroke: true,
  50995. strokeColor: "#ffffff",
  50996. fillColor: "#ee9900"
  50997. },
  50998. sets.barFaceStyle, sets.barFaceStyleByFields, sets.barFaceStyleByCodomain, i, fv[i]);
  50999. polySideSP.style = ShapeFactory.ShapeStyleTool({
  51000. stroke: true,
  51001. strokeColor: "#ffffff",
  51002. fillColor: "#ee9900"
  51003. },
  51004. sets.barSideStyle, sets.barSideStyleByFields, sets.barSideStyleByCodomain, i, fv[i]);
  51005. polyTopSP.style = ShapeFactory.ShapeStyleTool({
  51006. stroke: true,
  51007. strokeColor: "#ffffff",
  51008. fillColor: "#ee9900"
  51009. },
  51010. sets.barTopStyle, sets.barTopStyleByFields, sets.barTopStyleByCodomain, i, fv[i]);
  51011. // 3d 柱条高亮样式
  51012. sets.barSideHoverStyle = sets.barSideHoverStyle ? sets.barSideHoverStyle : sets.barFaceHoverStyle;
  51013. sets.barTopHoverStyle = sets.barTopHoverStyle ? sets.barTopHoverStyle : sets.barFaceHoverStyle;
  51014. polyFaceSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barFaceHoverStyle);
  51015. polySideSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barSideHoverStyle);
  51016. polyTopSP.highlightStyle = ShapeFactory.ShapeStyleTool({stroke: true}, sets.barTopHoverStyle);
  51017. // 图形携带的数据 id 信息 & 高亮模式
  51018. polyTopSP.refDataID = polySideSP.refDataID = polyFaceSP.refDataID = this.data.id;
  51019. // hover 模式(组合)
  51020. polyTopSP.isHoverByRefDataID = polySideSP.isHoverByRefDataID = polyFaceSP.isHoverByRefDataID = true;
  51021. // 高亮组(当鼠标 hover 到组内任何一个图形,整个组的图形都会高亮。refDataHoverGroup 在 isHoverByRefDataID 为 true 时有效)
  51022. polyTopSP.refDataHoverGroup = polySideSP.refDataHoverGroup = polyFaceSP.refDataHoverGroup = Util.createUniqueID("lr_shg");
  51023. // 图形携带的数据信息
  51024. polyTopSP.dataInfo = polySideSP.dataInfo = polyFaceSP.dataInfo = {
  51025. field: this.fields[i],
  51026. value: fv[i]
  51027. };
  51028. // 3d 柱条顶面、侧面、正面图形 hover click 设置
  51029. if (typeof(sets.barHoverAble) !== "undefined") {
  51030. polyTopSP.hoverable = polySideSP.hoverable = polyFaceSP.hoverable = sets.barHoverAble;
  51031. }
  51032. if (typeof(sets.barClickAble) !== "undefined") {
  51033. polyTopSP.clickable = polySideSP.clickable = polyFaceSP.clickable = sets.barClickAble;
  51034. }
  51035. // 创建3d 柱条的顶面、侧面、正面图形并添加到图表的图形列表数组
  51036. this.shapes.push(this.shapeFactory.createShape(polySideSP));
  51037. this.shapes.push(this.shapeFactory.createShape(polyTopSP));
  51038. this.shapes.push(this.shapeFactory.createShape(polyFaceSP));
  51039. }
  51040. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51041. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51042. this.shapesConvertToRelativeCoordinate();
  51043. }
  51044. /**
  51045. * @function SuperMap.Feature.Theme.Bar3D.prototype.calculateXShapeInfo
  51046. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  51047. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  51048. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  51049. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51050. * 本函数中图形配置对象 setting 可设属性:
  51051. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  51052. * 长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,
  51053. * 第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  51054. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:
  51055. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  51056. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51057. */
  51058. calculateXShapeInfo() {
  51059. var dvb = this.dataViewBox; // 数据视图框
  51060. var sets = this.setting; // 图表配置对象
  51061. var fvc = this.dataValues.length; // 数组值个数
  51062. if (fvc < 1) {
  51063. return null;
  51064. }
  51065. var xBlank; // x 轴空白间隔参数
  51066. var xShapePositions = []; // x 轴上图形的位置
  51067. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  51068. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  51069. // x 轴空白间隔参数处理
  51070. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 3) {
  51071. xBlank = sets.xShapeBlank;
  51072. var xsLen = dvbWidth - (xBlank[0] + xBlank[2] + (fvc - 1) * xBlank[1])
  51073. if (xsLen <= fvc) {
  51074. return null;
  51075. }
  51076. xShapeWidth = xsLen / fvc
  51077. } else {
  51078. // 默认使用等距离空白间隔,空白间隔为图形宽度
  51079. xShapeWidth = dvbWidth / (2 * fvc + 1);
  51080. xBlank = [xShapeWidth, xShapeWidth, xShapeWidth];
  51081. }
  51082. // 图形 x 轴上的位置计算
  51083. var xOffset = 0
  51084. for (var i = 0; i < fvc; i++) {
  51085. if (i == 0) {
  51086. xOffset = xBlank[0] + xShapeWidth / 2;
  51087. } else {
  51088. xOffset += (xShapeWidth + xBlank[1]);
  51089. }
  51090. xShapePositions.push(dvb[0] + xOffset);
  51091. }
  51092. return {
  51093. "xPositions": xShapePositions,
  51094. "width": xShapeWidth
  51095. };
  51096. }
  51097. }
  51098. /**
  51099. * @typedef {Object} SuperMap.Feature.Theme.Bar3D.setting
  51100. * @property {number} width - 专题要素(图表)宽度。
  51101. * @property {number} height - 专题要素(图表)高度。
  51102. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51103. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51104. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51105. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 25, 20, 20];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  51106. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51107. * @property {boolean} [useBackground=true] - 是否使用图表背景框。
  51108. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式。
  51109. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51110. * @property {Array.<number>} [xShapeBlank] - 水平方向上的图形空白间隔参数。长度为 3 的数组,第一元素表示第一个图形左端与数据视图框左端的空白间距,第二个元素表示图形间空白间距,第三个元素表示最后一个图形右端与数据视图框右端端的空白间距 。
  51111. * @property {number} [bar3DParameter=10] - 3D 柱状参数,3d柱形正面相对于背面向 x 轴和 y 轴负方向偏移的绝对值。
  51112. * @property {boolean} [useAxis=true] - 是否使用坐标轴。
  51113. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  51114. * @property {boolean} [axisUseArrow=true] -坐标轴是否使用箭头。
  51115. * @property {number} [axisYTick=0] - y 轴刻度数量。
  51116. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  51117. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  51118. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正,默认值:0;数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  51119. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,否则沿数据视图框下面条边等距排布标签。
  51120. * @property {SuperMap.Feature.ShapeParameters.Label.style} axisXLabelsStyle - x 轴上的标签组样式。
  51121. * @property {Array.<number>} axisXLabelsOffset - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,默认值:-10;数组第二项表示 x 轴标签组纵向上的偏移量,向下为正,默认值:10。
  51122. * @property {boolean} [useXReferenceLine] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  51123. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  51124. * @property {number} [axis3DParameter=20] - 3D 坐标轴参数,此属性值在大于等于 15 时有效。
  51125. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} barFaceStyle - 3d 柱状图柱条正面基础 style,此参数控制柱条正面基础样式,优先级低于 barFaceStyleByFields 和 barFaceStyleByCodomain。
  51126. * @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。
  51127. * @property {Array.<Object>} [barFaceStyleByCodomain] - 按柱条正面代表的数据值所在值域范围控制柱条正面样式,优先级高于 barFaceStyle 和 barFaceStyleByFields。
  51128. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barSideStyle=barFaceStyle] - 3d 柱状图柱条侧面基础 style,此参数控制柱条侧面基础样式,优先级低于 barSideStyleByFields 和 barSideStyleByCodomain。
  51129. * @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。
  51130. * @property {Array.<Object>} [barSideStyleByCodomain=barFaceStyleByCodomain] - 按柱条侧面代表的数据值所在值域范围控制柱条侧面样式,优先级高于 barSideStyle 和 barSideStyleByFields。
  51131. * @property {Object} [barFaceHoverStyle] - 3d 柱条正面 hover 状态时的样式,barHoverAble 为 true 时有效。
  51132. * @property {Object} [barSideHoverStyle=barFaceHoverStyle] - 3d 柱条侧面 hover 状态时的样式,barHoverAble 为 true 时有效。
  51133. * @property {Object} [barTopHoverStyle=barFaceHoverStyle] - 3d 柱条顶面 hover 状态时的样式,barHoverAble 为 true 时有效。
  51134. * @property {boolean} [barHoverAble=true] - 是否允许柱条使用 hover 状态。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  51135. * @property {boolean} [barClickAble=true] - 是否允许柱条被点击。同时设置 barHoverAble 和 barClickAble 为 false,可以直接屏蔽柱条对专题图层事件的响应。
  51136. * @property {SuperMap.Feature.ShapeParameters.Polygon.style} [barTopStyle=barFaceStyle] - 3d 柱状图柱条顶面基础 style,此参数控制柱条顶面基础样式,优先级低于 barTopStyleByFields 和 barTopStyleByCodomain。
  51137. * @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。
  51138. * @property {Array.<Object>} [barTopStyleByCodomain=barFaceStyleByCodomain] - 按柱条顶面代表的数据值所在值域范围控制柱条顶面样式,优先级高于 barTopStyle 和 barTopStyleByFields。
  51139. */
  51140. SuperMap.Feature.Theme.Bar3D = Bar3D;
  51141. ;// CONCATENATED MODULE: ./src/common/overlay/RankSymbol.js
  51142. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51143. * This program are made available under the terms of the Apache License, Version 2.0
  51144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51145. /**
  51146. * @class SuperMap.Feature.Theme.RankSymbol
  51147. * @classdesc 符号专题要素基类。
  51148. * @category Visualization Theme
  51149. * @description 此类定义了符号专题要素基础模型,具体的图表模型通过继承此类,在子类中实现 assembleShapes 方法。
  51150. * 符号专题要素模型采用了可视化图形大小自适应策略,用较少的参数控制着图表诸多图形,图表配置对象 <SuperMap.Feature.Theme.RankSymbol.setting> 的基础属性只有 5 个,
  51151. * 它们控制着图表结构、值域范围、数据小数位等基础图表形态。构成图表的图形必须在图表结构里自适应大小。
  51152. * 此类不可实例化,此类的可实例化子类必须实现 assembleShapes() 方法。
  51153. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51154. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  51155. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51156. * @param {Object} setting - 图表配置对象。
  51157. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51158. *
  51159. * @extends SuperMap.Feature.Theme.Graph
  51160. *
  51161. */
  51162. class RankSymbol extends Graph {
  51163. constructor(data, layer, fields, setting, lonlat, options) {
  51164. super(data, layer, fields, setting, lonlat, options);
  51165. /**
  51166. * @member SuperMap.Feature.Theme.RankSymbol.prototype.setting -{Object}
  51167. * @description 符号配置对象,该对象控制着图表的可视化显示。
  51168. * 下面是此配置对象的 5 个基础可设属性:<br>
  51169. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51170. * @param {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51171. * @param {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51172. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51173. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51174. * 除了以上 5 个基础属性,此对象的可设属性在不同子类中有较大差异,不同子类中对同一属性的解释也可能不同。
  51175. * 请在此类的子类中查看 setting 对象的可设属性和属性含义。
  51176. */
  51177. this.setting = null;
  51178. // 配置项检测与赋值
  51179. if (setting && setting.codomain) {
  51180. this.setting = setting;
  51181. this.DVBCodomain = this.setting.codomain;
  51182. }
  51183. this.CLASS_NAME = "SuperMap.Feature.Theme.RankSymbol";
  51184. }
  51185. /**
  51186. * @function SuperMap.Feature.Theme.RankSymbol.prototype.destroy
  51187. * @description 销毁专题要素。
  51188. */
  51189. destroy() {
  51190. this.setting = null;
  51191. super.destroy();
  51192. }
  51193. /**
  51194. * @function SuperMap.Feature.Theme.RankSymbol.prototype.initBaseParameter
  51195. * @description 初始化专题要素(图形)基础参数。
  51196. * 在调用此方法前,此类的图表模型相关属性都是不可用的 ,此方法在 assembleShapes 函数中调用。
  51197. * 调用此函数关系到 setting 对象的以下属性。
  51198. * @param {Array.<number>} codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51199. * @param {number} [XOffset] - 专题要素(图形)在 X 方向上的偏移值,单位像素。
  51200. * @param {number} [YOffset] - 专题要素(图形)在 Y 方向上的偏移值,单位像素。
  51201. * @param {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图形框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51202. * @param {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51203. * @returns {boolean} 初始化参数是否成功。
  51204. */
  51205. initBaseParameter() {
  51206. // 参数初始化是否成功
  51207. var isSuccess = true;
  51208. // setting 属性是否已成功赋值
  51209. if (!this.setting) {
  51210. return false;
  51211. }
  51212. var sets = this.setting;
  51213. // 图表偏移
  51214. if (sets.XOffset) {
  51215. this.XOffset = sets.XOffset;
  51216. }
  51217. if (sets.YOffset) {
  51218. this.YOffset = sets.YOffset;
  51219. }
  51220. this.XOffset = sets.XOffset ? sets.XOffset : 0;
  51221. this.YOffset = sets.YOffset ? sets.YOffset : 0;
  51222. // 其他默认值
  51223. this.origonPoint = [];
  51224. this.chartBox = [];
  51225. this.dataViewBox = [];
  51226. this.DVBParameter = sets.dataViewBoxParameter ? sets.dataViewBoxParameter : [0, 0, 0, 0];
  51227. this.DVBOrigonPoint = [];
  51228. this.DVBCenterPoint = [];
  51229. this.origonPointOffset = [];
  51230. // 图表位置
  51231. this.resetLocation();
  51232. // 专题要素宽度 w
  51233. var w = this.width;
  51234. // 专题要素高度 h
  51235. var h = this.height;
  51236. // 专题要素像素位置 loc
  51237. var loc = this.location;
  51238. // 专题要素像素位置 loc
  51239. this.origonPoint = [loc[0] - w / 2, loc[1] - h / 2];
  51240. // 专题要素原点(左上角)
  51241. var op = this.origonPoint;
  51242. // 图表框([left, bottom, right, top])
  51243. this.chartBox = [op[0], op[1] + h, op[0] + w, op[1]];
  51244. // 图表框
  51245. var cb = this.chartBox;
  51246. // 数据视图框参数,它是图表框各方向对应的内偏距
  51247. var dbbP = this.DVBParameter;
  51248. // 数据视图框 ([left, bottom, right, top])
  51249. this.dataViewBox = [cb[0] + dbbP[0], cb[1] - dbbP[1], cb[2] - dbbP[2], cb[3] + dbbP[3]];
  51250. // 数据视图框
  51251. var dvb = this.dataViewBox;
  51252. //检查数据视图框是否合法
  51253. if (dvb[0] >= dvb[2] || dvb[1] <= dvb[3]) {
  51254. return false;
  51255. }
  51256. // 数据视图框原点
  51257. this.DVBOrigonPoint = [dvb[0], dvb[3]];
  51258. // 数据视图框宽度
  51259. this.DVBWidth = Math.abs(dvb[2] - dvb[0]);
  51260. // 数据视图框高度
  51261. this.DVBHeight = Math.abs(dvb[1] - dvb[3]);
  51262. // 数据视图框中心点
  51263. this.DVBCenterPoint = [this.DVBOrigonPoint[0] + this.DVBWidth / 2, this.DVBOrigonPoint[1] + this.DVBHeight / 2];
  51264. // 数据视图框原点与图表框的原点偏移量
  51265. this.origonPointOffset = [this.DVBOrigonPoint[0] - op[0], this.DVBOrigonPoint[1] - op[1]];
  51266. return isSuccess;
  51267. }
  51268. }
  51269. SuperMap.Feature.Theme.RankSymbol = RankSymbol;
  51270. ;// CONCATENATED MODULE: ./src/common/overlay/Circle.js
  51271. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51272. * This program are made available under the terms of the Apache License, Version 2.0
  51273. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51274. /**
  51275. * @class SuperMap.Feature.Theme.Circle
  51276. * @classdesc 圆类。
  51277. * @category Visualization Theme
  51278. * @extends SuperMap.Feature.Theme.RankSymbol
  51279. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51280. * @param {SuperMap.Layer.RankSymbol} layer - 此专题要素所在图层。
  51281. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51282. * @param {SuperMap.Feature.Theme.Circle.setting} setting - 图表配置对象。
  51283. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置,默认为 data 指代的地理要素 Bounds 中心。
  51284. */
  51285. class Circle extends RankSymbol {
  51286. constructor(data, layer, fields, setting, lonlat) {
  51287. super(data, layer, fields, setting, lonlat);
  51288. this.CLASS_NAME = "SuperMap.Feature.Theme.Circle";
  51289. }
  51290. /**
  51291. * @function SuperMap.Feature.Theme.Circle.prototype.destroy
  51292. * @override
  51293. */
  51294. destroy() {
  51295. super.destroy();
  51296. }
  51297. /**
  51298. * @function SuperMap.Feature.Theme.Circle.prototype.assembleShapes
  51299. * @description 装配图形(扩展接口)。
  51300. */
  51301. assembleShapes() {
  51302. //默认填充颜色
  51303. var defaultFillColor = "#ff9277";
  51304. // setting 属性是否已成功赋值
  51305. if (!this.setting) {
  51306. return false;
  51307. }
  51308. var sets = this.setting;
  51309. // 检测 setting 的必设参数
  51310. if (!(sets.codomain)) {
  51311. return false;
  51312. }
  51313. // 数据
  51314. var decimalNumber = (typeof(sets.decimalNumber) !== "undefined" && !isNaN(sets.decimalNumber)) ? sets.decimalNumber : -1;
  51315. var dataEffective = Theme_Theme.getDataValues(this.data, this.fields, decimalNumber);
  51316. this.dataValues = dataEffective ? dataEffective : [];
  51317. // 数据值数组
  51318. var fv = this.dataValues;
  51319. //if(fv.length != 1) return; // 没有数据 或者数据不唯一
  51320. //if(fv[0] < 0) return; //数据为负值
  51321. //用户应该定义最大 最小半径 默认最大半径MaxR:100 最小半径MinR:0;
  51322. if (!sets.maxR) {
  51323. sets.maxR = 100;
  51324. }
  51325. if (!sets.minR) {
  51326. sets.minR = 0;
  51327. }
  51328. // 值域范围
  51329. var codomain = this.DVBCodomain;
  51330. // 重要步骤:定义Circle数据视图框中单位值的含义,单位值:1所代表的长度
  51331. // 用户定义了值域范围
  51332. if (codomain && codomain[1] - codomain[0] > 0) {
  51333. this.DVBUnitValue = sets.maxR / (codomain[1] - codomain[0]);
  51334. } else {
  51335. //this.DVBUnitValue = sets.maxR / maxValue;
  51336. this.DVBUnitValue = sets.maxR;
  51337. }
  51338. var uv = this.DVBUnitValue;
  51339. //圆半径
  51340. var r = fv[0] * uv + sets.minR;
  51341. this.width = 2 * r;
  51342. this.height = 2 * r;
  51343. // 重要步骤:初始化参数
  51344. if (!this.initBaseParameter()) {
  51345. return;
  51346. }
  51347. //假如用户设置了值域范围 没有在值域范围直接返回
  51348. if (codomain) {
  51349. if (fv[0] < codomain[0] || fv[0] > codomain[1]) {
  51350. return;
  51351. }
  51352. }
  51353. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为圆心
  51354. //圆形对象参数
  51355. var circleSP = new Circle_Circle(dvbCenter[0], dvbCenter[1], r);
  51356. //circleSP.sytle 初始化
  51357. circleSP.style = ShapeFactory.ShapeStyleTool(null, sets.circleStyle, null, null, 0);
  51358. //图形的填充颜色
  51359. if (typeof (sets.fillColor) !== "undefined") {
  51360. //用户自定义
  51361. circleSP.style.fillColor = sets.fillColor;
  51362. } else {
  51363. //当前默认
  51364. circleSP.style.fillColor = defaultFillColor;
  51365. }
  51366. //圆形 Hover样式
  51367. circleSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.circleHoverStyle);
  51368. //圆形 Hover 与 click 设置
  51369. if (typeof(sets.circleHoverAble) !== "undefined") {
  51370. circleSP.hoverable = sets.circleHoverAble;
  51371. }
  51372. if (typeof(sets.circleClickAble) !== "undefined") {
  51373. circleSP.clickable = sets.circleClickAble;
  51374. }
  51375. //图形携带的数据信息
  51376. circleSP.refDataID = this.data.id;
  51377. circleSP.dataInfo = {
  51378. field: this.fields[0],
  51379. r: r,
  51380. value: fv[0]
  51381. };
  51382. // 创建扇形并把此扇形添加到图表图形数组
  51383. this.shapes.push(this.shapeFactory.createShape(circleSP));
  51384. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51385. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51386. this.shapesConvertToRelativeCoordinate();
  51387. }
  51388. }
  51389. /**
  51390. * @typedef {Object} SuperMap.Feature.Theme.Circle.setting
  51391. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51392. * @property {number} [maxR] - 圆形的最大半径。
  51393. * @property {number} [minR] - 圆形的最小半径。
  51394. * @property {string} [fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  51395. * @property {Object} [circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  51396. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51397. * @property {Object} [circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  51398. * @property {boolean} [circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  51399. * @property {boolean} [circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  51400. *
  51401. */
  51402. SuperMap.Feature.Theme.Circle = Circle;
  51403. ;// CONCATENATED MODULE: ./src/common/overlay/Line.js
  51404. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51405. * This program are made available under the terms of the Apache License, Version 2.0
  51406. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51407. /**
  51408. * @class SuperMap.Feature.Theme.Line
  51409. * @classdesc 折线图。
  51410. * @category Visualization Theme
  51411. * @example
  51412. * // pointStyleByCodomain 参数用法示例
  51413. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  51414. * // start: 值域值下限(包含);
  51415. * // end: 值域值上限(不包含);
  51416. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  51417. * // pointStyleByCodomain 数组形如:
  51418. * [
  51419. * {
  51420. * start:0,
  51421. * end:250,
  51422. * style:{
  51423. * fillColor:"#00CD00"
  51424. * }
  51425. * },
  51426. * {
  51427. * start:250,
  51428. * end:500,
  51429. * style:{
  51430. * fillColor:"#00EE00"
  51431. * }
  51432. * },
  51433. * {
  51434. * start:500,
  51435. * end:750,
  51436. * style:{
  51437. * fillColor:"#00FF7F"
  51438. * }
  51439. * },
  51440. * {
  51441. * start:750,
  51442. * end:1500,
  51443. * style:{
  51444. * fillColor:"#00FF00"
  51445. * }
  51446. * }
  51447. * ]
  51448. *
  51449. * @extends SuperMap.Feature.Theme.Graph
  51450. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51451. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  51452. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51453. * @param {SuperMap.Feature.Theme.Line.setting} setting - 图表配置对象。
  51454. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51455. */
  51456. class Line extends Graph {
  51457. constructor(data, layer, fields, setting, lonlat, options) {
  51458. super(data, layer, fields, setting, lonlat, options);
  51459. this.CLASS_NAME = "SuperMap.Feature.Theme.Line";
  51460. }
  51461. /**
  51462. * @function SuperMap.Feature.Theme.Line.prototype.destroy
  51463. * @override
  51464. */
  51465. destroy() {
  51466. super.destroy();
  51467. }
  51468. /**
  51469. * @function SuperMap.Feature.Theme.Line.prototype.assembleShapes
  51470. * @description 装配图形(扩展接口)。
  51471. */
  51472. assembleShapes() {
  51473. // 图表配置对象
  51474. var sets = this.setting;
  51475. // 默认数据视图框
  51476. if (!sets.dataViewBoxParameter) {
  51477. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  51478. sets.dataViewBoxParameter = [45, 15, 15, 15];
  51479. } else {
  51480. sets.dataViewBoxParameter = [5, 5, 5, 5];
  51481. }
  51482. }
  51483. // 重要步骤:初始化参数
  51484. if (!this.initBaseParameter()) {
  51485. return;
  51486. }
  51487. var dvb = this.dataViewBox;
  51488. // 值域
  51489. var codomain = this.DVBCodomain;
  51490. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  51491. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  51492. var uv = this.DVBUnitValue;
  51493. // 数据值数组
  51494. var fv = this.dataValues;
  51495. if (fv.length < 1) {
  51496. return;
  51497. } // 没有数据
  51498. // 获取 x 轴上的图形信息
  51499. var xShapeInfo = this.calculateXShapeInfo();
  51500. if (!xShapeInfo) {
  51501. return;
  51502. }
  51503. // 折线每个节点的 x 位置
  51504. var xsLoc = xShapeInfo.xPositions;
  51505. // 背景框,默认启用
  51506. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  51507. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  51508. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51509. }
  51510. // 折线图必须使用坐标轴
  51511. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  51512. // var isDataEffective = true;
  51513. var xPx; // 折线节点 x 坐标
  51514. var yPx; // 折线节点 y 坐标
  51515. var poiLists = []; // 折线节点数组
  51516. var shapePois = []; // 折线节点图形数组
  51517. for (var i = 0, len = fv.length; i < len; i++) {
  51518. // 数据溢出值域检查
  51519. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51520. // isDataEffective = false;
  51521. return null;
  51522. }
  51523. xPx = xsLoc[i];
  51524. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  51525. // 折线节点参数对象
  51526. var poiSP = new Point_Point(xPx, yPx);
  51527. // 折线节点 style
  51528. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  51529. // 折线节点 hover 样式
  51530. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  51531. // 折线节点 hover click
  51532. if (typeof(sets.pointHoverAble) !== "undefined") {
  51533. poiSP.hoverable = sets.pointHoverAble;
  51534. }
  51535. if (typeof(sets.pointClickAble) !== "undefined") {
  51536. poiSP.clickable = sets.pointClickAble;
  51537. }
  51538. // 图形携带的数据信息
  51539. poiSP.refDataID = this.data.id;
  51540. poiSP.dataInfo = {
  51541. field: this.fields[i],
  51542. value: fv[i]
  51543. };
  51544. // 创建图形并把此图形添加到折线节点图形数组
  51545. shapePois.push(this.shapeFactory.createShape(poiSP));
  51546. // 添加折线节点到折线节点数组
  51547. var poi = [xPx, yPx];
  51548. poiLists.push(poi);
  51549. }
  51550. // 折线参数对象
  51551. var lineSP = new Line_Line(poiLists);
  51552. lineSP.style = ShapeFactory.ShapeStyleTool({strokeColor: "#ee9900"}, sets.lineStyle);
  51553. // 禁止事件响应
  51554. lineSP.clickable = false;
  51555. lineSP.hoverable = false;
  51556. var shapeLine = this.shapeFactory.createShape(lineSP);
  51557. this.shapes.push(shapeLine);
  51558. // 添加节点到图表图形数组
  51559. this.shapes = this.shapes.concat(shapePois);
  51560. // // 数据范围检测未通过,清空图形
  51561. // if (isDataEffective === false) {
  51562. // this.shapes = [];
  51563. // }
  51564. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51565. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51566. this.shapesConvertToRelativeCoordinate();
  51567. }
  51568. /**
  51569. * @function SuperMap.Feature.Theme.Line.prototype.calculateXShapeInfo
  51570. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  51571. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  51572. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  51573. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51574. * 本函数中图形配置对象 setting 可设属性:<br>
  51575. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  51576. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  51577. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  51578. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。<br>
  51579. * width - {number} 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  51580. */
  51581. calculateXShapeInfo() {
  51582. var dvb = this.dataViewBox; // 数据视图框
  51583. var sets = this.setting; // 图表配置对象
  51584. var fvc = this.dataValues.length; // 数组值个数
  51585. if (fvc < 1) {
  51586. return null;
  51587. }
  51588. var xBlank; // x 轴空白间隔参数
  51589. var xShapePositions = []; // x 轴上图形的位置
  51590. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  51591. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  51592. var unitOffset = 0; // 单位偏移量
  51593. // x 轴空白间隔参数处理
  51594. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  51595. xBlank = sets.xShapeBlank;
  51596. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  51597. if (xsLen <= fvc) {
  51598. return null;
  51599. }
  51600. unitOffset = xsLen / (fvc - 1);
  51601. } else {
  51602. // 默认使用等距离空白间隔,空白间隔为图形宽度
  51603. unitOffset = dvbWidth / (fvc + 1);
  51604. xBlank = [unitOffset, unitOffset, unitOffset];
  51605. }
  51606. // 图形 x 轴上的位置计算
  51607. var xOffset = 0
  51608. for (var i = 0; i < fvc; i++) {
  51609. if (i == 0) {
  51610. xOffset = xBlank[0];
  51611. } else {
  51612. xOffset += unitOffset;
  51613. }
  51614. xShapePositions.push(dvb[0] + xOffset);
  51615. }
  51616. return {
  51617. "xPositions": xShapePositions,
  51618. "width": xShapeWidth
  51619. };
  51620. }
  51621. }
  51622. /**
  51623. * @typedef {Object} SuperMap.Feature.Theme.Line.setting
  51624. * @property {number} width - 专题要素(图表)宽度。
  51625. * @property {number} height - 专题要素(图表)高度。
  51626. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51627. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51628. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51629. * @property {Array.<number>} [dataViewBoxParameter] - {Array.<number>} 数据视图框 dataViewBox 参数,
  51630. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51631. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  51632. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51633. * @property {boolean} [useBackground] - 是否使用图表背景框。
  51634. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  51635. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  51636. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51637. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。长度为 2 的数组,第一元素表示折线左端点与数据视图框左端的空白间距,
  51638. * 第二个元素表示折线右端点右端与数据视图框右端端的空白间距。
  51639. * @property {SuperMap.Feature.ShapeParameters.Line.style} [axisStyle] - 坐标轴样式。
  51640. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  51641. * @property {number} [axisYTick=0] - y 轴刻度数量。
  51642. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  51643. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  51644. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正。
  51645. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  51646. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  51647. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  51648. * 否则沿数据视图框下面条边等距排布标签。
  51649. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  51650. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正;
  51651. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正;
  51652. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  51653. * @property {SuperMap.Feature.ShapeParameters.Line.style} ]xReferenceLineStyle] - 水平参考线样式。
  51654. * @property {SuperMap.Feature.ShapeParameters.Line.style} [lineStyle] - 折线图中折线 style。
  51655. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 折线图中折线节点基础 style,此参数控制折线节点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  51656. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为折线节点赋 style,此参数按字段控制折线节点样式,
  51657. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  51658. * 此参数中的 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"],
  51659. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的折线节点使用 style1,字段 POP_1995 对应的折线节点使用 style2 ,字段 POP_1999 对应的折线节点使用 style3。
  51660. * @property {Array.<Object>} pointStyleByCodomain - 按折线节点代表的数据值所在值域范围控制折线节点样式,优先级高于 pointStyle 和 pointStyleByFields。
  51661. * @property {Object} [pointHoverStyle=true] - 折线节点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  51662. * @property {boolean} [pointHoverAble=true] - 是否允许折线节点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  51663. * @property {boolean} [pointClickAble=true] - 是否允许折线节点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽折线节点对专题图层事件的响应。
  51664. */
  51665. SuperMap.Feature.Theme.Line = Line;
  51666. ;// CONCATENATED MODULE: ./src/common/overlay/Pie.js
  51667. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51668. * This program are made available under the terms of the Apache License, Version 2.0
  51669. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51670. /**
  51671. * @class SuperMap.Feature.Theme.Pie
  51672. * @classdesc 饼图。
  51673. * @category Visualization Theme
  51674. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51675. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  51676. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51677. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  51678. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51679. * @extends SuperMap.Feature.Theme.Graph
  51680. * @example
  51681. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  51682. * // start: 值域值下限(包含);
  51683. * // end: 值域值上限(不包含);
  51684. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  51685. * // sectorStyleByCodomain 数组形如:
  51686. * [
  51687. * {
  51688. * start:0,
  51689. * end:250,
  51690. * style:{
  51691. * fillColor:"#00CD00"
  51692. * }
  51693. * },
  51694. * {
  51695. * start:250,
  51696. * end:500,
  51697. * style:{
  51698. * fillColor:"#00EE00"
  51699. * }
  51700. * },
  51701. * {
  51702. * start:500,
  51703. * end:750,
  51704. * style:{
  51705. * fillColor:"#00FF7F"
  51706. * }
  51707. * },
  51708. * {
  51709. * start:750,
  51710. * end:1500,
  51711. * style:{
  51712. * fillColor:"#00FF00"
  51713. * }
  51714. * }
  51715. * ]
  51716. * @extends {SuperMap.Feature.Theme.Graph}
  51717. */
  51718. class Pie extends Graph {
  51719. constructor(data, layer, fields, setting, lonlat) {
  51720. super(data, layer, fields, setting, lonlat);
  51721. this.CLASS_NAME = "SuperMap.Feature.Theme.Pie";
  51722. }
  51723. /**
  51724. * @function SuperMap.Feature.Theme.Pie.prototype.destroy
  51725. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  51726. */
  51727. destroy() {
  51728. super.destroy();
  51729. }
  51730. /**
  51731. * @function SuperMap.Feature.Theme.Pie.prototype.assembleShapes
  51732. * @description 装配图形(扩展接口)。
  51733. */
  51734. assembleShapes() {
  51735. // 图表配置对象
  51736. var sets = this.setting;
  51737. // 一个默认 style 组
  51738. var defaultStyleGroup = [
  51739. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  51740. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  51741. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  51742. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  51743. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  51744. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  51745. ];
  51746. // 重要步骤:初始化参数
  51747. if (!this.initBaseParameter()) {
  51748. return;
  51749. }
  51750. // 背景框,默认不启用
  51751. if (sets.useBackground) {
  51752. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51753. }
  51754. // 数据值数组
  51755. var fv = this.dataValues;
  51756. if (fv.length < 1) {
  51757. return;
  51758. } // 没有数据
  51759. // 值域范围
  51760. var codomain = this.DVBCodomain;
  51761. // 值域范围检测
  51762. for (let i = 0; i < fv.length; i++) {
  51763. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51764. return;
  51765. }
  51766. }
  51767. // 值的绝对值总和
  51768. var valueSum = 0;
  51769. for (let i = 0; i < fv.length; i++) {
  51770. valueSum += Math.abs(fv[i]);
  51771. }
  51772. // 重要步骤:定义图表 Pie 数据视图框中单位值的含义,单位值:每度代表的数值
  51773. this.DVBUnitValue = 360 / valueSum;
  51774. var uv = this.DVBUnitValue;
  51775. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  51776. var startAngle = 0; // 扇形起始边角度
  51777. var endAngle = 0; // 扇形终止边角度
  51778. var startAngleTmp = startAngle; // 扇形临时起始边角度
  51779. // 扇形(自适应)半径
  51780. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  51781. for (var i = 0; i < fv.length; i++) {
  51782. var fvi = Math.abs(fv[i]);
  51783. //计算终止角
  51784. if (i === 0) {
  51785. endAngle = startAngle + fvi * uv;
  51786. } else if (i === fvi.length - 1) {
  51787. endAngle = startAngleTmp;
  51788. } else {
  51789. endAngle = startAngle + fvi * uv;
  51790. }
  51791. //矫正误差计算
  51792. if ((endAngle - startAngle) >= 360) {
  51793. endAngle = 359.9999999;
  51794. }
  51795. // 扇形参数对象
  51796. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle);
  51797. // 扇形样式
  51798. if (typeof(sets.sectorStyleByFields) === "undefined") {
  51799. // 使用默认 style 组
  51800. var colorIndex = i % defaultStyleGroup.length;
  51801. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  51802. } else {
  51803. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  51804. }
  51805. // 扇形 hover 样式
  51806. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  51807. // 扇形 hover 与 click 设置
  51808. if (typeof(sets.sectorHoverAble) !== "undefined") {
  51809. sectorSP.hoverable = sets.sectorHoverAble;
  51810. }
  51811. if (typeof(sets.sectorClickAble) !== "undefined") {
  51812. sectorSP.clickable = sets.sectorClickAble;
  51813. }
  51814. // 图形携带的数据信息
  51815. sectorSP.refDataID = this.data.id;
  51816. sectorSP.dataInfo = {
  51817. field: this.fields[i],
  51818. value: fv[i]
  51819. };
  51820. // 创建扇形并把此扇形添加到图表图形数组
  51821. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  51822. // 把上一次的结束角度作为下一次的起始角度
  51823. startAngle = endAngle;
  51824. }
  51825. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51826. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51827. this.shapesConvertToRelativeCoordinate();
  51828. }
  51829. }
  51830. /**
  51831. * @typedef {Object} SuperMap.Feature.Theme.Pie.setting
  51832. * @property {number} width - 专题要素(图表)宽度。
  51833. * @property {number} height - 专题要素(图表)高度。
  51834. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  51835. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  51836. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  51837. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,
  51838. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  51839. * @property {Array.<number>} decimalNumber - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  51840. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  51841. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  51842. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  51843. * @property {SuperMap.Feature.ShapeParameters.Sector.style} sectorStyle - 饼图中扇形的基础 style,此参数控制饼图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  51844. * @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"],
  51845. * sectorStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的饼图扇形使用 style1,字段 POP_1995 对应的饼图扇形使用 style2 ,字段 POP_1999 对应的饼图扇形使用 style3。
  51846. * @property {Array.<Object>} sectorStyleByCodomain - 按饼图扇形代表的数据值所在值域范围控制饼图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  51847. * @property {Object} [sectorHoverStyle] 饼图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  51848. * @property {boolean} [sectorHoverAble=true] 是否允许饼图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  51849. * @property {boolean} [sectorClickAble=true] 是否允许饼图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽饼图扇形对专题图层事件的响应。
  51850. */
  51851. SuperMap.Feature.Theme.Pie = Pie;
  51852. ;// CONCATENATED MODULE: ./src/common/overlay/Point.js
  51853. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  51854. * This program are made available under the terms of the Apache License, Version 2.0
  51855. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  51856. /**
  51857. * @class SuperMap.Feature.Theme.Point
  51858. * @classdesc 点状图。
  51859. * @category Visualization Theme
  51860. * @param {SuperMap.Feature.Vector} data - 用户数据。
  51861. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  51862. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  51863. * @param {SuperMap.Feature.Theme.Point.setting} setting - 图表配置对象。
  51864. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  51865. * @example
  51866. * // pointStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  51867. * // start: 值域值下限(包含);
  51868. * // end: 值域值上限(不包含);
  51869. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Point.style> 。
  51870. * // pointStyleByCodomain 数组形如:
  51871. * [
  51872. * {
  51873. * start:0,
  51874. * end:250,
  51875. * style:{
  51876. * fillColor:"#00CD00"
  51877. * }
  51878. * },
  51879. * {
  51880. * start:250,
  51881. * end:500,
  51882. * style:{
  51883. * fillColor:"#00EE00"
  51884. * }
  51885. * },
  51886. * {
  51887. * start:500,
  51888. * end:750,
  51889. * style:{
  51890. * fillColor:"#00FF7F"
  51891. * }
  51892. * },
  51893. * {
  51894. * start:750,
  51895. * end:1500,
  51896. * style:{
  51897. * fillColor:"#00FF00"
  51898. * }
  51899. * }
  51900. * ]
  51901. *@extends {SuperMap.Feature.Theme.Graph}
  51902. */
  51903. class overlay_Point_Point extends Graph {
  51904. constructor(data, layer, fields, setting, lonlat, options) {
  51905. super(data, layer, fields, setting, lonlat, options);
  51906. this.CLASS_NAME = "SuperMap.Feature.Theme.Point";
  51907. }
  51908. /**
  51909. * @function SuperMap.Feature.Theme.Point.prototype.destroy
  51910. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  51911. */
  51912. destroy() {
  51913. super.destroy();
  51914. }
  51915. /**
  51916. * @function SuperMap.Feature.Theme.prototype.Point.assembleShapes
  51917. * @description 装配图形(扩展接口)。
  51918. */
  51919. assembleShapes() {
  51920. // 图表配置对象
  51921. var sets = this.setting;
  51922. // 默认数据视图框
  51923. if (!sets.dataViewBoxParameter) {
  51924. if (typeof(sets.useAxis) === "undefined" || sets.useAxis) {
  51925. sets.dataViewBoxParameter = [45, 15, 15, 15];
  51926. } else {
  51927. sets.dataViewBoxParameter = [5, 5, 5, 5];
  51928. }
  51929. }
  51930. // 重要步骤:初始化参数
  51931. if (!this.initBaseParameter()) {
  51932. return;
  51933. }
  51934. var dvb = this.dataViewBox;
  51935. // 值域
  51936. var codomain = this.DVBCodomain;
  51937. // 重要步骤:定义图表 Bar 数据视图框中单位值的含义
  51938. this.DVBUnitValue = (codomain[1] - codomain[0]) / this.DVBHeight;
  51939. var uv = this.DVBUnitValue;
  51940. var fv = this.dataValues;
  51941. // 获取 x 轴上的图形信息
  51942. var xShapeInfo = this.calculateXShapeInfo();
  51943. if (!xShapeInfo) {
  51944. return;
  51945. }
  51946. // 折线每个节点的 x 位置
  51947. var xsLoc = xShapeInfo.xPositions;
  51948. // 背景框,默认启用
  51949. if (typeof(sets.useBackground) === "undefined" || sets.useBackground) {
  51950. // 将背景框图形添加到模型的 shapes 数组,注意添加顺序,后添加的图形在先添加的图形之上。
  51951. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  51952. }
  51953. // 点状图必须使用坐标轴
  51954. this.shapes = this.shapes.concat(ShapeFactory.GraphAxis(this.shapeFactory, dvb, sets, xShapeInfo));
  51955. var xPx; // 图形点 x 坐标
  51956. var yPx; // 图形点 y 坐标
  51957. for (var i = 0, len = fv.length; i < len; i++) {
  51958. // 数据溢出值域检查
  51959. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  51960. //isDataEffective = false;
  51961. return null;
  51962. }
  51963. xPx = xsLoc[i];
  51964. yPx = dvb[1] - (fv[i] - codomain[0]) / uv;
  51965. // 图形点参数对象
  51966. var poiSP = new Point_Point(xPx, yPx);
  51967. // 图形点 style
  51968. poiSP.style = ShapeFactory.ShapeStyleTool({fillColor: "#ee9900"}, sets.pointStyle, sets.pointStyleByFields, sets.pointStyleByCodomain, i, fv[i]);
  51969. // 图形点 hover 样式
  51970. poiSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.pointHoverStyle);
  51971. // 图形点 hover click
  51972. if (typeof(sets.pointHoverAble) !== "undefined") {
  51973. poiSP.hoverable = sets.pointHoverAble;
  51974. }
  51975. if (typeof(sets.pointClickAble) !== "undefined") {
  51976. poiSP.clickable = sets.pointClickAble;
  51977. }
  51978. // 图形携带的数据信息
  51979. poiSP.refDataID = this.data.id;
  51980. poiSP.dataInfo = {
  51981. field: this.fields[i],
  51982. value: fv[i]
  51983. };
  51984. // 创建图形点并把此图形添加到图表图形数组
  51985. this.shapes.push(this.shapeFactory.createShape(poiSP));
  51986. }
  51987. // 数据范围检测未通过,清空图形
  51988. // if (isDataEffective === false) {
  51989. // this.shapes = [];
  51990. // }
  51991. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  51992. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  51993. this.shapesConvertToRelativeCoordinate();
  51994. }
  51995. /**
  51996. * @function SuperMap.Feature.Theme.Point.prototype.calculateXShapeInfo
  51997. * @description 计算 X 轴方向上的图形信息,此信息是一个对象,包含两个属性,
  51998. * 属性 xPositions 是一个一维数组,该数组元素表示图形在 x 轴方向上的像素坐标值,
  51999. * 如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  52000. * width 表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  52001. * 本函数中图形配置对象 setting 可设属性:<br>
  52002. * xShapeBlank - {Array.<number>} 水平方向上的图形空白间隔参数。
  52003. * 长度为 2 的数组,第一元素表示第折线左端点与数据视图框左端的空白间距,第二个元素表示折线右端点右端与数据视图框右端端的空白间距 。
  52004. * @returns {Object} 如果计算失败,返回 null;如果计算成功,返回 X 轴方向上的图形信息,此信息是一个对象,包含以下两个属性:<br>
  52005. * xPositions - {Array.<number>} 表示图形在 x 轴方向上的像素坐标值,如果图形在 x 方向上有一定宽度,通常取图形在 x 方向上的中心点为图形在 x 方向上的坐标值。
  52006. * width - {number}表示图形的宽度(特别注意:点的宽度始终为 0,而不是其直径)。
  52007. */
  52008. calculateXShapeInfo() {
  52009. var dvb = this.dataViewBox; // 数据视图框
  52010. var sets = this.setting; // 图表配置对象
  52011. var fvc = this.dataValues.length; // 数组值个数
  52012. if (fvc < 1) {
  52013. return null;
  52014. }
  52015. var xBlank; // x 轴空白间隔参数
  52016. var xShapePositions = []; // x 轴上图形的位置
  52017. var xShapeWidth = 0; // x 轴上图形宽度(自适应)
  52018. var dvbWidth = this.DVBWidth; // 数据视图框宽度
  52019. var unitOffset = 0; // 单位偏移量
  52020. // x 轴空白间隔参数处理
  52021. if (sets.xShapeBlank && sets.xShapeBlank.length && sets.xShapeBlank.length == 2) {
  52022. xBlank = sets.xShapeBlank;
  52023. var xsLen = dvbWidth - (xBlank[0] + xBlank[1]);
  52024. if (xsLen <= fvc) {
  52025. return null;
  52026. }
  52027. unitOffset = xsLen / (fvc - 1);
  52028. } else {
  52029. // 默认使用等距离空白间隔,空白间隔为图形宽度
  52030. unitOffset = dvbWidth / (fvc + 1);
  52031. xBlank = [unitOffset, unitOffset, unitOffset];
  52032. }
  52033. // 图形 x 轴上的位置计算
  52034. var xOffset = 0
  52035. for (var i = 0; i < fvc; i++) {
  52036. if (i == 0) {
  52037. xOffset = xBlank[0];
  52038. } else {
  52039. xOffset += unitOffset;
  52040. }
  52041. xShapePositions.push(dvb[0] + xOffset);
  52042. }
  52043. return {
  52044. "xPositions": xShapePositions,
  52045. "width": xShapeWidth
  52046. };
  52047. }
  52048. }
  52049. /**
  52050. * @typedef {Object} SuperMap.Feature.Theme.Point.setting
  52051. * @property {number} width - 专题要素(图表)宽度。
  52052. * @property {number} height - 专题要素(图表)高度。
  52053. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  52054. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  52055. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  52056. * @property {Array.<number>} [dataViewBoxParameter] - 数据视图框 dataViewBox 参数,
  52057. * 它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  52058. * 当使用坐标轴时 dataViewBoxParameter 的默认值为:[45, 15, 15, 15];不使用坐标轴时 dataViewBoxParameter 的默认值为:[5, 5, 5, 5]。
  52059. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  52060. * @property {boolean} [useBackground] - 是否使用图表背景框。
  52061. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} backgroundStyle - 背景样式。
  52062. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,
  52063. * 则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  52064. * @property {Array.<number>} xShapeBlank - 水平方向上的图形空白间隔参数。
  52065. * 长度为 2 的数组,第一个元素表示第一个(沿 x 轴方向)图形点与数据视图框左端的空白间距,第二个元素表示最后一个(沿 x 轴方向)图形点与数据视图框右端端的空白间距 。
  52066. * @property {Object} axisStyle - 坐标轴样式。
  52067. * @property {boolean} [axisUseArrow=false] - 坐标轴是否使用箭头。
  52068. * @property {number} [axisYTick=0] - y 轴刻度数量。
  52069. * @property {Array.<string>} [axisYLabels] - y 轴上的标签组内容,标签顺序沿着数据视图框左面条边自上而下,等距排布。例如:["1000", "750", "500", "250", "0"]。
  52070. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisYLabelsStyle] - y 轴上的标签组样式。
  52071. * @property {Array.<number>} [axisYLabelsOffset=0] - y 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 y 轴标签组横向上的偏移量,向左为正;
  52072. * 数组第二项表示 y 轴标签组纵向上的偏移量,向下为正。
  52073. * @property {Array.<string>} [axisXLabels] - x 轴上的标签组内容,标签顺序沿着数据视图框下面条边自左向右排布,例如:["92年", "95年", "99年"]。
  52074. * 标签排布规则:当标签数量与 xShapeInfo 中的属性 xShapeCenter 数量相同(即标签个数与数据个数相等时), 按照 xShapeCenter 提供的位置排布标签,
  52075. * 否则沿数据视图框下面条边等距排布标签。
  52076. * @property {SuperMap.Feature.ShapeParameters.Label.style} [axisXLabelsStyle] - x 轴上的标签组样式。
  52077. * @property {Array.<number>} [axisXLabelsOffset=0] - x 轴上的标签组偏移量。长度为 2 的数组,数组第一项表示 x 轴标签组横向上的偏移量,向左为正,
  52078. * 数组第二项表示 x 轴标签组纵向上的偏移量,向下为正。
  52079. * @property {boolean} [useXReferenceLine=true] - 是否使用水平参考线,如果为 true,在 axisYTick 大于 0 时有效,水平参考线是 y 轴刻度在数据视图框里的延伸。
  52080. * @property {SuperMap.Feature.ShapeParameters.Line.style} [xReferenceLineStyle] - 水平参考线样式。
  52081. * @property {SuperMap.Feature.ShapeParameters.Point.style} [pointStyle] - 点状图中图形点基础 style,此参数控制图形点基础样式,优先级低于 pointStyleByFields 和 pointStyleByCodomain。
  52082. * @property {Array.<SuperMap.Feature.ShapeParameters.Point.style>} [pointStyleByFields] - 按专题字段 themeFields(<SuperMap.Layer.Graph.themeFields>)为图形点赋 style,此参数按字段控制图形点样式,
  52083. * 优先级低于 pointStyleByCodomain,高于 pointStyle。此数组中的元素是样式对象。
  52084. * 此参数中的 style 与 themeFields 中的字段一一对应 。例如: themeFields(<SuperMap.Layer.Graph.themeFields>) 为 ["POP_1992", "POP_1995", "POP_1999"],
  52085. * pointStyleByFields 为[style1, style2, style3],则在图表中,字段 POP_1992 对应的图形点使用 style1,字段 POP_1995 对应的图形点使用 style2 ,字段 POP_1999 对应的图形点使用 style3。
  52086. * @property {Array.<Object>} pointStyleByCodomain - 按图形点代表的数据值所在值域范围控制图形点样式,优先级高于 pointStyle 和 pointStyleByFields。
  52087. * @property {Object} [pointHoverStyle] - 图形点 hover 状态时的样式,pointHoverAble 为 true 时有效。
  52088. * @property {Object} [pointHoverAble=true] - 是否允许图形点使用 hover 状态。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  52089. * @property {Object} [pointClickAble=true] - 是否允许图形点被点击。同时设置 pointHoverAble 和 pointClickAble 为 false,可以直接屏蔽图形点对专题图层事件的响应。
  52090. */
  52091. SuperMap.Feature.Theme.Point = overlay_Point_Point;
  52092. ;// CONCATENATED MODULE: ./src/common/overlay/Ring.js
  52093. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52094. * This program are made available under the terms of the Apache License, Version 2.0
  52095. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52096. /**
  52097. * @class SuperMap.Feature.Theme.Ring
  52098. * @classdesc 环状图。
  52099. * @category Visualization Theme
  52100. * @description 基于路由对象计算指定点 M 值操作的参数类。通过该类提供参数信息。
  52101. * @param {SuperMap.Feature.Vector} data - 用户数据。
  52102. * @param {SuperMap.Layer.Graph} layer - 此专题要素所在图层。
  52103. * @param {Array.<string>} fields - data 中的参与此图表生成的字段名称。
  52104. * @param {SuperMap.Feature.Theme.Ring.setting} setting - 图表配置对象。
  52105. * @param {SuperMap.LonLat} [lonlat] - 专题要素地理位置。默认为 data 指代的地理要素 Bounds 中心。
  52106. * @example
  52107. * // sectorStyleByCodomain 的每个元素是个包含值域信息和与值域对应样式信息的对象,该对象(必须)有三个属性:
  52108. * // start: 值域值下限(包含);
  52109. * // end: 值域值上限(不包含);
  52110. * // style: 数据可视化图形的 style,这个样式对象的可设属性: <SuperMap.Feature.ShapeParameters.Sector.style> 。
  52111. * // sectorStyleByCodomain 数组形如:
  52112. * [
  52113. * {
  52114. * start:0,
  52115. * end:250,
  52116. * style:{
  52117. * fillColor:"#00CD00"
  52118. * }
  52119. * },
  52120. * {
  52121. * start:250,
  52122. * end:500,
  52123. * style:{
  52124. * fillColor:"#00EE00"
  52125. * }
  52126. * },
  52127. * {
  52128. * start:500,
  52129. * end:750,
  52130. * style:{
  52131. * fillColor:"#00FF7F"
  52132. * }
  52133. * },
  52134. * {
  52135. * start:750,
  52136. * end:1500,
  52137. * style:{
  52138. * fillColor:"#00FF00"
  52139. * }
  52140. * }
  52141. * ]
  52142. * @param {Object} [sectorHoverStyle=true] - 环状图扇形 hover 状态时的样式,sectorHoverAble 为 true 时有效。
  52143. * @param {boolean} [sectorHoverAble=true] - 是否允许环状图扇形使用 hover 状态。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  52144. * @param {boolean} [sectorClickAble=true] - 是否允许环状图扇形被点击。同时设置 sectorHoverAble 和 sectorClickAble 为 false,可以直接屏蔽环状图扇形对专题图层事件的响应。
  52145. *
  52146. * @extends {SuperMap.Feature.Theme.Graph}
  52147. */
  52148. class Ring extends Graph {
  52149. constructor(data, layer, fields, setting, lonlat) {
  52150. super(data, layer, fields, setting, lonlat);
  52151. this.CLASS_NAME = "SuperMap.Feature.Theme.Ring";
  52152. }
  52153. /**
  52154. * @function SuperMap.Feature.Theme.Ring.prototype.destroy
  52155. * @description 销毁此专题要素。调用 destroy 后此对象所以属性置为 null。
  52156. */
  52157. destroy() {
  52158. super.destroy();
  52159. }
  52160. /**
  52161. * @function SuperMap.Feature.Theme.Ring.prototype.assembleShapes
  52162. * @description 装配图形(扩展接口)。
  52163. */
  52164. assembleShapes() {
  52165. // 重要步骤:初始化参数
  52166. if (!this.initBaseParameter()) {
  52167. return;
  52168. }
  52169. // 一个默认 style 组
  52170. var defaultStyleGroup = [
  52171. {fillColor: "#ff9277"}, {fillColor: "#dddd00"}, {fillColor: "#ffc877"}, {fillColor: "#bbe3ff"}, {fillColor: "#d5ffbb"},
  52172. {fillColor: "#bbbbff"}, {fillColor: "#ddb000"}, {fillColor: "#b0dd00"}, {fillColor: "#e2bbff"}, {fillColor: "#ffbbe3"},
  52173. {fillColor: "#ff7777"}, {fillColor: "#ff9900"}, {fillColor: "#83dd00"}, {fillColor: "#77e3ff"}, {fillColor: "#778fff"},
  52174. {fillColor: "#c877ff"}, {fillColor: "#ff77ab"}, {fillColor: "#ff6600"}, {fillColor: "#aa8800"}, {fillColor: "#77c7ff"},
  52175. {fillColor: "#ad77ff"}, {fillColor: "#ff77ff"}, {fillColor: "#dd0083"}, {fillColor: "#777700"}, {fillColor: "#00aa00"},
  52176. {fillColor: "#0088aa"}, {fillColor: "#8400dd"}, {fillColor: "#aa0088"}, {fillColor: "#dd0000"}, {fillColor: "#772e00"}
  52177. ];
  52178. // 图表配置对象
  52179. var sets = this.setting;
  52180. // 背景框,默认不启用
  52181. if (sets.useBackground) {
  52182. this.shapes.push(ShapeFactory.Background(this.shapeFactory, this.chartBox, sets));
  52183. }
  52184. // 数据值数组
  52185. var fv = this.dataValues;
  52186. if (fv.length < 1) {
  52187. return;
  52188. } // 没有数据
  52189. // 值域范围
  52190. var codomain = this.DVBCodomain;
  52191. // 值域范围检测
  52192. for (let i = 0; i < fv.length; i++) {
  52193. if (fv[i] < codomain[0] || fv[i] > codomain[1]) {
  52194. return;
  52195. }
  52196. }
  52197. // 值的绝对值总和
  52198. var valueSum = 0;
  52199. for (let i = 0; i < fv.length; i++) {
  52200. valueSum += Math.abs(fv[i]);
  52201. }
  52202. // 重要步骤:定义图表 Ring 数据视图框中单位值的含义,单位值:每度代表的数值
  52203. this.DVBUnitValue = 360 / valueSum;
  52204. var uv = this.DVBUnitValue;
  52205. var dvbCenter = this.DVBCenterPoint; // 数据视图框中心作为扇心
  52206. var startAngle = 0; // 扇形起始边角度
  52207. var endAngle = 0; // 扇形终止边角度
  52208. var startAngleTmp = startAngle; // 扇形临时起始边角度
  52209. // 扇形外环(自适应)半径
  52210. var r = this.DVBHeight < this.DVBWidth ? this.DVBHeight / 2 : this.DVBWidth / 2;
  52211. // 扇形内环(自适应)半径
  52212. var isInRange = sets.innerRingRadius >= 0 && sets.innerRingRadius < r;
  52213. var r0 = (
  52214. typeof(sets.innerRingRadius) !== "undefined"
  52215. && !isNaN(sets.innerRingRadius)
  52216. && isInRange
  52217. ) ? sets.innerRingRadius : 0;
  52218. for (var i = 0; i < fv.length; i++) {
  52219. var fvi = Math.abs(fv[i]);
  52220. // 计算结束角度
  52221. if (i === 0) {
  52222. endAngle = startAngle + fvi * uv;
  52223. } else if (i === fvi.length - 1) {
  52224. endAngle = startAngleTmp;
  52225. } else {
  52226. endAngle = startAngle + fvi * uv;
  52227. }
  52228. // 扇形参数对象
  52229. var sectorSP = new Sector(dvbCenter[0], dvbCenter[1], r, startAngle, endAngle, r0);
  52230. // 扇形样式
  52231. if (typeof(sets.sectorStyleByFields) === "undefined") {
  52232. // 使用默认 style 组
  52233. var colorIndex = i % defaultStyleGroup.length;
  52234. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, defaultStyleGroup, null, colorIndex);
  52235. } else {
  52236. sectorSP.style = ShapeFactory.ShapeStyleTool(null, sets.sectorStyle, sets.sectorStyleByFields, sets.sectorStyleByCodomain, i, fv[i]);
  52237. }
  52238. // 扇形 hover 样式
  52239. sectorSP.highlightStyle = ShapeFactory.ShapeStyleTool(null, sets.sectorHoverStyle);
  52240. // 扇形 hover 与 click 设置
  52241. if (typeof(sets.sectorHoverAble) !== "undefined") {
  52242. sectorSP.hoverable = sets.sectorHoverAble;
  52243. }
  52244. if (typeof(sets.sectorClickAble) !== "undefined") {
  52245. sectorSP.clickable = sets.sectorClickAble;
  52246. }
  52247. // 图形携带的数据信息
  52248. sectorSP.refDataID = this.data.id;
  52249. sectorSP.dataInfo = {
  52250. field: this.fields[i],
  52251. value: fv[i]
  52252. };
  52253. // 创建扇形并把此扇形添加到图表图形数组
  52254. this.shapes.push(this.shapeFactory.createShape(sectorSP));
  52255. // 把上一次的结束角度作为下一次的起始角度
  52256. startAngle = endAngle;
  52257. }
  52258. // 重要步骤:将图形转为由相对坐标表示的图形,以便在地图平移缩放过程中快速重绘图形
  52259. // (统计专题图模块从结构上要求使用相对坐标,assembleShapes() 函数必须在图形装配完成后调用 shapesConvertToRelativeCoordinate() 函数)
  52260. this.shapesConvertToRelativeCoordinate();
  52261. }
  52262. }
  52263. /**
  52264. * @typedef {Object} SuperMap.Feature.Theme.Ring.setting
  52265. * @property {number} width - 专题要素(图表)宽度。
  52266. * @property {number} height - 专题要素(图表)高度。
  52267. * @property {Array.<number>} codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  52268. * @property {number} [XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  52269. * @property {number} [YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  52270. * @property {Array.<number>} [dataViewBoxParameter=[0, 0, 0, 0]] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox (由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值。
  52271. * @property {number} [decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  52272. * @property {boolean} [useBackground=false] - 是否使用图表背景框。
  52273. * @property {SuperMap.Feature.ShapeParameters.Rectangle.style} [backgroundStyle] - 背景样式,此样式对象对象可设属性。
  52274. * @property {Array.<number>} [backgroundRadius=[0, 0, 0, 0]] - 背景框矩形圆角半径,可以用数组分别指定四个角的圆角半径,设:左上、右上、右下、左下角的半径依次为 r1、r2、r3、r4 ,则 backgroundRadius 为 [r1、r2、r3、r4 ]。
  52275. * @property {number} [innerRingRadius=0] - 环状图内环半径,取值范围大于 0,小于外环半径(外环半径:数据视图框长和宽中较小值的二分之一)。
  52276. * @property {SuperMap.Feature.ShapeParameters.Sector.style} [sectorStyle] - 环状图中扇形的基础 style,此参数控制环状图扇形基础样式,优先级低于 sectorStyleByFields 和 sectorStyleByCodomain。
  52277. * @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。
  52278. * @property {Array.<SuperMap.Feature.ShapeParameters.Sector.style>} [sectorStyleByCodomain] - 按环状图扇形代表的数据值所在值域范围控制环状图扇形样式,优先级高于 sectorStyle 和 sectorStyleByFields。
  52279. */
  52280. SuperMap.Feature.Theme.Ring = Ring;
  52281. ;// CONCATENATED MODULE: ./src/common/overlay/ThemeVector.js
  52282. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52283. * This program are made available under the terms of the Apache License, Version 2.0
  52284. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52285. /**
  52286. * @class SuperMap.Feature.Theme.Vector
  52287. * @classdesc 矢量专题要素类。
  52288. * @category Visualization Theme
  52289. * @extends SuperMap.Feature.Theme
  52290. * @param {SuperMap.Feature.Vector} data - 用户数据,的类型为矢量数据 feature。
  52291. * @param {SuperMap.Layer} layer - 此专题要素所在图层。
  52292. * @param {Object} style - 样式。
  52293. * @param {Object} options - 创建专题要素时的可选参数。
  52294. * @param {number} [options.nodesClipPixel=2] - 节点抽稀像素距离, 单位:像素。
  52295. * @param {boolean} [options.isHoverAble=true] - 图形是否可 hover。
  52296. * @param {boolean} [options.isMultiHover=true] - 是否使用多图形高亮,isHoverAble 为 true 时生效。
  52297. * @param {boolean} [options.isClickAble=true] - 图形是否可点击。
  52298. * @param {Object} [options.highlightStyle] - 高亮样式。
  52299. */
  52300. class ThemeVector extends Theme_Theme {
  52301. constructor(data, layer, style, options, shapeOptions) {
  52302. super(data, layer);
  52303. //数据的 geometry 属性必须存在且类型是 SuperMap.Geometry 或其子类的类型
  52304. if (!data.geometry) {
  52305. return;
  52306. }
  52307. if (!(data.geometry instanceof Geometry)) {
  52308. return;
  52309. }
  52310. /**
  52311. * @member {SuperMap.Bounds} [SuperMap.Feature.Theme.Vector.prototype.dataBounds]
  52312. * @description 用户数据的(feature.geometry)地理范围。
  52313. */
  52314. this.dataBounds = data.geometry.getBounds();
  52315. /**
  52316. * @member {number} [SuperMap.Feature.Theme.Vector.prototype.nodesClipPixel=2]
  52317. * @description 节点抽稀像素距离。
  52318. */
  52319. this.nodesClipPixel = 2;
  52320. /**
  52321. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isHoverAble=true]
  52322. * @description 图形是否可 hover。
  52323. */
  52324. this.isHoverAble = true;
  52325. /**
  52326. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isMultiHover=true]
  52327. * @description 是否使用多图形高亮,isHoverAble 为 true 时生效。
  52328. */
  52329. this.isMultiHover = true;
  52330. /**
  52331. * @member {boolean} [SuperMap.Feature.Theme.Vector.prototype.isClickAble=true]
  52332. * @description 图形是否可点击。
  52333. */
  52334. this.isClickAble = true;
  52335. /**
  52336. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.highlightStyle]
  52337. * @description 高亮样式。
  52338. */
  52339. this.highlightStyle = null;
  52340. /**
  52341. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.shapeOptions]
  52342. * @description 添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做。
  52343. */
  52344. this.shapeOptions = {};
  52345. /**
  52346. * @member {Object} [SuperMap.Feature.Theme.Vector.prototype.style]
  52347. * @description 可视化图形的 style。在子类中规定其对象结构和默认属性值。
  52348. */
  52349. this.style = style || {};
  52350. this.CLASS_NAME = "SuperMap.Feature.Theme.Vector";
  52351. this.style = style ? style : {};
  52352. if (options) {
  52353. Util.copyAttributesWithClip(this, options, ["shapeOptions", "dataBounds"])
  52354. }
  52355. if (shapeOptions) {
  52356. Util.copyAttributesWithClip(this.shapeOptions, shapeOptions);
  52357. }
  52358. //设置基础参数 dataBounds、lonlat、location
  52359. var geometry = data.geometry;
  52360. this.lonlat = this.dataBounds.getCenterLonLat();
  52361. this.location = this.getLocalXY(this.lonlat);
  52362. //将地理要素转为专题要素
  52363. if (geometry instanceof LinearRing) {
  52364. this.lineToTF(geometry);
  52365. } else if (geometry instanceof LineString) {
  52366. this.lineToTF(geometry);
  52367. } else if (geometry instanceof Curve) {
  52368. //独立几何体
  52369. } else if (geometry instanceof MultiPoint) {
  52370. this.multiPointToTF(geometry);
  52371. } else if (geometry instanceof MultiLineString) {
  52372. this.multiLineStringToTF(geometry);
  52373. } else if (geometry instanceof MultiPolygon) {
  52374. this.multiPolygonToTF(geometry);
  52375. } else if (geometry instanceof Polygon) {
  52376. this.polygonToTF(geometry);
  52377. } else if (geometry instanceof Collection) {
  52378. //独立几何体
  52379. } else if (geometry instanceof Point) {
  52380. this.pointToTF(geometry);
  52381. } else if (geometry instanceof Rectangle) {
  52382. this.rectangleToTF(geometry);
  52383. } else if (geometry instanceof GeoText) {
  52384. this.geoTextToTF(geometry);
  52385. }
  52386. }
  52387. /**
  52388. * @function SuperMap.Feature.Theme.Vector.prototype.destroy
  52389. * @override
  52390. */
  52391. destroy() {
  52392. this.style = null;
  52393. this.dataBounds = null;
  52394. this.nodesClipPixel = null;
  52395. this.isHoverAble = null;
  52396. this.isMultiHover = null;
  52397. this.isClickAble = null;
  52398. this.highlightStyle = null;
  52399. this.shapeOptions = null;
  52400. super.destroy();
  52401. }
  52402. /**
  52403. * @function SuperMap.Feature.Theme.Vector.prototype.lineToTF
  52404. * @description 转换线和线环要素。
  52405. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 LineString 或 LineRing。
  52406. */
  52407. lineToTF(geometry) {
  52408. var components = geometry.components;
  52409. //节点像素坐标
  52410. var localLX = [];
  52411. //参考位置,参考中心为
  52412. var refLocal = [];
  52413. var location = this.location;
  52414. var pointList = [];
  52415. //节点抽稀距离
  52416. var nCPx = this.nodesClipPixel;
  52417. for (var i = 0; i < components.length; i++) {
  52418. var components_i = components[i];
  52419. refLocal = [];
  52420. localLX = this.getLocalXY(components_i);
  52421. refLocal[0] = localLX[0] - location[0];
  52422. refLocal[1] = localLX[1] - location[1];
  52423. //抽稀 - 2 px
  52424. if (pointList.length > 0) {
  52425. var lastLocalXY = pointList[pointList.length - 1];
  52426. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  52427. continue;
  52428. }
  52429. }
  52430. //使用参考点
  52431. pointList.push(refLocal);
  52432. }
  52433. if (pointList.length < 2) {
  52434. return null;
  52435. }
  52436. //赋 style
  52437. var style = new Object();
  52438. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  52439. style.pointList = pointList;
  52440. //创建图形
  52441. var shape = new SmicBrokenLine({
  52442. style: style,
  52443. clickable: this.isClickAble,
  52444. hoverable: this.isHoverAble
  52445. });
  52446. //设置高亮样式
  52447. if (this.highlightStyle) {
  52448. shape.highlightStyle = this.highlightStyle;
  52449. }
  52450. //设置参考中心,指定图形位置
  52451. shape.refOriginalPosition = this.location;
  52452. //储存数据 id 属性,用于事件
  52453. shape.refDataID = this.data.id;
  52454. //储存数据 id 属性,用于事件-多图形同时高亮
  52455. shape.isHoverByRefDataID = this.isMultiHover;
  52456. //添加到渲染器前修改 shape 的一些属性,非特殊情况通常不允许这么做
  52457. if (this.shapeOptions) {
  52458. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52459. }
  52460. this.shapes.push(shape);
  52461. }
  52462. /**
  52463. * @function SuperMap.Feature.Theme.Vector.prototype.multiPointToTF
  52464. * @description 转多点要素。
  52465. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPoint。
  52466. */
  52467. multiPointToTF(geometry) {
  52468. /* //-- 不抽稀
  52469. var components = geometry.components;
  52470. for(var i = 0; i < components.length; i++){
  52471. var components_i = components[i];
  52472. this.pointToTF(components_i);
  52473. }
  52474. */
  52475. var components = geometry.components;
  52476. //节点像素坐标
  52477. var localLX = [];
  52478. //参考位置,参考中心为
  52479. var refLocal = [];
  52480. var location = this.location;
  52481. var pointList = [];
  52482. //节点抽稀距离
  52483. var nCPx = this.nodesClipPixel;
  52484. for (var i = 0; i < components.length; i++) {
  52485. var components_i = components[i];
  52486. refLocal = [];
  52487. localLX = this.getLocalXY(components_i);
  52488. refLocal[0] = localLX[0] - location[0];
  52489. refLocal[1] = localLX[1] - location[1];
  52490. //抽稀
  52491. if (pointList.length > 0) {
  52492. var lastLocalXY = pointList[pointList.length - 1];
  52493. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  52494. continue;
  52495. }
  52496. }
  52497. //使用参考点
  52498. pointList.push(refLocal);
  52499. //赋 style
  52500. var style = new Object();
  52501. style.r = 6; //防止漏设此参数,默认 6 像素
  52502. style = Util.copyAttributesWithClip(style, this.style);
  52503. style.x = refLocal[0];
  52504. style.y = refLocal[1];
  52505. //创建图形
  52506. var shape = new SmicPoint({
  52507. style: style,
  52508. clickable: this.isClickAble,
  52509. hoverable: this.isHoverAble
  52510. });
  52511. //设置高亮样式
  52512. if (this.highlightStyle) {
  52513. shape.highlightStyle = this.highlightStyle;
  52514. }
  52515. //设置参考中心,指定图形位置
  52516. shape.refOriginalPosition = location;
  52517. //储存数据 id 属性,用于事件
  52518. shape.refDataID = this.data.id;
  52519. //储存数据 id 属性,用于事件-多图形同时高亮
  52520. shape.isHoverByRefDataID = this.isMultiHover;
  52521. //修改一些 shape 可选属性,通常不需要这么做
  52522. if (this.shapeOptions) {
  52523. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52524. }
  52525. this.shapes.push(shape);
  52526. }
  52527. }
  52528. /**
  52529. * @function SuperMap.Feature.Theme.Vector.prototype.multiLineStringToTF
  52530. * @description 转换多线要素。
  52531. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiLineString。
  52532. */
  52533. multiLineStringToTF(geometry) {
  52534. var components = geometry.components;
  52535. for (var i = 0; i < components.length; i++) {
  52536. var components_i = components[i];
  52537. this.lineToTF(components_i);
  52538. }
  52539. }
  52540. /**
  52541. * @function SuperMap.Feature.Theme.Vector.prototype.multiPolygonToTF
  52542. * @description 转换多面要素。
  52543. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 MultiPolygon。
  52544. */
  52545. multiPolygonToTF(geometry) {
  52546. var components = geometry.components;
  52547. for (var i = 0; i < components.length; i++) {
  52548. var components_i = components[i];
  52549. this.polygonToTF(components_i);
  52550. }
  52551. }
  52552. /**
  52553. * @function SuperMap.Feature.Theme.Vector.prototype.pointToTF
  52554. * @description 转换点要素。
  52555. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Point。
  52556. */
  52557. pointToTF(geometry) {
  52558. //参考位置,参考中心为
  52559. var location = this.location;
  52560. //geometry 像素坐标
  52561. var localLX = this.getLocalXY(geometry);
  52562. //赋 style
  52563. var style = new Object();
  52564. style.r = 6; //防止漏设此参数,默认 6 像素
  52565. style = Util.copyAttributesWithClip(style, this.style);
  52566. style.x = localLX[0] - location[0];
  52567. style.y = localLX[1] - location[1];
  52568. //创建图形
  52569. var shape = new SmicPoint({
  52570. style: style,
  52571. clickable: this.isClickAble,
  52572. hoverable: this.isHoverAble
  52573. });
  52574. //设置高亮样式
  52575. if (this.highlightStyle) {
  52576. shape.highlightStyle = this.highlightStyle;
  52577. }
  52578. //设置参考中心,指定图形位置
  52579. shape.refOriginalPosition = location;
  52580. //储存数据 id 属性,用于事件
  52581. shape.refDataID = this.data.id;
  52582. //储存数据 id 属性,用于事件-多图形同时高亮
  52583. shape.isHoverByRefDataID = this.isMultiHover;
  52584. //修改一些 shape 可选属性,通常不需要这么做
  52585. if (this.shapeOptions) {
  52586. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52587. }
  52588. this.shapes.push(shape);
  52589. }
  52590. /**
  52591. * @function SuperMap.Feature.Theme.Vector.prototype.polygonToThemeFeature
  52592. * @description 转换面要素。
  52593. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Polygon。
  52594. */
  52595. polygonToTF(geometry) {
  52596. var components = geometry.components;
  52597. //节点像素坐标
  52598. var localLX = [];
  52599. //参考位置,参考中心为
  52600. var refLocal = [];
  52601. var location = this.location;
  52602. var pointList = [];
  52603. //岛洞
  52604. var holePolygonPointList = [];
  52605. var holePolygonPointLists = [];
  52606. //节点抽稀距离
  52607. var nCPx = this.nodesClipPixel;
  52608. for (var i = 0; i < components.length; i++) {
  52609. var components_i = components[i].components;
  52610. if (i === 0) {
  52611. // 第一个 component 正常绘制
  52612. pointList = [];
  52613. for (var j = 0; j < components_i.length; j++) {
  52614. refLocal = [];
  52615. localLX = this.getLocalXY(components_i[j]);
  52616. refLocal[0] = localLX[0] - location[0];
  52617. refLocal[1] = localLX[1] - location[1];
  52618. //抽稀 - 2 px
  52619. if (pointList.length > 0) {
  52620. var lastLocalXY = pointList[pointList.length - 1];
  52621. if ((Math.abs(lastLocalXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastLocalXY[1] - refLocal[1]) <= nCPx)) {
  52622. continue;
  52623. }
  52624. }
  52625. //使用参考点
  52626. pointList.push(refLocal);
  52627. }
  52628. } else {
  52629. // 其它 component 作为岛洞
  52630. holePolygonPointList = [];
  52631. for (var k = 0; k < components_i.length; k++) {
  52632. refLocal = [];
  52633. localLX = this.getLocalXY(components_i[k]);
  52634. refLocal[0] = localLX[0] - location[0];
  52635. refLocal[1] = localLX[1] - location[1];
  52636. //抽稀 - 2 px
  52637. if (holePolygonPointList.length > 0) {
  52638. var lastXY = holePolygonPointList[holePolygonPointList.length - 1];
  52639. if ((Math.abs(lastXY[0] - refLocal[0]) <= nCPx) && (Math.abs(lastXY[1] - refLocal[1]) <= nCPx)) {
  52640. continue;
  52641. }
  52642. }
  52643. //使用参考点
  52644. holePolygonPointList.push(refLocal);
  52645. }
  52646. }
  52647. if (holePolygonPointList.length < 2) {
  52648. continue;
  52649. }
  52650. holePolygonPointLists.push(holePolygonPointList);
  52651. }
  52652. if (pointList.length < 2) {
  52653. return;
  52654. }
  52655. //赋 style
  52656. var style = {};
  52657. style = Util.copyAttributesWithClip(style, this.style, ['pointList']);
  52658. style.pointList = pointList;
  52659. //创建图形
  52660. var shape = new SmicPolygon({
  52661. style: style,
  52662. clickable: this.isClickAble,
  52663. hoverable: this.isHoverAble
  52664. });
  52665. //设置高亮样式
  52666. if (this.highlightStyle) {
  52667. shape.highlightStyle = this.highlightStyle;
  52668. }
  52669. //设置参考中心,指定图形位置
  52670. shape.refOriginalPosition = this.location;
  52671. //储存数据 id 属性,用于事件
  52672. shape.refDataID = this.data.id;
  52673. //储存数据 id 属性,用于事件-多图形同时高亮
  52674. shape.isHoverByRefDataID = this.isMultiHover;
  52675. //岛洞面
  52676. if (holePolygonPointLists.length > 0) {
  52677. shape.holePolygonPointLists = holePolygonPointLists;
  52678. }
  52679. //修改一些 shape 可选属性,通常不需要这么做
  52680. if (this.shapeOptions) {
  52681. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52682. }
  52683. this.shapes.push(shape);
  52684. }
  52685. /**
  52686. * @function SuperMap.Feature.Theme.Vector.prototype.rectangleToTF
  52687. * @description 转换矩形要素。
  52688. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 Rectangle。
  52689. */
  52690. rectangleToTF(geometry) {
  52691. //参考位置,参考中心为
  52692. var location = this.location;
  52693. var ll = new LonLat(geometry.x, geometry.y);
  52694. //地图分辨率
  52695. var res = this.layer.map.getResolution();
  52696. //geometry 像素坐标
  52697. var localLX = this.getLocalXY(ll);
  52698. //赋 style
  52699. var style = new Object();
  52700. style.r = 6; //防止漏设此参数,默认 6 像素
  52701. style = Util.copyAttributesWithClip(style, this.style);
  52702. style.x = localLX[0] - location[0];
  52703. // SuperMap.Geometry.Rectangle 使用左下角定位, SmicRectangle 使用左上角定位,需要转换
  52704. style.y = (localLX[1] - location[1]) - 2 * geometry.width / res;
  52705. style.width = geometry.width / res;
  52706. style.height = geometry.height / res;
  52707. //创建图形
  52708. var shape = new SmicRectangle({
  52709. style: style,
  52710. clickable: this.isClickAble,
  52711. hoverable: this.isHoverAble
  52712. });
  52713. //设置高亮样式
  52714. if (this.highlightStyle) {
  52715. shape.highlightStyle = this.highlightStyle;
  52716. }
  52717. //设置参考中心,指定图形位置
  52718. shape.refOriginalPosition = location;
  52719. //储存数据 id 属性,用于事件
  52720. shape.refDataID = this.data.id;
  52721. //储存数据 id 属性,用于事件-多图形同时高亮
  52722. shape.isHoverByRefDataID = this.isMultiHover;
  52723. //修改一些 shape 可选属性,通常不需要这么做
  52724. if (this.shapeOptions) {
  52725. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52726. }
  52727. this.shapes.push(shape);
  52728. }
  52729. /**
  52730. * @function SuperMap.Feature.Theme.Vector.prototype.geoTextToTF
  52731. * @description 转换文本要素。
  52732. * @param {SuperMap.Geometry} geometry - 用户数据几何地理信息,这里必须是 GeoText。
  52733. */
  52734. geoTextToTF(geometry) {
  52735. //参考位置,参考中心为
  52736. var location = this.location;
  52737. //geometry 像素坐标
  52738. var localLX = this.getLocalXY(geometry);
  52739. //赋 style
  52740. var style = new Object();
  52741. style.r = 6; //防止漏设此参数,默认 6 像素
  52742. style = Util.copyAttributesWithClip(style, this.style, ["x", "y", "text"]);
  52743. style.x = localLX[0] - location[0];
  52744. style.y = localLX[1] - location[1];
  52745. style.text = geometry.text;
  52746. //创建图形
  52747. var shape = new SmicText({
  52748. style: style,
  52749. clickable: this.isClickAble,
  52750. hoverable: this.isHoverAble
  52751. });
  52752. //设置高亮样式
  52753. if (this.highlightStyle) {
  52754. shape.highlightStyle = this.highlightStyle;
  52755. }
  52756. //设置参考中心,指定图形位置
  52757. shape.refOriginalPosition = location;
  52758. //储存数据 id 属性,用于事件
  52759. shape.refDataID = this.data.id;
  52760. //储存数据 id 属性,用于事件-多图形同时高亮
  52761. shape.isHoverByRefDataID = this.isMultiHover;
  52762. //修改一些 shape 可选属性,通常不需要这么做
  52763. if (this.shapeOptions) {
  52764. Util.copyAttributesWithClip(shape, this.shapeOptions);
  52765. }
  52766. this.shapes.push(shape);
  52767. }
  52768. /**
  52769. * @function SuperMap.Feature.Theme.Vector.prototype.updateAndAddShapes
  52770. * @description 修改位置,针对地图平移操作,地图漫游操作后调用此函数。
  52771. */
  52772. updateAndAddShapes() {
  52773. var newLocalLX = this.getLocalXY(this.lonlat);
  52774. this.location = newLocalLX;
  52775. var render = this.layer.renderer;
  52776. for (var i = 0, len = this.shapes.length; i < len; i++) {
  52777. var shape = this.shapes[i];
  52778. //设置参考中心,指定图形位置
  52779. shape.refOriginalPosition = newLocalLX;
  52780. render.addShape(shape);
  52781. }
  52782. }
  52783. /**
  52784. * @function SuperMap.Feature.Theme.Vector.prototype.getShapesCount
  52785. * @description 获得专题要素中可视化图形的数量。
  52786. * @returns {number} 可视化图形的数量。
  52787. */
  52788. getShapesCount() {
  52789. return this.shapes.length;
  52790. }
  52791. /**
  52792. * @function SuperMap.Feature.Theme.Vector.prototype.getLocalXY
  52793. * @description 地理坐标转为像素坐标。
  52794. * @param {SuperMap.LonLat} lonlat - 专题要素地理位置。
  52795. */
  52796. getLocalXY(lonlat) {
  52797. return this.layer.getLocalXY(lonlat);
  52798. }
  52799. }
  52800. SuperMap.Feature.Theme.ThemeVector = ThemeVector;
  52801. ;// CONCATENATED MODULE: ./src/common/overlay/feature/index.js
  52802. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52803. * This program are made available under the terms of the Apache License, Version 2.0
  52804. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52805. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Group.js
  52806. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  52807. * This program are made available under the terms of the Apache License, Version 2.0
  52808. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  52809. /**
  52810. * @class SuperMap.LevelRenderer.Group
  52811. * @category Visualization Theme
  52812. * @private
  52813. * @classdesc Group 是一个容器,可以插入子节点,Group 的变换也会被应用到子节点上。
  52814. * @extends {SuperMap.LevelRenderer.Transformable}
  52815. * (code)
  52816. * var g = new SuperMap.LevelRenderer.Group();
  52817. * var Circle = new SuperMap.LevelRenderer.Shape.Circle();
  52818. * g.position[0] = 100;
  52819. * g.position[1] = 100;
  52820. * g.addChild(new Circle({
  52821. * style: {
  52822. * x: 100,
  52823. * y: 100,
  52824. * r: 20,
  52825. * brushType: 'fill'
  52826. * }
  52827. * }));
  52828. * LR.addGroup(g);
  52829. * (end)
  52830. */
  52831. class Group extends SuperMap.mixin(Eventful, Transformable) {
  52832. /**
  52833. * @function SuperMap.LevelRenderer.Group.prototype.constructor
  52834. * @description 构造函数。
  52835. * @param {Array} options - Group 的配置(options)项,可以是 Group 的自有属性,也可以是自定义的属性。
  52836. */
  52837. constructor(options) {
  52838. super(options)
  52839. options = options || {};
  52840. /**
  52841. * @member {string} SuperMap.LevelRenderer.Group.prototype.id
  52842. * @description Group 的唯一标识。
  52843. */
  52844. this.id = null;
  52845. /**
  52846. * @readonly
  52847. * @member {string} [SuperMap.LevelRenderer.Group.prototype.type='group']
  52848. * @description 类型。
  52849. */
  52850. this.type = 'group';
  52851. //http://www.w3.org/TR/2dcontext/#clipping-region
  52852. /**
  52853. * @member {string} SuperMap.LevelRenderer.Group.prototype.clipShape
  52854. * @description 用于裁剪的图形(shape),所有 Group 内的图形在绘制时都会被这个图形裁剪,该图形会继承 Group 的变换。
  52855. */
  52856. this.clipShape = null;
  52857. /**
  52858. * @member {Array} SuperMap.LevelRenderer.Group.prototype._children
  52859. * @description _children。
  52860. */
  52861. this._children = [];
  52862. /**
  52863. * @member {Array} SuperMap.LevelRenderer.Group.prototype._storage
  52864. * @description _storage。
  52865. */
  52866. this._storage = null;
  52867. /**
  52868. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.__dirty=true]
  52869. * @description __dirty。
  52870. */
  52871. this.__dirty = true;
  52872. /**
  52873. * @member {boolean} [SuperMap.LevelRenderer.Group.prototype.ignore=false]
  52874. * @description 是否忽略该 Group 及其所有子节点。
  52875. */
  52876. this.ignore = false;
  52877. Util.extend(this, options);
  52878. this.id = this.id || Util.createUniqueID("smShapeGroup_");
  52879. this.CLASS_NAME = "SuperMap.LevelRenderer.Group";
  52880. }
  52881. /**
  52882. * @function SuperMap.LevelRenderer.Group.prototype.destroy
  52883. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  52884. */
  52885. destroy() {
  52886. this.id = null;
  52887. this.type = null;
  52888. this.clipShape = null;
  52889. this._children = null;
  52890. this._storage = null;
  52891. this.__dirty = null;
  52892. this.ignore = null;
  52893. super.destroy();
  52894. }
  52895. /**
  52896. * @function SuperMap.LevelRenderer.Group.prototype.children
  52897. * @description 复制并返回一份新的包含所有儿子节点的数组。
  52898. * @returns {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  52899. */
  52900. children() {
  52901. return this._children.slice();
  52902. }
  52903. /**
  52904. * @function SuperMap.LevelRenderer.Group.prototype.childAt
  52905. * @description 获取指定 index 的儿子节点
  52906. * @param {number} idx - 节点索引。
  52907. * @returns {SuperMap.LevelRenderer.Shape} 图形。
  52908. */
  52909. childAt(idx) {
  52910. return this._children[idx];
  52911. }
  52912. /**
  52913. * @function SuperMap.LevelRenderer.Group.prototype.addChild
  52914. * @description 添加子节点,可以是 Shape 或者 Group。
  52915. * @param {(SuperMap.LevelRenderer.Shape|SuperMap.LevelRenderer.Group)} child - 节点图形。
  52916. */
  52917. // TODO Type Check
  52918. addChild(child) {
  52919. if (child == this) {
  52920. return;
  52921. }
  52922. if (child.parent == this) {
  52923. return;
  52924. }
  52925. if (child.parent) {
  52926. child.parent.removeChild(child);
  52927. }
  52928. this._children.push(child);
  52929. child.parent = this;
  52930. if (this._storage && this._storage !== child._storage) {
  52931. this._storage.addToMap(child);
  52932. if (child instanceof Group) {
  52933. child.addChildrenToStorage(this._storage);
  52934. }
  52935. }
  52936. }
  52937. /**
  52938. * @function SuperMap.LevelRenderer.Group.prototype.removeChild
  52939. * @description 移除子节点。
  52940. * @param {SuperMap.LevelRenderer.Shape} child - 需要移除的子节点图形。
  52941. */
  52942. removeChild(child) {
  52943. var idx = Util.indexOf(this._children, child);
  52944. this._children.splice(idx, 1);
  52945. child.parent = null;
  52946. if (this._storage) {
  52947. this._storage.delFromMap(child.id);
  52948. if (child instanceof Group) {
  52949. child.delChildrenFromStorage(this._storage);
  52950. }
  52951. }
  52952. }
  52953. /**
  52954. * @function SuperMap.LevelRenderer.Group.prototype.eachChild
  52955. * @description 遍历所有子节点。
  52956. * @param {function} cb - 回调函数。
  52957. * @param {Object} context - 上下文。
  52958. */
  52959. eachChild(cb, context) {
  52960. var haveContext = !!context;
  52961. for (var i = 0; i < this._children.length; i++) {
  52962. var child = this._children[i];
  52963. if (haveContext) {
  52964. cb.call(context, child);
  52965. } else {
  52966. cb(child);
  52967. }
  52968. }
  52969. }
  52970. /**
  52971. * @function SuperMap.LevelRenderer.Group.prototype.traverse
  52972. * @description 深度优先遍历所有子孙节点。
  52973. * @param {function} cb - 回调函数。
  52974. * @param {Object} context - 上下文。
  52975. */
  52976. traverse(cb, context) {
  52977. var haveContext = !!context;
  52978. for (var i = 0; i < this._children.length; i++) {
  52979. var child = this._children[i];
  52980. if (haveContext) {
  52981. cb.call(context, child);
  52982. } else {
  52983. cb(child);
  52984. }
  52985. if (child.type === 'group') {
  52986. child.traverse(cb, context);
  52987. }
  52988. }
  52989. }
  52990. /**
  52991. * @function SuperMap.LevelRenderer.Group.prototype.addChildrenToStorage
  52992. * @description 把子图形添加到仓库。
  52993. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  52994. */
  52995. addChildrenToStorage(storage) {
  52996. for (var i = 0; i < this._children.length; i++) {
  52997. var child = this._children[i];
  52998. storage.addToMap(child);
  52999. if (child.type === 'group') {
  53000. child.addChildrenToStorage(storage);
  53001. }
  53002. }
  53003. }
  53004. /**
  53005. * @function SuperMap.LevelRenderer.Group.prototype.delChildrenFromStorage
  53006. * @description 从仓库把子图形删除。
  53007. * @param {SuperMap.LevelRenderer.Storage} storage - 图形仓库。
  53008. */
  53009. delChildrenFromStorage(storage) {
  53010. for (var i = 0; i < this._children.length; i++) {
  53011. var child = this._children[i];
  53012. storage.delFromMap(child.id);
  53013. if (child.type === 'group') {
  53014. child.delChildrenFromStorage(storage);
  53015. }
  53016. }
  53017. }
  53018. /**
  53019. * @function SuperMap.LevelRenderer.Group.prototype.modSelf
  53020. * @description 是否修改。
  53021. */
  53022. modSelf() {
  53023. this.__dirty = true;
  53024. }
  53025. }
  53026. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Storage.js
  53027. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53028. * This program are made available under the terms of the Apache License, Version 2.0
  53029. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53030. /**
  53031. * @private
  53032. * @class SuperMap.LevelRenderer.Storage
  53033. * @category Visualization Theme
  53034. * @classdesc 内容(图像)仓库 (M) 。
  53035. */
  53036. class Storage {
  53037. /**
  53038. * @function SuperMap.LevelRenderer.Storage.constructor
  53039. * @description 构造函数。
  53040. */
  53041. constructor() {
  53042. /**
  53043. * @member {Object} SuperMap.LevelRenderer.Storage.prototype._elements
  53044. * @description 所有常规形状,id 索引的 map。
  53045. */
  53046. this._elements = {};
  53047. /**
  53048. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._hoverElements
  53049. * @description 高亮层形状,不稳定,动态增删,数组位置也是 z 轴方向,靠前显示在下方。
  53050. *
  53051. */
  53052. this._hoverElements = [];
  53053. /**
  53054. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._roots
  53055. * @description _roots。
  53056. *
  53057. */
  53058. this._roots = [];
  53059. /**
  53060. * @member {Array} SuperMap.LevelRenderer.Storage.prototype._shapeList
  53061. * @description _shapeList。
  53062. *
  53063. */
  53064. this._shapeList = [];
  53065. /**
  53066. * @member {number} SuperMap.LevelRenderer.Storage.prototype._shapeListOffset
  53067. * @description _shapeListOffset。默认值:0。
  53068. *
  53069. */
  53070. this._shapeListOffset = 0;
  53071. this.CLASS_NAME = "SuperMap.LevelRenderer.Storage";
  53072. }
  53073. /**
  53074. * @function SuperMap.LevelRenderer.Storage.prototype.destroy
  53075. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  53076. */
  53077. destroy() {
  53078. this.dispose();
  53079. this._shapeList = null;
  53080. this._shapeListOffset = null;
  53081. }
  53082. /**
  53083. * @function SuperMap.LevelRenderer.Storage.prototype.iterShape
  53084. * @description 遍历迭代器。
  53085. *
  53086. * @param {Function} fun - 迭代回调函数,return true终止迭代。
  53087. * @param {Object} option - 迭代参数,缺省为仅降序遍历普通层图形。
  53088. * @param {boolean} [hover=true] - 是否是高亮层图形。
  53089. * @param {string} [normal='down'] - 是否是普通层图形,迭代时是否指定及z轴顺序。可设值:'down' ,'up'。
  53090. * @param {boolean} [update=false] - 是否在迭代前更新形状列表。
  53091. * @return {SuperMap.LevelRenderer.Storage} this。
  53092. */
  53093. iterShape(fun, option) {
  53094. if (!option) {
  53095. var defaultIterateOption = {
  53096. hover: false,
  53097. normal: 'down',
  53098. update: false
  53099. };
  53100. option = defaultIterateOption;
  53101. }
  53102. if (option.hover) {
  53103. // 高亮层数据遍历
  53104. for (var i = 0, l = this._hoverElements.length; i < l; i++) {
  53105. var el = this._hoverElements[i];
  53106. el.updateTransform();
  53107. if (fun(el)) {
  53108. return this;
  53109. }
  53110. }
  53111. }
  53112. if (option.update) {
  53113. this.updateShapeList();
  53114. }
  53115. // 遍历: 'down' | 'up'
  53116. switch (option.normal) {
  53117. case 'down':
  53118. {
  53119. // 降序遍历,高层优先
  53120. let l = this._shapeList.length;
  53121. while (l--) {
  53122. if (fun(this._shapeList[l])) {
  53123. return this;
  53124. }
  53125. }
  53126. break;
  53127. }
  53128. // case 'up':
  53129. default:
  53130. {
  53131. // 升序遍历,底层优先
  53132. for (let i = 0, l = this._shapeList.length; i < l; i++) {
  53133. if (fun(this._shapeList[i])) {
  53134. return this;
  53135. }
  53136. }
  53137. break;
  53138. }
  53139. }
  53140. return this;
  53141. }
  53142. /**
  53143. * @function SuperMap.LevelRenderer.Storage.prototype.getHoverShapes
  53144. * @param {boolean} [update=false] - 是否在返回前更新图形的变换。
  53145. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  53146. */
  53147. getHoverShapes(update) {
  53148. // hoverConnect
  53149. var hoverElements = [], len = this._hoverElements.length;
  53150. for (let i = 0; i < len; i++) {
  53151. hoverElements.push(this._hoverElements[i]);
  53152. var target = this._hoverElements[i].hoverConnect;
  53153. if (target) {
  53154. var shape;
  53155. target = target instanceof Array ? target : [target];
  53156. for (var j = 0, k = target.length; j < k; j++) {
  53157. shape = target[j].id ? target[j] : this.get(target[j]);
  53158. if (shape) {
  53159. hoverElements.push(shape);
  53160. }
  53161. }
  53162. }
  53163. }
  53164. hoverElements.sort(Storage.shapeCompareFunc);
  53165. if (update) {
  53166. for (let i = 0, l = hoverElements.length; i < l; i++) {
  53167. hoverElements[i].updateTransform();
  53168. }
  53169. }
  53170. return hoverElements;
  53171. }
  53172. /**
  53173. * @function SuperMap.LevelRenderer.Storage.prototype.getShapeList
  53174. * @description 返回所有图形的绘制队列。
  53175. *
  53176. * @param {boolean} [update=false] - 是否在返回前更新该数组。 详见:<SuperMap.LevelRenderer.Shape> updateShapeList。
  53177. * @return {SuperMap.LevelRenderer.Shape} 图形。
  53178. */
  53179. getShapeList(update) {
  53180. if (update) {
  53181. this.updateShapeList();
  53182. }
  53183. return this._shapeList;
  53184. }
  53185. /**
  53186. * @function SuperMap.LevelRenderer.Storage.prototype.updateShapeList
  53187. * @description 更新图形的绘制队列。每次绘制前都会调用,该方法会先深度优先遍历整个树,更新所有Group和Shape的变换并且把所有可见的Shape保存到数组中,最后根据绘制的优先级(zlevel > z > 插入顺序)排序得到绘制队列。
  53188. */
  53189. updateShapeList() {
  53190. this._shapeListOffset = 0;
  53191. var rootsLen = this._roots.length;
  53192. for (let i = 0; i < rootsLen; i++) {
  53193. let root = this._roots[i];
  53194. this._updateAndAddShape(root);
  53195. }
  53196. this._shapeList.length = this._shapeListOffset;
  53197. var shapeListLen = this._shapeList.length;
  53198. for (let i = 0; i < shapeListLen; i++) {
  53199. this._shapeList[i].__renderidx = i;
  53200. }
  53201. this._shapeList.sort(Storage.shapeCompareFunc);
  53202. }
  53203. /**
  53204. * @function SuperMap.LevelRenderer.Storage.prototype._updateAndAddShape
  53205. * @description 更新并添加图形。
  53206. *
  53207. */
  53208. _updateAndAddShape(el, clipShapes) {
  53209. if (el.ignore) {
  53210. return;
  53211. }
  53212. el.updateTransform();
  53213. if (el.type == 'group') {
  53214. if (el.clipShape) {
  53215. // clipShape 的变换是基于 group 的变换
  53216. el.clipShape.parent = el;
  53217. el.clipShape.updateTransform();
  53218. // PENDING 效率影响
  53219. if (clipShapes) {
  53220. clipShapes = clipShapes.slice();
  53221. clipShapes.push(el.clipShape);
  53222. } else {
  53223. clipShapes = [el.clipShape];
  53224. }
  53225. }
  53226. for (var i = 0; i < el._children.length; i++) {
  53227. var child = el._children[i];
  53228. // Force to mark as dirty if group is dirty
  53229. child.__dirty = el.__dirty || child.__dirty;
  53230. this._updateAndAddShape(child, clipShapes);
  53231. }
  53232. // Mark group clean here
  53233. el.__dirty = false;
  53234. } else {
  53235. el.__clipShapes = clipShapes;
  53236. this._shapeList[this._shapeListOffset++] = el;
  53237. }
  53238. }
  53239. /**
  53240. * @function SuperMap.LevelRenderer.Storage.prototype.mod
  53241. * @description 修改图形(Shape)或者组(Group)。
  53242. *
  53243. * @param {string} elId - 唯一标识。
  53244. * @param {Object} params - 参数。
  53245. * @return {SuperMap.LevelRenderer.Storage} this。
  53246. */
  53247. mod(elId, params) {
  53248. var el = this._elements[elId];
  53249. if (el) {
  53250. el.modSelf();
  53251. if (params) {
  53252. // 如果第二个参数直接使用 shape
  53253. // parent, _storage, __startClip 三个属性会有循环引用
  53254. // 主要为了向 1.x 版本兼容,2.x 版本不建议使用第二个参数
  53255. if (params.parent || params._storage || params.__startClip) {
  53256. var target = {};
  53257. for (var name in params) {
  53258. if (
  53259. name == 'parent'
  53260. || name == '_storage'
  53261. || name == '__startClip'
  53262. ) {
  53263. continue;
  53264. }
  53265. if (params.hasOwnProperty(name)) {
  53266. target[name] = params[name];
  53267. }
  53268. }
  53269. new Util_Util().merge(el, target, true);
  53270. } else {
  53271. new Util_Util().merge(el, params, true);
  53272. }
  53273. }
  53274. }
  53275. return this;
  53276. }
  53277. /**
  53278. * @function SuperMap.LevelRenderer.Storage.prototype.drift
  53279. * @description 移动指定的图形(Shape)的位置。
  53280. * @param {string} shapeId - 唯一标识。
  53281. * @param {number} dx
  53282. * @param {number} dy
  53283. * @return {SuperMap.LevelRenderer.Storage} this。
  53284. */
  53285. drift(shapeId, dx, dy) {
  53286. var shape = this._elements[shapeId];
  53287. if (shape) {
  53288. shape.needTransform = true;
  53289. if (shape.draggable === 'horizontal') {
  53290. dy = 0;
  53291. } else if (shape.draggable === 'vertical') {
  53292. dx = 0;
  53293. }
  53294. if (!shape.ondrift // ondrift
  53295. // 有onbrush并且调用执行返回false或undefined则继续
  53296. || (shape.ondrift && !shape.ondrift(dx, dy))
  53297. ) {
  53298. shape.drift(dx, dy);
  53299. }
  53300. }
  53301. return this;
  53302. }
  53303. /**
  53304. * @function SuperMap.LevelRenderer.Storage.prototype.addHover
  53305. * @description 添加高亮层数据。
  53306. * @param {SuperMap.LevelRenderer.Shape} shape - 图形。
  53307. * @return {SuperMap.LevelRenderer.Storage} this。
  53308. */
  53309. addHover(shape) {
  53310. shape.updateNeedTransform();
  53311. this._hoverElements.push(shape);
  53312. return this;
  53313. }
  53314. /**
  53315. * @function SuperMap.LevelRenderer.Storage.prototype.delHover
  53316. * @description 清空高亮层数据。
  53317. * @return {SuperMap.LevelRenderer.Storage} this。
  53318. */
  53319. delHover() {
  53320. this._hoverElements = [];
  53321. return this;
  53322. }
  53323. /**
  53324. * @function SuperMap.LevelRenderer.Storage.prototype.hasHoverShape
  53325. * @description 是否有图形在高亮层里。
  53326. * @return {boolean} 是否有图形在高亮层里。
  53327. */
  53328. hasHoverShape() {
  53329. return this._hoverElements.length > 0;
  53330. }
  53331. /**
  53332. * @function SuperMap.LevelRenderer.Storage.prototype.addRoot
  53333. * @description 添加图形(Shape)或者组(Group)到根节点。
  53334. *
  53335. * @param {(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)} el - 图形。
  53336. *
  53337. */
  53338. addRoot(el) {
  53339. if (el instanceof Group) {
  53340. el.addChildrenToStorage(this);
  53341. }
  53342. this.addToMap(el);
  53343. this._roots.push(el);
  53344. }
  53345. /**
  53346. * @function SuperMap.LevelRenderer.Storage.prototype.delRoot
  53347. * @description 删除指定的图形(Shape)或者组(Group)。
  53348. *
  53349. * @param {Array.<string>} elId - 删除图形(Shape)或者组(Group)的 id 数组。如果为空清空整个Storage。
  53350. *
  53351. */
  53352. delRoot(elId) {
  53353. if (typeof(elId) == 'undefined') {
  53354. // 不指定elId清空
  53355. for (var i = 0; i < this._roots.length; i++) {
  53356. var root = this._roots[i];
  53357. if (root instanceof Group) {
  53358. root.delChildrenFromStorage(this);
  53359. }
  53360. }
  53361. this._elements = {};
  53362. this._hoverElements = [];
  53363. this._roots = [];
  53364. return;
  53365. }
  53366. if (elId instanceof Array) {
  53367. var elIdLen = elId.length;
  53368. for (let i = 0; i < elIdLen; i++) {
  53369. this.delRoot(elId[i]);
  53370. }
  53371. return;
  53372. }
  53373. var el;
  53374. if (typeof(elId) == 'string') {
  53375. el = this._elements[elId];
  53376. } else {
  53377. el = elId;
  53378. }
  53379. var idx = new Util_Util().indexOf(this._roots, el);
  53380. if (idx >= 0) {
  53381. this.delFromMap(el.id);
  53382. this._roots.splice(idx, 1);
  53383. if (el instanceof Group) {
  53384. el.delChildrenFromStorage(this);
  53385. }
  53386. }
  53387. }
  53388. /**
  53389. * @function SuperMap.LevelRenderer.Storage.prototype.addToMap
  53390. * @description 添加图形到 map。
  53391. *
  53392. * @param {SuperMap.LevelRenderer.Shape} el - 图形。
  53393. * @return {SuperMap.LevelRenderer.Storage} this。
  53394. */
  53395. addToMap(el) {
  53396. if (el instanceof Group) {
  53397. el._storage = this;
  53398. }
  53399. el.modSelf();
  53400. this._elements[el.id] = el;
  53401. return this;
  53402. }
  53403. /**
  53404. * @function SuperMap.LevelRenderer.Storage.prototype.get
  53405. * @description 获取指定图形。
  53406. *
  53407. * @param {string} elId - 图形 id。
  53408. * @return {SuperMap.LevelRenderer.Shape} 图形。
  53409. */
  53410. get(elId) {
  53411. return this._elements[elId];
  53412. }
  53413. /**
  53414. * @function SuperMap.LevelRenderer.Storage.prototype.delFromMap
  53415. * @description 从 map 中删除指定图形。
  53416. *
  53417. * @param {string} elId - 图形id。
  53418. * @return {SuperMap.LevelRenderer.Storage} this。
  53419. */
  53420. delFromMap(elId) {
  53421. var el = this._elements[elId];
  53422. if (el) {
  53423. delete this._elements[elId];
  53424. if (el instanceof Group) {
  53425. el._storage = null;
  53426. }
  53427. }
  53428. return this;
  53429. }
  53430. /**
  53431. * @function SuperMap.LevelRenderer.Storage.prototype.dispose
  53432. * @description 清空并且释放 Storage。
  53433. */
  53434. dispose() {
  53435. this._elements = null;
  53436. // this._renderList = null;
  53437. this._roots = null;
  53438. this._hoverElements = null;
  53439. }
  53440. static shapeCompareFunc(a, b) {
  53441. if (a.zlevel == b.zlevel) {
  53442. if (a.z == b.z) {
  53443. return a.__renderidx - b.__renderidx;
  53444. }
  53445. return a.z - b.z;
  53446. }
  53447. return a.zlevel - b.zlevel;
  53448. }
  53449. }
  53450. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Painter.js
  53451. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  53452. * This program are made available under the terms of the Apache License, Version 2.0
  53453. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  53454. /**
  53455. * @private
  53456. * @class SuperMap.LevelRenderer.Painter
  53457. * @category Visualization Theme
  53458. * @classdesc Painter 绘图模块。
  53459. */
  53460. class Painter {
  53461. /**
  53462. * @function SuperMap.LevelRenderer.Painter.constructor
  53463. * @description 构造函数。
  53464. *
  53465. * @param {HTMLElement} root - 绘图区域(DIV)。
  53466. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  53467. *
  53468. */
  53469. constructor(root, storage) {
  53470. /**
  53471. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype.root
  53472. * @description 绘图容器。
  53473. *
  53474. */
  53475. this.root = root;
  53476. /**
  53477. * @member {Array} SuperMap.LevelRenderer.Painter.prototype.storage
  53478. * @description 图形仓库。
  53479. *
  53480. */
  53481. this.storage = storage;
  53482. /**
  53483. * @member {HTMLElement} SuperMap.LevelRenderer.Painter.prototype._domRoot
  53484. * @description 容器根 dom 对象。
  53485. *
  53486. */
  53487. this._domRoot = null;
  53488. /**
  53489. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layers
  53490. * @description 绘制层对象。
  53491. *
  53492. */
  53493. this._layers = {};
  53494. /**
  53495. * @member {Array} SuperMap.LevelRenderer.Painter.prototype._zlevelList
  53496. * @description 层列表。
  53497. *
  53498. */
  53499. this._zlevelList = [];
  53500. /**
  53501. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._layerConfig
  53502. * @description 绘制层配置对象。
  53503. *
  53504. */
  53505. this._layerConfig = {};
  53506. /**
  53507. * @member {Object} SuperMap.LevelRenderer.Painter.prototype._bgDom
  53508. * @description 背景层 Canvas (Dom)。
  53509. *
  53510. */
  53511. this._bgDom = null;
  53512. /**
  53513. * @member {Function} SuperMap.LevelRenderer.Painter.prototype.shapeToImage
  53514. * @description 形状转图像函数。
  53515. *
  53516. */
  53517. this.shapeToImage = null;
  53518. // retina 屏幕优化
  53519. Painter.devicePixelRatio = Math.max((window.devicePixelRatio || 1), 1);
  53520. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter";
  53521. this.root.innerHTML = '';
  53522. this._width = this._getWidth(); // 宽,缓存记录
  53523. this._height = this._getHeight(); // 高,缓存记录
  53524. var domRoot = document.createElement('div');
  53525. this._domRoot = domRoot;
  53526. // domRoot.onselectstart = returnFalse; // 避免页面选中的尴尬
  53527. domRoot.style.position = 'relative';
  53528. domRoot.style.overflow = 'hidden';
  53529. domRoot.style.width = this._width + 'px';
  53530. domRoot.style.height = this._height + 'px';
  53531. this.root.appendChild(domRoot);
  53532. this.shapeToImage = this._createShapeToImageProcessor();
  53533. // 创建各层canvas
  53534. // 背景
  53535. //this._bgDom = Painter.createDom('bg', 'div', this);
  53536. this._bgDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme_background_"), 'div', this);
  53537. domRoot.appendChild(this._bgDom);
  53538. this._bgDom.onselectstart = returnFalse;
  53539. this._bgDom.style['-webkit-user-select'] = 'none';
  53540. this._bgDom.style['user-select'] = 'none';
  53541. this._bgDom.style['-webkit-touch-callout'] = 'none';
  53542. // 高亮
  53543. //var hoverLayer = new PaintLayer('_hoverLayer_', this);
  53544. var hoverLayer = new PaintLayer(Util.createUniqueID("_highLightLayer_"), this);
  53545. this._layers['hover'] = hoverLayer;
  53546. domRoot.appendChild(hoverLayer.dom);
  53547. hoverLayer.initContext();
  53548. hoverLayer.dom.onselectstart = returnFalse;
  53549. hoverLayer.dom.style['-webkit-user-select'] = 'none';
  53550. hoverLayer.dom.style['user-select'] = 'none';
  53551. hoverLayer.dom.style['-webkit-touch-callout'] = 'none';
  53552. var me = this;
  53553. this.updatePainter = function (shapeList, callback) {
  53554. me.refreshShapes(shapeList, callback);
  53555. };
  53556. // 返回false的方法,用于避免页面被选中
  53557. function returnFalse() {
  53558. return false;
  53559. }
  53560. /* eslint-disable */
  53561. // 什么都不干的空方法
  53562. function doNothing() { //NOSONAR
  53563. }
  53564. /* eslint-enable */
  53565. }
  53566. /**
  53567. * @function SuperMap.LevelRenderer.Painter.prototype.destroy
  53568. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  53569. */
  53570. destroy() {
  53571. this.dispose();
  53572. this._zlevelList = null;
  53573. this._layerConfig = null;
  53574. this._bgDom = null;
  53575. this.shapeToImage = null;
  53576. }
  53577. /**
  53578. * @function SuperMap.LevelRenderer.Painter.prototype.render
  53579. * @description 渲染。首次绘图,创建各种 dom 和 context。
  53580. *
  53581. * @param {Function} callback - 绘画结束后的回调函数。
  53582. * @return {SuperMap.LevelRenderer.Painter} this。
  53583. */
  53584. render(callback) {
  53585. // TODO
  53586. this.refresh(callback, true);
  53587. return this;
  53588. }
  53589. /**
  53590. * @function SuperMap.LevelRenderer.Painter.prototype.refresh
  53591. * @description 刷新。
  53592. *
  53593. * @param {Function} callback - 刷新结束后的回调函数。
  53594. * @param {boolean} paintAll - 强制绘制所有 shape。
  53595. * @return {SuperMap.LevelRenderer.Painter} this。
  53596. */
  53597. refresh(callback, paintAll) {
  53598. var list = this.storage.getShapeList(true);
  53599. this._paintList(list, paintAll);
  53600. if (typeof callback == 'function') {
  53601. callback();
  53602. }
  53603. return this;
  53604. }
  53605. /**
  53606. * Method: _paintList
  53607. * 按列表绘制图形。
  53608. */
  53609. _paintList(list, paintAll) {
  53610. if (typeof(paintAll) == 'undefined') {
  53611. paintAll = false;
  53612. }
  53613. this._updateLayerStatus(list);
  53614. var currentLayer;
  53615. var currentZLevel;
  53616. var ctx;
  53617. for (var id in this._layers) {
  53618. if (id !== 'hover') {
  53619. this._layers[id].unusedCount++;
  53620. this._layers[id].updateTransform();
  53621. }
  53622. }
  53623. var invTransform = [];
  53624. for (var i = 0, l = list.length; i < l; i++) {
  53625. var shape = list[i];
  53626. if (currentZLevel !== shape.zlevel) {
  53627. if (currentLayer && currentLayer.needTransform) {
  53628. ctx.restore();
  53629. }
  53630. currentLayer = this.getLayer(shape.zlevel);
  53631. ctx = currentLayer.ctx;
  53632. currentZLevel = shape.zlevel;
  53633. // Reset the count
  53634. currentLayer.unusedCount = 0;
  53635. if (currentLayer.dirty || paintAll) {
  53636. currentLayer.clear();
  53637. }
  53638. if (currentLayer.needTransform) {
  53639. ctx.save();
  53640. currentLayer.setTransform(ctx);
  53641. }
  53642. }
  53643. // Start group clipping
  53644. if (ctx && shape.__startClip) {
  53645. var clipShape = shape.__startClip;
  53646. ctx.save();
  53647. // Set transform
  53648. if (clipShape.needTransform) {
  53649. let m = clipShape.transform;
  53650. SUtil_SUtil.Util_matrix.invert(invTransform, m);
  53651. ctx.transform(
  53652. m[0], m[1],
  53653. m[2], m[3],
  53654. m[4], m[5]
  53655. );
  53656. }
  53657. ctx.beginPath();
  53658. clipShape.buildPath(ctx, clipShape.style);
  53659. ctx.clip();
  53660. // Transform back
  53661. if (clipShape.needTransform) {
  53662. let m = invTransform;
  53663. ctx.transform(
  53664. m[0], m[1],
  53665. m[2], m[3],
  53666. m[4], m[5]
  53667. );
  53668. }
  53669. }
  53670. if (((currentLayer && currentLayer.dirty) || paintAll) && !shape.invisible) {
  53671. if (
  53672. !shape.onbrush
  53673. || (shape.onbrush && !shape.onbrush(ctx, false))
  53674. ) {
  53675. if (Config.catchBrushException) {
  53676. try {
  53677. shape.brush(ctx, false, this.updatePainter);
  53678. } catch (error) {
  53679. SUtil_SUtil.Util_log(
  53680. error,
  53681. 'brush error of ' + shape.type,
  53682. shape
  53683. );
  53684. }
  53685. } else {
  53686. shape.brush(ctx, false, this.updatePainter);
  53687. }
  53688. }
  53689. }
  53690. // Stop group clipping
  53691. if (ctx && shape.__stopClip) {
  53692. ctx.restore();
  53693. }
  53694. shape.__dirty = false;
  53695. }
  53696. if (ctx && currentLayer && currentLayer.needTransform) {
  53697. ctx.restore();
  53698. }
  53699. for (let id in this._layers) {
  53700. if (id !== 'hover') {
  53701. var layer = this._layers[id];
  53702. layer.dirty = false;
  53703. // 删除过期的层
  53704. // PENDING
  53705. // if (layer.unusedCount >= 500) {
  53706. // this.delLayer(id);
  53707. // }
  53708. if (layer.unusedCount == 1) {
  53709. layer.clear();
  53710. }
  53711. }
  53712. }
  53713. }
  53714. /**
  53715. * @function SuperMap.LevelRenderer.Painter.prototype.getLayer
  53716. * @description 获取 zlevel 所在层,如果不存在则会创建一个新的层。
  53717. *
  53718. * @param {number} zlevel - zlevel。
  53719. * @return {SuperMap.LevelRenderer.Painter} this。
  53720. */
  53721. getLayer(zlevel) {
  53722. // Change draw layer
  53723. var currentLayer = this._layers[zlevel];
  53724. if (!currentLayer) {
  53725. var len = this._zlevelList.length;
  53726. var prevLayer = null;
  53727. var i = -1;
  53728. if (len > 0 && zlevel > this._zlevelList[0]) {
  53729. for (i = 0; i < len - 1; i++) {
  53730. if (
  53731. this._zlevelList[i] < zlevel
  53732. && this._zlevelList[i + 1] > zlevel
  53733. ) {
  53734. break;
  53735. }
  53736. }
  53737. prevLayer = this._layers[this._zlevelList[i]];
  53738. }
  53739. this._zlevelList.splice(i + 1, 0, zlevel);
  53740. // Create a new layer
  53741. //currentLayer = new PaintLayer(zlevel, this);
  53742. currentLayer = new PaintLayer(Util.createUniqueID("_levelLayer_" + zlevel), this);
  53743. var prevDom = prevLayer ? prevLayer.dom : this._bgDom;
  53744. if (prevDom.nextSibling) {
  53745. prevDom.parentNode.insertBefore(
  53746. currentLayer.dom,
  53747. prevDom.nextSibling
  53748. );
  53749. } else {
  53750. prevDom.parentNode.appendChild(
  53751. currentLayer.dom
  53752. );
  53753. }
  53754. currentLayer.initContext();
  53755. this._layers[zlevel] = currentLayer;
  53756. if (this._layerConfig[zlevel]) {
  53757. new Util_Util().merge(currentLayer, this._layerConfig[zlevel], true);
  53758. }
  53759. currentLayer.updateTransform();
  53760. }
  53761. return currentLayer;
  53762. }
  53763. /**
  53764. * @function SuperMap.LevelRenderer.Painter.prototype.getLayers
  53765. * @description 获取所有已创建的层。
  53766. * @return {Array.<Painter.Layer>} 已创建的层
  53767. */
  53768. getLayers() {
  53769. return this._layers;
  53770. }
  53771. /**
  53772. * Method: _updateLayerStatus
  53773. * 更新绘制层状态。
  53774. */
  53775. _updateLayerStatus(list) {
  53776. var layers = this._layers;
  53777. var elCounts = {};
  53778. for (let z in layers) {
  53779. if (z !== 'hover') {
  53780. elCounts[z] = layers[z].elCount;
  53781. layers[z].elCount = 0;
  53782. }
  53783. }
  53784. for (let i = 0; i < list.length; i++) {
  53785. var shape = list[i];
  53786. var zlevel = shape.zlevel;
  53787. var layer = layers[zlevel];
  53788. if (layer) {
  53789. layer.elCount++;
  53790. // 已经被标记为需要刷新
  53791. if (layer.dirty) {
  53792. continue;
  53793. }
  53794. layer.dirty = shape.__dirty;
  53795. }
  53796. }
  53797. // 层中的元素数量有发生变化
  53798. for (let z in layers) {
  53799. if (z !== 'hover') {
  53800. if (elCounts[z] !== layers[z].elCount) {
  53801. layers[z].dirty = true;
  53802. }
  53803. }
  53804. }
  53805. }
  53806. /**
  53807. * @function SuperMap.LevelRenderer.Painter.prototype.refreshShapes
  53808. * @description 更新的图形元素列表。
  53809. *
  53810. * @param {number} shapeList - 需要更新的图形元素列表。
  53811. * @param {number} callback - 视图更新后回调函数。
  53812. * @return {SuperMap.LevelRenderer.Painter} this。
  53813. */
  53814. refreshShapes(shapeList, callback) {
  53815. for (var i = 0, l = shapeList.length; i < l; i++) {
  53816. var shape = shapeList[i];
  53817. this.storage.mod(shape.id);
  53818. }
  53819. this.refresh(callback);
  53820. return this;
  53821. }
  53822. /**
  53823. * @function SuperMap.LevelRenderer.Painter.prototype.clear
  53824. * @description 清除 hover 层外所有内容。
  53825. * @return {SuperMap.LevelRenderer.Painter} this。
  53826. */
  53827. clear() {
  53828. for (var k in this._layers) {
  53829. if (k == 'hover') {
  53830. continue;
  53831. }
  53832. this._layers[k].clear();
  53833. }
  53834. return this;
  53835. }
  53836. /**
  53837. * @function SuperMap.LevelRenderer.Painter.prototype.modLayer
  53838. * @description 修改指定 zlevel 的绘制参数。
  53839. *
  53840. * @param {string} zlevel - zlevel。
  53841. * @param {Object} config - 配置对象。
  53842. * @param {string} [config.clearColor=0] - 每次清空画布的颜色。
  53843. * @param {boolean} [config.motionBlur=false] - 是否开启动态模糊。
  53844. * @param {number} [config.lastFrameAlpha=0.7] - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  53845. * @param {Array.<number>} config.position - 层的平移。
  53846. * @param {Array.<number>} config.rotation - 层的旋转。
  53847. * @param {Array.<number>} config.scale - 层的缩放。
  53848. * @param {boolean} config.zoomable - 层是否支持鼠标缩放操作。默认值:false。
  53849. * @param {boolean} config.panable - 层是否支持鼠标平移操作。默认值:false。
  53850. *
  53851. */
  53852. modLayer(zlevel, config) {
  53853. if (config) {
  53854. if (!this._layerConfig[zlevel]) {
  53855. this._layerConfig[zlevel] = config;
  53856. } else {
  53857. new Util_Util().merge(this._layerConfig[zlevel], config, true);
  53858. }
  53859. var layer = this._layers[zlevel];
  53860. if (layer) {
  53861. new Util_Util().merge(layer, this._layerConfig[zlevel], true);
  53862. }
  53863. }
  53864. }
  53865. /**
  53866. * @function SuperMap.LevelRenderer.Painter.prototype.delLayer
  53867. * @description 删除指定层。
  53868. *
  53869. * @param {string} zlevel - 层所在的 zlevel。
  53870. */
  53871. delLayer(zlevel) {
  53872. var layer = this._layers[zlevel];
  53873. if (!layer) {
  53874. return;
  53875. }
  53876. // Save config
  53877. this.modLayer(zlevel, {
  53878. position: layer.position,
  53879. rotation: layer.rotation,
  53880. scale: layer.scale
  53881. });
  53882. layer.dom.parentNode.removeChild(layer.dom);
  53883. delete this._layers[zlevel];
  53884. this._zlevelList.splice(new Util_Util().indexOf(this._zlevelList, zlevel), 1);
  53885. }
  53886. /**
  53887. * @function SuperMap.LevelRenderer.Painter.prototype.refreshHover
  53888. * @description 刷新 hover 层。
  53889. * @return {SuperMap.LevelRenderer.Painter} this。
  53890. */
  53891. refreshHover() {
  53892. this.clearHover();
  53893. var list = this.storage.getHoverShapes(true);
  53894. for (var i = 0, l = list.length; i < l; i++) {
  53895. this._brushHover(list[i]);
  53896. }
  53897. this.storage.delHover();
  53898. return this;
  53899. }
  53900. /**
  53901. * @function SuperMap.LevelRenderer.Painter.prototype.clearHover
  53902. * @description 清除 hover 层所有内容。
  53903. * @return {SuperMap.LevelRenderer.Painter} this。
  53904. */
  53905. clearHover() {
  53906. var hover = this._layers.hover;
  53907. hover && hover.clear();
  53908. return this;
  53909. }
  53910. /**
  53911. * @function SuperMap.LevelRenderer.Painter.prototype.resize
  53912. * @description 区域大小变化后重绘。
  53913. * @return {SuperMap.LevelRenderer.Painter} this。
  53914. */
  53915. resize() {
  53916. var domRoot = this._domRoot;
  53917. domRoot.style.display = 'none';
  53918. var width = this._getWidth();
  53919. var height = this._getHeight();
  53920. domRoot.style.display = '';
  53921. // 优化没有实际改变的resize
  53922. if (this._width != width || height != this._height) {
  53923. this._width = width;
  53924. this._height = height;
  53925. domRoot.style.width = width + 'px';
  53926. domRoot.style.height = height + 'px';
  53927. for (var id in this._layers) {
  53928. this._layers[id].resize(width, height);
  53929. }
  53930. this.refresh(null, true);
  53931. }
  53932. return this;
  53933. }
  53934. /**
  53935. * @function SuperMap.LevelRenderer.Painter.prototype.clearLayer
  53936. * @description 清除指定的一个层。
  53937. * @param {number} zLevel - 层。
  53938. */
  53939. clearLayer(zLevel) {
  53940. var layer = this._layers[zLevel];
  53941. if (layer) {
  53942. layer.clear();
  53943. }
  53944. }
  53945. /**
  53946. * @function SuperMap.LevelRenderer.Painter.prototype.dispose
  53947. * @description 释放。
  53948. *
  53949. */
  53950. dispose() {
  53951. this.root.innerHTML = '';
  53952. this.root = null;
  53953. this.storage = null;
  53954. this._domRoot = null;
  53955. this._layers = null;
  53956. }
  53957. /**
  53958. * @function SuperMap.LevelRenderer.Painter.prototype.getDomHover
  53959. * @description 获取 Hover 层的 Dom。
  53960. */
  53961. getDomHover() {
  53962. return this._layers.hover.dom;
  53963. }
  53964. /**
  53965. * @function SuperMap.LevelRenderer.Painter.prototype.toDataURL
  53966. * @description 图像导出。
  53967. * @param {string} type - 图片类型。
  53968. * @param {string} backgroundColor - 背景色。默认值:'#fff'。
  53969. * @param {Object} args
  53970. * @return {string} 图片的Base64 url。
  53971. */
  53972. toDataURL(type, backgroundColor, args) {
  53973. //var imageDom = Painter.createDom('image', 'canvas', this);
  53974. var imageDom = Painter.createDom(Util.createUniqueID("SuperMap.Theme.image_"), 'canvas', this);
  53975. this._bgDom.appendChild(imageDom);
  53976. var ctx = imageDom.getContext('2d');
  53977. Painter.devicePixelRatio != 1
  53978. && ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  53979. ctx.fillStyle = backgroundColor || '#fff';
  53980. ctx.rect(
  53981. 0, 0,
  53982. this._width * Painter.devicePixelRatio,
  53983. this._height * Painter.devicePixelRatio
  53984. );
  53985. ctx.fill();
  53986. var self = this;
  53987. // 升序遍历,shape上的zlevel指定绘画图层的z轴层叠
  53988. this.storage.iterShape(
  53989. function (shape) {
  53990. if (!shape.invisible) {
  53991. if (!shape.onbrush // 没有onbrush
  53992. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  53993. || (shape.onbrush && !shape.onbrush(ctx, false))
  53994. ) {
  53995. if (Config.catchBrushException) {
  53996. try {
  53997. shape.brush(ctx, false, self.updatePainter);
  53998. } catch (error) {
  53999. SUtil_SUtil.Util_log(
  54000. error,
  54001. 'brush error of ' + shape.type,
  54002. shape
  54003. );
  54004. }
  54005. } else {
  54006. shape.brush(ctx, false, self.updatePainter);
  54007. }
  54008. }
  54009. }
  54010. },
  54011. {normal: 'up', update: true}
  54012. );
  54013. var image = imageDom.toDataURL(type, args);
  54014. ctx = null;
  54015. this._bgDom.removeChild(imageDom);
  54016. return image;
  54017. }
  54018. /**
  54019. * @function SuperMap.LevelRenderer.Painter.prototype.getWidth
  54020. * @description 获取绘图区域宽度。
  54021. * @return {number} 绘图区域宽度。
  54022. */
  54023. getWidth() {
  54024. return this._width;
  54025. }
  54026. /**
  54027. * @function SuperMap.LevelRenderer.Painter.prototype.getHeight
  54028. * @description 获取绘图区域高度。
  54029. * @return {number} 绘图区域高度。
  54030. */
  54031. getHeight() {
  54032. return this._height;
  54033. }
  54034. /**
  54035. * Method: _getWidth
  54036. *
  54037. */
  54038. _getWidth() {
  54039. var root = this.root;
  54040. var stl = root.currentStyle
  54041. || document.defaultView.getComputedStyle(root);
  54042. return ((root.clientWidth || parseInt(stl.width, 10))
  54043. - parseInt(stl.paddingLeft, 10) // 请原谅我这比较粗暴
  54044. - parseInt(stl.paddingRight, 10)).toFixed(0) - 0;
  54045. }
  54046. /**
  54047. * Method: _getHeight
  54048. *
  54049. */
  54050. _getHeight() {
  54051. var root = this.root;
  54052. var stl = root.currentStyle
  54053. || document.defaultView.getComputedStyle(root);
  54054. return ((root.clientHeight || parseInt(stl.height, 10))
  54055. - parseInt(stl.paddingTop, 10) // 请原谅我这比较粗暴
  54056. - parseInt(stl.paddingBottom, 10)).toFixed(0) - 0;
  54057. }
  54058. /**
  54059. * Method: _brushHover
  54060. *
  54061. */
  54062. _brushHover(shape) {
  54063. var ctx = this._layers.hover.ctx;
  54064. if (!shape.onbrush // 没有onbrush
  54065. // 有onbrush并且调用执行返回false或undefined则继续粉刷
  54066. || (shape.onbrush && !shape.onbrush(ctx, true))
  54067. ) {
  54068. var layer = this.getLayer(shape.zlevel);
  54069. if (layer.needTransform) {
  54070. ctx.save();
  54071. layer.setTransform(ctx);
  54072. }
  54073. // Retina 优化
  54074. if (Config.catchBrushException) {
  54075. try {
  54076. shape.brush(ctx, true, this.updatePainter);
  54077. } catch (error) {
  54078. SUtil_SUtil.Util_log(
  54079. error, 'hoverBrush error of ' + shape.type, shape
  54080. );
  54081. }
  54082. } else {
  54083. shape.brush(ctx, true, this.updatePainter);
  54084. }
  54085. if (layer.needTransform) {
  54086. ctx.restore();
  54087. }
  54088. }
  54089. }
  54090. /**
  54091. * Method: _shapeToImage
  54092. *
  54093. */
  54094. _shapeToImage(id, shape, width, height, devicePixelRatio) {
  54095. var canvas = document.createElement('canvas');
  54096. var ctx = canvas.getContext('2d');
  54097. var _devicePixelRatio = devicePixelRatio || window.devicePixelRatio || 1;
  54098. canvas.style.width = width + 'px';
  54099. canvas.style.height = height + 'px';
  54100. canvas.setAttribute('width', width * _devicePixelRatio);
  54101. canvas.setAttribute('height', height * _devicePixelRatio);
  54102. ctx.clearRect(0, 0, width * _devicePixelRatio, height * _devicePixelRatio);
  54103. var shapeTransform = {
  54104. position: shape.position,
  54105. rotation: shape.rotation,
  54106. scale: shape.scale
  54107. };
  54108. shape.position = [0, 0, 0];
  54109. shape.rotation = 0;
  54110. shape.scale = [1, 1];
  54111. if (shape) {
  54112. shape.brush(ctx, false);
  54113. }
  54114. var imgShape = new SmicImage({
  54115. id: id,
  54116. style: {
  54117. x: 0,
  54118. y: 0,
  54119. image: canvas
  54120. }
  54121. });
  54122. if (shapeTransform.position != null) {
  54123. imgShape.position = shape.position = shapeTransform.position;
  54124. }
  54125. if (shapeTransform.rotation != null) {
  54126. imgShape.rotation = shape.rotation = shapeTransform.rotation;
  54127. }
  54128. if (shapeTransform.scale != null) {
  54129. imgShape.scale = shape.scale = shapeTransform.scale;
  54130. }
  54131. return imgShape;
  54132. }
  54133. /**
  54134. * Method: _createShapeToImageProcessor
  54135. *
  54136. */
  54137. _createShapeToImageProcessor() {
  54138. var me = this;
  54139. return function (id, e, width, height) {
  54140. return me._shapeToImage(
  54141. id, e, width, height, Painter.devicePixelRatio
  54142. );
  54143. };
  54144. }
  54145. // SMIC-方法扩展 - start
  54146. /**
  54147. * @function SuperMap.LevelRenderer.Painter.prototype.updateHoverLayer
  54148. * @description 更新设置显示高亮图层。
  54149. * @param {Array} shapes - 图形数组。
  54150. */
  54151. updateHoverLayer(shapes) {
  54152. if (!(shapes instanceof Array)) {
  54153. return this;
  54154. }
  54155. //清除高亮
  54156. this.clearHover();
  54157. this.storage.delHover();
  54158. for (var i = 0; i < shapes.length; i++) {
  54159. this.storage.addHover(shapes[i]);
  54160. this._brushHover(shapes[i]);
  54161. }
  54162. }
  54163. /**
  54164. * @function SuperMap.LevelRenderer.Painter.prototype.createDom
  54165. * @description 创建 Dom。
  54166. *
  54167. * @param {string} id - Dom id
  54168. * @param {string} type - Dom type
  54169. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  54170. * @return {Object} Dom
  54171. */
  54172. static createDom(id, type, painter) {
  54173. var newDom = document.createElement(type);
  54174. var width = painter._width;
  54175. var height = painter._height;
  54176. // 没append呢,请原谅我这样写,清晰~
  54177. newDom.style.position = 'absolute';
  54178. newDom.style.left = 0;
  54179. newDom.style.top = 0;
  54180. newDom.style.width = width + 'px';
  54181. newDom.style.height = height + 'px';
  54182. newDom.setAttribute('width', width * Painter.devicePixelRatio);
  54183. newDom.setAttribute('height', height * Painter.devicePixelRatio);
  54184. // id不作为索引用,避免可能造成的重名,定义为私有属性
  54185. //newDom.setAttribute('data-zr-dom-id', id);
  54186. newDom.setAttribute('id', id);
  54187. return newDom;
  54188. }
  54189. }
  54190. /**
  54191. * @private
  54192. * @class Painter.Layer
  54193. * @classdesc 绘制层类。
  54194. * @extends SuperMap.LevelRenderer.Transformable
  54195. */
  54196. class PaintLayer extends Transformable {
  54197. /**
  54198. * @function Painter.Layer.constructor
  54199. * @description 构造函数。
  54200. *
  54201. * @param {string} id - id。
  54202. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  54203. *
  54204. */
  54205. constructor(id, painter) {
  54206. super(id, painter);
  54207. /**
  54208. * @member {Object} Painter.Layer.prototype.dom
  54209. * @description dom。
  54210. */
  54211. this.dom = null;
  54212. /**
  54213. * @member {Object} Painter.Layer.prototype.domBack
  54214. * @description domBack。
  54215. */
  54216. this.domBack = null;
  54217. /**
  54218. * @member {Object} Painter.Layer.prototype.ctxBack
  54219. * @description ctxBack。
  54220. */
  54221. this.ctxBack = null;
  54222. /**
  54223. * @member {SuperMap.LevelRenderer.Painter} Painter.Layer.prototype.painter
  54224. * @description painter。
  54225. */
  54226. this.painter = painter;
  54227. /**
  54228. * @member {number} Painter.Layer.prototype.unusedCount
  54229. * @description unusedCount。
  54230. */
  54231. this.unusedCount = 0;
  54232. /**
  54233. * @member {Object} Painter.Layer.prototype.config
  54234. * @description config。
  54235. */
  54236. this.config = null;
  54237. /**
  54238. * @member {boolean} Painter.Layer.prototype.dirty
  54239. * @description dirty。
  54240. */
  54241. this.dirty = true;
  54242. /**
  54243. * @member {number} Painter.Layer.prototype.elCount
  54244. * @description elCount。
  54245. */
  54246. this.elCount = 0;
  54247. // Configs
  54248. /**
  54249. * @member {string} Painter.Layer.prototype.clearColor
  54250. * @description 每次清空画布的颜色。默认值:0;
  54251. */
  54252. this.clearColor = 0;
  54253. /**
  54254. * @member {boolean} Painter.Layer.prototype.motionBlur
  54255. * @description 是否开启动态模糊。默认值:false;
  54256. */
  54257. this.motionBlur = false;
  54258. /**
  54259. * @member {number} Painter.Layer.prototype.lastFrameAlpha
  54260. * @description 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显
  54261. */
  54262. this.lastFrameAlpha = 0.7;
  54263. /**
  54264. * @member {boolean} Painter.Layer.prototype.zoomable
  54265. * @description 层是否支持鼠标平移操作。默认值:false;
  54266. */
  54267. this.zoomable = false;
  54268. /**
  54269. * @member {boolean} Painter.Layer.prototype.panable
  54270. * @description 层是否支持鼠标缩放操作。默认值:false;
  54271. */
  54272. this.panable = false;
  54273. /**
  54274. * @member {number} Painter.Layer.prototype.maxZoom
  54275. * @description maxZoom。默认值:Infinity。
  54276. */
  54277. this.maxZoom = Infinity;
  54278. /**
  54279. * @member {number} Painter.Layer.prototype.minZoom
  54280. * @description minZoom。默认值:0。
  54281. */
  54282. this.minZoom = 0;
  54283. /**
  54284. * @member {number} Painter.Layer.prototype.ctx
  54285. * @description Canvas 上下文。
  54286. */
  54287. this.ctx = null;
  54288. this.dom = Painter.createDom(Util.createUniqueID("SuperMap.Theme" + id), 'canvas', painter);
  54289. this.dom.onselectstart = returnFalse; // 避免页面选中的尴尬
  54290. this.dom.style['-webkit-user-select'] = 'none';
  54291. this.dom.style['user-select'] = 'none';
  54292. this.dom.style['-webkit-touch-callout'] = 'none';
  54293. // Function
  54294. // 返回false的方法,用于避免页面被选中
  54295. function returnFalse() {
  54296. return false;
  54297. }
  54298. this.CLASS_NAME = "SuperMap.LevelRenderer.Painter.Layer";
  54299. }
  54300. /**
  54301. * @function Painter.Layer.prototype.destroy
  54302. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  54303. */
  54304. destroy() {
  54305. this.dom = null;
  54306. this.domBack = null;
  54307. this.ctxBack = null;
  54308. this.painter = null;
  54309. this.unusedCount = null;
  54310. this.config = null;
  54311. this.dirty = null;
  54312. this.elCount = null;
  54313. this.clearColor = null;
  54314. this.motionBlur = null;
  54315. this.lastFrameAlpha = null;
  54316. this.zoomable = null;
  54317. this.panable = null;
  54318. this.maxZoom = null;
  54319. this.minZoom = null;
  54320. this.ctx = null;
  54321. Transformable.destroy.apply(this, arguments);
  54322. }
  54323. /**
  54324. * @function Painter.Layer.prototype.initContext
  54325. * @description 初始化 Canvan 2D 上下文。
  54326. */
  54327. initContext() {
  54328. this.ctx = this.dom.getContext('2d');
  54329. if (Painter.devicePixelRatio != 1) {
  54330. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  54331. }
  54332. }
  54333. /**
  54334. * @function Painter.Layer.prototype.createBackBuffer
  54335. * @description 创建备份缓冲。
  54336. */
  54337. createBackBuffer() {
  54338. this.domBack = Painter.createDom(Util.createUniqueID("SuperMap.Theme.back-" + this.id), 'canvas', this.painter);
  54339. this.ctxBack = this.domBack.getContext('2d');
  54340. if (Painter.devicePixelRatio != 1) {
  54341. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  54342. }
  54343. }
  54344. /**
  54345. * @function Painter.Layer.prototype.resize
  54346. * @description 改变大小。
  54347. *
  54348. * @param {number} width - 宽。
  54349. * @param {number} height - 高。
  54350. */
  54351. resize(width, height) {
  54352. this.dom.style.width = width + 'px';
  54353. this.dom.style.height = height + 'px';
  54354. this.dom.setAttribute('width', width * Painter.devicePixelRatio);
  54355. this.dom.setAttribute('height', height * Painter.devicePixelRatio);
  54356. if (Painter.devicePixelRatio != 1) {
  54357. this.ctx.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  54358. }
  54359. if (this.domBack) {
  54360. this.domBack.setAttribute('width', width * Painter.devicePixelRatio);
  54361. this.domBack.setAttribute('height', height * Painter.devicePixelRatio);
  54362. if (Painter.devicePixelRatio != 1) {
  54363. this.ctxBack.scale(Painter.devicePixelRatio, Painter.devicePixelRatio);
  54364. }
  54365. }
  54366. }
  54367. /**
  54368. * @function Painter.Layer.prototype.clear
  54369. * @description 清空该层画布。
  54370. */
  54371. clear() {
  54372. var dom = this.dom;
  54373. var ctx = this.ctx;
  54374. var width = dom.width;
  54375. var height = dom.height;
  54376. var haveClearColor = this.clearColor;
  54377. var haveMotionBLur = this.motionBlur;
  54378. var lastFrameAlpha = this.lastFrameAlpha;
  54379. if (haveMotionBLur) {
  54380. if (!this.domBack) {
  54381. this.createBackBuffer();
  54382. }
  54383. this.ctxBack.globalCompositeOperation = 'copy';
  54384. this.ctxBack.drawImage(
  54385. dom, 0, 0,
  54386. width / Painter.devicePixelRatio,
  54387. height / Painter.devicePixelRatio
  54388. );
  54389. }
  54390. if (haveClearColor) {
  54391. ctx.save();
  54392. ctx.fillStyle = this.config.clearColor;
  54393. ctx.fillRect(
  54394. 0, 0,
  54395. width / Painter.devicePixelRatio,
  54396. height / Painter.devicePixelRatio
  54397. );
  54398. ctx.restore();
  54399. } else {
  54400. ctx.clearRect(
  54401. 0, 0,
  54402. width / Painter.devicePixelRatio,
  54403. height / Painter.devicePixelRatio
  54404. );
  54405. }
  54406. if (haveMotionBLur) {
  54407. var domBack = this.domBack;
  54408. ctx.save();
  54409. ctx.globalAlpha = lastFrameAlpha;
  54410. ctx.drawImage(
  54411. domBack, 0, 0,
  54412. width / Painter.devicePixelRatio,
  54413. height / Painter.devicePixelRatio
  54414. );
  54415. ctx.restore();
  54416. }
  54417. }
  54418. }
  54419. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Handler.js
  54420. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  54421. * This program are made available under the terms of the Apache License, Version 2.0
  54422. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  54423. /**
  54424. * @private
  54425. * @class SuperMap.LevelRenderer.Handler
  54426. * @category Visualization Theme
  54427. * @classdesc Handler控制模块。
  54428. * @extends {SuperMap.LevelRenderer.Eventful}
  54429. */
  54430. class Handler extends Eventful {
  54431. /**
  54432. * @function SuperMap.LevelRenderer.Handler.constructor
  54433. * @description 构造函数。
  54434. * @param {HTMLElement} root - 绘图区域。
  54435. * @param {SuperMap.LevelRenderer.Storage} storage - Storage 实例。
  54436. * @param {SuperMap.LevelRenderer.Painter} painter - Painter 实例。
  54437. */
  54438. constructor(root, storage, painter) {
  54439. super(root, storage, painter);
  54440. /**
  54441. * @member {HTMLElement} SuperMap.LevelRenderer.Handler.prototype.root
  54442. * @description 绘图区域
  54443. */
  54444. this.root = root;
  54445. /**
  54446. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Handler.prototype.storage
  54447. * @description Storage 实例
  54448. */
  54449. this.storage = storage;
  54450. /**
  54451. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Handler.prototype.Painter
  54452. * @description Painter 实例
  54453. */
  54454. this.painter = painter;
  54455. /**
  54456. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastX=0]
  54457. * @description 上一次鼠标位置x坐标值
  54458. */
  54459. this._lastX = 0;
  54460. /**
  54461. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._lastY=0]
  54462. * @description 上一次鼠标位置y坐标值
  54463. */
  54464. this._lastY = 0;
  54465. /**
  54466. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseX=0]
  54467. * @description 当前鼠标位置x坐标值
  54468. */
  54469. this._mouseX = 0;
  54470. /**
  54471. * @member {number} [SuperMap.LevelRenderer.Handler.prototype._mouseY=0]
  54472. * @description 当前鼠标位置y坐标值
  54473. */
  54474. this._mouseY = 0;
  54475. /**
  54476. * @member {Function} SuperMap.LevelRenderer.Handler.prototype._findHover
  54477. * @description 查找 Hover 图形
  54478. */
  54479. this._findHover = null;
  54480. /**
  54481. * @member {Object} SuperMap.LevelRenderer.Handler.prototype._domHover
  54482. * @description 高亮 DOM
  54483. */
  54484. this._domHover = null;
  54485. // 各种事件标识的私有变量
  54486. // this._hasfound = false; // 是否找到 hover 图形元素
  54487. // this._lastHover = null; // 最后一个 hover 图形元素
  54488. // this._mouseDownTarget = null;
  54489. // this._draggingTarget = null; // 当前被拖拽的图形元素
  54490. // this._isMouseDown = false;
  54491. // this._isDragging = false;
  54492. // this._lastMouseDownMoment;
  54493. // this._lastTouchMoment;
  54494. // this._lastDownButton;
  54495. this._findHover = bind3Arg(findHover, this);
  54496. this._domHover = painter.getDomHover();
  54497. this.CLASS_NAME = "SuperMap.LevelRenderer.Handler";
  54498. var domHandlers = {
  54499. /**
  54500. * Method: resize
  54501. * 窗口大小改变响应函数。
  54502. *
  54503. * Parameters:
  54504. * event - {Event} event。
  54505. *
  54506. */
  54507. resize: function (event) {
  54508. event = event || window.event;
  54509. this._lastHover = null;
  54510. this._isMouseDown = 0;
  54511. // 分发SuperMap.LevelRenderer.Config.EVENT.RESIZE事件,global
  54512. this.dispatch(Config.EVENT.RESIZE, event);
  54513. },
  54514. /**
  54515. * Method: click
  54516. * 点击响应函数。
  54517. *
  54518. * Parameters:
  54519. * event - {Event} event。
  54520. *
  54521. */
  54522. click: function (event) {
  54523. event = this._zrenderEventFixed(event);
  54524. // 分发SuperMap.LevelRenderer.Config.EVENT.CLICK事件
  54525. var _lastHover = this._lastHover;
  54526. if ((_lastHover && _lastHover.clickable)
  54527. || !_lastHover
  54528. ) {
  54529. // 判断没有发生拖拽才触发click事件
  54530. if (this._clickThreshold < 10) {
  54531. this._dispatchAgency(_lastHover, Config.EVENT.CLICK, event);
  54532. }
  54533. }
  54534. this._mousemoveHandler(event);
  54535. },
  54536. /**
  54537. * Method: dblclick
  54538. * 双击响应函数。
  54539. *
  54540. * Parameters:
  54541. * event - {Event} event。
  54542. *
  54543. */
  54544. dblclick: function (event) {
  54545. event = event || window.event;
  54546. event = this._zrenderEventFixed(event);
  54547. // 分发SuperMap.LevelRenderer.Config.EVENT.DBLCLICK事件
  54548. var _lastHover = this._lastHover;
  54549. if ((_lastHover && _lastHover.clickable)
  54550. || !_lastHover
  54551. ) {
  54552. // 判断没有发生拖拽才触发dblclick事件
  54553. if (this._clickThreshold < 5) {
  54554. this._dispatchAgency(_lastHover, Config.EVENT.DBLCLICK, event);
  54555. }
  54556. }
  54557. this._mousemoveHandler(event);
  54558. },
  54559. /**
  54560. * Method: mousewheel
  54561. * 鼠标滚轮响应函数。
  54562. *
  54563. * Parameters:
  54564. * event - {Event} event。
  54565. *
  54566. */
  54567. mousewheel: function (event) {
  54568. event = this._zrenderEventFixed(event);
  54569. // http://www.sitepoint.com/html5-javascript-mouse-wheel/
  54570. // https://developer.mozilla.org/en-US/docs/DOM/DOM_event_reference/mousewheel
  54571. var delta = event.wheelDelta // Webkit
  54572. || -event.detail; // Firefox
  54573. var scale = delta > 0 ? 1.1 : 1 / 1.1;
  54574. var layers = this.painter.getLayers();
  54575. var needsRefresh = false;
  54576. for (var z in layers) {
  54577. if (z !== 'hover') {
  54578. var layer = layers[z];
  54579. var pos = layer.position;
  54580. if (layer.zoomable) {
  54581. layer.__zoom = layer.__zoom || 1;
  54582. var newZoom = layer.__zoom;
  54583. newZoom *= scale;
  54584. newZoom = Math.max(
  54585. Math.min(layer.maxZoom, newZoom),
  54586. layer.minZoom
  54587. );
  54588. scale = newZoom / layer.__zoom;
  54589. layer.__zoom = newZoom;
  54590. // Keep the mouse center when scaling
  54591. pos[0] -= (this._mouseX - pos[0]) * (scale - 1);
  54592. pos[1] -= (this._mouseY - pos[1]) * (scale - 1);
  54593. layer.scale[0] *= scale;
  54594. layer.scale[1] *= scale;
  54595. layer.dirty = true;
  54596. needsRefresh = true;
  54597. }
  54598. }
  54599. }
  54600. if (needsRefresh) {
  54601. this.painter.refresh();
  54602. }
  54603. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEWHEEL事件
  54604. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEWHEEL, event);
  54605. this._mousemoveHandler(event);
  54606. },
  54607. /**
  54608. * Method: mousemove
  54609. * 鼠标(手指)移动响应函数。
  54610. *
  54611. * Parameters:
  54612. * event - {Event} event。
  54613. *
  54614. */
  54615. mousemove: function (event) {
  54616. // 拖拽不触发click事件
  54617. this._clickThreshold++;
  54618. event = this._zrenderEventFixed(event);
  54619. this._lastX = this._mouseX;
  54620. this._lastY = this._mouseY;
  54621. this._mouseX = SUtil_SUtil.Util_event.getX(event);
  54622. this._mouseY = SUtil_SUtil.Util_event.getY(event);
  54623. var dx = this._mouseX - this._lastX;
  54624. var dy = this._mouseY - this._lastY;
  54625. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGSTART事件
  54626. // 避免手抖点击误认为拖拽
  54627. // if (this._mouseX - this._lastX > 1 || this._mouseY - this._lastY > 1) {
  54628. this._processDragStart(event);
  54629. // }
  54630. this._hasfound = 0;
  54631. this._event = event;
  54632. this._iterateAndFindHover();
  54633. // 找到的在迭代函数里做了处理,没找到得在迭代完后处理
  54634. if (!this._hasfound) {
  54635. // 过滤首次拖拽产生的mouseout和dragLeave
  54636. if (!this._draggingTarget
  54637. || (this._lastHover && this._lastHover != this._draggingTarget)
  54638. ) {
  54639. // 可能出现SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  54640. this._processOutShape(event);
  54641. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  54642. this._processDragLeave(event);
  54643. }
  54644. this._lastHover = null;
  54645. this.storage.delHover();
  54646. this.painter.clearHover();
  54647. }
  54648. // set cursor for root element
  54649. var cursor = '';
  54650. // 如果存在拖拽中元素,被拖拽的图形元素最后addHover
  54651. if (this._draggingTarget) {
  54652. this.storage.drift(this._draggingTarget.id, dx, dy);
  54653. this._draggingTarget.modSelf();
  54654. this.storage.addHover(this._draggingTarget);
  54655. } else if (this._isMouseDown) {
  54656. // Layer dragging
  54657. var layers = this.painter.getLayers();
  54658. var needsRefresh = false;
  54659. for (var z in layers) {
  54660. if (z !== 'hover') {
  54661. var layer = layers[z];
  54662. if (layer.panable) {
  54663. // PENDING
  54664. cursor = 'move';
  54665. // Keep the mouse center when scaling
  54666. layer.position[0] += dx;
  54667. layer.position[1] += dy;
  54668. needsRefresh = true;
  54669. layer.dirty = true;
  54670. }
  54671. }
  54672. }
  54673. if (needsRefresh) {
  54674. this.painter.refresh();
  54675. }
  54676. }
  54677. if (this._draggingTarget || (this._hasfound && this._lastHover.draggable)) {
  54678. cursor = 'move';
  54679. } else if (this._hasfound && this._lastHover.clickable) {
  54680. cursor = 'pointer';
  54681. }
  54682. this.root.style.cursor = cursor;
  54683. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEMOVE事件
  54684. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEMOVE, event);
  54685. if (this._draggingTarget || this._hasfound || this.storage.hasHoverShape()) {
  54686. this.painter.refreshHover();
  54687. }
  54688. },
  54689. /**
  54690. * Method: mouseout
  54691. * 鼠标(手指)离开响应函数。
  54692. *
  54693. * Parameters:
  54694. * event - {Event} event。
  54695. *
  54696. */
  54697. mouseout: function (event) {
  54698. event = this._zrenderEventFixed(event);
  54699. var element = event.toElement || event.relatedTarget;
  54700. if (element != this.root) {
  54701. while (element && element.nodeType != 9) {
  54702. // 忽略包含在root中的dom引起的mouseOut
  54703. if (element == this.root) {
  54704. this._mousemoveHandler(event);
  54705. return;
  54706. }
  54707. element = element.parentNode;
  54708. }
  54709. }
  54710. event.zrenderX = this._lastX;
  54711. event.zrenderY = this._lastY;
  54712. this.root.style.cursor = '';
  54713. this._isMouseDown = 0;
  54714. this._processOutShape(event);
  54715. this._processDrop(event);
  54716. this._processDragEnd(event);
  54717. this.painter.refreshHover();
  54718. this.dispatch(Config.EVENT.GLOBALOUT, event);
  54719. },
  54720. /**
  54721. * Method: mousedown
  54722. * 鼠标(手指)按下响应函数。
  54723. *
  54724. * Parameters:
  54725. * event - {Event} event。
  54726. *
  54727. */
  54728. mousedown: function (event) {
  54729. // 重置 clickThreshold
  54730. this._clickThreshold = 0;
  54731. if (this._lastDownButton == 2) {
  54732. this._lastDownButton = event.button;
  54733. this._mouseDownTarget = null;
  54734. // 仅作为关闭右键菜单使用
  54735. return;
  54736. }
  54737. this._lastMouseDownMoment = new Date();
  54738. event = this._zrenderEventFixed(event);
  54739. this._isMouseDown = 1;
  54740. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEDOWN事件
  54741. this._mouseDownTarget = this._lastHover;
  54742. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEDOWN, event);
  54743. this._lastDownButton = event.button;
  54744. },
  54745. /**
  54746. * Method: mouseup
  54747. * 鼠标(手指)抬起响应函数。
  54748. *
  54749. * Parameters:
  54750. * event - {Event} event。
  54751. *
  54752. */
  54753. mouseup: function (event) {
  54754. event = this._zrenderEventFixed(event);
  54755. this.root.style.cursor = '';
  54756. this._isMouseDown = 0;
  54757. this._mouseDownTarget = null;
  54758. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEUP事件
  54759. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEUP, event);
  54760. this._processDrop(event);
  54761. this._processDragEnd(event);
  54762. },
  54763. /**
  54764. * Method: touchstart
  54765. * Touch 开始响应函数。
  54766. *
  54767. * Parameters:
  54768. * event - {Event} event。
  54769. *
  54770. */
  54771. touchstart: function (event) {
  54772. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54773. event = this._zrenderEventFixed(event, true);
  54774. this._lastTouchMoment = new Date();
  54775. // 平板补充一次findHover
  54776. this._mobildFindFixed(event);
  54777. this._mousedownHandler(event);
  54778. },
  54779. /**
  54780. * Method: touchmove
  54781. * Touch 移动响应函数。
  54782. *
  54783. * Parameters:
  54784. * event - {Event} event。
  54785. *
  54786. */
  54787. touchmove: function (event) {
  54788. event = this._zrenderEventFixed(event, true);
  54789. this._mousemoveHandler(event);
  54790. if (this._isDragging) {
  54791. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54792. }
  54793. },
  54794. /**
  54795. * Method: touchend
  54796. * Touch 结束响应函数。
  54797. *
  54798. * Parameters:
  54799. * event - {Event} event。
  54800. *
  54801. */
  54802. touchend: function (event) {
  54803. // SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54804. event = this._zrenderEventFixed(event, true);
  54805. this._mouseupHandler(event);
  54806. var now = new Date();
  54807. if (now - this._lastTouchMoment < Config.EVENT.touchClickDelay) {
  54808. this._mobildFindFixed(event);
  54809. this._clickHandler(event);
  54810. if (now - this._lastClickMoment < Config.EVENT.touchClickDelay / 2) {
  54811. this._dblclickHandler(event);
  54812. if (this._lastHover && this._lastHover.clickable) {
  54813. SUtil_SUtil.Util_event.stop(event);// 阻止浏览器默认事件,重要
  54814. }
  54815. }
  54816. this._lastClickMoment = now;
  54817. }
  54818. this.painter.clearHover();
  54819. }
  54820. };
  54821. initDomHandler(this);
  54822. // 初始化,事件绑定,支持的所有事件都由如下原生事件计算得来
  54823. if (window.addEventListener) {
  54824. window.addEventListener('resize', this._resizeHandler);
  54825. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  54826. // mobile支持
  54827. root.addEventListener('touchstart', this._touchstartHandler);
  54828. root.addEventListener('touchmove', this._touchmoveHandler);
  54829. root.addEventListener('touchend', this._touchendHandler);
  54830. } else {
  54831. // mobile的click/move/up/down自己模拟
  54832. root.addEventListener('click', this._clickHandler);
  54833. root.addEventListener('dblclick', this._dblclickHandler);
  54834. root.addEventListener('mousewheel', this._mousewheelHandler);
  54835. root.addEventListener('mousemove', this._mousemoveHandler);
  54836. root.addEventListener('mousedown', this._mousedownHandler);
  54837. root.addEventListener('mouseup', this._mouseupHandler);
  54838. }
  54839. root.addEventListener('DOMMouseScroll', this._mousewheelHandler);
  54840. root.addEventListener('mouseout', this._mouseoutHandler);
  54841. } else {
  54842. window.attachEvent('onresize', this._resizeHandler);
  54843. root.attachEvent('onclick', this._clickHandler);
  54844. //root.attachEvent('ondblclick ', this._dblclickHandler);
  54845. root.ondblclick = this._dblclickHandler;
  54846. root.attachEvent('onmousewheel', this._mousewheelHandler);
  54847. root.attachEvent('onmousemove', this._mousemoveHandler);
  54848. root.attachEvent('onmouseout', this._mouseoutHandler);
  54849. root.attachEvent('onmousedown', this._mousedownHandler);
  54850. root.attachEvent('onmouseup', this._mouseupHandler);
  54851. }
  54852. // 辅助函数 start
  54853. /**
  54854. * Method: bind1Arg
  54855. * bind 一个参数的 function。
  54856. *
  54857. * Parameters:
  54858. * handler - {Function} 要 bind 的 function。
  54859. * context - {Object} 运行时 this 环境。
  54860. *
  54861. * Returns:
  54862. * {Function}
  54863. */
  54864. function bind1Arg(handler, context) {
  54865. return function (e) {
  54866. return handler.call(context, e);
  54867. };
  54868. }
  54869. /*
  54870. // bind 两个参数的 function
  54871. function bind2Arg(handler, context) {
  54872. return function (arg1, arg2) {
  54873. return handler.call(context, arg1, arg2);
  54874. };
  54875. }
  54876. */
  54877. // bind 三个参数的 function
  54878. function bind3Arg(handler, context) {
  54879. return function (arg1, arg2, arg3) {
  54880. return handler.call(context, arg1, arg2, arg3);
  54881. };
  54882. }
  54883. /**
  54884. * Method: initDomHandler
  54885. * 为控制类实例初始化 dom 事件处理函数。
  54886. *
  54887. * Parameters:
  54888. * instance - {<SuperMap.LevelRenderer.Handler>} 控制类实例 。
  54889. *
  54890. * Returns:
  54891. * {Function}
  54892. */
  54893. function initDomHandler(instance) {
  54894. var domHandlerNames = [
  54895. 'resize', 'click', 'dblclick',
  54896. 'mousewheel', 'mousemove', 'mouseout', 'mouseup', 'mousedown',
  54897. 'touchstart', 'touchend', 'touchmove'
  54898. ];
  54899. var len = domHandlerNames.length;
  54900. while (len--) {
  54901. var name = domHandlerNames[len];
  54902. instance['_' + name + 'Handler'] = bind1Arg(domHandlers[name], instance);
  54903. }
  54904. }
  54905. /**
  54906. * Method: findHover
  54907. * 迭代函数,查找 hover 到的图形元素并即时做些事件分发。
  54908. *
  54909. * Parameters:
  54910. * shape - {Object} 图形。
  54911. * x - {number} 鼠标 x。
  54912. * y - {number} 鼠标 y。
  54913. *
  54914. * Returns:
  54915. * {boolean} 是否找到图形。
  54916. *
  54917. */
  54918. function findHover(shape, x, y) {
  54919. var me = this;
  54920. if (
  54921. (me._draggingTarget && me._draggingTarget.id == shape.id) // 迭代到当前拖拽的图形上
  54922. || shape.isSilent() // 打酱油的路过,啥都不响应的shape~
  54923. ) {
  54924. return false;
  54925. }
  54926. var event = me._event;
  54927. if (shape.isCover(x, y)) {
  54928. if (shape.hoverable) {
  54929. // SMIC-修改 - start
  54930. if (shape.isHoverByRefDataID && shape.isHoverByRefDataID === true) {
  54931. if (shape.refDataID) {
  54932. var fid = shape.refDataID;
  54933. //me.painter.clearHover();
  54934. //me.storage.delHover();
  54935. var hoverGroup = null;
  54936. if (shape.refDataHoverGroup) {
  54937. hoverGroup = shape.refDataHoverGroup;
  54938. }
  54939. //查找同一个用户数据 feature 的所有图形
  54940. var shapeList = me.storage._shapeList;
  54941. for (var i = 0, len = shapeList.length; i < len; i++) {
  54942. var si = shapeList[i];
  54943. if (si.refDataID && fid === si.refDataID) {
  54944. if (hoverGroup) {
  54945. if (si.refDataHoverGroup && hoverGroup === si.refDataHoverGroup) {
  54946. me.storage.addHover(si);
  54947. }
  54948. } else {
  54949. me.storage.addHover(si);
  54950. }
  54951. }
  54952. }
  54953. }
  54954. } else {
  54955. me.storage.addHover(shape);
  54956. }
  54957. //初始代码:
  54958. // me.storage.addHover(shape);
  54959. // SMIC-修改 - end
  54960. }
  54961. // 查找是否在 clipShape 中
  54962. var p = shape.parent;
  54963. while (p) {
  54964. if (p.clipShape && !p.clipShape.isCover(me._mouseX, me._mouseY)) {
  54965. // 已经被祖先 clip 掉了
  54966. return false;
  54967. }
  54968. p = p.parent;
  54969. }
  54970. if (me._lastHover != shape) {
  54971. me._processOutShape(event);
  54972. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  54973. me._processDragLeave(event);
  54974. me._lastHover = shape;
  54975. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  54976. me._processDragEnter(event);
  54977. }
  54978. me._processOverShape(event);
  54979. // 可能出现SuperMap.LevelRenderer.Config.EVENT.DRAGOVER
  54980. me._processDragOver(event);
  54981. me._hasfound = 1;
  54982. return true; // 找到则中断迭代查找
  54983. }
  54984. return false;
  54985. }
  54986. // 辅助函数 end
  54987. }
  54988. /**
  54989. * @function SuperMap.LevelRenderer.Handler.prototype.destroy
  54990. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  54991. */
  54992. destroy() {
  54993. this.dispose();
  54994. this._lastX = null;
  54995. this._lastY = null;
  54996. this._mouseX = null;
  54997. this._mouseY = null;
  54998. this._findHover = null;
  54999. Eventful.prototype.destroy.apply(this, arguments);
  55000. }
  55001. /**
  55002. * @function SuperMap.LevelRenderer.Handler.prototype.on
  55003. * @description 自定义事件绑定。
  55004. * @param {string} eventName - 事件名称,resize、hover、drag等。
  55005. * @param {function} handler - 响应函数。
  55006. * @returns {SuperMap.LevelRenderer.Handler} this。
  55007. */
  55008. on(eventName, handler) {
  55009. this.bind(eventName, handler);
  55010. return this;
  55011. }
  55012. /**
  55013. * @function SuperMap.LevelRenderer.Handler.prototype.un
  55014. * @description 自定义事件解除绑定。
  55015. * @param {string} eventName - 事件名称,resize、hover、drag等。
  55016. * @param {function} handler - 响应函数。
  55017. * @returns {SuperMap.LevelRenderer.Handler} this。
  55018. */
  55019. un(eventName, handler) {
  55020. this.unbind(eventName, handler);
  55021. return this;
  55022. }
  55023. /**
  55024. * @function SuperMap.LevelRenderer.Handler.prototype.trigger
  55025. * @description 事件触发。
  55026. * @param {string} eventName - 事件名称,resize、hover、drag等。
  55027. * @param {event} eventArgs - dom事件对象。
  55028. */
  55029. trigger(eventName, eventArgs) {
  55030. var EVENT = Config.EVENT;
  55031. switch (eventName) {
  55032. case EVENT.RESIZE:
  55033. case EVENT.CLICK:
  55034. case EVENT.DBLCLICK:
  55035. case EVENT.MOUSEWHEEL:
  55036. case EVENT.MOUSEMOVE:
  55037. case EVENT.MOUSEDOWN:
  55038. case EVENT.MOUSEUP:
  55039. case EVENT.MOUSEOUT:
  55040. this['_' + eventName + 'Handler'](eventArgs);
  55041. break;
  55042. }
  55043. }
  55044. /**
  55045. * @function SuperMap.LevelRenderer.Handler.prototype.dispose
  55046. * @description 释放,解绑所有事件。
  55047. */
  55048. dispose() {
  55049. var root = this.root;
  55050. if (window.removeEventListener) {
  55051. window.removeEventListener('resize', this._resizeHandler);
  55052. if (SUtil_SUtil.Util_env.os.tablet || SUtil_SUtil.Util_env.os.phone) {
  55053. // mobile支持
  55054. root.removeEventListener('touchstart', this._touchstartHandler);
  55055. root.removeEventListener('touchmove', this._touchmoveHandler);
  55056. root.removeEventListener('touchend', this._touchendHandler);
  55057. } else {
  55058. // mobile的click自己模拟
  55059. root.removeEventListener('click', this._clickHandler);
  55060. root.removeEventListener('dblclick', this._dblclickHandler);
  55061. root.removeEventListener('mousewheel', this._mousewheelHandler);
  55062. root.removeEventListener('mousemove', this._mousemoveHandler);
  55063. root.removeEventListener('mousedown', this._mousedownHandler);
  55064. root.removeEventListener('mouseup', this._mouseupHandler);
  55065. }
  55066. root.removeEventListener('DOMMouseScroll', this._mousewheelHandler);
  55067. root.removeEventListener('mouseout', this._mouseoutHandler);
  55068. } else {
  55069. window.detachEvent('onresize', this._resizeHandler);
  55070. root.detachEvent('onclick', this._clickHandler);
  55071. root.detachEvent('dblclick', this._dblclickHandler);
  55072. root.detachEvent('onmousewheel', this._mousewheelHandler);
  55073. root.detachEvent('onmousemove', this._mousemoveHandler);
  55074. root.detachEvent('onmouseout', this._mouseoutHandler);
  55075. root.detachEvent('onmousedown', this._mousedownHandler);
  55076. root.detachEvent('onmouseup', this._mouseupHandler);
  55077. }
  55078. this.root = null;
  55079. this._domHover = null;
  55080. this.storage = null;
  55081. this.painter = null;
  55082. this.un();
  55083. }
  55084. /**
  55085. * Method: _processDragStart
  55086. * 拖拽开始。
  55087. *
  55088. * Parameters:
  55089. * event - {Object} 事件对象。
  55090. *
  55091. */
  55092. _processDragStart(event) {
  55093. var _lastHover = this._lastHover;
  55094. if (this._isMouseDown
  55095. && _lastHover
  55096. && _lastHover.draggable
  55097. && !this._draggingTarget
  55098. && this._mouseDownTarget == _lastHover
  55099. ) {
  55100. // 拖拽点击生效时长阀门,某些场景需要降低拖拽敏感度
  55101. if (_lastHover.dragEnableTime &&
  55102. new Date() - this._lastMouseDownMoment < _lastHover.dragEnableTime
  55103. ) {
  55104. return;
  55105. }
  55106. var _draggingTarget = _lastHover;
  55107. this._draggingTarget = _draggingTarget;
  55108. this._isDragging = 1;
  55109. _draggingTarget.invisible = true;
  55110. this.storage.mod(_draggingTarget.id);
  55111. // 分发 Config.EVENT.DRAGSTART事件
  55112. this._dispatchAgency(
  55113. _draggingTarget,
  55114. Config.EVENT.DRAGSTART,
  55115. event
  55116. );
  55117. this.painter.refresh();
  55118. }
  55119. }
  55120. /**
  55121. * Method: _processDragEnter
  55122. * 拖拽进入目标元素。
  55123. *
  55124. * Parameters:
  55125. * event - {Object} 事件对象。
  55126. *
  55127. */
  55128. _processDragEnter(event) {
  55129. if (this._draggingTarget) {
  55130. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGENTER事件
  55131. this._dispatchAgency(
  55132. this._lastHover,
  55133. Config.EVENT.DRAGENTER,
  55134. event,
  55135. this._draggingTarget
  55136. );
  55137. }
  55138. }
  55139. /**
  55140. * Method: _processDragOver
  55141. * 拖拽在目标元素上移动。
  55142. *
  55143. * Parameters:
  55144. * event - {Object} 事件对象。
  55145. *
  55146. */
  55147. _processDragOver(event) {
  55148. if (this._draggingTarget) {
  55149. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGOVER事件
  55150. this._dispatchAgency(
  55151. this._lastHover,
  55152. Config.EVENT.DRAGOVER,
  55153. event,
  55154. this._draggingTarget
  55155. );
  55156. }
  55157. }
  55158. /**
  55159. * Method: _processDragLeave
  55160. * 拖拽离开目标元素。
  55161. *
  55162. * Parameters:
  55163. * event - {Object} 事件对象。
  55164. *
  55165. */
  55166. _processDragLeave(event) {
  55167. if (this._draggingTarget) {
  55168. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGLEAVE事件
  55169. this._dispatchAgency(
  55170. this._lastHover,
  55171. Config.EVENT.DRAGLEAVE,
  55172. event,
  55173. this._draggingTarget
  55174. );
  55175. }
  55176. }
  55177. /**
  55178. * Method: _processDrop
  55179. * 拖拽在目标元素上完成。
  55180. *
  55181. * Parameters:
  55182. * event - {Object} 事件对象。
  55183. *
  55184. */
  55185. _processDrop(event) {
  55186. if (this._draggingTarget) {
  55187. this._draggingTarget.invisible = false;
  55188. this.storage.mod(this._draggingTarget.id);
  55189. this.painter.refresh();
  55190. // 分发SuperMap.LevelRenderer.Config.EVENT.DROP事件
  55191. this._dispatchAgency(
  55192. this._lastHover,
  55193. Config.EVENT.DROP,
  55194. event,
  55195. this._draggingTarget
  55196. );
  55197. }
  55198. }
  55199. /**
  55200. * Method: _processDragEnd
  55201. * 拖拽结束。
  55202. *
  55203. * Parameters:
  55204. * event - {Object} 事件对象。
  55205. *
  55206. */
  55207. _processDragEnd(event) {
  55208. if (this._draggingTarget) {
  55209. // 分发SuperMap.LevelRenderer.Config.EVENT.DRAGEND事件
  55210. this._dispatchAgency(
  55211. this._draggingTarget,
  55212. Config.EVENT.DRAGEND,
  55213. event
  55214. );
  55215. this._lastHover = null;
  55216. }
  55217. this._isDragging = 0;
  55218. this._draggingTarget = null;
  55219. }
  55220. /**
  55221. * Method: _processOverShape
  55222. * 鼠标在某个图形元素上移动。
  55223. *
  55224. * Parameters:
  55225. * event - {Object} 事件对象。
  55226. *
  55227. */
  55228. _processOverShape(event) {
  55229. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOVER事件
  55230. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOVER, event);
  55231. }
  55232. /**
  55233. * Method: _processOutShape
  55234. * 鼠标离开某个图形元素。
  55235. *
  55236. * Parameters:
  55237. * event - {Object} 事件对象。
  55238. *
  55239. */
  55240. _processOutShape(event) {
  55241. // 分发SuperMap.LevelRenderer.Config.EVENT.MOUSEOUT事件
  55242. this._dispatchAgency(this._lastHover, Config.EVENT.MOUSEOUT, event);
  55243. }
  55244. /**
  55245. * Method: _dispatchAgency
  55246. * 鼠标离开某个图形元素。
  55247. *
  55248. * Parameters:
  55249. * targetShape - {Object} 目标图形元素。
  55250. * eventName - {Object} 事件名称。
  55251. * event - {Object} 事件对象。
  55252. * draggedShape - {Object} 拖拽事件特有,当前被拖拽图形元素。
  55253. *
  55254. */
  55255. _dispatchAgency(targetShape, eventName, event, draggedShape) {
  55256. var eventHandler = 'on' + eventName;
  55257. var eventPacket = {
  55258. type: eventName,
  55259. event: event,
  55260. target: targetShape,
  55261. cancelBubble: false
  55262. };
  55263. var el = targetShape;
  55264. if (draggedShape) {
  55265. eventPacket.dragged = draggedShape;
  55266. }
  55267. while (el) {
  55268. el[eventHandler]
  55269. && (eventPacket.cancelBubble = el[eventHandler](eventPacket));
  55270. el.dispatch(eventName, eventPacket);
  55271. el = el.parent;
  55272. if (eventPacket.cancelBubble) {
  55273. break;
  55274. }
  55275. }
  55276. if (targetShape) {
  55277. // 冒泡到顶级 zrender 对象
  55278. if (!eventPacket.cancelBubble) {
  55279. this.dispatch(eventName, eventPacket);
  55280. }
  55281. } else if (!draggedShape) {
  55282. // 无hover目标,无拖拽对象,原生事件分发
  55283. this.dispatch(eventName, {
  55284. type: eventName,
  55285. event: event
  55286. });
  55287. }
  55288. }
  55289. /**
  55290. * Method: _iterateAndFindHover
  55291. * 迭代寻找 hover shape。
  55292. *
  55293. */
  55294. _iterateAndFindHover() {
  55295. var invTransform = SUtil_SUtil.Util_matrix.create();
  55296. var list = this.storage.getShapeList();
  55297. var currentZLevel;
  55298. var currentLayer;
  55299. var tmp = [0, 0];
  55300. for (var i = list.length - 1; i >= 0; i--) {
  55301. var shape = list[i];
  55302. if (currentZLevel !== shape.zlevel) {
  55303. currentLayer = this.painter.getLayer(shape.zlevel, currentLayer);
  55304. tmp[0] = this._mouseX;
  55305. tmp[1] = this._mouseY;
  55306. if (currentLayer.needTransform) {
  55307. SUtil_SUtil.Util_matrix.invert(invTransform, currentLayer.transform);
  55308. SUtil_SUtil.Util_vector.applyTransform(tmp, tmp, invTransform);
  55309. }
  55310. }
  55311. if (this._findHover(shape, tmp[0], tmp[1])) {
  55312. break;
  55313. }
  55314. }
  55315. }
  55316. /**
  55317. * Method: _mobildFindFixed
  55318. * touch 有指尖错觉,四向尝试,让touch上的点击更好触发事件。
  55319. *
  55320. * Parameters:
  55321. * event - {Object} 事件对象。
  55322. *
  55323. */
  55324. _mobildFindFixed(event) {
  55325. // touch指尖错觉的尝试偏移量配置
  55326. var MOBILE_TOUCH_OFFSETS = [
  55327. {x: 10},
  55328. {x: -20},
  55329. {x: 10, y: 10},
  55330. {y: -20}
  55331. ];
  55332. this._lastHover = null;
  55333. this._mouseX = event.zrenderX;
  55334. this._mouseY = event.zrenderY;
  55335. this._event = event;
  55336. this._iterateAndFindHover();
  55337. for (var i = 0; !this._lastHover && i < MOBILE_TOUCH_OFFSETS.length; i++) {
  55338. var offset = MOBILE_TOUCH_OFFSETS[i];
  55339. offset.x && (this._mouseX += offset.x);
  55340. offset.y && (this._mouseX += offset.y);
  55341. this._iterateAndFindHover();
  55342. }
  55343. if (this._lastHover) {
  55344. event.zrenderX = this._mouseX;
  55345. event.zrenderY = this._mouseY;
  55346. }
  55347. }
  55348. /**
  55349. * Method: _zrenderEventFixed
  55350. * 如果存在第三方嵌入的一些dom触发的事件,或touch事件,需要转换一下事件坐标 。
  55351. *
  55352. * Parameters:
  55353. * event - {Object} 事件。
  55354. * isTouch - {boolean} 是否触摸。
  55355. *
  55356. */
  55357. _zrenderEventFixed(event, isTouch) {
  55358. if (event.zrenderFixed) {
  55359. return event;
  55360. }
  55361. if (!isTouch) {
  55362. event = event || window.event;
  55363. // 进入对象优先~
  55364. var target = event.toElement
  55365. || event.relatedTarget
  55366. || event.srcElement
  55367. || event.target;
  55368. if (target && target != this._domHover) {
  55369. event.zrenderX = (typeof event.offsetX != 'undefined'
  55370. ? event.offsetX
  55371. : event.layerX)
  55372. + target.offsetLeft;
  55373. event.zrenderY = (typeof event.offsetY != 'undefined'
  55374. ? event.offsetY
  55375. : event.layerY)
  55376. + target.offsetTop;
  55377. }
  55378. } else {
  55379. var touch = event.type != 'touchend'
  55380. ? event.targetTouches[0]
  55381. : event.changedTouches[0];
  55382. if (touch) {
  55383. var rBounding = this.root.getBoundingClientRect();
  55384. // touch事件坐标是全屏的~
  55385. event.zrenderX = touch.clientX - rBounding.left;
  55386. event.zrenderY = touch.clientY - rBounding.top;
  55387. }
  55388. }
  55389. event.zrenderFixed = 1;
  55390. return event;
  55391. }
  55392. // SMIC-方法扩展 - start
  55393. /**
  55394. * @function SuperMap.LevelRenderer.Handler.prototype.getLastHoverOne
  55395. * @description 获取单个高亮图形
  55396. */
  55397. getLastHoverOne() {
  55398. if (this._lastHover) {
  55399. return this._lastHover;
  55400. }
  55401. return null;
  55402. }
  55403. // SMIC-方法扩展 - end
  55404. }
  55405. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Easing.js
  55406. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55407. * This program are made available under the terms of the Apache License, Version 2.0
  55408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55409. /**
  55410. * @class SuperMap.LevelRenderer.Animation.easing
  55411. * @category Visualization Theme
  55412. * @classdesc 缓动
  55413. * @private
  55414. */
  55415. // 缓动代码来自 https://github.com/sole/tween.js/blob/master/src/Tween.js
  55416. // http://sole.github.io/tween.js/examples/03_graphs.html
  55417. class Easing {
  55418. /**
  55419. * @function SuperMap.LevelRenderer.Animation.easing.constructor
  55420. * @description 构造函数。
  55421. */
  55422. constructor() {
  55423. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.easing";
  55424. }
  55425. /**
  55426. * @function SuperMap.LevelRenderer.Animation.easing.destroy
  55427. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55428. */
  55429. destroy() {
  55430. }
  55431. /**
  55432. * @function SuperMap.LevelRenderer.Animation.easing.Linear
  55433. * @description 线性缓动
  55434. * @param {number} k - 参数
  55435. * @return {number} 输入值
  55436. */
  55437. Linear(k) {
  55438. return k;
  55439. }
  55440. /**
  55441. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticIn
  55442. * @description 二次方的缓动(t^2)
  55443. * @param {number} k - 参数
  55444. * @return {number} 二次方的缓动的值
  55445. */
  55446. QuadraticIn(k) {
  55447. return k * k;
  55448. }
  55449. /**
  55450. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticOut
  55451. * @description 返回按二次方缓动退出的值
  55452. * @param {number} k - 参数
  55453. * @return {number} 按二次方缓动退出的值
  55454. */
  55455. QuadraticOut(k) {
  55456. return k * (2 - k);
  55457. }
  55458. /**
  55459. * @function SuperMap.LevelRenderer.Animation.easing.QuadraticInOut
  55460. * @description 返回按二次方缓动进入和退出的值
  55461. * @param {number} k - 参数
  55462. * @return {number} 按二次方缓动进入和退出的值
  55463. */
  55464. QuadraticInOut(k) {
  55465. if ((k *= 2) < 1) {
  55466. return 0.5 * k * k;
  55467. }
  55468. return -0.5 * (--k * (k - 2) - 1);
  55469. }
  55470. /**
  55471. * @function SuperMap.LevelRenderer.Animation.easing.CubicIn
  55472. * @description 三次方的缓动(t^3)
  55473. * @param {number} k - 参数
  55474. * @return {number} 按三次方缓动的值
  55475. */
  55476. CubicIn(k) {
  55477. return k * k * k;
  55478. }
  55479. /**
  55480. * @function SuperMap.LevelRenderer.Animation.easing.CubicOut
  55481. * @description 返回按三次方缓动退出的值
  55482. * @param {number} k - 参数
  55483. * @return {number} 按三次方缓动退出的值
  55484. */
  55485. CubicOut(k) {
  55486. return --k * k * k + 1;
  55487. }
  55488. /**
  55489. * @function SuperMap.LevelRenderer.Animation.easing.CubicInOut
  55490. * @description 返回按三次方缓动进入退出的值
  55491. * @param {number} k - 参数
  55492. * @return {number} 按三次方缓动进入退出的值
  55493. */
  55494. CubicInOut(k) {
  55495. if ((k *= 2) < 1) {
  55496. return 0.5 * k * k * k;
  55497. }
  55498. return 0.5 * ((k -= 2) * k * k + 2);
  55499. }
  55500. /**
  55501. * @function SuperMap.LevelRenderer.Animation.easing.QuarticIn
  55502. * @description 返回按四次方缓动进入的值
  55503. * @param {number} k - 参数
  55504. * @return {number} 按四次方缓动进入的值
  55505. */
  55506. QuarticIn(k) {
  55507. return k * k * k * k;
  55508. }
  55509. /**
  55510. * @function SuperMap.LevelRenderer.Animation.easing.QuarticOut
  55511. * @description 返回按四次方缓动退出的值
  55512. * @param {number} k - 参数
  55513. * @return {number} 按四次方缓动退出的值
  55514. */
  55515. QuarticOut(k) {
  55516. return 1 - (--k * k * k * k);
  55517. }
  55518. /**
  55519. * @function SuperMap.LevelRenderer.Animation.easing.QuarticInOut
  55520. * @description 返回按四次方缓动进入退出的值
  55521. * @param {number} k - 参数
  55522. * @return {number} 按四次方缓动进入退出的值
  55523. */
  55524. QuarticInOut(k) {
  55525. if ((k *= 2) < 1) {
  55526. return 0.5 * k * k * k * k;
  55527. }
  55528. return -0.5 * ((k -= 2) * k * k * k - 2);
  55529. }
  55530. // 五次方的缓动(t^5)
  55531. /**
  55532. * @function SuperMap.LevelRenderer.Animation.easing.QuinticIn
  55533. * @description 返回按五次方缓动的值
  55534. * @param {number} k - 参数
  55535. * @return {number} 按五次方缓动的值
  55536. */
  55537. QuinticIn(k) {
  55538. return k * k * k * k * k;
  55539. }
  55540. /**
  55541. * @function SuperMap.LevelRenderer.Animation.easing.QuinticOut
  55542. * @description 返回按五次方缓动退出的值
  55543. * @param {number} k - 参数
  55544. * @return {number} 按五次方缓动退出的值
  55545. */
  55546. QuinticOut(k) {
  55547. return --k * k * k * k * k + 1;
  55548. }
  55549. /**
  55550. * @function SuperMap.LevelRenderer.Animation.easing.QuinticInOut
  55551. * @description 返回按五次方缓动进入退出的值
  55552. * @param {number} k - 参数
  55553. * @return {number} 按五次方缓动进入退出的值
  55554. */
  55555. QuinticInOut(k) {
  55556. if ((k *= 2) < 1) {
  55557. return 0.5 * k * k * k * k * k;
  55558. }
  55559. return 0.5 * ((k -= 2) * k * k * k * k + 2);
  55560. }
  55561. // 正弦曲线的缓动(sin(t))
  55562. /**
  55563. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalIn
  55564. * @description 返回按正弦曲线的缓动进入的值
  55565. * @param {number} k - 参数
  55566. * @return {number} 按正弦曲线的缓动进入的值
  55567. */
  55568. SinusoidalIn(k) {
  55569. return 1 - Math.cos(k * Math.PI / 2);
  55570. }
  55571. /**
  55572. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalOut
  55573. * @description 返回按正弦曲线的缓动退出的值
  55574. * @param {number} k - 参数
  55575. * @return {number} 按正弦曲线的缓动退出的值
  55576. */
  55577. SinusoidalOut(k) {
  55578. return Math.sin(k * Math.PI / 2);
  55579. }
  55580. /**
  55581. * @function SuperMap.LevelRenderer.Animation.easing.SinusoidalInOut
  55582. * @description 返回按正弦曲线的缓动进入退出的值
  55583. * @param {number} k - 参数
  55584. * @return {number} 按正弦曲线的缓动进入退出的值
  55585. */
  55586. SinusoidalInOut(k) {
  55587. return 0.5 * (1 - Math.cos(Math.PI * k));
  55588. }
  55589. // 指数曲线的缓动(2^t)
  55590. /**
  55591. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialIn
  55592. * @description 返回按指数曲线的缓动进入的值
  55593. * @param {number} k - 参数
  55594. * @return {number} 按指数曲线的缓动进入的值
  55595. */
  55596. ExponentialIn(k) {
  55597. return k === 0 ? 0 : Math.pow(1024, k - 1);
  55598. }
  55599. /**
  55600. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialOut
  55601. * @description 返回按指数曲线的缓动退出的值
  55602. * @param {number} k - 参数
  55603. * @return {number} 按指数曲线的缓动退出的值
  55604. */
  55605. ExponentialOut(k) {
  55606. return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
  55607. }
  55608. /**
  55609. * @function SuperMap.LevelRenderer.Animation.easing.ExponentialInOut
  55610. * @description 返回按指数曲线的缓动进入退出的值
  55611. * @param {number} k - 参数
  55612. * @return {number} 按指数曲线的缓动进入退出的值
  55613. */
  55614. ExponentialInOut(k) {
  55615. if (k === 0) {
  55616. return 0;
  55617. }
  55618. if (k === 1) {
  55619. return 1;
  55620. }
  55621. if ((k *= 2) < 1) {
  55622. return 0.5 * Math.pow(1024, k - 1);
  55623. }
  55624. return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
  55625. }
  55626. // 圆形曲线的缓动(sqrt(1-t^2))
  55627. /**
  55628. * @function SuperMap.LevelRenderer.Animation.easing.CircularIn
  55629. * @description 返回按圆形曲线的缓动进入的值
  55630. * @param {number} k - 参数
  55631. * @return {number} 按圆形曲线的缓动进入的值
  55632. */
  55633. CircularIn(k) {
  55634. return 1 - Math.sqrt(1 - k * k);
  55635. }
  55636. /**
  55637. * @function SuperMap.LevelRenderer.Animation.easing.CircularOut
  55638. * @description 返回按圆形曲线的缓动退出的值
  55639. * @param {number} k - 参数
  55640. * @return {number} 按圆形曲线的缓动退出的值
  55641. */
  55642. CircularOut(k) {
  55643. return Math.sqrt(1 - (--k * k));
  55644. }
  55645. /**
  55646. * @function SuperMap.LevelRenderer.Animation.easing.CircularInOut
  55647. * @description 返回按圆形曲线的缓动进入退出的值
  55648. * @param {number} k - 参数
  55649. * @return {number} 按圆形曲线的缓动进入退出的值
  55650. */
  55651. CircularInOut(k) {
  55652. if ((k *= 2) < 1) {
  55653. return -0.5 * (Math.sqrt(1 - k * k) - 1);
  55654. }
  55655. return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
  55656. }
  55657. // 创建类似于弹簧在停止前来回振荡的动画
  55658. /**
  55659. * @function SuperMap.LevelRenderer.Animation.easing.ElasticIn
  55660. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  55661. * @param {number} k - 参数
  55662. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入的值
  55663. */
  55664. ElasticIn(k) {
  55665. var s;
  55666. var a = 0.1;
  55667. var p = 0.4;
  55668. if (k === 0) {
  55669. return 0;
  55670. }
  55671. if (k === 1) {
  55672. return 1;
  55673. }
  55674. if (a < 1) {
  55675. a = 1;
  55676. s = p / 4;
  55677. } else {
  55678. s = p * Math.asin(1 / a) / (2 * Math.PI);
  55679. }
  55680. return -(a * Math.pow(2, 10 * (k -= 1)) *
  55681. Math.sin((k - s) * (2 * Math.PI) / p));
  55682. }
  55683. /**
  55684. * @function SuperMap.LevelRenderer.Animation.easing.ElasticOut
  55685. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  55686. * @param {number} k - 参数
  55687. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动退出的值
  55688. */
  55689. ElasticOut(k) {
  55690. var s;
  55691. var a = 0.1;
  55692. var p = 0.4;
  55693. if (k === 0) {
  55694. return 0;
  55695. }
  55696. if (k === 1) {
  55697. return 1;
  55698. }
  55699. if (a < 1) {
  55700. a = 1;
  55701. s = p / 4;
  55702. } else {
  55703. s = p * Math.asin(1 / a) / (2 * Math.PI);
  55704. }
  55705. return (a * Math.pow(2, -10 * k) *
  55706. Math.sin((k - s) * (2 * Math.PI) / p) + 1);
  55707. }
  55708. /**
  55709. * @function SuperMap.LevelRenderer.Animation.easing.ElasticInOut
  55710. * @description 返回按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  55711. * @param {number} k - 参数
  55712. * @return {number} 按类似于弹簧在停止前来回振荡的动画的缓动进入退出的值
  55713. */
  55714. ElasticInOut(k) {
  55715. var s;
  55716. var a = 0.1;
  55717. var p = 0.4;
  55718. if (k === 0) {
  55719. return 0;
  55720. }
  55721. if (k === 1) {
  55722. return 1;
  55723. }
  55724. if (a < 1) {
  55725. a = 1;
  55726. s = p / 4;
  55727. } else {
  55728. s = p * Math.asin(1 / a) / (2 * Math.PI);
  55729. }
  55730. if ((k *= 2) < 1) {
  55731. return -0.5 * (a * Math.pow(2, 10 * (k -= 1))
  55732. * Math.sin((k - s) * (2 * Math.PI) / p));
  55733. }
  55734. return a * Math.pow(2, -10 * (k -= 1))
  55735. * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
  55736. }
  55737. // 在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动
  55738. /**
  55739. * @function SuperMap.LevelRenderer.Animation.easing.BackIn
  55740. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  55741. * @param {number} k - 参数
  55742. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入的值
  55743. */
  55744. BackIn(k) {
  55745. var s = 1.70158;
  55746. return k * k * ((s + 1) * k - s);
  55747. }
  55748. /**
  55749. * @function SuperMap.LevelRenderer.Animation.easing.BackOut
  55750. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  55751. * @param {number} k - 参数
  55752. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动退出的值
  55753. */
  55754. BackOut(k) {
  55755. var s = 1.70158;
  55756. return --k * k * ((s + 1) * k + s) + 1;
  55757. }
  55758. /**
  55759. * @function SuperMap.LevelRenderer.Animation.easing.BackInOut
  55760. * @description 返回按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  55761. * @param {number} k - 参数
  55762. * @return {number} 按在某一动画开始沿指示的路径进行动画处理前稍稍收回该动画的移动的缓动进入退出的值
  55763. */
  55764. BackInOut(k) {
  55765. var s = 1.70158 * 1.525;
  55766. if ((k *= 2) < 1) {
  55767. return 0.5 * (k * k * ((s + 1) * k - s));
  55768. }
  55769. return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
  55770. }
  55771. // 创建弹跳效果
  55772. /**
  55773. * @function SuperMap.LevelRenderer.Animation.easing.BounceIn
  55774. * @description 返回按弹跳效果的缓动进入的值
  55775. * @param {number} k - 参数
  55776. * @return {number} 按弹跳效果的缓动进入的值
  55777. */
  55778. BounceIn(k) {
  55779. return 1 - this.BounceOut(1 - k);
  55780. }
  55781. /**
  55782. * @function SuperMap.LevelRenderer.Animation.easing.BounceOut
  55783. * @description 返回按弹跳效果的缓动退出的值
  55784. * @param {number} k - 参数
  55785. * @return {number} 按弹跳效果的缓动退出的值
  55786. */
  55787. BounceOut(k) {
  55788. if (k < (1 / 2.75)) {
  55789. return 7.5625 * k * k;
  55790. } else if (k < (2 / 2.75)) {
  55791. return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
  55792. } else if (k < (2.5 / 2.75)) {
  55793. return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
  55794. } else {
  55795. return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
  55796. }
  55797. }
  55798. /**
  55799. * @function SuperMap.LevelRenderer.Animation.easing.BounceInOut
  55800. * @description 返回按弹跳效果的缓动进入退出的值
  55801. * @param {number} k - 参数
  55802. * @return {number} 按弹跳效果的缓动进入退出的值
  55803. */
  55804. BounceInOut(k) {
  55805. if (k < 0.5) {
  55806. return this.BounceIn(k * 2) * 0.5;
  55807. }
  55808. return this.BounceOut(k * 2 - 1) * 0.5 + 0.5;
  55809. }
  55810. }
  55811. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Clip.js
  55812. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55813. * This program are made available under the terms of the Apache License, Version 2.0
  55814. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55815. /**
  55816. * @class SuperMap.LevelRenderer.Animation.Clip
  55817. * @category Visualization Theme
  55818. * @classdec 动画片段
  55819. * @private
  55820. */
  55821. class Clip {
  55822. /**
  55823. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.constructor
  55824. * @description 构造函数。
  55825. * @param {Object} options - 参数。
  55826. * @param {Object} options.target - 动画对象,可以是数组,如果是数组的话会批量分发 onframe 等事件。
  55827. * @param {number} [options.life=1000] - 动画时长。
  55828. * @param {number} [options.delay=0] - 动画延迟时间。
  55829. * @param {boolean} [options.loop=true] - 是否循环。
  55830. * @param {number} [options.gap=0] - 循环的间隔时间。
  55831. * @param {Object} options.onframe - 帧。
  55832. * @param {boolean} options.easing - 是否消除。
  55833. * @param {boolean} options.ondestroy - 是否销毁。
  55834. * @param {boolean} options.onrestart - 是否重播。
  55835. */
  55836. constructor(options) {
  55837. this._targetPool = options.target || {};
  55838. if (!(this._targetPool instanceof Array)) {
  55839. this._targetPool = [this._targetPool];
  55840. }
  55841. // 生命周期
  55842. this._life = options.life || 1000;
  55843. // 延时
  55844. this._delay = options.delay || 0;
  55845. // 开始时间
  55846. this._startTime = new Date().getTime() + this._delay;// 单位毫秒
  55847. // 结束时间
  55848. this._endTime = this._startTime + this._life * 1000;
  55849. // 是否循环
  55850. this.loop = typeof options.loop == 'undefined'
  55851. ? false : options.loop;
  55852. this.gap = options.gap || 0;
  55853. this.easing = options.easing || 'Linear';
  55854. this.onframe = options.onframe;
  55855. this.ondestroy = options.ondestroy;
  55856. this.onrestart = options.onrestart;
  55857. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Clip";
  55858. }
  55859. /**
  55860. * @function SuperMap.LevelRenderer.Animation.Clip.prototype.destroy
  55861. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  55862. */
  55863. destroy() {
  55864. }
  55865. step(time) {
  55866. var easing = new Easing();
  55867. var percent = (time - this._startTime) / this._life;
  55868. // 还没开始
  55869. if (percent < 0) {
  55870. return;
  55871. }
  55872. percent = Math.min(percent, 1);
  55873. var easingFunc = typeof this.easing == 'string'
  55874. ? easing[this.easing]
  55875. : this.easing;
  55876. var schedule = typeof easingFunc === 'function'
  55877. ? easingFunc(percent)
  55878. : percent;
  55879. this.fire('frame', schedule);
  55880. // 结束
  55881. if (percent == 1) {
  55882. if (this.loop) {
  55883. this.restart();
  55884. // 重新开始周期
  55885. // 抛出而不是直接调用事件直到 stage.update 后再统一调用这些事件
  55886. return 'restart';
  55887. }
  55888. // 动画完成将这个控制器标识为待删除
  55889. // 在Animation.update中进行批量删除
  55890. this._needsRemove = true;
  55891. return 'destroy';
  55892. }
  55893. return null;
  55894. }
  55895. restart() {
  55896. var time = new Date().getTime();
  55897. var remainder = (time - this._startTime) % this._life;
  55898. this._startTime = new Date().getTime() - remainder + this.gap;
  55899. }
  55900. fire(eventType, arg) {
  55901. for (var i = 0, len = this._targetPool.length; i < len; i++) {
  55902. if (this['on' + eventType]) {
  55903. this['on' + eventType](this._targetPool[i], arg);
  55904. }
  55905. }
  55906. }
  55907. }
  55908. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Animation.js
  55909. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  55910. * This program are made available under the terms of the Apache License, Version 2.0
  55911. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  55912. /**
  55913. * @class SuperMap.LevelRenderer.Animation
  55914. * @classdesc 动画主类, 调度和管理所有动画控制器
  55915. * @category Visualization Theme
  55916. * @extends {SuperMap.LevelRenderer.Eventful}
  55917. * @private
  55918. */
  55919. class Animation extends Eventful {
  55920. /**
  55921. * @function SuperMap.LevelRenderer.Animation.prototype.constructor
  55922. * @description 构造函数。
  55923. * @param {Object} options - 动画参数。
  55924. * @param {Object} options.onframe - onframe。
  55925. * @param {Object} options.stage - stage。
  55926. * (start code)
  55927. * var animation = new SuperMap.LevelRenderer.Animation();
  55928. * var obj = {
  55929. * x: 100,
  55930. * y: 100
  55931. * };
  55932. * animation.animate(node.position)
  55933. * .when(1000, {
  55934. * x: 500,
  55935. * y: 500
  55936. * })
  55937. * .when(2000, {
  55938. * x: 100,
  55939. * y: 100
  55940. * })
  55941. * .start('spline');
  55942. * (end)
  55943. */
  55944. constructor(options) {
  55945. super(options);
  55946. options = options || {};
  55947. /**
  55948. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.stage
  55949. * @description stage。
  55950. */
  55951. this.stage = {};
  55952. /**
  55953. * @member {Object} SuperMap.LevelRenderer.Animation.prototype.onframe
  55954. * @description onframe。
  55955. */
  55956. this.onframe = function () {
  55957. };
  55958. /**
  55959. * @member {Array} SuperMap.LevelRenderer.Animation.prototype._clips
  55960. * @description _clips。
  55961. */
  55962. this._clips = [];
  55963. /**
  55964. * @member {boolean} SuperMap.LevelRenderer.Animation.prototype._running
  55965. * @description _running。
  55966. */
  55967. this._running = false;
  55968. /**
  55969. * @member {number} SuperMap.LevelRenderer.Animation.prototype._time
  55970. * @description _time。
  55971. */
  55972. this._time = 0;
  55973. Util.extend(this, options);
  55974. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation";
  55975. }
  55976. /**
  55977. * @function SuperMap.LevelRenderer.Animation.prototype.add
  55978. * @description 添加动画片段。
  55979. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  55980. */
  55981. add(clip) {
  55982. this._clips.push(clip);
  55983. }
  55984. /**
  55985. * @function SuperMap.LevelRenderer.Animation.prototype.remove
  55986. * @description 删除动画片段。
  55987. * @param {SuperMap.LevelRenderer.Animation.Clip} clip - 动画片段。
  55988. */
  55989. remove(clip) {
  55990. var idx = new Util_Util().indexOf(this._clips, clip);
  55991. if (idx >= 0) {
  55992. this._clips.splice(idx, 1);
  55993. }
  55994. }
  55995. /**
  55996. * @function SuperMap.LevelRenderer.Animation.prototype.update
  55997. * @description 更新动画片段。
  55998. */
  55999. _update() {
  56000. var time = new Date().getTime();
  56001. var delta = time - this._time;
  56002. var clips = this._clips;
  56003. var len = clips.length;
  56004. var deferredEvents = [];
  56005. var deferredClips = [];
  56006. for (let i = 0; i < len; i++) {
  56007. var clip = clips[i];
  56008. var e = clip.step(time);
  56009. // Throw out the events need to be called after
  56010. // stage.update, like destroy
  56011. if (e) {
  56012. deferredEvents.push(e);
  56013. deferredClips.push(clip);
  56014. }
  56015. }
  56016. if (this.stage.update) {
  56017. this.stage.update();
  56018. }
  56019. // Remove the finished clip
  56020. for (let i = 0; i < len;) {
  56021. if (clips[i]._needsRemove) {
  56022. clips[i] = clips[len - 1];
  56023. clips.pop();
  56024. len--;
  56025. } else {
  56026. i++;
  56027. }
  56028. }
  56029. len = deferredEvents.length;
  56030. for (let i = 0; i < len; i++) {
  56031. deferredClips[i].fire(deferredEvents[i]);
  56032. }
  56033. this._time = time;
  56034. this.onframe(delta);
  56035. this.dispatch('frame', delta);
  56036. }
  56037. /**
  56038. * @function SuperMap.LevelRenderer.Animation.prototype.start
  56039. * @description 开始运行动画。
  56040. */
  56041. start() {
  56042. var requestAnimationFrame = window.requestAnimationFrame
  56043. || window.msRequestAnimationFrame
  56044. || window.mozRequestAnimationFrame
  56045. || window.webkitRequestAnimationFrame
  56046. || function (func) {
  56047. setTimeout(func, 16);
  56048. };
  56049. var self = this;
  56050. this._running = true;
  56051. function step() {
  56052. if (self._running) {
  56053. self._update();
  56054. requestAnimationFrame(step);
  56055. }
  56056. }
  56057. this._time = new Date().getTime();
  56058. requestAnimationFrame(step);
  56059. }
  56060. /**
  56061. * @function SuperMap.LevelRenderer.Animation.prototype.stop
  56062. * @description 停止运行动画。
  56063. */
  56064. stop() {
  56065. this._running = false;
  56066. }
  56067. /**
  56068. * @function SuperMap.LevelRenderer.Animation.prototype.clear
  56069. * @description 清除所有动画片段。
  56070. */
  56071. clear() {
  56072. this._clips = [];
  56073. }
  56074. /**
  56075. * @function SuperMap.LevelRenderer.Animation.prototype.animate
  56076. * @description 对一个目标创建一个animator对象,可以指定目标中的属性使用动画。
  56077. * @param {Object} target - 目标对象。
  56078. * @param {Object} options - 动画参数选项。
  56079. * @param {boolean} [options.loop=false] - 是否循环播放动画。
  56080. * @param {function} [options.getter] - 如果指定getter函数,会通过getter函数取属性值。
  56081. * @param {function} [options.setter] - 如果指定setter函数,会通过setter函数设置属性值。
  56082. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator。
  56083. */
  56084. animate(target, options) {
  56085. options = options || {};
  56086. var deferred = new Animator(
  56087. target,
  56088. options.loop,
  56089. options.getter,
  56090. options.setter
  56091. );
  56092. deferred.animation = this;
  56093. return deferred;
  56094. }
  56095. static _interpolateNumber(p0, p1, percent) {
  56096. return (p1 - p0) * percent + p0;
  56097. }
  56098. static _interpolateArray(p0, p1, percent, out, arrDim) {
  56099. var len = p0.length;
  56100. if (arrDim == 1) {
  56101. for (let i = 0; i < len; i++) {
  56102. out[i] = Animation._interpolateNumber(p0[i], p1[i], percent);
  56103. }
  56104. } else {
  56105. var len2 = p0[0].length;
  56106. for (let i = 0; i < len; i++) {
  56107. for (let j = 0; j < len2; j++) {
  56108. out[i][j] = Animation._interpolateNumber(
  56109. p0[i][j], p1[i][j], percent
  56110. );
  56111. }
  56112. }
  56113. }
  56114. }
  56115. static _isArrayLike(data) {
  56116. switch (typeof data) {
  56117. case 'undefined':
  56118. case 'string':
  56119. return false;
  56120. }
  56121. return typeof data.length !== 'undefined';
  56122. }
  56123. static _catmullRomInterpolateArray(p0, p1, p2, p3, t, t2, t3, out, arrDim) {
  56124. var len = p0.length;
  56125. if (arrDim == 1) {
  56126. for (let i = 0; i < len; i++) {
  56127. out[i] = Animation._catmullRomInterpolate(
  56128. p0[i], p1[i], p2[i], p3[i], t, t2, t3
  56129. );
  56130. }
  56131. } else {
  56132. var len2 = p0[0].length;
  56133. for (let i = 0; i < len; i++) {
  56134. for (var j = 0; j < len2; j++) {
  56135. out[i][j] = Animation._catmullRomInterpolate(
  56136. p0[i][j], p1[i][j], p2[i][j], p3[i][j],
  56137. t, t2, t3
  56138. );
  56139. }
  56140. }
  56141. }
  56142. }
  56143. static _catmullRomInterpolate(p0, p1, p2, p3, t, t2, t3) {
  56144. var v0 = (p2 - p0) * 0.5;
  56145. var v1 = (p3 - p1) * 0.5;
  56146. return (2 * (p1 - p2) + v0 + v1) * t3
  56147. + (-3 * (p1 - p2) - 2 * v0 - v1) * t2
  56148. + v0 * t + p1;
  56149. }
  56150. static _cloneValue(value) {
  56151. var arraySlice = Array.prototype.slice;
  56152. if (Animation._isArrayLike(value)) {
  56153. var len = value.length;
  56154. if (Animation._isArrayLike(value[0])) {
  56155. var ret = [];
  56156. for (var i = 0; i < len; i++) {
  56157. ret.push(arraySlice.call(value[i]));
  56158. }
  56159. return ret;
  56160. } else {
  56161. return arraySlice.call(value);
  56162. }
  56163. } else {
  56164. return value;
  56165. }
  56166. }
  56167. static rgba2String(rgba) {
  56168. rgba[0] = Math.floor(rgba[0]);
  56169. rgba[1] = Math.floor(rgba[1]);
  56170. rgba[2] = Math.floor(rgba[2]);
  56171. return 'rgba(' + rgba.join(',') + ')';
  56172. }
  56173. }
  56174. /**
  56175. * @class SuperMap.LevelRenderer.Animation.Animator
  56176. */
  56177. class Animator {
  56178. /**
  56179. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.animate
  56180. * @description 构造函数
  56181. * @param {Object} target - 目标对象。
  56182. * @param {Object} options - 动画参数选项。
  56183. * @param {boolean} [loop=false] - 是否循环播放动画。
  56184. * @param {function} [getterl] - 如果指定getter函数,会通过getter函数取属性值。
  56185. * @param {function} [setter] - 如果指定setter函数,会通过setter函数设置属性值。
  56186. */
  56187. constructor(target, loop, getter, setter) {
  56188. /**
  56189. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._tracks
  56190. * @description _tracks。
  56191. */
  56192. this._tracks = {};
  56193. /**
  56194. * @member {Object} SuperMap.LevelRenderer.Animation.Animator.prototype._target
  56195. * @description _target。
  56196. */
  56197. this._target = target;
  56198. /**
  56199. * @member {boolean} SuperMap.LevelRenderer.Animation.Animator.prototype._loop
  56200. * @description _loop。
  56201. */
  56202. this._loop = loop || false;
  56203. /**
  56204. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._getter
  56205. * @description _getter。
  56206. */
  56207. this._getter = getter || _defaultGetter;
  56208. /**
  56209. * @member {function} SuperMap.LevelRenderer.Animation.Animator.prototype._setter
  56210. * @description _setter。
  56211. */
  56212. this._setter = setter || _defaultSetter;
  56213. /**
  56214. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._clipCount
  56215. * @description _clipCount。
  56216. */
  56217. this._clipCount = 0;
  56218. /**
  56219. * @member {number} SuperMap.LevelRenderer.Animation.Animator.prototype._delay
  56220. * @description _delay。
  56221. */
  56222. this._delay = 0;
  56223. /**
  56224. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._doneList
  56225. * @description _doneList。
  56226. */
  56227. this._doneList = [];
  56228. /**
  56229. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._onframeList
  56230. * @description _onframeList。
  56231. */
  56232. this._onframeList = [];
  56233. /**
  56234. * @member {Array} SuperMap.LevelRenderer.Animation.Animator.prototype._clipList
  56235. * @description _clipList。
  56236. */
  56237. this._clipList = [];
  56238. this.CLASS_NAME = "SuperMap.LevelRenderer.Animation.Animator";
  56239. //Function
  56240. function _defaultGetter(target, key) {
  56241. return target[key];
  56242. }
  56243. function _defaultSetter(target, key, value) {
  56244. target[key] = value;
  56245. }
  56246. }
  56247. /**
  56248. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.when
  56249. * @description 设置动画关键帧
  56250. * @param {number} time - 关键帧时间,单位是ms
  56251. * @param {Object} props - 关键帧的属性值,key-value表示
  56252. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  56253. */
  56254. when(time /* ms */, props) {
  56255. for (var propName in props) {
  56256. if (!this._tracks[propName]) {
  56257. this._tracks[propName] = [];
  56258. // If time is 0
  56259. // Then props is given initialize value
  56260. // Else
  56261. // Initialize value from current prop value
  56262. if (time !== 0) {
  56263. this._tracks[propName].push({
  56264. time: 0,
  56265. value: Animation._cloneValue(
  56266. this._getter(this._target, propName)
  56267. )
  56268. });
  56269. }
  56270. }
  56271. this._tracks[propName].push({
  56272. time: parseInt(time, 10),
  56273. value: props[propName]
  56274. });
  56275. }
  56276. return this;
  56277. }
  56278. /**
  56279. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.during
  56280. * @description 添加动画每一帧的回调函数
  56281. * @param {RequestCallback} callback - 回调函数
  56282. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  56283. */
  56284. during(callback) {
  56285. this._onframeList.push(callback);
  56286. return this;
  56287. }
  56288. /**
  56289. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.start
  56290. * @description 开始执行动画
  56291. * @param {(string|function)} easing - 动画缓动函数。详见:<{@link SuperMap.LevelRenderer.Animation.easing}>。
  56292. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  56293. */
  56294. start(easing) {
  56295. var self = this;
  56296. var setter = this._setter;
  56297. var getter = this._getter;
  56298. var onFrameListLen = self._onframeList.length;
  56299. var useSpline = easing === 'spline';
  56300. var ondestroy = function () {
  56301. self._clipCount--;
  56302. if (self._clipCount === 0) {
  56303. // Clear all tracks
  56304. self._tracks = {};
  56305. var len = self._doneList.length;
  56306. for (var i = 0; i < len; i++) {
  56307. self._doneList[i].call(self);
  56308. }
  56309. }
  56310. };
  56311. var createTrackClip = function (keyframes, propName) {
  56312. var trackLen = keyframes.length;
  56313. if (!trackLen) {
  56314. return;
  56315. }
  56316. // Guess data type
  56317. var firstVal = keyframes[0].value;
  56318. var isValueArray = Animation._isArrayLike(firstVal);
  56319. var isValueColor = false;
  56320. // For vertices morphing
  56321. var arrDim = (
  56322. isValueArray
  56323. && Animation._isArrayLike(firstVal[0])
  56324. )
  56325. ? 2 : 1;
  56326. // Sort keyframe as ascending
  56327. keyframes.sort(function (a, b) {
  56328. return a.time - b.time;
  56329. });
  56330. var trackMaxTime = keyframes[trackLen - 1].time;
  56331. // Percents of each keyframe
  56332. var kfPercents = [];
  56333. // Value of each keyframe
  56334. var kfValues = [];
  56335. for (let i = 0; i < trackLen; i++) {
  56336. kfPercents.push(keyframes[i].time / trackMaxTime);
  56337. // Assume value is a color when it is a string
  56338. var value = keyframes[i].value;
  56339. if (typeof(value) == 'string') {
  56340. value = SUtil_SUtil.Util_color.toArray(value);
  56341. if (value.length === 0) { // Invalid color
  56342. value[0] = value[1] = value[2] = 0;
  56343. value[3] = 1;
  56344. }
  56345. isValueColor = true;
  56346. }
  56347. kfValues.push(value);
  56348. }
  56349. // Cache the key of last frame to speed up when
  56350. // animation playback is sequency
  56351. var cacheKey = 0;
  56352. var cachePercent = 0;
  56353. var start;
  56354. var i;
  56355. var w;
  56356. var p0;
  56357. var p1;
  56358. var p2;
  56359. var p3;
  56360. if (isValueColor) {
  56361. var rgba = [0, 0, 0, 0];
  56362. }
  56363. var onframe = function (target, percent) {
  56364. // Find the range keyframes
  56365. // kf1-----kf2---------current--------kf3
  56366. // find kf2 and kf3 and do interpolation
  56367. if (percent < cachePercent) {
  56368. // Start from next key
  56369. start = Math.min(cacheKey + 1, trackLen - 1);
  56370. for (i = start; i >= 0; i--) {
  56371. if (kfPercents[i] <= percent) {
  56372. break;
  56373. }
  56374. }
  56375. i = Math.min(i, trackLen - 2);
  56376. } else {
  56377. for (i = cacheKey; i < trackLen; i++) {
  56378. if (kfPercents[i] > percent) {
  56379. break;
  56380. }
  56381. }
  56382. i = Math.min(i - 1, trackLen - 2);
  56383. }
  56384. cacheKey = i;
  56385. cachePercent = percent;
  56386. var range = (kfPercents[i + 1] - kfPercents[i]);
  56387. if (range === 0) {
  56388. return;
  56389. } else {
  56390. w = (percent - kfPercents[i]) / range;
  56391. }
  56392. if (useSpline) {
  56393. p1 = kfValues[i];
  56394. p0 = kfValues[i === 0 ? i : i - 1];
  56395. p2 = kfValues[i > trackLen - 2 ? trackLen - 1 : i + 1];
  56396. p3 = kfValues[i > trackLen - 3 ? trackLen - 1 : i + 2];
  56397. if (isValueArray) {
  56398. Animation._catmullRomInterpolateArray(
  56399. p0, p1, p2, p3, w, w * w, w * w * w,
  56400. getter(target, propName),
  56401. arrDim
  56402. );
  56403. } else {
  56404. let value;
  56405. if (isValueColor) {
  56406. // value = SuperMap.LevelRenderer.Animation._catmullRomInterpolateArray(
  56407. // p0, p1, p2, p3, w, w * w, w * w * w,
  56408. // rgba, 1
  56409. // );
  56410. value = Animation.rgba2String(rgba);
  56411. } else {
  56412. value = Animation._catmullRomInterpolate(
  56413. p0, p1, p2, p3, w, w * w, w * w * w
  56414. );
  56415. }
  56416. setter(
  56417. target,
  56418. propName,
  56419. value
  56420. );
  56421. }
  56422. } else {
  56423. if (isValueArray) {
  56424. Animation._interpolateArray(
  56425. kfValues[i], kfValues[i + 1], w,
  56426. getter(target, propName),
  56427. arrDim
  56428. );
  56429. } else {
  56430. let value;
  56431. if (isValueColor) {
  56432. Animation._interpolateArray(
  56433. kfValues[i], kfValues[i + 1], w,
  56434. rgba, 1
  56435. );
  56436. value = Animation.rgba2String(rgba);
  56437. } else {
  56438. value = Animation._interpolateNumber(kfValues[i], kfValues[i + 1], w);
  56439. }
  56440. setter(
  56441. target,
  56442. propName,
  56443. value
  56444. );
  56445. }
  56446. }
  56447. for (i = 0; i < onFrameListLen; i++) {
  56448. self._onframeList[i](target, percent);
  56449. }
  56450. };
  56451. var clip = new Clip({
  56452. target: self._target,
  56453. life: trackMaxTime,
  56454. loop: self._loop,
  56455. delay: self._delay,
  56456. onframe: onframe,
  56457. ondestroy: ondestroy
  56458. });
  56459. if (easing && easing !== 'spline') {
  56460. clip.easing = easing;
  56461. }
  56462. self._clipList.push(clip);
  56463. self._clipCount++;
  56464. self.animation.add(clip);
  56465. };
  56466. for (var propName in this._tracks) {
  56467. createTrackClip(this._tracks[propName], propName);
  56468. }
  56469. return this;
  56470. }
  56471. /**
  56472. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.stop
  56473. * @description 停止动画
  56474. */
  56475. stop() {
  56476. for (var i = 0; i < this._clipList.length; i++) {
  56477. var clip = this._clipList[i];
  56478. this.animation.remove(clip);
  56479. }
  56480. this._clipList = [];
  56481. }
  56482. /**
  56483. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.delay
  56484. * @description 设置动画延迟开始的时间
  56485. * @param {number} time - 时间,单位ms
  56486. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  56487. */
  56488. delay(time) {
  56489. this._delay = time;
  56490. return this;
  56491. }
  56492. /**
  56493. * @function SuperMap.LevelRenderer.Animation.Animator.prototype.done
  56494. * @description 添加动画结束的回调
  56495. * @param {function} cb - Function
  56496. * @returns {SuperMap.LevelRenderer.Animation.Animator} Animator
  56497. */
  56498. done(cb) {
  56499. if (cb) {
  56500. this._doneList.push(cb);
  56501. }
  56502. return this;
  56503. }
  56504. }
  56505. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/Render.js
  56506. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  56507. * This program are made available under the terms of the Apache License, Version 2.0
  56508. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  56509. /**
  56510. * @private
  56511. * @class SuperMap.LevelRenderer.Render
  56512. * @category Visualization Theme
  56513. * @classdesc Render 接口类,对外可用的所有接口都在这里。内部使用非 get 接口统一返回 this 对象,支持链式调用。
  56514. */
  56515. class Render {
  56516. /**
  56517. * @function SuperMap.LevelRenderer.Render.constructor
  56518. * @description 构造函数。
  56519. *
  56520. * @param {string} id - 唯一标识。
  56521. * @param {HTMLElement} dom - Dom 对象。
  56522. */
  56523. constructor(id, dom) {
  56524. /**
  56525. * @member {string} SuperMap.LevelRenderer.Render.prototype.id
  56526. * @description 唯一标识。
  56527. */
  56528. this.id = id;
  56529. /**
  56530. * @member {SuperMap.LevelRenderer.Storage} SuperMap.LevelRenderer.Render.prototype.storage
  56531. * @description 图形仓库对象。
  56532. */
  56533. this.storage = new Storage();
  56534. /**
  56535. * @member {SuperMap.LevelRenderer.Painter} SuperMap.LevelRenderer.Render.prototype.painter
  56536. * @description 绘制器对象。
  56537. *
  56538. */
  56539. this.painter = new Painter(dom, this.storage);
  56540. /**
  56541. * @member {SuperMap.LevelRenderer.Handler} SuperMap.LevelRenderer.Render.prototype.handler
  56542. * @description 事件处理对象。
  56543. *
  56544. */
  56545. this.handler = new Handler(dom, this.storage, this.painter);
  56546. /**
  56547. * @member {Array} SuperMap.LevelRenderer.Render.prototype.animatingElements
  56548. * @description 动画控制数组。
  56549. *
  56550. */
  56551. this.animatingElements = [];
  56552. /**
  56553. * @member {SuperMap.LevelRenderer.animation.Animation} SuperMap.LevelRenderer.Render.prototype.animation
  56554. * @description 动画对象。
  56555. *
  56556. */
  56557. this.animation = new Animation({
  56558. stage: {
  56559. update: Render.getFrameCallback(this)
  56560. }
  56561. });
  56562. /**
  56563. * @member {boolean} SuperMap.LevelRenderer.Render.prototype._needsRefreshNextFrame
  56564. * @description 是否需要刷新下一帧。
  56565. *
  56566. */
  56567. this._needsRefreshNextFrame = false;
  56568. this.animation.start();
  56569. this.CLASS_NAME = "SuperMap.LevelRenderer.Render";
  56570. }
  56571. /**
  56572. * @function SuperMap.LevelRenderer.Render.prototype.destory
  56573. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  56574. */
  56575. destroy() {
  56576. this.id = null;
  56577. this.storage = null;
  56578. this.painter = null;
  56579. this.handler = null;
  56580. this.animatingElements = null;
  56581. this.animation = null;
  56582. this._needsRefreshNextFrame = null;
  56583. }
  56584. /**
  56585. * @function SuperMap.LevelRenderer.Render.prototype.getId
  56586. * @description 获取实例唯一标识。
  56587. * @return {string} 实例唯一标识。
  56588. */
  56589. getId() {
  56590. return this.id;
  56591. }
  56592. /**
  56593. * @function SuperMap.LevelRenderer.Render.prototype.addShape
  56594. * @description 添加图形形状到根节点。
  56595. *
  56596. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象,可用属性全集,详见各 shape。
  56597. * @return {SuperMap.LevelRenderer.Render} this。
  56598. */
  56599. addShape(shape) {
  56600. this.storage.addRoot(shape);
  56601. return this;
  56602. }
  56603. /**
  56604. * @function SuperMap.LevelRenderer.Render.prototype.addGroup
  56605. * @description 添加组到根节点。
  56606. *
  56607. * (code)
  56608. * //添加组到根节点例子
  56609. * var render = new SuperMap.LevelRenderer.Render("Render",document.getElementById('lRendertest'));
  56610. * render.clear();
  56611. * var g = new SuperMap.LevelRenderer.Group();
  56612. * g.addChild(new SuperMap.LevelRenderer.Shape.Circle({
  56613. * style: {
  56614. * x: 100,
  56615. * y: 100,
  56616. * r: 20,
  56617. * brushType: 'fill'
  56618. * }
  56619. * }));
  56620. * render.addGroup(g);
  56621. * render.render();
  56622. * (end)
  56623. *
  56624. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  56625. * @return {SuperMap.LevelRenderer.Render} this。
  56626. */
  56627. addGroup(group) {
  56628. this.storage.addRoot(group);
  56629. return this;
  56630. }
  56631. /**
  56632. * @function SuperMap.LevelRenderer.Render.prototype.delShape
  56633. * @description 从根节点删除图形形状。
  56634. *
  56635. * @param {string} shapeId - 图形对象唯一标识。
  56636. * @return {SuperMap.LevelRenderer.Render} this。
  56637. */
  56638. delShape(shapeId) {
  56639. this.storage.delRoot(shapeId);
  56640. return this;
  56641. }
  56642. /**
  56643. * @function SuperMap.LevelRenderer.Render.prototype.delGroup
  56644. * @description 从根节点删除组。
  56645. *
  56646. * @param {string} groupId - 组对象唯一标识。
  56647. * @return {SuperMap.LevelRenderer.Render} this。
  56648. */
  56649. delGroup(groupId) {
  56650. this.storage.delRoot(groupId);
  56651. return this;
  56652. }
  56653. /**
  56654. * @function SuperMap.LevelRenderer.Render.prototype.modShape
  56655. * @description 修改图形形状。
  56656. *
  56657. * @param {string} shapeId - 图形对象唯一标识。
  56658. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  56659. * @return {SuperMap.LevelRenderer.Render} this。
  56660. */
  56661. modShape(shapeId, shape) {
  56662. this.storage.mod(shapeId, shape);
  56663. return this;
  56664. }
  56665. /**
  56666. * @function SuperMap.LevelRenderer.Render.prototype.modGroup
  56667. * @description 修改组。
  56668. *
  56669. * @param {string} groupId - 组对象唯一标识。
  56670. * @param {SuperMap.LevelRenderer.Group} group - 组对象。
  56671. * @return {SuperMap.LevelRenderer.Render} this。
  56672. */
  56673. modGroup(groupId, group) {
  56674. this.storage.mod(groupId, group);
  56675. return this;
  56676. }
  56677. /**
  56678. * @function SuperMap.LevelRenderer.Render.prototype.modLayer
  56679. * @description 修改指定 zlevel 的绘制配置项。
  56680. *
  56681. * @param {string} zLevel - 组对象唯一标识。
  56682. * @param {Object} config - 配置对象。
  56683. * @param {string} clearColor - 每次清空画布的颜色。默认值:0。
  56684. * @param {noolean} motionBlur - 是否开启动态模糊。默认值:false。
  56685. * @param {number} lastFrameAlpha - 在开启动态模糊的时候使用,与上一帧混合的alpha值,值越大尾迹越明显。默认值:0.7。
  56686. * @param {Array.<number>} position - 层的平移。
  56687. * @param {Array.<number>} rotation - 层的旋转。
  56688. * @param {Array.<number>} scale - 层的缩放。
  56689. * @param {boolean} zoomable - 层是否支持鼠标缩放操作。默认值:false。
  56690. * @param {boolean} panable - 层是否支持鼠标平移操作。默认值:false。
  56691. * @return {SuperMap.LevelRenderer.Render} this。
  56692. */
  56693. modLayer(zLevel, config) {
  56694. this.painter.modLayer(zLevel, config);
  56695. return this;
  56696. }
  56697. /**
  56698. * @function SuperMap.LevelRenderer.Render.prototype.addHoverShape
  56699. * @description 添加额外高亮层显示,仅提供添加方法,每次刷新后高亮层图形均被清空。
  56700. *
  56701. * @param {SuperMap.LevelRenderer.Shape} shape - 图形对象。
  56702. * @return {SuperMap.LevelRenderer.Render} this。
  56703. */
  56704. addHoverShape(shape) {
  56705. this.storage.addHover(shape);
  56706. return this;
  56707. }
  56708. /**
  56709. * @function SuperMap.LevelRenderer.Render.prototype.render
  56710. * @description 渲染。
  56711. *
  56712. * @callback {Function} callback - 渲染结束后回调函数。
  56713. * @return {SuperMap.LevelRenderer.Render} this。
  56714. */
  56715. render(callback) {
  56716. this.painter.render(callback);
  56717. this._needsRefreshNextFrame = false;
  56718. return this;
  56719. }
  56720. /**
  56721. * @function SuperMap.LevelRenderer.Render.prototype.refresh
  56722. * @description 视图更新。
  56723. *
  56724. * @callback {Function} callback - 视图更新后回调函数。
  56725. * @return {SuperMap.LevelRenderer.Render} this。
  56726. */
  56727. refresh(callback) {
  56728. this.painter.refresh(callback);
  56729. this._needsRefreshNextFrame = false;
  56730. return this;
  56731. }
  56732. /**
  56733. * @function SuperMap.LevelRenderer.Render.prototype.refreshNextFrame
  56734. * @description 标记视图在浏览器下一帧需要绘制。
  56735. * @return {SuperMap.LevelRenderer.Render} this。
  56736. */
  56737. refreshNextFrame() {
  56738. this._needsRefreshNextFrame = true;
  56739. return this;
  56740. }
  56741. /**
  56742. * @function SuperMap.LevelRenderer.Render.prototype.refreshHover
  56743. * @description 绘制(视图更新)高亮层。
  56744. * @callback {Function} callback - 视图更新后回调函数。
  56745. * @return {SuperMap.LevelRenderer.Render} this。
  56746. */
  56747. refreshHover(callback) {
  56748. this.painter.refreshHover(callback);
  56749. return this;
  56750. }
  56751. /**
  56752. * @function SuperMap.LevelRenderer.Render.prototype.refreshShapes
  56753. * @description 视图更新。
  56754. *
  56755. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapeList - 需要更新的图形列表。
  56756. * @callback {Function} callback - 视图更新后回调函数。
  56757. * @return {SuperMap.LevelRenderer.Render} this。
  56758. */
  56759. refreshShapes(shapeList, callback) {
  56760. this.painter.refreshShapes(shapeList, callback);
  56761. return this;
  56762. }
  56763. /**
  56764. * @function SuperMap.LevelRenderer.Render.prototype.resize
  56765. * @description 调整视图大小。
  56766. * @return {SuperMap.LevelRenderer.Render} this。
  56767. */
  56768. resize() {
  56769. this.painter.resize();
  56770. return this;
  56771. }
  56772. /**
  56773. * @function SuperMap.LevelRenderer.Render.prototype.animate
  56774. * @description 动画。
  56775. *
  56776. * @example
  56777. * zr.animate(circle.id, 'style', false)
  56778. * .when(1000, {x: 10} )
  56779. * .done(function(){ // Animation done })
  56780. * .start()
  56781. *
  56782. *
  56783. * @param {Array.<(SuperMap.LevelRenderer.Shape/SuperMap.LevelRenderer.Group)>} el - 动画对象。
  56784. * @param {string} path - 需要添加动画的属性获取路径,可以通过 a.b.c 来获取深层的属性。若传入对象为<SuperMap.LevelRenderer.Group>,path需为空字符串。
  56785. * @param {Function} loop - 动画是否循环。
  56786. * @return {SuperMap.LevelRenderer.animation.Animator} Animator。
  56787. */
  56788. animate(el, path, loop) {
  56789. if (typeof(el) === 'string') {
  56790. el = this.storage.get(el);
  56791. }
  56792. if (el) {
  56793. var target;
  56794. if (path) {
  56795. var pathSplitted = path.split('.');
  56796. var prop = el;
  56797. for (var i = 0, l = pathSplitted.length; i < l; i++) {
  56798. if (!prop) {
  56799. continue;
  56800. }
  56801. prop = prop[pathSplitted[i]];
  56802. }
  56803. if (prop) {
  56804. target = prop;
  56805. }
  56806. } else {
  56807. target = el;
  56808. }
  56809. if (!target) {
  56810. SUtil_SUtil.Util_log(
  56811. 'Property "'
  56812. + path
  56813. + '" is not existed in element '
  56814. + el.id
  56815. );
  56816. return;
  56817. }
  56818. var animatingElements = this.animatingElements;
  56819. if (typeof el.__aniCount === 'undefined') {
  56820. // 正在进行的动画记数
  56821. el.__aniCount = 0;
  56822. }
  56823. if (el.__aniCount === 0) {
  56824. animatingElements.push(el);
  56825. }
  56826. el.__aniCount++;
  56827. return this.animation.animate(target, {loop: loop})
  56828. .done(function () {
  56829. el.__aniCount--;
  56830. if (el.__aniCount === 0) {
  56831. // 从animatingElements里移除
  56832. var idx = new Util_Util().indexOf(animatingElements, el);
  56833. animatingElements.splice(idx, 1);
  56834. }
  56835. });
  56836. } else {
  56837. SUtil_SUtil.Util_log('Element not existed');
  56838. }
  56839. }
  56840. /**
  56841. * @function SuperMap.LevelRenderer.Render.prototype.clearAnimation
  56842. * @description 停止所有动画。
  56843. *
  56844. */
  56845. clearAnimation() {
  56846. this.animation.clear();
  56847. }
  56848. /**
  56849. * @function SuperMap.LevelRenderer.Render.prototype.getWidth
  56850. * @description 获取视图宽度。
  56851. * @return {number} 视图宽度。
  56852. */
  56853. getWidth() {
  56854. return this.painter.getWidth();
  56855. }
  56856. /**
  56857. * @function SuperMap.LevelRenderer.Render.prototype.getHeight
  56858. * @description 获取视图高度。
  56859. * @return {number} 视图高度。
  56860. */
  56861. getHeight() {
  56862. return this.painter.getHeight();
  56863. }
  56864. /**
  56865. * @function SuperMap.LevelRenderer.Render.prototype.toDataURL
  56866. * @description 图像导出。
  56867. *
  56868. * @param {string} type - 类型。
  56869. * @param {string} backgroundColor - 背景色,默认值:"#FFFFFF"。
  56870. * @param {string} args - 参数。
  56871. * @return {string} 图片的 Base64 url。
  56872. */
  56873. toDataURL(type, backgroundColor, args) {
  56874. return this.painter.toDataURL(type, backgroundColor, args);
  56875. }
  56876. /**
  56877. * @function SuperMap.LevelRenderer.Render.prototype.shapeToImage
  56878. * @description 将常规 shape 转成 image shape。
  56879. *
  56880. * @param {SuperMap.LevelRenderer.Shape} e - 图形。
  56881. * @param {number} width - 宽度。
  56882. * @param {number} height - 高度。
  56883. * @return {Object} image shape。
  56884. */
  56885. shapeToImage(e, width, height) {
  56886. var id = Util.createUniqueID("SuperMap.LevelRenderer.ToImage_");
  56887. return this.painter.shapeToImage(id, e, width, height);
  56888. }
  56889. /**
  56890. * @function SuperMap.LevelRenderer.Render.prototype.on
  56891. * @description 事件绑定。
  56892. *
  56893. * @param {string} eventName - 事件名称。
  56894. * @param {Function} eventHandler - 响应函数。
  56895. * @return {SuperMap.LevelRenderer.Render} this。
  56896. */
  56897. on(eventName, eventHandler) {
  56898. this.handler.on(eventName, eventHandler);
  56899. return this;
  56900. }
  56901. /**
  56902. * @function SuperMap.LevelRenderer.Render.prototype.un
  56903. * @description 事件解绑定,参数为空则解绑所有自定义事件。
  56904. *
  56905. * @param {string} eventName - 事件名称。
  56906. * @param {Function} eventHandler - 响应函数。
  56907. * @return {SuperMap.LevelRenderer.Render} this。
  56908. */
  56909. un(eventName, eventHandler) {
  56910. this.handler.un(eventName, eventHandler);
  56911. return this;
  56912. }
  56913. /**
  56914. * @function SuperMap.LevelRenderer.Render.prototype.trigger
  56915. * @description 事件触发。
  56916. *
  56917. * @param {string} eventName - 事件名称,resize,hover,drag,etc。
  56918. * @param {event} event - event dom事件对象。
  56919. * @return {SuperMap.LevelRenderer.Render} this。
  56920. */
  56921. trigger(eventName, event) {
  56922. this.handler.trigger(eventName, event);
  56923. this.handler.dispatch(eventName, event);
  56924. return this;
  56925. }
  56926. /**
  56927. * @function SuperMap.LevelRenderer.Render.prototype.clear
  56928. * @description 清除当前 Render 下所有类图的数据和显示,clear 后 MVC 和已绑定事件均还存在在,Render 可用。
  56929. * @return {SuperMap.LevelRenderer.Render} this。
  56930. */
  56931. clear() {
  56932. this.storage.delRoot();
  56933. this.painter.clear();
  56934. return this;
  56935. }
  56936. /**
  56937. * @function SuperMap.LevelRenderer.Render.prototype.dispose
  56938. * @description 释放当前 Render 实例(删除包括 dom,数据、显示和事件绑定),dispose后 Render 不可用。
  56939. */
  56940. dispose() {
  56941. this.animation.stop();
  56942. this.clear();
  56943. this.storage.dispose();
  56944. this.painter.dispose();
  56945. this.handler.dispose();
  56946. this.animation = null;
  56947. this.animatingElements = null;
  56948. this.storage = null;
  56949. this.painter = null;
  56950. this.handler = null;
  56951. // 释放后告诉全局删除对自己的索引,没想到啥好方法
  56952. // zrender.delInstance(this.id);
  56953. }
  56954. // SMIC-方法扩展 - start
  56955. /**
  56956. * @function SuperMap.LevelRenderer.Render.prototype.updateHoverShapes
  56957. * @description 更新设置显示高亮图层。
  56958. *
  56959. * @param {Array.<SuperMap.LevelRenderer.Shape>} shapes - 图形数组。
  56960. * @return {SuperMap.LevelRenderer.Render} this。
  56961. */
  56962. updateHoverShapes(shapes) {
  56963. this.painter.updateHoverLayer(shapes);
  56964. return this;
  56965. }
  56966. /**
  56967. * @function SuperMap.LevelRenderer.Render.prototype.getAllShapes
  56968. * @description 获取所有图形。
  56969. * @return {Array.<SuperMap.LevelRenderer.Shape>} 图形数组。
  56970. */
  56971. getAllShapes() {
  56972. return this.storage._shapeList;
  56973. }
  56974. /**
  56975. * @function SuperMap.LevelRenderer.Render.prototype.clearAll
  56976. * @description 清除高亮和图形图层。
  56977. * @return {SuperMap.LevelRenderer.Render} this。
  56978. */
  56979. clearAll() {
  56980. this.clear();
  56981. this.painter.clearHover();
  56982. return this;
  56983. }
  56984. /**
  56985. * @function SuperMap.LevelRenderer.Render.prototype.getHoverOne
  56986. * @description 获取单个高亮图形,当前鼠标对应。
  56987. * @return {SuperMap.LevelRenderer.Shape} 高亮图形。
  56988. */
  56989. getHoverOne() {
  56990. return this.handler.getLastHoverOne();
  56991. }
  56992. static getFrameCallback(renderInstance) {
  56993. return function () {
  56994. var animatingElements = renderInstance.animatingElements;
  56995. //animatingElements instanceof Array 临时解决 destory 报错
  56996. if (animatingElements instanceof Array) {
  56997. for (var i = 0, l = animatingElements.length; i < l; i++) {
  56998. renderInstance.storage.mod(animatingElements[i].id);
  56999. }
  57000. if (animatingElements.length || renderInstance._needsRefreshNextFrame) {
  57001. renderInstance.refresh();
  57002. }
  57003. }
  57004. };
  57005. }
  57006. // SMIC-方法扩展 - end
  57007. }
  57008. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/LevelRenderer.js
  57009. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57010. * This program are made available under the terms of the Apache License, Version 2.0
  57011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57012. /**
  57013. * @class SuperMap.LevelRenderer
  57014. * @category Visualization Theme
  57015. * @classdesc LevelRenderer 渲染器
  57016. * @private
  57017. */
  57018. class LevelRenderer {
  57019. /**
  57020. * @function SuperMap.LevelRenderer.constructor
  57021. * @description 构造函数。
  57022. * @example
  57023. * //在渲染器上加上图形
  57024. * var levelRenderer = new SuperMap.LevelRenderer();
  57025. * var zr = levelRenderer.init(document.getElementById('lRendertest'));
  57026. * zr.clear();
  57027. * zr.addShape(new SuperMap.LevelRenderer.Shape.Circle({
  57028. * style:{
  57029. * x : 100,
  57030. * y : 100,
  57031. * r : 50,
  57032. * brushType: 'fill'
  57033. * }
  57034. * }));
  57035. * zr.render();
  57036. */
  57037. constructor() {
  57038. /**
  57039. * @member {Object} SuperMap.LevelRenderer.prototype._instances
  57040. * @description LevelRenderer 实例 map 索引
  57041. */
  57042. LevelRenderer._instances = {};
  57043. // 工具
  57044. LevelRenderer.Tool = {};
  57045. /**
  57046. * @member {string} SuperMap.LevelRenderer.prototype.version
  57047. * @description 版本。zRender(Baidu)的版本号
  57048. * 记录当前 LevelRenderer 是在 zRender 的那个版本上构建而来。
  57049. * 在每次完整评判和实施由 zRender(Baidu)升级带来的 LevelRenderer 升级后修改。
  57050. */
  57051. this.version = '2.0.4';
  57052. this.CLASS_NAME = "SuperMap.LevelRenderer";
  57053. }
  57054. /**
  57055. * @function SuperMap.LevelRenderer.prototype.destroy
  57056. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为null。
  57057. */
  57058. destroy() {
  57059. this.dispose();
  57060. this.version = null;
  57061. }
  57062. /**
  57063. * @function SuperMap.LevelRenderer.prototype.init
  57064. * @description 创建 LevelRenderer 实例。
  57065. * @param {HTMLElement} dom - 绘图容器。
  57066. * @returns {SuperMap.LevelRenderer} LevelRenderer 实例。
  57067. */
  57068. init(dom) {
  57069. var zr = new Render(Util.createUniqueID("LRenderer_"), dom);
  57070. LevelRenderer._instances[zr.id] = zr;
  57071. return zr;
  57072. }
  57073. /**
  57074. * @function SuperMap.LevelRenderer.prototype.dispose
  57075. * @description LevelRenderer 实例销毁。
  57076. * 可以通过 zrender.dispose(zr) 销毁指定 SuperMap.LevelRenderer.Render 实例。
  57077. * 也可以通过 zr.dispose() 直接销毁
  57078. * @param {SuperMap.LevelRenderer.Render} zr - ZRender对象,不传此参数则销毁全部。
  57079. * @returns {SuperMap.LevelRenderer} this。
  57080. */
  57081. dispose(zr) {
  57082. if (zr) {
  57083. zr.dispose();
  57084. this.delInstance(zr.id);
  57085. } else {
  57086. for (var key in LevelRenderer._instances) {
  57087. LevelRenderer._instances[key].dispose();
  57088. }
  57089. LevelRenderer._instances = {};
  57090. }
  57091. return this;
  57092. }
  57093. /**
  57094. * @function SuperMap.LevelRenderer.prototype.getInstance
  57095. * @description 获取 SuperMap.LevelRenderer.Render 实例。
  57096. * @param {string} id - ZRender对象索引。
  57097. * @returns {SuperMap.LevelRenderer.Render} SuperMap.LevelRenderer.Render 实例。
  57098. */
  57099. getInstance(id) {
  57100. return LevelRenderer._instances[id];
  57101. }
  57102. /**
  57103. * @function SuperMap.LevelRenderer.prototype.delInstance
  57104. * @description 删除 zrender 实例,SuperMap.LevelRenderer.Render 实例 dispose 时会调用,删除后 getInstance 则返回 undefined
  57105. * @param {string} id - ZRender对象索引。
  57106. * @param {string} id - SuperMap.LevelRenderer.Render 对象索引。
  57107. * @returns {SuperMap.LevelRenderer} this。
  57108. */
  57109. delInstance(id) {
  57110. delete LevelRenderer._instances[id];
  57111. return this;
  57112. }
  57113. }
  57114. SuperMap.LevelRenderer = LevelRenderer;
  57115. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicEllipse.js
  57116. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57117. * This program are made available under the terms of the Apache License, Version 2.0
  57118. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57119. /**
  57120. * @private
  57121. * @class SuperMap.LevelRenderer.Shape.SmicEllipse
  57122. * @category Visualization Theme
  57123. * @classdesc 椭圆。
  57124. * @extends SuperMap.LevelRenderer.Shape
  57125. * @example
  57126. * var shape = new SuperMap.LevelRenderer.Shape.SmicEllipse({
  57127. * style: {
  57128. * x: 100,
  57129. * y: 100,
  57130. * a: 40,
  57131. * b: 20,
  57132. * brushType: 'both',
  57133. * color: 'blue',
  57134. * strokeColor: 'red',
  57135. * lineWidth: 3,
  57136. * text: 'SmicEllipse'
  57137. * }
  57138. * });
  57139. * levelRenderer.addShape(shape);
  57140. *
  57141. *
  57142. */
  57143. class SmicEllipse extends (/* unused pure expression or super */ null && (Shape)) {
  57144. /**
  57145. * @member {Object} SuperMap.LevelRenderer.Shape.SmicEllipse.style
  57146. * @description 绘制样式。
  57147. *
  57148. * @param {number} style.x - 圆心 x 坐标,必设参数。
  57149. * @param {number} style.y - 圆心 y 坐标,必设参数。
  57150. * @param {number} style.a - 横轴半径,必设参数。
  57151. * @param {number} style.b - 纵轴半径,必设参数。
  57152. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  57153. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  57154. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  57155. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  57156. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  57157. * @param {number} style.opacity - 绘制透明度。默认值:1。
  57158. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  57159. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  57160. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  57161. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  57162. * @param {string} style.text - 图形中的附加文本。默认值:""。
  57163. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  57164. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  57165. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  57166. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  57167. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  57168. */
  57169. //打开接口 style
  57170. /**
  57171. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.constructor
  57172. * @description 构造函数。
  57173. *
  57174. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  57175. *
  57176. */
  57177. constructor(options) {
  57178. super(options);
  57179. /**
  57180. * @member {string} SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.type
  57181. * @description 图形类型。
  57182. */
  57183. this.type = 'smicellipse';
  57184. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57185. this.refOriginalPosition = [0, 0];
  57186. }
  57187. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicEllipse";
  57188. }
  57189. /**
  57190. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.destroy
  57191. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  57192. */
  57193. destroy() {
  57194. this.type = null;
  57195. super.destroy();
  57196. }
  57197. /**
  57198. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.buildPath
  57199. * @description 构建椭圆的 Path。
  57200. *
  57201. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  57202. * @param {Object} style - style。
  57203. *
  57204. */
  57205. buildPath(ctx, style) {
  57206. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57207. this.refOriginalPosition = [0, 0];
  57208. }
  57209. var __OP = this.refOriginalPosition;
  57210. var k = 0.5522848;
  57211. var x = style.x + __OP[0];
  57212. var y = style.y + __OP[1];
  57213. var a = style.a;
  57214. var b = style.b;
  57215. var ox = a * k; // 水平控制点偏移量
  57216. var oy = b * k; // 垂直控制点偏移量
  57217. // 从椭圆的左端点开始顺时针绘制四条三次贝塞尔曲线
  57218. ctx.moveTo(x - a, y);
  57219. ctx.bezierCurveTo(x - a, y - oy, x - ox, y - b, x, y - b);
  57220. ctx.bezierCurveTo(x + ox, y - b, x + a, y - oy, x + a, y);
  57221. ctx.bezierCurveTo(x + a, y + oy, x + ox, y + b, x, y + b);
  57222. ctx.bezierCurveTo(x - ox, y + b, x - a, y + oy, x - a, y);
  57223. ctx.closePath();
  57224. }
  57225. /**
  57226. * @function SuperMap.LevelRenderer.Shape.SmicEllipse.prototype.getRect
  57227. * @description 计算返回椭圆包围盒矩形
  57228. *
  57229. * @param {Object} style - style
  57230. * @return {Object} 边框对象。包含属性:x,y,width,height。
  57231. *
  57232. */
  57233. getRect(style) {
  57234. if (style.__rect) {
  57235. return style.__rect;
  57236. }
  57237. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57238. this.refOriginalPosition = [0, 0];
  57239. }
  57240. var __OP = this.refOriginalPosition;
  57241. var lineWidth;
  57242. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  57243. lineWidth = style.lineWidth || 1;
  57244. } else {
  57245. lineWidth = 0;
  57246. }
  57247. style.__rect = {
  57248. x: Math.round((style.x + __OP[0]) - style.a - lineWidth / 2),
  57249. y: Math.round((style.x + __OP[1]) - style.b - lineWidth / 2),
  57250. width: style.a * 2 + lineWidth,
  57251. height: style.b * 2 + lineWidth
  57252. };
  57253. return style.__rect;
  57254. }
  57255. }
  57256. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicIsogon.js
  57257. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57258. * This program are made available under the terms of the Apache License, Version 2.0
  57259. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57260. /**
  57261. * @private
  57262. * @class SuperMap.LevelRenderer.Shape.SmicIsogon
  57263. * @category Visualization Theme
  57264. * @classdesc 正多边形。
  57265. * @extends SuperMap.LevelRenderer.Shape
  57266. */
  57267. class SmicIsogon extends (/* unused pure expression or super */ null && (Shape)) {
  57268. /**
  57269. * @member {Object} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.style
  57270. * @description 绘制样式。
  57271. *
  57272. * @param {number} x - 正 n 边形外接圆心 x 坐标,必设参数。
  57273. * @param {number} y - 正 n 边形外接圆心 y 坐标,必设参数。
  57274. * @param {number} r - 正n边形外接圆半径,必设参数。
  57275. * @param {number} n - 指明正几边形,必设参数(n>=3)。
  57276. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  57277. * @param {string} color - 填充颜色。默认值:"#000000'"。
  57278. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  57279. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  57280. * @param {number} lineWidth - 描边宽度。默认值:1。
  57281. * @param {number} opacity - 绘制透明度。默认值:1。
  57282. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  57283. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  57284. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  57285. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  57286. * @param {string} text - 图形中的附加文本。默认值:""。
  57287. * @param {string} textColor -文本颜色。默认值:"#000000'"。
  57288. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  57289. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  57290. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  57291. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  57292. */
  57293. //打开接口 style
  57294. /**
  57295. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.constructor
  57296. * @description 构造函数。
  57297. *
  57298. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  57299. *
  57300. */
  57301. constructor(options) {
  57302. super(options);
  57303. /**
  57304. * @member {string} SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.type
  57305. * @description 图形类型。
  57306. */
  57307. this.type = 'smicisogon';
  57308. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57309. this.refOriginalPosition = [0, 0];
  57310. }
  57311. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicIsogon";
  57312. }
  57313. /**
  57314. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.destroy
  57315. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  57316. */
  57317. destroy() {
  57318. this.type = null;
  57319. super.destroy();
  57320. }
  57321. /**
  57322. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.buildPath
  57323. * @description 创建n角星(n>=3)路径。
  57324. *
  57325. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  57326. * @param {Object} style - style。
  57327. *
  57328. */
  57329. buildPath(ctx, style) {
  57330. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57331. this.refOriginalPosition = [0, 0];
  57332. }
  57333. var __OP = this.refOriginalPosition;
  57334. var sin = SUtil.Util_math.sin;
  57335. var cos = SUtil.Util_math.cos;
  57336. var PI = Math.PI;
  57337. var n = style.n;
  57338. if (!n || n < 2) {
  57339. return;
  57340. }
  57341. var x = style.x + __OP[0];
  57342. var y = style.y + __OP[1];
  57343. var r = style.r;
  57344. var dStep = 2 * PI / n;
  57345. var deg = -PI / 2;
  57346. var xStart = x + r * cos(deg);
  57347. var yStart = y + r * sin(deg);
  57348. deg += dStep;
  57349. // 记录边界点,用于判断insight
  57350. var pointList = style.pointList = [];
  57351. pointList.push([xStart, yStart]);
  57352. for (let i = 0, end = n - 1; i < end; i++) {
  57353. pointList.push([x + r * cos(deg), y + r * sin(deg)]);
  57354. deg += dStep;
  57355. }
  57356. pointList.push([xStart, yStart]);
  57357. // 绘制
  57358. ctx.moveTo(pointList[0][0], pointList[0][1]);
  57359. for (let i = 0; i < pointList.length; i++) {
  57360. ctx.lineTo(pointList[i][0], pointList[i][1]);
  57361. }
  57362. ctx.closePath();
  57363. return;
  57364. }
  57365. /**
  57366. * @function SuperMap.LevelRenderer.Shape.SmicIsogon.prototype.getRect
  57367. * @description 计算返回正多边形的包围盒矩形。
  57368. *
  57369. * @param {Object} style - style
  57370. * @return {Object} 边框对象。包含属性:x,y,width,height。
  57371. */
  57372. getRect(style) {
  57373. if (style.__rect) {
  57374. return style.__rect;
  57375. }
  57376. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57377. this.refOriginalPosition = [0, 0];
  57378. }
  57379. var __OP = this.refOriginalPosition;
  57380. var lineWidth;
  57381. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  57382. lineWidth = style.lineWidth || 1;
  57383. } else {
  57384. lineWidth = 0;
  57385. }
  57386. style.__rect = {
  57387. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  57388. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  57389. width: style.r * 2 + lineWidth,
  57390. height: style.r * 2 + lineWidth
  57391. };
  57392. return style.__rect;
  57393. }
  57394. }
  57395. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicRing.js
  57396. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57397. * This program are made available under the terms of the Apache License, Version 2.0
  57398. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57399. /**
  57400. * @private
  57401. * @class SuperMap.LevelRenderer.Shape.SmicRing
  57402. * @category Visualization Theme
  57403. * @classdesc 圆环。
  57404. * @extends SuperMap.LevelRenderer.Shape
  57405. * @example
  57406. * var shape = new SuperMap.LevelRenderer.Shape.SmicRing({
  57407. * style: {
  57408. * x: 100,
  57409. * y: 100,
  57410. * r0: 30,
  57411. * r: 50
  57412. * }
  57413. * });
  57414. * levelRenderer.addShape(shape);
  57415. *
  57416. */
  57417. class SmicRing extends (/* unused pure expression or super */ null && (Shape)) {
  57418. /**
  57419. * @member {Object} SuperMap.LevelRenderer.Shape.SmicRing.prototype.style
  57420. * @description 绘制样式。
  57421. *
  57422. * @param {number} x - 圆心 x 坐标,必设参数。
  57423. * @param {number} y - 圆心 y 坐标,必设参数。
  57424. * @param {number} r - 外圆半径,必设参数。
  57425. * @param {number} r0 - 内圆半径,必设参数。
  57426. * @param {string} brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  57427. * @param {string} color - 填充颜色。默认值:"#000000'"。
  57428. * @param {string} strokeColor - 描边颜色。默认值:"#000000'"。
  57429. * @param {string} lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  57430. * @param {number} lineWidth -描边宽度。默认值:1。
  57431. * @param {number} opacity - 绘制透明度。默认值:1。
  57432. * @param {number} shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  57433. * @param {number} shadowColor - 阴影颜色。默认值:"#000000'"。
  57434. * @param {number} shadowOffsetX - 阴影横向偏移。默认值:0。
  57435. * @param {number} shadowOffsetY - 阴影纵向偏移。默认值:0。
  57436. * @param {string} text -图形中的附加文本。默认值:""。
  57437. * @param {string} textColor - 文本颜色。默认值:"#000000'"。
  57438. * @param {string} textFont - 附加文本样式。示例:'bold 18px verdana'。
  57439. * @param {string} textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  57440. * @param {string} textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  57441. * @param {string} textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  57442. */
  57443. //打开接口 style
  57444. /**
  57445. * @function SuperMap.LevelRenderer.Shape.SmicRing.constructor
  57446. * @description 构造函数。
  57447. *
  57448. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  57449. */
  57450. constructor(options) {
  57451. super(options);
  57452. /**
  57453. * @member {string} SuperMap.LevelRenderer.Shape.SmicRing.prototype.type
  57454. * @description 图形类型。
  57455. */
  57456. this.type = 'smicring';
  57457. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57458. this.refOriginalPosition = [0, 0];
  57459. }
  57460. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicRing";
  57461. }
  57462. /**
  57463. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.destroy
  57464. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  57465. */
  57466. destroy() {
  57467. this.type = null;
  57468. super.destroy();
  57469. }
  57470. /**
  57471. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.buildPath
  57472. * @description 创建圆环路径。
  57473. *
  57474. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  57475. * @param {Object} style - style。
  57476. *
  57477. */
  57478. buildPath(ctx, style) {
  57479. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57480. this.refOriginalPosition = [0, 0];
  57481. }
  57482. var __OP = this.refOriginalPosition;
  57483. // 非零环绕填充优化
  57484. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r, 0, Math.PI * 2, false);
  57485. ctx.moveTo((style.x + __OP[0]) + style.r0, style.y + __OP[1]);
  57486. ctx.arc(style.x + __OP[0], style.y + __OP[1], style.r0, 0, Math.PI * 2, true);
  57487. return;
  57488. }
  57489. /**
  57490. * @function SuperMap.LevelRenderer.Shape.SmicRing.prototype.getRect
  57491. * @description 计算返回圆环包围盒矩阵
  57492. *
  57493. * @param {Object} style - style
  57494. * @return {Object} 边框对象。包含属性:x,y,width,height。
  57495. */
  57496. getRect(style) {
  57497. if (style.__rect) {
  57498. return style.__rect;
  57499. }
  57500. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57501. this.refOriginalPosition = [0, 0];
  57502. }
  57503. var __OP = this.refOriginalPosition;
  57504. var lineWidth;
  57505. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  57506. lineWidth = style.lineWidth || 1;
  57507. } else {
  57508. lineWidth = 0;
  57509. }
  57510. style.__rect = {
  57511. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  57512. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  57513. width: style.r * 2 + lineWidth,
  57514. height: style.r * 2 + lineWidth
  57515. };
  57516. return style.__rect;
  57517. }
  57518. }
  57519. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/SmicStar.js
  57520. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57521. * This program are made available under the terms of the Apache License, Version 2.0
  57522. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57523. /**
  57524. * @private
  57525. * @class SuperMap.LevelRenderer.Shape.SmicStar
  57526. * @category Visualization Theme
  57527. * @classdesc n 角星(n>3)。
  57528. * @extends SuperMap.LevelRenderer.Shape
  57529. * @example
  57530. * var shape = new SuperMap.LevelRenderer.Shape.SmicStar({
  57531. * style: {
  57532. * x: 200,
  57533. * y: 100,
  57534. * r: 150,
  57535. * n: 5,
  57536. * text: '五角星'
  57537. * }
  57538. * });
  57539. * levelRenderer.addShape(shape);
  57540. *
  57541. *
  57542. */
  57543. class SmicStar extends (/* unused pure expression or super */ null && (Shape)) {
  57544. /**
  57545. * @member {Object} SuperMap.LevelRenderer.Shape.SmicStar.prototype.style
  57546. * @description 绘制样式。
  57547. *
  57548. * @param {number} style.x - n 角星外接圆心 x 坐标,必设参数。
  57549. * @param {number} style.y - n 角星外接圆心 y 坐标,必设参数。
  57550. * @param {number} style.r - n 角星外接圆半径,必设参数。
  57551. * @param {number} style.r0 - n 角星内部顶点(凹点)的外接圆半径。如果不指定此参数,则自动计算:取相隔外部顶点连线的交点作内部顶点。
  57552. * @param {number} style.n -指明几角星,必设参数。
  57553. * @param {string} style.brushType - 画笔类型。可设值:"fill", "stroke", "both"。默认值:"fill"。
  57554. * @param {string} style.color - 填充颜色。默认值:"#000000'"。
  57555. * @param {string} style.strokeColor - 描边颜色。默认值:"#000000'"。
  57556. * @param {string} style.lineCape - 线帽样式。可设值:"butt", "round", "square"。默认值:"butt"。
  57557. * @param {number} style.lineWidth - 描边宽度。默认值:1。
  57558. * @param {number} style.opacity - 绘制透明度。默认值:1。
  57559. * @param {number} style.shadowBlur - 阴影模糊度,大于0有效。默认值:0。
  57560. * @param {number} style.shadowColor - 阴影颜色。默认值:"#000000'"。
  57561. * @param {number} style.shadowOffsetX - 阴影横向偏移。默认值:0。
  57562. * @param {number} style.shadowOffsetY - 阴影纵向偏移。默认值:0。
  57563. * @param {string} style.text - 图形中的附加文本。默认值:""。
  57564. * @param {string} style.textColor - 文本颜色。默认值:"#000000'"。
  57565. * @param {string} style.textFont - 附加文本样式。示例:'bold 18px verdana'。
  57566. * @param {string} style.textPosition - 附加文本位置。可设值:"inside", "left", "right", top", "bottom", "end"。默认值:"end"。
  57567. * @param {string} style.textAlign - 附加文本水平对齐。可设值:"start", "end", "left", "right", "center"。默认根据 textPosition 自动设置。
  57568. * @param {string} style.textBaseline - 附加文本垂直对齐。可设值:"top", "bottom", "middle", "alphabetic", "hanging", "ideographic"。默认根据 textPosition 自动设置。
  57569. */
  57570. //打开接口 style
  57571. /**
  57572. * @function SuperMap.LevelRenderer.Shape.SmicStar.constructor
  57573. * @description 构造函数。
  57574. *
  57575. * @param {Array} options - shape 的配置(options)项,可以是 shape 的自有属性,也可以是自定义的属性。
  57576. *
  57577. */
  57578. constructor(options) {
  57579. super(options);
  57580. /**
  57581. * @member {string} SuperMap.LevelRenderer.Shape.SmicStar.prototype.type
  57582. * @description 图形类型。
  57583. */
  57584. this.type = 'smicstar';
  57585. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57586. this.refOriginalPosition = [0, 0];
  57587. }
  57588. this.CLASS_NAME = "SuperMap.LevelRenderer.Shape.SmicStar";
  57589. }
  57590. /**
  57591. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.destroy
  57592. * @description 销毁对象,释放资源。调用此函数后所有属性将被置为 null。
  57593. */
  57594. destroy() {
  57595. this.type = null;
  57596. super.destroy();
  57597. }
  57598. /**
  57599. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.buildPath
  57600. * @description 创建n 角星(n>3)路径。
  57601. *
  57602. * @param {CanvasRenderingContext2D} ctx - Context2D 上下文。
  57603. * @param {Object} style - style。
  57604. *
  57605. */
  57606. buildPath(ctx, style) {
  57607. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57608. this.refOriginalPosition = [0, 0];
  57609. }
  57610. var __OP = this.refOriginalPosition;
  57611. var n = style.n;
  57612. if (!n || n < 2) {
  57613. return;
  57614. }
  57615. var sin = SUtil.Util_math.sin;
  57616. var cos = SUtil.Util_math.cos;
  57617. var PI = Math.PI;
  57618. var x = style.x + __OP[0];
  57619. var y = style.y + __OP[1];
  57620. var r = style.r;
  57621. var r0 = style.r0;
  57622. // 如果未指定内部顶点外接圆半径,则自动计算
  57623. if (r0 == null) {
  57624. r0 = n > 4
  57625. // 相隔的外部顶点的连线的交点,
  57626. // 被取为内部交点,以此计算r0
  57627. ? r * cos(2 * PI / n) / cos(PI / n)
  57628. // 二三四角星的特殊处理
  57629. : r / 3;
  57630. }
  57631. var dStep = PI / n;
  57632. var deg = -PI / 2;
  57633. var xStart = x + r * cos(deg);
  57634. var yStart = y + r * sin(deg);
  57635. deg += dStep;
  57636. // 记录边界点,用于判断inside
  57637. var pointList = style.pointList = [];
  57638. pointList.push([xStart, yStart]);
  57639. for (var i = 0, end = n * 2 - 1, ri; i < end; i++) {
  57640. ri = i % 2 === 0 ? r0 : r;
  57641. pointList.push([x + ri * cos(deg), y + ri * sin(deg)]);
  57642. deg += dStep;
  57643. }
  57644. pointList.push([xStart, yStart]);
  57645. // 绘制
  57646. ctx.moveTo(pointList[0][0], pointList[0][1]);
  57647. for (let i = 0; i < pointList.length; i++) {
  57648. ctx.lineTo(pointList[i][0], pointList[i][1]);
  57649. }
  57650. ctx.closePath();
  57651. return;
  57652. }
  57653. /**
  57654. * @function SuperMap.LevelRenderer.Shape.SmicStar.prototype.getRect
  57655. * @description 返回 n 角星包围盒矩形。
  57656. *
  57657. * @param {Object} style - style
  57658. * @return {Object} 边框对象。包含属性:x,y,width,height。
  57659. */
  57660. getRect(style) {
  57661. if (style.__rect) {
  57662. return style.__rect;
  57663. }
  57664. if (!this.refOriginalPosition || this.refOriginalPosition.length !== 2) {
  57665. this.refOriginalPosition = [0, 0];
  57666. }
  57667. var __OP = this.refOriginalPosition;
  57668. var lineWidth;
  57669. if (style.brushType == 'stroke' || style.brushType == 'fill') {
  57670. lineWidth = style.lineWidth || 1;
  57671. } else {
  57672. lineWidth = 0;
  57673. }
  57674. style.__rect = {
  57675. x: Math.round((style.x + __OP[0]) - style.r - lineWidth / 2),
  57676. y: Math.round((style.y + __OP[1]) - style.r - lineWidth / 2),
  57677. width: style.r * 2 + lineWidth,
  57678. height: style.r * 2 + lineWidth
  57679. };
  57680. return style.__rect;
  57681. }
  57682. }
  57683. ;// CONCATENATED MODULE: ./src/common/overlay/levelRenderer/index.js
  57684. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57685. * This program are made available under the terms of the Apache License, Version 2.0
  57686. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57687. ;// CONCATENATED MODULE: ./src/common/overlay/index.js
  57688. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57689. * This program are made available under the terms of the Apache License, Version 2.0
  57690. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57691. ;// CONCATENATED MODULE: ./src/common/components/CommonTypes.js
  57692. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57693. * This program are made available under the terms of the Apache License, Version 2.0
  57694. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57695. /**
  57696. * 该文件用于存储一些公用常量
  57697. *
  57698. */
  57699. const CommonTypes_FileTypes = {
  57700. EXCEL: "EXCEL",
  57701. CSV: "CSV",
  57702. ISERVER: "ISERVER",
  57703. GEOJSON: "GEOJSON",
  57704. JSON: 'JSON'
  57705. };
  57706. const CommonTypes_FileConfig = {
  57707. fileMaxSize: 10 * 1024 * 1024
  57708. };
  57709. ;// CONCATENATED MODULE: ./src/common/components/openfile/FileModel.js
  57710. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57711. * This program are made available under the terms of the Apache License, Version 2.0
  57712. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57713. /**
  57714. * @class SuperMap.FileModel
  57715. * @description 文件数据组件数据模型,用于存储一些文件数据或状态,todo 结构待完善
  57716. * @category Components OpenFile
  57717. * @private
  57718. */
  57719. class FileModel {
  57720. constructor(options) {
  57721. this.FileTypes = FileTypes;
  57722. this.FileConfig = FileConfig;
  57723. this.loadFileObject = options && options.loadFileObject ? options.loadFileObject : [];
  57724. }
  57725. /**
  57726. * @function SuperMap.FileModel.prototype.set
  57727. * @description 设置属性值
  57728. * @param {string} key - 属性名称
  57729. * @param {string|Object} value - 属性值
  57730. */
  57731. set(key, value) {
  57732. this[key] = value;
  57733. }
  57734. /**
  57735. * @function SuperMap.FileModel.prototype.get
  57736. * @description 获取数据值
  57737. * @param {string} key - 属性名称
  57738. * @returns {string|Object} value - 返回属性值
  57739. */
  57740. get(key) {
  57741. return this[key];
  57742. }
  57743. }
  57744. ;// CONCATENATED MODULE: ./src/common/components/messagebox/MessageBox.js
  57745. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57746. * This program are made available under the terms of the Apache License, Version 2.0
  57747. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57748. /**
  57749. * @class SuperMap.Components.MessageBox
  57750. * @version 9.1.1
  57751. * @classdesc 组件信息提示框。
  57752. * @category Components Common
  57753. */
  57754. class MessageBox {
  57755. constructor() {
  57756. this._initView();
  57757. }
  57758. _initView() {
  57759. //原生js形式
  57760. const messageBoxContainer = document.createElement("div");
  57761. messageBoxContainer.hidden = true;
  57762. messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  57763. //图标
  57764. const iconContainer = document.createElement("div");
  57765. iconContainer.setAttribute("class", "icon");
  57766. this.icon = document.createElement("span");
  57767. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  57768. iconContainer.appendChild(this.icon);
  57769. messageBoxContainer.appendChild(iconContainer);
  57770. //内容:
  57771. const messageBox = document.createElement("div");
  57772. messageBox.setAttribute("class", "component-messagebox");
  57773. messageBox.innerHTML = "";
  57774. messageBoxContainer.appendChild(messageBox);
  57775. this.messageBox = messageBox;
  57776. //关闭按钮
  57777. const cancelContainer = document.createElement("div");
  57778. cancelContainer.setAttribute("class", "component-messagebox__cancelbtncontainer");
  57779. const cancelBtn = document.createElement("button");
  57780. cancelBtn.setAttribute("class", "component-messagebox__cancelBtn");
  57781. cancelBtn.innerHTML = "x";
  57782. cancelBtn.onclick = this.closeView.bind(this);
  57783. cancelContainer.appendChild(cancelBtn);
  57784. messageBoxContainer.appendChild(cancelContainer);
  57785. this.messageBoxContainer = messageBoxContainer;
  57786. document.body.appendChild(this.messageBoxContainer);
  57787. }
  57788. /**
  57789. * @function SuperMap.Components.MessageBox.prototype.closeView
  57790. * @description 关闭提示框。
  57791. */
  57792. closeView() {
  57793. this.messageBoxContainer.hidden = true;
  57794. }
  57795. /**
  57796. * @function SuperMap.Components.MessageBox.prototype.showView
  57797. * @description 显示提示框。
  57798. * @param {string} message - 提示框显示内容。
  57799. * @param {string}[type="warring"] 提示框类型,如 "warring", "failure", "success"。
  57800. */
  57801. showView(message, type = 'warring') {
  57802. //设置提示框的样式:
  57803. if (type === "success") {
  57804. this.icon.setAttribute("class", "supermapol-icons-message-success");
  57805. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-green");
  57806. } else if (type === "failure") {
  57807. this.icon.setAttribute("class", "supermapol-icons-message-failure");
  57808. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-red");
  57809. } else if (type === "warring") {
  57810. this.icon.setAttribute("class", "supermapol-icons-message-warning");
  57811. this.messageBoxContainer.setAttribute("class", "component-messageboxcontainer component-border-bottom-orange");
  57812. }
  57813. this.messageBox.innerHTML = message;
  57814. this.messageBoxContainer.hidden = false;
  57815. }
  57816. }
  57817. SuperMap.Components.MessageBox = MessageBox;
  57818. ;// CONCATENATED MODULE: external "function(){try{return echarts}catch(e){return {}}}()"
  57819. const external_function_try_return_echarts_catch_e_return_namespaceObject = function(){try{return echarts}catch(e){return {}}}();
  57820. var external_function_try_return_echarts_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_echarts_catch_e_return_namespaceObject);
  57821. ;// CONCATENATED MODULE: ./src/common/lang/Lang.js
  57822. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57823. * This program are made available under the terms of the Apache License, Version 2.0
  57824. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57825. /**
  57826. * @name Lang
  57827. * @memberOf SuperMap
  57828. * @namespace
  57829. * @category BaseTypes
  57830. * @description 国际化的命名空间,包含多种语言和方法库来设置和获取当前的语言。
  57831. */
  57832. let Lang = {
  57833. /**
  57834. * @member {string} SuperMap.Lang.code
  57835. * @description 当前所使用的语言类型。
  57836. */
  57837. code: null,
  57838. /**
  57839. * @member {string} [SuperMap.Lang.defaultCode='en-US']
  57840. * @description 默认使用的语言类型。
  57841. */
  57842. defaultCode: "en-US",
  57843. /**
  57844. * @function SuperMap.Lang.getCode
  57845. * @description 获取当前的语言代码。
  57846. * @returns {string} 当前的语言代码。
  57847. */
  57848. getCode: function () {
  57849. if (!SuperMap.Lang.code) {
  57850. SuperMap.Lang.setCode();
  57851. }
  57852. return SuperMap.Lang.code;
  57853. },
  57854. /**
  57855. * @function SuperMap.Lang.setCode
  57856. * @description 设置语言代码。
  57857. * @param {string} code - 此参数遵循IETF规范。
  57858. */
  57859. setCode: function () {
  57860. var lang = this.getLanguageFromCookie();
  57861. if (lang) {
  57862. SuperMap.Lang.code = lang;
  57863. return;
  57864. }
  57865. lang = SuperMap.Lang.defaultCode;
  57866. if (navigator.appName === 'Netscape') {
  57867. lang = navigator.language;
  57868. } else {
  57869. lang = navigator.browserLanguage;
  57870. }
  57871. if (lang.indexOf('zh') === 0) {
  57872. lang = 'zh-CN';
  57873. }
  57874. if (lang.indexOf('en') === 0) {
  57875. lang = 'en-US';
  57876. }
  57877. SuperMap.Lang.code = lang;
  57878. },
  57879. /**
  57880. * @function SuperMap.Lang.getLanguageFromCookie
  57881. * @description 从 cookie 中获取语言类型。
  57882. */
  57883. getLanguageFromCookie() {
  57884. var name = 'language=';
  57885. var ca = document.cookie.split(';');
  57886. for (var i = 0; i < ca.length; i++) {
  57887. var c = ca[i];
  57888. while (c.charAt(0) === ' ') {
  57889. c = c.substring(1)
  57890. }
  57891. if (c.indexOf(name) !== -1) {
  57892. return c.substring(name.length, c.length)
  57893. }
  57894. }
  57895. return "";
  57896. },
  57897. /**
  57898. * @function SuperMap.Lang.i18n
  57899. * @description 从当前语言字符串的字典查找 key。
  57900. * @param {string} key - 字典中 i18n 字符串值的关键字。
  57901. * @returns {string} 国际化的字符串。
  57902. */
  57903. i18n: function (key) {
  57904. var dictionary = SuperMap.Lang[SuperMap.Lang.getCode()];
  57905. var message = dictionary && dictionary[key];
  57906. if (!message) {
  57907. // Message not found, fall back to message key
  57908. message = key;
  57909. }
  57910. return message;
  57911. }
  57912. };
  57913. SuperMap.Lang = Lang;
  57914. SuperMap.i18n = SuperMap.Lang.i18n;
  57915. ;// CONCATENATED MODULE: external "function(){try{return XLSX}catch(e){return {}}}()"
  57916. const external_function_try_return_XLSX_catch_e_return_namespaceObject = function(){try{return XLSX}catch(e){return {}}}();
  57917. var external_function_try_return_XLSX_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_XLSX_catch_e_return_namespaceObject);
  57918. ;// CONCATENATED MODULE: ./src/common/components/util/FileReaderUtil.js
  57919. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  57920. * This program are made available under the terms of the Apache License, Version 2.0
  57921. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  57922. /**
  57923. * @class SuperMap.Components.FileReaderUtil
  57924. * @classdesc 组件读取文件工具类。
  57925. * @version 9.1.1
  57926. * @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(*, *=))}}
  57927. */
  57928. let FileReaderUtil = {
  57929. rABS: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsBinaryString,
  57930. rABF: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsArrayBuffer,
  57931. rAT: typeof FileReader !== 'undefined' && FileReader.prototype && FileReader.prototype.readAsText,
  57932. /**
  57933. * @function SuperMap.Components.FileReaderUtil.prototype.readFile
  57934. * @description 读取文件
  57935. * @param {string} fileType - 当前读取的文件类型
  57936. *
  57937. * @param {Object} file - 读取回来的文件内容对象
  57938. * @param {function} success - 读取文件成功回调函数
  57939. * @param {function} failed - 读取文件失败回调函数
  57940. * @param {Object} context - 回调重定向对象
  57941. */
  57942. readFile(fileType, file, success, failed, context) {
  57943. if (CommonTypes_FileTypes.JSON === fileType || CommonTypes_FileTypes.GEOJSON === fileType) {
  57944. this.readTextFile(file, success, failed, context)
  57945. } else if (CommonTypes_FileTypes.EXCEL === fileType || CommonTypes_FileTypes.CSV === fileType) {
  57946. this.readXLSXFile(file, success, failed, context)
  57947. }
  57948. },
  57949. /**
  57950. * 读取文本文件
  57951. * @param file
  57952. * @param success
  57953. * @param failed
  57954. * @param {Object} context - 回调重定向对象
  57955. */
  57956. readTextFile(file, success, failed, context) {
  57957. let reader = new FileReader();
  57958. reader.onloadend = function (evt) {
  57959. success && success.call(context, evt.target.result);
  57960. };
  57961. reader.onerror = function (error) {
  57962. failed && failed.call(context, error)
  57963. };
  57964. this.rAT ? reader.readAsText(file.file, 'utf-8') : reader.readAsBinaryString(file.file);
  57965. },
  57966. /**
  57967. * 读取excel或csv文件
  57968. * @param file
  57969. * @param success
  57970. * @param failed
  57971. * @param {Object} context - 回调重定向对象
  57972. */
  57973. readXLSXFile(file, success, failed, context) {
  57974. let reader = new FileReader();
  57975. reader.onloadend = function (evt) {
  57976. let xLSXData = new Uint8Array(evt.target.result);
  57977. let workbook = external_function_try_return_XLSX_catch_e_return_default().read(xLSXData, {type: "array"});
  57978. try {
  57979. if (workbook && workbook.SheetNames && workbook.SheetNames.length > 0) {
  57980. //暂时只读取第一个sheets的内容
  57981. let sheetName = workbook.SheetNames[0];
  57982. let xLSXCSVString = external_function_try_return_XLSX_catch_e_return_default().utils.sheet_to_csv(workbook.Sheets[sheetName]);
  57983. success && success.call(context, xLSXCSVString);
  57984. }
  57985. } catch (error) {
  57986. failed && failed.call(context, error);
  57987. }
  57988. };
  57989. reader.onerror = function (error) {
  57990. failed && failed.call(context, error)
  57991. };
  57992. this.rABF && reader.readAsArrayBuffer(file.file);
  57993. },
  57994. /**
  57995. * @function SuperMap.Components.FileReaderUtil.prototype.processDataToGeoJson
  57996. * @description 将读取回来得数据统一处理为 GeoJSON 格式
  57997. * @param {string} type - 文件类型
  57998. * @param {Object} data - 读取返回的数据对象
  57999. * @param {function} success - 数据处理成功的回调
  58000. * @param {function} failed - 数据处理失败的回调
  58001. * @param {Object} context - 回调重定向对象
  58002. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  58003. * @private
  58004. */
  58005. processDataToGeoJson(type, data, success, failed, context) {
  58006. let geojson = null;
  58007. if (type === "EXCEL" || type === "CSV") {
  58008. geojson = this.processExcelDataToGeoJson(data);
  58009. success && success.call(context, geojson);
  58010. } else if (type === 'JSON' || type === 'GEOJSON') {
  58011. let result = data;
  58012. //geojson、json未知,通过类容来判断
  58013. if ((typeof result) === "string") {
  58014. result = JSON.parse(result);
  58015. }
  58016. if (result.type === 'ISERVER') {
  58017. geojson = result.data.recordsets[0].features;
  58018. } else if (result.type === 'FeatureCollection') {
  58019. //geojson
  58020. geojson = result;
  58021. } else {
  58022. //不支持数据
  58023. failed && failed.call(context, Lang.i18n('msg_dataInWrongGeoJSONFormat'));
  58024. }
  58025. success && success.call(context, geojson);
  58026. } else {
  58027. failed && failed.call(context, Lang.i18n('msg_dataInWrongFormat'));
  58028. }
  58029. },
  58030. /**
  58031. * @function SuperMap.Components.FileReaderUtil.prototype.processExcelDataToGeoJson
  58032. * @description 表格文件数据处理
  58033. * @param {Object} data - 读取的表格文件数据
  58034. * @returns {GeoJSONObject} 返回标准 GeoJSON 规范格式数据
  58035. * @private
  58036. */
  58037. processExcelDataToGeoJson(data) {
  58038. //处理为对象格式转化
  58039. let dataContent = this.string2Csv(data);
  58040. let fieldCaptions = dataContent.colTitles;
  58041. //位置属性处理
  58042. let xfieldIndex = -1,
  58043. yfieldIndex = -1;
  58044. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  58045. if (this.isXField(fieldCaptions[i])) {
  58046. xfieldIndex = i;
  58047. }
  58048. if (this.isYField(fieldCaptions[i])) {
  58049. yfieldIndex = i;
  58050. }
  58051. }
  58052. // feature 构建后期支持坐标系 4326/3857
  58053. let features = [];
  58054. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  58055. let row = dataContent.rows[i];
  58056. //if (featureFrom === "LonLat") {
  58057. let x = Number(row[xfieldIndex]),
  58058. y = Number(row[yfieldIndex]);
  58059. //属性信息
  58060. let attributes = {};
  58061. for (let index in dataContent.colTitles) {
  58062. let key = dataContent.colTitles[index];
  58063. attributes[key] = dataContent.rows[i][index];
  58064. }
  58065. //目前csv 只支持处理点,所以先生成点类型的 geojson
  58066. let feature = {
  58067. "type": "Feature",
  58068. "geometry": {
  58069. "type": "Point",
  58070. "coordinates": [x, y]
  58071. },
  58072. "properties": attributes
  58073. };
  58074. features.push(feature);
  58075. }
  58076. return features;
  58077. },
  58078. /**
  58079. * 判断是否地理X坐标
  58080. * @param data
  58081. */
  58082. isXField(data) {
  58083. var lowerdata = data.toLowerCase();
  58084. return (lowerdata === "x" || lowerdata === "smx" ||
  58085. lowerdata === "jd" || lowerdata === "经度" || lowerdata === "东经" || lowerdata === "longitude" ||
  58086. lowerdata === "lot" || lowerdata === "lon" || lowerdata === "lng" || lowerdata === "x坐标");
  58087. },
  58088. /**
  58089. * 判断是否地理Y坐标
  58090. * @param data
  58091. */
  58092. isYField(data) {
  58093. var lowerdata = data.toLowerCase();
  58094. return (lowerdata === "y" || lowerdata === "smy" ||
  58095. lowerdata === "wd" || lowerdata === "纬度" || lowerdata === "北纬" ||
  58096. lowerdata === "latitude" || lowerdata === "lat" || lowerdata === "y坐标");
  58097. },
  58098. /**
  58099. * 字符串转为dataEditor 支持的csv格式数据
  58100. * @param string
  58101. * @param withoutTitle
  58102. */
  58103. string2Csv(string, withoutTitle) {
  58104. // let rows = string.split('\r\n');
  58105. let rows = string.split('\n');
  58106. let result = {};
  58107. if (!withoutTitle) {
  58108. result["colTitles"] = rows[0].split(',');
  58109. } else {
  58110. result["colTitles"] = [];
  58111. }
  58112. result['rows'] = [];
  58113. for (let i = (withoutTitle) ? 0 : 1; i < rows.length; i++) {
  58114. rows[i] && result['rows'].push(rows[i].split(','));
  58115. }
  58116. return result;
  58117. }
  58118. };
  58119. SuperMap.Components.FileReaderUtil = FileReaderUtil;
  58120. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartModel.js
  58121. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58122. * This program are made available under the terms of the Apache License, Version 2.0
  58123. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58124. /**
  58125. * @class SuperMap.Components.ChartModel
  58126. * @classdesc 图表组件数据模型
  58127. * @private
  58128. * @param {Object} datasets - 数据来源。
  58129. * @category Components Chart
  58130. * @fires SuperMap.Components.ChartModel#getdatafailed
  58131. */
  58132. class ChartModel {
  58133. constructor(datasets) {
  58134. this.datasets = datasets;
  58135. this.EVENT_TYPES = ['getdatafailed'];
  58136. this.events = new Events(this, null, this.EVENT_TYPES);
  58137. }
  58138. /**
  58139. * @private
  58140. * @function SuperMap.Components.ChartModel.prototype.getDatasetInfo
  58141. * @description 获得数据集数据。
  58142. * @param {string} datasetUrl - 数据集资源地址。
  58143. */
  58144. getDatasetInfo(success) {
  58145. let datasetUrl = this.datasets.url;
  58146. let me = this;
  58147. FetchRequest.get(datasetUrl)
  58148. .then(function (response) {
  58149. return response.json();
  58150. })
  58151. .then(function (results) {
  58152. if (results.datasetInfo) {
  58153. let datasetInfo = results.datasetInfo;
  58154. me.datasetsInfo = {
  58155. dataSourceName: datasetInfo.dataSourceName,
  58156. datasetName: datasetInfo.name,
  58157. mapName: results.name
  58158. };
  58159. success({
  58160. result: me.datasetsInfo
  58161. });
  58162. }
  58163. })
  58164. .catch(function (error) {
  58165. console.log(error);
  58166. me._fireFailedEvent(error);
  58167. });
  58168. }
  58169. /**
  58170. * @private
  58171. * @function SuperMap.Components.ChartModel.prototype.getDataFeatures
  58172. * @description 请求数据集的数据信息
  58173. * @param {Object} results - 数据集信息。
  58174. * @param {function} success - 成功回调函数。
  58175. */
  58176. getDataFeatures(results, success) {
  58177. let datasetsInfo = results.result;
  58178. let getFeatureParam, getFeatureBySQLParams, getFeatureBySQLService;
  58179. let params = {
  58180. name: datasetsInfo.datasetName + '@' + datasetsInfo.dataSourceName
  58181. };
  58182. Object.assign(params, this.datasets.queryInfo);
  58183. getFeatureParam = new SuperMap.FilterParameter(params);
  58184. getFeatureBySQLParams = new SuperMap.GetFeaturesBySQLParameters({
  58185. queryParameter: getFeatureParam,
  58186. datasetNames: [datasetsInfo.dataSourceName + ':' + datasetsInfo.datasetName],
  58187. fromIndex: 0,
  58188. toIndex: 100000
  58189. });
  58190. getFeatureBySQLService = new SuperMap.GetFeaturesBySQLService(datasetsInfo.dataUrl, {
  58191. eventListeners: {
  58192. processCompleted: success,
  58193. processFailed: function () {}
  58194. }
  58195. });
  58196. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  58197. }
  58198. /**
  58199. * @private
  58200. * @function SuperMap.Components.ChartModel.prototype.getLayerFeatures
  58201. * @description 请求图层要素的数据信息
  58202. * @param {Object} results - 数据集信息。
  58203. * @param {Callbacks} success - 成功回调函数。
  58204. */
  58205. getLayerFeatures(results, success) {
  58206. let datasetsInfo = results.result;
  58207. let queryParam, queryBySQLParams, queryBySQLService;
  58208. let params = {
  58209. name: datasetsInfo.mapName
  58210. };
  58211. Object.assign(params, this.datasets.queryInfo);
  58212. queryParam = new SuperMap.FilterParameter(params);
  58213. queryBySQLParams = new SuperMap.QueryBySQLParameters({
  58214. queryParams: [queryParam],
  58215. expectCount: 100000
  58216. });
  58217. queryBySQLService = new SuperMap.QueryBySQLService(datasetsInfo.dataUrl, {
  58218. eventListeners: {
  58219. processCompleted: success,
  58220. processFailed: function () {}
  58221. }
  58222. });
  58223. queryBySQLService.processAsync(queryBySQLParams);
  58224. }
  58225. /**
  58226. * @private
  58227. * @function SuperMap.Components.ChartModel.prototype.getDataInfoByIptl
  58228. * @description 用dataId获取iportal的数据。
  58229. * @param {Callbacks} success - getdatachart。
  58230. *
  58231. */
  58232. getDataInfoByIptl(success) {
  58233. // success是chart的回调
  58234. this.getServiceInfo(this.datasets.url, success);
  58235. }
  58236. /**
  58237. * @private
  58238. * @function SuperMap.Components.ChartModel.prototype.getServiceInfo
  58239. * @description 用iportal获取dataItemServices。
  58240. * @param {String} url
  58241. * @param {Callbacks} success - getdatachart。
  58242. * */
  58243. getServiceInfo(url, success) {
  58244. let me = this;
  58245. FetchRequest.get(url, null, {
  58246. withCredentials: this.datasets.withCredentials
  58247. })
  58248. .then((response) => {
  58249. return response.json();
  58250. })
  58251. .then((data) => {
  58252. if (data.succeed === false) {
  58253. //请求失败
  58254. me._fireFailedEvent(data);
  58255. return;
  58256. }
  58257. // 是否有rest服务
  58258. if (data.dataItemServices && data.dataItemServices.length > 0) {
  58259. let dataItemServices = data.dataItemServices,
  58260. resultData;
  58261. dataItemServices.forEach((item) => {
  58262. // 如果有restdata并且发布成功,就请求restdata服务
  58263. // 如果有restmap并且发布成功,就请求restmap服务
  58264. // 其他情况就请求iportal/content.json
  58265. if (item.serviceType === 'RESTDATA' && item.serviceStatus === 'PUBLISHED') {
  58266. resultData = item;
  58267. } else if (item.serviceType === 'RESTMAP' && item.serviceStatus === 'PUBLISHED') {
  58268. resultData = item;
  58269. } else {
  58270. me.getDatafromContent(url, success);
  58271. return;
  58272. }
  58273. });
  58274. // 如果有服务,获取数据源和数据集, 然后请求rest服务
  58275. resultData && me.getDatafromRest(resultData.serviceType, resultData.address, success);
  58276. } else {
  58277. me.getDatafromContent(url, success);
  58278. return;
  58279. }
  58280. })
  58281. .catch((error) => {
  58282. console.log(error);
  58283. me._fireFailedEvent(error);
  58284. });
  58285. }
  58286. /**
  58287. * @private
  58288. * @function SuperMap.Components.ChartModel.prototype.getDatafromURL
  58289. * @description 用iportal获取数据。(通过固定的url来请求,但是不能请求工作空间的数据)
  58290. * @param {String} url
  58291. * @param {Callbacks} success - getdatachart。
  58292. */
  58293. getDatafromContent(url, success) {
  58294. // 成功回调传入的results
  58295. let results = {
  58296. result: {}
  58297. },
  58298. me = this;
  58299. url += '/content.json?pageSize=9999999&currentPage=1';
  58300. // 获取图层数据
  58301. FetchRequest.get(url, null, {
  58302. withCredentials: this.datasets.withCredentials
  58303. })
  58304. .then((response) => {
  58305. return response.json();
  58306. })
  58307. .then((data) => {
  58308. if (data.succeed === false) {
  58309. //请求失败
  58310. me._fireFailedEvent(data);
  58311. return;
  58312. }
  58313. if (data.type) {
  58314. if (data.type === 'JSON' || data.type === 'GEOJSON') {
  58315. // 将字符串转换成json
  58316. data.content = JSON.parse(data.content.trim());
  58317. // 如果是json文件 data.content = {type:'fco', features},格式不固定
  58318. if (!data.content.features) {
  58319. //json格式解析失败
  58320. console.log(Lang.i18n('msg_jsonResolveFiled'));
  58321. return;
  58322. }
  58323. let features = this._formatGeoJSON(data.content);
  58324. results.result.features = {
  58325. type: data.content.type,
  58326. features
  58327. };
  58328. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  58329. let features = this._excelData2Feature(data.content);
  58330. results.result.features = {
  58331. type: 'FeatureCollection',
  58332. features
  58333. };
  58334. }
  58335. success(results, 'content');
  58336. }
  58337. }, this)
  58338. .catch((error) => {
  58339. console.log(error);
  58340. me._fireFailedEvent(error);
  58341. });
  58342. }
  58343. /**
  58344. * @private
  58345. * @function SuperMap.Components.ChartModel.prototype._getDataSource
  58346. * @description 获取数据源名和数据集名。
  58347. * @param {string} serviceType 服务类型
  58348. * @param {string} address 地址
  58349. * @param {Callbacks} success - getdatachart。
  58350. * @return{array} [数据源名:数据集名]
  58351. * @return{string} 图层名
  58352. */
  58353. getDatafromRest(serviceType, address, success) {
  58354. let me = this,
  58355. withCredentials = this.datasets.withCredentials;
  58356. if (serviceType === 'RESTDATA') {
  58357. let url = `${address}/data/datasources`,
  58358. sourceName,
  58359. datasetName;
  58360. // 请求获取数据源名
  58361. FetchRequest.get(url, null, {
  58362. withCredentials
  58363. })
  58364. .then((response) => {
  58365. return response.json();
  58366. })
  58367. .then((data) => {
  58368. sourceName = data.datasourceNames[0];
  58369. url = `${address}/data/datasources/${sourceName}/datasets`;
  58370. // 请求获取数据集名
  58371. FetchRequest.get(url, null, {
  58372. withCredentials
  58373. })
  58374. .then((response) => {
  58375. return response.json();
  58376. })
  58377. .then((data) => {
  58378. datasetName = data.datasetNames[0];
  58379. // 请求restdata服务
  58380. me.getDatafromRestData(`${address}/data`, [sourceName + ':' + datasetName], success);
  58381. return [sourceName + ':' + datasetName];
  58382. })
  58383. .catch(function (error) {
  58384. me._fireFailedEvent(error);
  58385. });
  58386. })
  58387. .catch(function (error) {
  58388. me._fireFailedEvent(error);
  58389. });
  58390. } else {
  58391. // 如果是地图服务
  58392. let url = `${address}/maps`,
  58393. mapName,
  58394. layerName,
  58395. path;
  58396. // 请求获取地图名
  58397. FetchRequest.get(url, null, {
  58398. withCredentials
  58399. })
  58400. .then((response) => {
  58401. return response.json();
  58402. })
  58403. .then((data) => {
  58404. mapName = data[0].name;
  58405. path = data[0].path;
  58406. url = url = `${address}/maps/${mapName}/layers`;
  58407. // 请求获取图层名
  58408. FetchRequest.get(url, null, {
  58409. withCredentials
  58410. })
  58411. .then((response) => {
  58412. return response.json();
  58413. })
  58414. .then((data) => {
  58415. layerName = data[0].subLayers.layers[0].caption;
  58416. // 请求restmap服务
  58417. me.getDatafromRestMap(layerName, path, success);
  58418. return layerName;
  58419. })
  58420. .catch(function (error) {
  58421. me._fireFailedEvent(error);
  58422. });
  58423. })
  58424. .catch(function (error) {
  58425. me._fireFailedEvent(error);
  58426. });
  58427. }
  58428. }
  58429. /**
  58430. * @private
  58431. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestData
  58432. * @description 请求restdata服务
  58433. * @param {String} url
  58434. * @param {Array<string>} dataSource [数据源名:数据集名]
  58435. * @param {Callbacks} success - getdatachart。
  58436. */
  58437. getDatafromRestData(url, dataSource, success) {
  58438. let me = this;
  58439. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'SmID>0';
  58440. this._getFeatureBySQL(
  58441. url,
  58442. dataSource,
  58443. this.datasets.queryInfo,
  58444. (results) => {
  58445. // 此时的features已经处理成geojson了
  58446. success(results, 'RESTDATA');
  58447. },
  58448. (error) => {
  58449. console.log(error);
  58450. me._fireFailedEvent(error);
  58451. }
  58452. );
  58453. }
  58454. /**
  58455. * @private
  58456. * @function SuperMap.Components.ChartModel.prototype.getDatafromRestMap
  58457. * @description 请求restmap服务
  58458. * @param {String} dataSource layerName
  58459. * @param {String} path - map服务地址。
  58460. * @param {Callbacks} success - getdatachart。
  58461. */
  58462. getDatafromRestMap(dataSource, path, success) {
  58463. let me = this;
  58464. this.datasets.queryInfo.attributeFilter = this.datasets.queryInfo.attributeFilter || 'smid=1';
  58465. this._queryFeatureBySQL(
  58466. path,
  58467. dataSource,
  58468. this.datasets.queryInfo,
  58469. null,
  58470. null,
  58471. (results) => {
  58472. // let features = result.result.recordsets[0].features;
  58473. success(results, 'RESTMAP');
  58474. },
  58475. (error) => {
  58476. console.log(error);
  58477. me._fireFailedEvent(error);
  58478. }
  58479. );
  58480. }
  58481. /**
  58482. * @private
  58483. * @function SuperMap.Components.ChartModel.prototype._getFeatureBySQL
  58484. * @description 通过 sql 方式查询数据。
  58485. */
  58486. _getFeatureBySQL(url, datasetNames, queryInfo, processCompleted, processFaild) {
  58487. let getFeatureParam, getFeatureBySQLService, getFeatureBySQLParams;
  58488. let params = {
  58489. name: datasetNames.join().replace(':', '@')
  58490. };
  58491. Object.assign(params, queryInfo);
  58492. getFeatureParam = new FilterParameter(params);
  58493. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  58494. queryParameter: getFeatureParam,
  58495. datasetNames: datasetNames,
  58496. fromIndex: 0,
  58497. toIndex: 100000,
  58498. returnContent: true
  58499. });
  58500. let options = {
  58501. eventListeners: {
  58502. processCompleted: (getFeaturesEventArgs) => {
  58503. processCompleted && processCompleted(getFeaturesEventArgs);
  58504. },
  58505. processFailed: (e) => {
  58506. processFaild && processFaild(e);
  58507. }
  58508. }
  58509. };
  58510. getFeatureBySQLService = new GetFeaturesBySQLService(url, options);
  58511. getFeatureBySQLService.processAsync(getFeatureBySQLParams);
  58512. }
  58513. /**
  58514. * @private
  58515. * @function SuperMap.Components.ChartModel.prototype._queryFeatureBySQL
  58516. * @description 通过 sql 方式查询数据。
  58517. */
  58518. _queryFeatureBySQL(
  58519. url,
  58520. layerName,
  58521. queryInfo,
  58522. fields,
  58523. epsgCode,
  58524. processCompleted,
  58525. processFaild,
  58526. startRecord,
  58527. recordLength,
  58528. onlyAttribute
  58529. ) {
  58530. var queryParam, queryBySQLParams;
  58531. var filterParams = {
  58532. name: layerName
  58533. };
  58534. Object.assign(filterParams, queryInfo);
  58535. queryParam = new FilterParameter(filterParams);
  58536. if (fields) {
  58537. queryParam.fields = fields;
  58538. }
  58539. var params = {
  58540. queryParams: [queryParam]
  58541. };
  58542. if (onlyAttribute) {
  58543. params.queryOption = QueryOption.ATTRIBUTE;
  58544. }
  58545. startRecord && (params.startRecord = startRecord);
  58546. recordLength && (params.expectCount = recordLength);
  58547. if (epsgCode) {
  58548. params.prjCoordSys = {
  58549. epsgCode: epsgCode
  58550. };
  58551. }
  58552. queryBySQLParams = new QueryBySQLParameters(params);
  58553. this._queryBySQL(url, queryBySQLParams, (data) => {
  58554. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  58555. });
  58556. }
  58557. /**
  58558. * @function SuperMap.Components.ChartModel.prototype._queryBySQL
  58559. * @description SQL 查询服务。
  58560. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  58561. * @param {RequestCallback} callback - 回调函数。
  58562. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  58563. */
  58564. _queryBySQL(url, params, callback, resultFormat) {
  58565. var me = this;
  58566. var queryBySQLService = new QueryBySQLService(url, {
  58567. eventListeners: {
  58568. scope: me,
  58569. processCompleted: callback,
  58570. processFailed: callback
  58571. },
  58572. format: me._processFormat(resultFormat)
  58573. });
  58574. queryBySQLService.processAsync(params);
  58575. }
  58576. /**
  58577. * @function SuperMap.Components.ChartModel.prototype._processFormat
  58578. * @description 将数据转换成geojson。
  58579. * @param {object} resultFormat - 返回结果集。
  58580. * @return {object} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回结果类型。
  58581. */
  58582. _processFormat(resultFormat) {
  58583. return resultFormat ? resultFormat : DataFormat.GEOJSON;
  58584. }
  58585. /**
  58586. * @private
  58587. * @function SuperMap.Components.ChartModel.prototype._formatGeoJSON
  58588. * @description 格式 GeoJSON。
  58589. * @param {GeoJSON} data - GeoJSON 数据。
  58590. */
  58591. _formatGeoJSON(data) {
  58592. let features = data.features;
  58593. features.forEach((row, index) => {
  58594. row.properties['index'] = index;
  58595. });
  58596. return features;
  58597. }
  58598. /**
  58599. * @private
  58600. * @description 将 csv 和 xls 文件内容转换成 geojson
  58601. * @function SuperMap.Components.ChartModel.prototype._excelData2Feature
  58602. * @param content 文件内容
  58603. * @param layerInfo 图层信息
  58604. * @returns {Array} feature的数组集合
  58605. */
  58606. _excelData2Feature(dataContent) {
  58607. let fieldCaptions = dataContent.colTitles;
  58608. //位置属性处理
  58609. let xfieldIndex = -1,
  58610. yfieldIndex = -1;
  58611. for (let i = 0, len = fieldCaptions.length; i < len; i++) {
  58612. if (FileReaderUtil.isXField(fieldCaptions[i])) {
  58613. xfieldIndex = i;
  58614. }
  58615. if (FileReaderUtil.isYField(fieldCaptions[i])) {
  58616. yfieldIndex = i;
  58617. }
  58618. }
  58619. // feature 构建后期支持坐标系 4326/3857
  58620. let features = [];
  58621. for (let i = 0, len = dataContent.rows.length; i < len; i++) {
  58622. let row = dataContent.rows[i];
  58623. let x = Number(row[xfieldIndex]),
  58624. y = Number(row[yfieldIndex]);
  58625. //属性信息
  58626. let attributes = {};
  58627. for (let index in dataContent.colTitles) {
  58628. let key = dataContent.colTitles[index];
  58629. attributes[key] = dataContent.rows[i][index];
  58630. }
  58631. attributes['index'] = i + '';
  58632. //目前csv 只支持处理点,所以先生成点类型的 geojson
  58633. let feature = {
  58634. type: 'Feature',
  58635. geometry: {
  58636. type: 'Point',
  58637. coordinates: [x, y]
  58638. },
  58639. properties: attributes
  58640. };
  58641. features.push(feature);
  58642. }
  58643. return features;
  58644. }
  58645. /**
  58646. * @private
  58647. * @description 请求数据失败的事件
  58648. * @function SuperMap.Components.ChartModel.prototype._fireFailedEvent
  58649. * @param {object} error 错误信息
  58650. */
  58651. _fireFailedEvent(error) {
  58652. let errorData = error
  58653. ? {
  58654. error,
  58655. message: Lang.i18n('msg_getdatafailed')
  58656. }
  58657. : {
  58658. message: Lang.i18n('msg_getdatafailed')
  58659. };
  58660. /**
  58661. * @event SuperMap.Components.Chart#getdatafailed
  58662. * @description 监听到获取数据失败事件后触发
  58663. * @property {Object} error - 事件对象。
  58664. */
  58665. this.events.triggerEvent('getdatafailed', errorData);
  58666. }
  58667. }
  58668. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartViewModel.js
  58669. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  58670. * This program are made available under the terms of the Apache License, Version 2.0
  58671. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  58672. /**
  58673. * @class SuperMap.Components.ChartViewModel
  58674. * @classdesc 图表组件功能类
  58675. * @category Components Chart
  58676. * @version 10.0.0
  58677. * @param {Object} options - 可选参数。
  58678. * @param {string} options.type - 图表类型。
  58679. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源。
  58680. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  58681. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  58682. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  58683. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  58684. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  58685. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  58686. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  58687. * @fires SuperMap.Components.ChartViewModel#getdatafailed
  58688. */
  58689. class ChartViewModel {
  58690. constructor(options) {
  58691. this.datasets = options.datasets;
  58692. this.xField = [];
  58693. this.yField = [];
  58694. this.grid = {
  58695. top: "50px",
  58696. bottom: "50px",
  58697. left: "50px",
  58698. right: "60px"
  58699. };
  58700. this.chartType = options.type || "bar";
  58701. this._initXYField(options.chartOptions);
  58702. this.EVENT_TYPES = ["getdatafailed"];
  58703. this.events = new Events(this, null, this.EVENT_TYPES);
  58704. }
  58705. /**
  58706. * @function SuperMap.Components.ChartViewModel.prototype._initXYField
  58707. * @description 初始化XY字段。
  58708. * @private
  58709. * @param {Object} chartOptions - options里的图表参数
  58710. */
  58711. _initXYField(chartOptions) {
  58712. let me = this;
  58713. if (chartOptions && chartOptions.length > 0) {
  58714. chartOptions.forEach(function (option) {
  58715. if (option.xAxis) {
  58716. me.xField.push({
  58717. field: option.xAxis.field,
  58718. name: option.xAxis.name
  58719. });
  58720. }
  58721. if (option.yAxis) {
  58722. me.yField.push({
  58723. field: option.yAxis.field,
  58724. name: option.yAxis.name
  58725. });
  58726. }
  58727. });
  58728. }
  58729. }
  58730. /**
  58731. * @function SuperMap.Components.ChartViewModel.prototype.getDatasetInfo
  58732. * @description 获得数据集数据。
  58733. * @param {function} success - 成功回调函数
  58734. */
  58735. getDatasetInfo(success) {
  58736. this.createChart = success;
  58737. if (this.datasets && this._checkUrl(this.datasets.url)) {
  58738. this.chartModel = new ChartModel(this.datasets);
  58739. if(this.datasets.type === 'iServer'){
  58740. this.chartModel.getDatasetInfo(this._getDatasetInfoSuccess.bind(this));
  58741. }else if(this.datasets.type === 'iPortal'){
  58742. this.chartModel.getDataInfoByIptl(this._getDataInfoSuccess.bind(this));
  58743. }
  58744. /**
  58745. * @event SuperMap.Components.ChartViewModel#getdatafailed
  58746. * @description 监听到获取数据失败事件后触发
  58747. * @property {Object} error - 事件对象。
  58748. */
  58749. this.chartModel.events.on({"getdatafailed": (error) => {
  58750. this.events.triggerEvent("getdatafailed", error)
  58751. }});
  58752. }
  58753. }
  58754. /**
  58755. * @function SuperMap.Components.ChartViewModel.prototype._getDatasetInfoSuccess
  58756. * @description 成功回调函数。
  58757. * @private
  58758. * @param {Object} results - 数据集信息
  58759. */
  58760. _getDatasetInfoSuccess(results) {
  58761. let datasetUrl = this.datasets.url;
  58762. //判断服务为地图服务 或者 数据服务
  58763. let restIndex = datasetUrl.indexOf("rest");
  58764. if (restIndex > 0) {
  58765. let index = datasetUrl.indexOf("/", restIndex + 5);
  58766. let type = datasetUrl.substring(restIndex + 5, index);
  58767. let dataUrl = datasetUrl.substring(0, restIndex + 4) + "/data";
  58768. if (type === "maps") {
  58769. let mapIndex = datasetUrl.indexOf("/", index + 1);
  58770. let mapName = datasetUrl.substring(index + 1, mapIndex);
  58771. dataUrl = datasetUrl.substring(0, restIndex + 4) + "/maps/" + mapName;
  58772. results.result.dataUrl = dataUrl;
  58773. this._getLayerFeatures(results);
  58774. } else if (type === "data") {
  58775. results.result.dataUrl = dataUrl;
  58776. this._getDataFeatures(results);
  58777. }
  58778. }
  58779. }
  58780. /**
  58781. * @function SuperMap.Components.ChartViewModel.prototype._getDataInfoSuccess
  58782. * @description 请求iportal数据成功之后的回调
  58783. * @private
  58784. */
  58785. _getDataInfoSuccess(results, type) {
  58786. let me = this;
  58787. if(type === 'RESTMAP'){
  58788. me._getChartDatasFromLayer(results);
  58789. }else{
  58790. me._getChartDatas(results);
  58791. }
  58792. }
  58793. /**
  58794. * @function SuperMap.Components.ChartViewModel.prototype._getDataFeatures
  58795. * @description 请求数据集的数据信息
  58796. * @private
  58797. * @param {Object} results - 数据集信息
  58798. */
  58799. _getDataFeatures(results) {
  58800. this.chartModel.getDataFeatures(results, this._getChartDatas.bind(this));
  58801. }
  58802. /**
  58803. * @function SuperMap.Components.ChartViewModel.prototype._getLayerFeatures
  58804. * @description 请求图层的数据信息
  58805. * @private
  58806. * @param {Object} results - 数据集信息
  58807. */
  58808. _getLayerFeatures(results) {
  58809. this.chartModel.getLayerFeatures(results, this._getChartDatasFromLayer.bind(this));
  58810. }
  58811. /**
  58812. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatas
  58813. * @description 将请求回来的数据转换为图表所需的数据格式
  58814. * @private
  58815. * @param {Object} results - 数据要素信息
  58816. */
  58817. _getChartDatas(results) {
  58818. if (results) {
  58819. // 数据来自restdata---results.result.features
  58820. this.features = results.result.features;
  58821. let features = this.features.features;
  58822. let data = {};
  58823. if (features.length) {
  58824. let feature = features[0];
  58825. let attrFields = [],
  58826. itemTypes = [];
  58827. for (let attr in feature.properties) {
  58828. attrFields.push(attr);
  58829. itemTypes.push(this._getDataType(feature.properties[attr]));
  58830. }
  58831. data = {
  58832. features,
  58833. fieldCaptions: attrFields,
  58834. fieldTypes: itemTypes,
  58835. fieldValues: []
  58836. }
  58837. for (let m in itemTypes) {
  58838. let fieldValue = [];
  58839. for (let j in features) {
  58840. let feature = features[j];
  58841. let caption = data.fieldCaptions[m];
  58842. let value = feature.properties[caption];
  58843. fieldValue.push(value);
  58844. }
  58845. data.fieldValues.push(fieldValue);
  58846. }
  58847. this.createChart(data);
  58848. }
  58849. }
  58850. }
  58851. /**
  58852. * @function SuperMap.Components.ChartViewModel.prototype._getChartDatasFromLayer
  58853. * @description 将请求回来的数据转换为图表所需的数据格式
  58854. * @private
  58855. * @param {Object} results - 图层数据要素信息
  58856. */
  58857. _getChartDatasFromLayer(results) {
  58858. if (results.result.recordsets) {
  58859. let recordsets = results.result.recordsets[0];
  58860. let features = recordsets.features.features;
  58861. this.features = recordsets.features;
  58862. let data = {};
  58863. if (features.length) {
  58864. data = {
  58865. features: recordsets.features,
  58866. fieldCaptions: recordsets.fieldCaptions,
  58867. fieldTypes: recordsets.fieldTypes,
  58868. fieldValues: []
  58869. }
  58870. for (let m in data.fieldCaptions) {
  58871. let fieldValue = [];
  58872. for (let j in features) {
  58873. let feature = features[j];
  58874. let caption = data.fieldCaptions[m];
  58875. let value = feature.properties[caption];
  58876. fieldValue.push(value);
  58877. }
  58878. data.fieldValues.push(fieldValue);
  58879. }
  58880. this.createChart(data);
  58881. }
  58882. }
  58883. }
  58884. /**
  58885. * @function SuperMap.Components.ChartViewModel.prototype._createChartOptions
  58886. * @description 创建图表所需参数
  58887. * @private
  58888. * @param {Object} data - 图表数据
  58889. */
  58890. _createChartOptions(data) {
  58891. this.calculatedData = this._createChartDatas(data);
  58892. return this.updateChartOptions(this.chartType);
  58893. }
  58894. /**
  58895. * @function SuperMap.Components.ChartViewModel.prototype.changeType
  58896. * @description 改变图表类型
  58897. * @param {string} type - 图表类型
  58898. */
  58899. changeType(type) {
  58900. if (type !== this.chartType) {
  58901. this.chartType = type;
  58902. return this.updateChartOptions(this.chartType);
  58903. }
  58904. }
  58905. /**
  58906. * @function SuperMap.Components.ChartViewModel.prototype.updateData
  58907. * @description 改变图表类型
  58908. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  58909. * @param {function} success 成功回调函数
  58910. */
  58911. updateData(datasets, chartOption, success) {
  58912. this.updateChart = success;
  58913. this.xField = [];
  58914. this.yField = [];
  58915. this._initXYField(chartOption);
  58916. // type的设置默认值
  58917. datasets.type = datasets.type || 'iServer';
  58918. // withCredentials的设置默认值
  58919. datasets.withCredentials = datasets.withCredentials || false;
  58920. this.datasets = datasets;
  58921. this.getDatasetInfo(this._updateDataSuccess.bind(this));
  58922. }
  58923. /**
  58924. * @function SuperMap.Components.ChartViewModel.prototype._updateDataSuccess
  58925. * @description 改变图表类型
  58926. * @private
  58927. * @param {Object} data - 图表数据
  58928. */
  58929. _updateDataSuccess(data) {
  58930. let options = this._createChartOptions(data);
  58931. this.updateChart(options);
  58932. }
  58933. /**
  58934. * @function SuperMap.Components.ChartViewModel.prototype.updateChartOptions
  58935. * @description 更新图表所需参数
  58936. * @param {string} type - 图表类型
  58937. * @param {Object} style - 图表样式
  58938. */
  58939. updateChartOptions(type, style) {
  58940. if (this.calculatedData) {
  58941. let grid = this.grid;
  58942. let series = this._createChartSeries(this.calculatedData, type);
  58943. let datas = [];
  58944. for (let i in this.calculatedData.XData) {
  58945. datas.push({
  58946. value: this.calculatedData.XData[i].fieldsData
  58947. });
  58948. }
  58949. let xAxis = {
  58950. type: "category",
  58951. name: this.xField[0].name || "X",
  58952. data: datas,
  58953. nameTextStyle: {
  58954. color: '#fff',
  58955. fontSize: 14
  58956. },
  58957. splitLine: {
  58958. show: false
  58959. },
  58960. axisLine: {
  58961. lineStyle: {
  58962. color: '#eee'
  58963. }
  58964. }
  58965. }
  58966. let yAxis = {
  58967. type: "value",
  58968. name: this.yFieldName || "Y",
  58969. data: {},
  58970. nameTextStyle: {
  58971. color: '#fff',
  58972. fontSize: 14
  58973. },
  58974. splitLine: {
  58975. show: false
  58976. },
  58977. axisLine: {
  58978. lineStyle: {
  58979. color: '#eee'
  58980. }
  58981. }
  58982. }
  58983. let tooltip = {
  58984. formatter: '{b0}: {c0}'
  58985. };
  58986. let backgroundColor = '#404a59';
  58987. if (style) {
  58988. if (style.grid) {
  58989. grid = style.grid;
  58990. }
  58991. if (style.tooltip) {
  58992. tooltip = style.tooltip;
  58993. }
  58994. if (style.backgroundColor) {
  58995. backgroundColor = style.backgroundColor;
  58996. }
  58997. }
  58998. return {
  58999. backgroundColor: backgroundColor,
  59000. grid: grid,
  59001. series: series,
  59002. xAxis: xAxis,
  59003. yAxis: yAxis,
  59004. tooltip: tooltip
  59005. }
  59006. }
  59007. }
  59008. /**
  59009. * @function SuperMap.Components.ChartViewModel.prototype._createChartDatas
  59010. * @description 构建图表数据
  59011. * @private
  59012. * @param {Object} data - 源数据
  59013. */
  59014. _createChartDatas(data) {
  59015. let fieldIndex = 0, yfieldIndexs = [];
  59016. let fieldCaptions = data.fieldCaptions;
  59017. let me = this;
  59018. //X
  59019. fieldCaptions.forEach(function (field, index) {
  59020. if (me.xField[0] && field === me.xField[0].field) {
  59021. fieldIndex = index;
  59022. }
  59023. });
  59024. //Y
  59025. this.yFieldName = "";
  59026. this.yField.forEach(function (value, index) {
  59027. if (index !== 0) {
  59028. me.yFieldName = me.yFieldName + ",";
  59029. }
  59030. me.yFieldName = me.yFieldName + value.name;
  59031. fieldCaptions.forEach(function (field, index) {
  59032. if (field === value.field) {
  59033. yfieldIndexs.push(index);
  59034. }
  59035. });
  59036. })
  59037. let datas = this._getAttrData(data, fieldIndex);
  59038. let yDatas = [];
  59039. if (yfieldIndexs.length > 0) {
  59040. yfieldIndexs.forEach(function (yfieldIndex) {
  59041. let yData = [];
  59042. for (let i in data.fieldValues[yfieldIndex]) {
  59043. yData.push({
  59044. value: data.fieldValues[yfieldIndex][i]
  59045. });
  59046. }
  59047. yDatas.push(yData);
  59048. });
  59049. } else { //未指定Y字段时,y轴计数
  59050. let YData = [],
  59051. XData = [],
  59052. len = datas.length;
  59053. //计算X轴,Y轴数据,并去重
  59054. for (let i = 0; i < len; i++) {
  59055. let isSame = false;
  59056. for (let j = 0, leng = XData.length; j < leng; j++) {
  59057. if (datas[i].fieldsData === XData[j].fieldsData) {
  59058. YData[j].value++;
  59059. XData[j].recordIndexs.push(i);
  59060. isSame = true;
  59061. break;
  59062. }
  59063. }
  59064. if (!isSame) {
  59065. if (datas[i].fieldsData) {
  59066. XData.push({ fieldsData: datas[i].fieldsData, recordIndexs: [i] });
  59067. YData.push({ value: 1 });
  59068. }
  59069. }
  59070. }
  59071. datas = XData;
  59072. yDatas = [YData];
  59073. }
  59074. return {
  59075. XData: datas,
  59076. YData: yDatas
  59077. }
  59078. }
  59079. /**
  59080. * @function SuperMap.Components.ChartViewModel.prototype._getAttrData
  59081. * @description 选中字段数据
  59082. * @private
  59083. * @param {Object} datacontent - 图表数据
  59084. * @param {number} index - 字段索引
  59085. */
  59086. _getAttrData(datacontent, index) {
  59087. if (index === 0) {
  59088. this.xField = [{
  59089. field: datacontent.fieldCaptions[index],
  59090. name: datacontent.fieldCaptions[index]
  59091. }];
  59092. }
  59093. let fieldsDatas = [];
  59094. for (let i = 0, len = datacontent.fieldValues[index].length; i < len; i++) {
  59095. let value = datacontent.fieldValues[index][i];
  59096. fieldsDatas.push({
  59097. recordIndexs: i,
  59098. fieldsData: value
  59099. });
  59100. }
  59101. return fieldsDatas;
  59102. }
  59103. /**
  59104. * @function SuperMap.Components.ChartViewModel.prototype._createChartSeries
  59105. * @description 图表数据
  59106. * @private
  59107. * @param {Object} calculatedData - 图表数据
  59108. * @param {string} chartType - 图表类型
  59109. */
  59110. _createChartSeries(calculatedData, chartType) {
  59111. let series = [];
  59112. let yDatas = calculatedData.YData;
  59113. yDatas.forEach(function (yData) {
  59114. let value = 0;
  59115. let serieData = [];
  59116. for (let data of yData) {
  59117. value = data.value;
  59118. serieData.push({
  59119. value: value
  59120. });
  59121. }
  59122. let serie = {
  59123. type: chartType,
  59124. data: serieData,
  59125. name: "y"
  59126. };
  59127. series.push(serie);
  59128. });
  59129. return series;
  59130. }
  59131. /**
  59132. * @function SuperMap.Components.ChartViewModel.prototype._isDate
  59133. * @description 判断是否为日期
  59134. * @private
  59135. * @param {string} data - 字符串
  59136. */
  59137. _isDate(data) {
  59138. 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;
  59139. return reg.test(data);
  59140. }
  59141. /**
  59142. * @function SuperMap.Components.ChartViewModel.prototype._isNumber
  59143. * @description 判断是否为数值
  59144. * @private
  59145. * @param {string} data - 字符串
  59146. */
  59147. _isNumber(data) {
  59148. let mdata = Number(data);
  59149. if (mdata === 0) {
  59150. return true;
  59151. }
  59152. return !isNaN(mdata);
  59153. }
  59154. /**
  59155. * @function SuperMap.Components.ChartViewModel.prototype._getDataType
  59156. * @description 判断数据的类型
  59157. * @private
  59158. * @param {string} data - 字符串
  59159. */
  59160. _getDataType(data) {
  59161. if (data !== null && data !== undefined && data !== '') {
  59162. if (this._isDate(data)) {
  59163. return "DATE";
  59164. }
  59165. if (this._isNumber(data)) {
  59166. return "NUMBER";
  59167. }
  59168. }
  59169. return "STRING";
  59170. }
  59171. /**
  59172. * @function SuperMap.Components.ChartViewModel.prototype._checkUrl
  59173. * @description 检查url是否符合要求
  59174. * @private
  59175. * @param {string} url
  59176. */
  59177. _checkUrl(url) {
  59178. let match;
  59179. if (url === '' || !this._isMatchUrl(url)) {
  59180. match = false;
  59181. } else if (/^http[s]?:\/\/localhost/.test(url) || /^http[s]?:\/\/127.0.0.1/.test(url)) {
  59182. //不是实际域名
  59183. match = false;
  59184. } else {
  59185. match = true;
  59186. }
  59187. return match;
  59188. }
  59189. /**
  59190. * @function SuperMap.Components.ChartViewModel.prototype._isMatchUrl
  59191. * @description 判断输入的地址是否符合地址格式
  59192. * @private
  59193. * @param {string} str - url
  59194. */
  59195. _isMatchUrl(str) {
  59196. var reg = new RegExp('(https?|http|file|ftp)://[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]');
  59197. return reg.test(str);
  59198. }
  59199. /**
  59200. * @function SuperMap.Components.ChartViewModel.prototype.getStyle
  59201. * @description 获取图表样式。
  59202. */
  59203. getStyle() {
  59204. let style = {
  59205. grid: this.grid,
  59206. tooltip: this.tooltip,
  59207. backgroundColor: this.backgroundColor
  59208. }
  59209. return style;
  59210. }
  59211. /**
  59212. * @function SuperMap.Components.ChartViewModel.prototype.getFeatures
  59213. * @description 获取地图服务,数据服务请求返回的数据。
  59214. */
  59215. getFeatures() {
  59216. return this.features;
  59217. }
  59218. /**
  59219. * @function SuperMap.Components.ChartViewModel.prototype.setStyle
  59220. * @description 设置图表样式。
  59221. * @param {Object} style - 图表样式
  59222. */
  59223. setStyle(style) {
  59224. return this.updateChartOptions(this.chartType, style);
  59225. }
  59226. }
  59227. SuperMap.Components.ChartViewModel = ChartViewModel;
  59228. ;// CONCATENATED MODULE: ./src/common/components/chart/ChartView.js
  59229. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59230. * This program are made available under the terms of the Apache License, Version 2.0
  59231. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59232. /**
  59233. * @class SuperMap.Components.Chart
  59234. * @classdesc 图表组件
  59235. * @version 9.1.2
  59236. * @param {string} domID - 图表dom元素ID。
  59237. * @param {Object} options - 可选参数。
  59238. * @param {string} options.type - 图表类型。
  59239. * @param {SuperMap.Components.Chart.Datasets} options.datasets - 数据来源
  59240. * @param {Array.<Object>} options.chartOptions - 图表可选参数。
  59241. * @param {Array.<Object>} options.chartOptions.xAxis - 图表X轴。
  59242. * @param {string} options.chartOptions.xAxis.field - 图表X轴字段名。
  59243. * @param {string} options.chartOptions.xAxis.name - 图表X轴名称。
  59244. * @param {Array.<Object>} options.chartOptions.yAxis - 图表Y轴。
  59245. * @param {string} options.chartOptions.yAxis.field - 图表Y轴字段名。
  59246. * @param {string} options.chartOptions.yAxis.name - 图表Y轴名称。
  59247. * @category Components Chart
  59248. */
  59249. /**
  59250. * @typedef {Object} SuperMap.Components.Chart.Datasets - 数据来源
  59251. * @property {string} [type = 'iServer'] - 服务类型 iServer, iPortal。
  59252. * @property {string} url - 服务url地址。
  59253. * @property {boolean} [withCredentials = false] - 设置请求是否带cookie
  59254. * @property {SuperMap.FilterParameter} queryInfo - 查询条件
  59255. */
  59256. class ChartView {
  59257. constructor(domID, options) {
  59258. this.domID = domID;
  59259. this.chartType = options.type || "bar";
  59260. // 设置options.datasets.type的默认值是iServer
  59261. options.datasets.type = options.datasets.type || 'iServer';
  59262. // 设置withCredentials的默认值为false
  59263. options.datasets.withCredentials = options.datasets.withCredentials || false;
  59264. this.viewModel = new ChartViewModel(options);
  59265. //添加控件。
  59266. this._fillDataToView();
  59267. }
  59268. /**
  59269. * @function SuperMap.Components.Chart.prototype.onAdd
  59270. * @description 创建图表之后成功回调
  59271. * @param {function} addChart - 回调函数
  59272. */
  59273. onAdd(addChart) {
  59274. this.addChart = addChart;
  59275. }
  59276. /**
  59277. * @function SuperMap.Components.Chart.prototype._fillDataToView
  59278. * @description 填充数据到 view。
  59279. * @private
  59280. */
  59281. _fillDataToView() {
  59282. let messageboxs = new MessageBox();
  59283. //iclient 绑定createChart事件成功回调
  59284. this.viewModel.getDatasetInfo(this._createChart.bind(this));
  59285. this.viewModel.events.on({
  59286. "getdatafailed": (error) => {
  59287. messageboxs.showView(error.message);
  59288. }
  59289. });
  59290. }
  59291. /**
  59292. * @function SuperMap.Components.Chart.prototype.getStyle
  59293. * @description 获取图表样式。
  59294. */
  59295. getStyle() {
  59296. return this.viewModel.getStyle()
  59297. }
  59298. /**
  59299. * @function SuperMap.Components.Chart.prototype.getFeatures
  59300. * @description 获取地图服务,数据服务请求返回的数据。
  59301. */
  59302. getFeatures() {
  59303. return this.viewModel.getFeatures();
  59304. }
  59305. /**
  59306. * @function SuperMap.Components.Chart.prototype.setStyle
  59307. * @description 设置图表样式。
  59308. * @param {Object} style - 图表样式 参考Echarts-options样式设置
  59309. */
  59310. setStyle(style) {
  59311. let newOptions = this.viewModel.setStyle(style);
  59312. this._updateChart(newOptions);
  59313. }
  59314. /**
  59315. * @function SuperMap.Components.Chart.prototype.changeType
  59316. * @description 改变图表类型
  59317. * @param {string} type - 图表类型
  59318. */
  59319. changeType(type) {
  59320. if (this.chartType !== type) {
  59321. this.chartType = type;
  59322. let newOptions = this.viewModel.changeType(type);
  59323. this._updateChart(newOptions);
  59324. }
  59325. }
  59326. /**
  59327. * @function SuperMap.Components.Chart.prototype.updateData
  59328. * @description 更新图表数据
  59329. * @param {SuperMap.Components.Chart.Datasets} datasets - 数据来源
  59330. * @param {Object} chartOption - X,Y轴信息
  59331. */
  59332. updateData(datasets, chartOption) {
  59333. let me = this;
  59334. this.viewModel.updateData(datasets, chartOption, function (options) {
  59335. me._updateChart(options);
  59336. if (me.addChart) {
  59337. me.addChart();
  59338. }
  59339. });
  59340. }
  59341. /**
  59342. * @function SuperMap.Components.Chart.prototype._createChart
  59343. * @description 创建图表
  59344. * @private
  59345. * @param {Object} data - 图表数据
  59346. */
  59347. _createChart(data) {
  59348. this.echart = external_function_try_return_echarts_catch_e_return_default().init(
  59349. document.getElementById(this.domID),
  59350. null, {
  59351. renderer: "canvas"
  59352. }
  59353. )
  59354. let options = this.viewModel._createChartOptions(data);
  59355. this.echart.setOption(options);
  59356. if (this.addChart) {
  59357. this.addChart();
  59358. }
  59359. }
  59360. /**
  59361. * @function SuperMap.Components.Chart.prototype._updateChart
  59362. * @description 更新图表
  59363. * @private
  59364. * @param {Object} options - 图表参数
  59365. */
  59366. _updateChart(options) {
  59367. if (this.echart) {
  59368. this.echart.clear();
  59369. this.echart.setOption(options);
  59370. }
  59371. }
  59372. }
  59373. SuperMap.Components.Chart = ChartView;
  59374. ;// CONCATENATED MODULE: ./src/common/components/templates/TemplateBase.js
  59375. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59376. * This program are made available under the terms of the Apache License, Version 2.0
  59377. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59378. /**
  59379. * @class SuperMap.Components.TemplateBase
  59380. * @classdesc 组件公用组件父类,用于约束统一封装的公用组件结构。
  59381. * @version 9.1.1
  59382. * @param {Object} options - 组件配置参数。
  59383. * @param {string} options.id - 组件 dom 元素 id。
  59384. * @category Components Common
  59385. */
  59386. class TemplateBase {
  59387. constructor(options) {
  59388. options = options ? options : {};
  59389. /**
  59390. * @member {string} [SuperMap.Components.TemplateBase.prototype.id=null]
  59391. * @description 组件 dom 元素 id。
  59392. */
  59393. this.id = options.id ? options.id : null;
  59394. /**
  59395. * @member {Element} [SuperMap.Components.TemplateBase.prototype.rootContainer=null]
  59396. * @description 组件 dom 元素对象。
  59397. */
  59398. this.rootContainer = null;
  59399. }
  59400. /**
  59401. * @function SuperMap.Components.TemplateBase.prototype.getElement
  59402. * @description 获取当前组件元素对象。
  59403. * @return {Element}
  59404. */
  59405. getElement() {
  59406. //todo 其实感觉再这里给组件设置不太合理
  59407. if (this.id) {
  59408. this.rootContainer.id = this.id;
  59409. }
  59410. return this.rootContainer;
  59411. }
  59412. /**
  59413. * @function SuperMap.Components.TemplateBase.prototype._initView
  59414. * @private
  59415. * @description 初始化模板。
  59416. */
  59417. _initView() {
  59418. //子类实现此方法
  59419. }
  59420. /**
  59421. * @function SuperMap.Components.TemplateBase.prototype.showView
  59422. * @description 显示组件。
  59423. */
  59424. showView() {
  59425. this.rootContainer.hidden = false;
  59426. }
  59427. /**
  59428. * @function SuperMap.Components.TemplateBase.prototype.closeView
  59429. * @description 隐藏组件。
  59430. */
  59431. closeView() {
  59432. this.rootContainer.hidden = true;
  59433. }
  59434. }
  59435. SuperMap.Components.TemplateBase = TemplateBase;
  59436. ;// CONCATENATED MODULE: ./src/common/components/templates/CommonContainer.js
  59437. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59438. * This program are made available under the terms of the Apache License, Version 2.0
  59439. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59440. /**
  59441. * @class SuperMap.Components.CommonContainer
  59442. * @classdesc 组件统一外框。
  59443. * @version 9.1.1
  59444. * @param {Object} options - 组件可选参数。
  59445. * @param {string} options.id - 组件 dom 元素 id。
  59446. * @param {string} options.title - 标题。
  59447. * @category Components Common
  59448. * @extends {SuperMap.Components.TemplateBase}
  59449. */
  59450. class CommonContainer extends TemplateBase {
  59451. constructor(options) {
  59452. super(options);
  59453. let title = options.title ? options.title : "";
  59454. this._initView(title);
  59455. }
  59456. /**
  59457. * @private
  59458. * @override
  59459. */
  59460. _initView(title) {
  59461. const container = document.createElement("div");
  59462. container.setAttribute("class", "component-container");
  59463. //title
  59464. const titleContainer = document.createElement("div");
  59465. titleContainer.setAttribute("class", "component-title");
  59466. const titleContent = document.createElement("div");
  59467. titleContent.innerHTML = title;
  59468. titleContainer.appendChild(titleContent);
  59469. container.appendChild(titleContainer);
  59470. //container
  59471. const componentContent = document.createElement("div");
  59472. componentContent.setAttribute("class", "component-content");
  59473. container.appendChild(componentContent);
  59474. this.content = componentContent;
  59475. this.rootContainer = container;
  59476. return container;
  59477. }
  59478. /**
  59479. * @function SuperMap.Components.CommonContainer.prototype.getContentElement
  59480. * @description 获取内容元素容器
  59481. */
  59482. getContentElement() {
  59483. return this.content;
  59484. }
  59485. /**
  59486. * @function SuperMap.Components.CommonContainer.prototype.appendContent
  59487. * @description 填充内容元素
  59488. */
  59489. appendContent(element) {
  59490. this.content.appendChild(element);
  59491. }
  59492. }
  59493. SuperMap.Components.CommonContainer = CommonContainer;
  59494. ;// CONCATENATED MODULE: ./src/common/components/templates/Select.js
  59495. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59496. * This program are made available under the terms of the Apache License, Version 2.0
  59497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59498. /**
  59499. * @class SuperMap.Components.Select
  59500. * @classdesc 组件统一的文字下拉框。
  59501. * @version 9.1.1
  59502. * @param {Array.<string|Array>} options - 需要创建的 Select 数据数组。
  59503. * @param {string} options.id - 组件 dom 元素 id。
  59504. * @param {string} [options.labelName] - label 名称。
  59505. * @param {Array.<string>} options.optionsArr - 需要创建的 option 数据数组。
  59506. * @param {Function} [options.optionsClickCb] - option 点击事件回调函数。
  59507. * @extends {SuperMap.Components.TemplateBase}
  59508. * @category Components Common
  59509. */
  59510. class Select extends TemplateBase {
  59511. constructor(options) {
  59512. super(options);
  59513. this._initView(options);
  59514. }
  59515. _initView(options) {
  59516. let selectTool = this._createElement('div', "component-selecttool");
  59517. if (options.labelName) {
  59518. let label = this._createElement('label', 'component-selecttool__lable--describe', selectTool);
  59519. label.innerHTML = options.labelName;
  59520. }
  59521. let chartSelect = this._createElement('div', 'component-selecttool--chart', selectTool);
  59522. chartSelect.setAttribute('tabindex', '1');
  59523. let selectName = this._createElement('div', "component-selecttool__name", chartSelect);
  59524. selectName.title = options.optionsArr[0];
  59525. selectName.innerHTML = options.optionsArr[0];
  59526. let chartTriangleBtn = this._createElement('div', 'component-selecttool__trianglebtn--chart', chartSelect);
  59527. let triangleBtn = this._createElement('div', 'component-triangle-down-img', chartTriangleBtn);
  59528. let selectContent = this._createElement('div', 'component-selecttool__content', chartSelect);
  59529. let scrollarea = this._createElement('div', 'component-selecttool__content--chart', selectContent);
  59530. let scrollareaContent = this._createElement('div', 'component-selecttool__scrollarea__content', scrollarea);
  59531. scrollareaContent.setAttribute('tabindex', '1');
  59532. this.createOptions(scrollareaContent, options.optionsArr);
  59533. this.optionClickEvent(scrollareaContent, selectName, options.optionsClickCb);
  59534. // 下拉框显示 & 隐藏事件
  59535. this._selectClickEvent(chartSelect, selectContent, triangleBtn);
  59536. this.rootContainer = selectTool;
  59537. }
  59538. /**
  59539. * @function SuperMap.Components.Select.prototype.createOptions
  59540. * @description 创建所属下拉框选项。
  59541. */
  59542. createOptions(container, optionsArr) {
  59543. for (let i in optionsArr) {
  59544. let option = this._createElement('div', 'component-selecttool__option', container);
  59545. option.title = optionsArr[i];
  59546. option.innerHTML = optionsArr[i];
  59547. }
  59548. }
  59549. /**
  59550. * @function SuperMap.Components.Select.prototype._selectClickEvent
  59551. * @description select 点击显示&隐藏事件。
  59552. * @private
  59553. */
  59554. _selectClickEvent(eventElement, contentElement, triangleBtn) {
  59555. eventElement.onclick = function (e) {
  59556. if (contentElement.style.display === "block") {
  59557. contentElement.style.display = "none";
  59558. triangleBtn.className = "component-triangle-down-img";
  59559. } else {
  59560. contentElement.style.display = "block";
  59561. triangleBtn.className = "triangle-up-img";
  59562. }
  59563. e.preventDefault();
  59564. e.stopPropagation();
  59565. };
  59566. eventElement.onmousedown = function (evt) {
  59567. //console.log('dropdownbox onmousedown '+evt.target.className);
  59568. if (evt.target !== this) {
  59569. this.focus();
  59570. evt.preventDefault();
  59571. evt.stopPropagation()
  59572. }
  59573. };
  59574. eventElement.onblur = function () {
  59575. contentElement.style.display = "none";
  59576. triangleBtn.className = "component-triangle-down-img";
  59577. }
  59578. }
  59579. /**
  59580. * @function Select.prototype._createElement
  59581. * @description 通用创建元素。
  59582. * @private
  59583. */
  59584. _createElement(tagName, className, parentEle) {
  59585. let ele = document.createElement(tagName || 'div');
  59586. className && (ele.className = className);
  59587. parentEle && parentEle.appendChild(ele);
  59588. return ele;
  59589. }
  59590. /**
  59591. * @function SuperMap.Components.Select.prototype.optionClickEvent
  59592. * @description 下拉框的 option 的点击事件。
  59593. */
  59594. optionClickEvent(optionEleArr, selectNameEle, optionsClickCb) {
  59595. for (let i = 0; i < optionEleArr.children.length; i++) {
  59596. let childEle = optionEleArr.children[i];
  59597. childEle.onclick = function () {
  59598. selectNameEle.innerHTML = childEle.innerHTML;
  59599. selectNameEle.title = childEle.title;
  59600. if (childEle.getAttribute('data-value')) {
  59601. selectNameEle.setAttribute('data-value', childEle.getAttribute('data-value'))
  59602. }
  59603. optionsClickCb && optionsClickCb(childEle);
  59604. }
  59605. }
  59606. }
  59607. }
  59608. SuperMap.Components.Select = Select;
  59609. ;// CONCATENATED MODULE: ./src/common/components/templates/DropDownBox.js
  59610. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59611. * This program are made available under the terms of the Apache License, Version 2.0
  59612. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59613. /**
  59614. * @class SuperMap.Components.DropDownBox
  59615. * @classdesc 组件统一的图片下拉框。
  59616. * @version 9.1.1
  59617. * @param {Array.<Object>} optionsArr - 需要创建的 option 数据数组。
  59618. * @param {string} optionsArr.id - 组件 dom 元素 id。
  59619. * @param {string} optionsArr.title - 下拉框 title。
  59620. * @param {string} optionsArr.remark - 下拉框解释标记文本。
  59621. * @param {string} optionsArr.icon - 下拉框图标。
  59622. * @param {string} [optionsArr.dataValue] - 下拉框 attribute 名为 data-value 的值 。
  59623. * @param {string} [optionsArr.icon.className] - 下拉框图标类名。
  59624. * @param {string} [optionsArr.icon.background] - 下拉框图标背景 url。
  59625. * @category Components Common
  59626. * @extends {SuperMap.Components.TemplateBase}
  59627. */
  59628. class DropDownBox extends TemplateBase {
  59629. constructor(optionsArr) {
  59630. super(optionsArr);
  59631. this._initView(optionsArr);
  59632. }
  59633. /**
  59634. * @function SuperMap.Components.DropDownBox.prototype._initView
  59635. * @description 初始化下拉框。
  59636. * @private
  59637. * @override
  59638. */
  59639. _initView(optionsArr) {
  59640. let dropDownContainer = document.createElement('div');
  59641. dropDownContainer.className = 'component-dropdownbox--container';
  59642. let dropDownBox = document.createElement('div');
  59643. dropDownBox.setAttribute('tabindex', '1');
  59644. dropDownBox.className = "component-dropdownbox";
  59645. dropDownContainer.appendChild(dropDownBox);
  59646. let dropDownTopContainer = document.createElement('div');
  59647. dropDownBox.appendChild(dropDownTopContainer);
  59648. this._createDropDownOption(optionsArr[0], dropDownTopContainer);
  59649. let triangleBtnContainer = document.createElement('div');
  59650. triangleBtnContainer.className = 'component-dropdownbox__triangle-btn';
  59651. dropDownBox.appendChild(triangleBtnContainer);
  59652. let triangleBtn = document.createElement('div');
  59653. triangleBtn.className = 'component-triangle-down-img';
  59654. triangleBtnContainer.appendChild(triangleBtn);
  59655. let createDropDownBoxParam = {
  59656. "parentEle": dropDownBox,
  59657. "dropDownContent": ['component-dropdownbox__content component-dropdownbox__content--chart', 'dropDownContent'],
  59658. "scrollareaContent": 'component-selecttool__scrollarea__content',
  59659. "optionsArr": optionsArr,
  59660. "triangleBtn": triangleBtn,
  59661. "dropDownTopContainer": dropDownTopContainer
  59662. };
  59663. this._createDropDownBox(createDropDownBoxParam);
  59664. this.rootContainer = dropDownContainer;
  59665. }
  59666. /**
  59667. * @function SuperMap.Components.DropDownBox.prototype._createDropDownBox
  59668. * @description 创建下拉框。
  59669. * @private
  59670. */
  59671. _createDropDownBox(createDropDownBoxParam) {
  59672. let dropDownBox = createDropDownBoxParam.parentEle;
  59673. let dropDownTopContainer = createDropDownBoxParam.dropDownTopContainer;
  59674. let dropDownContent = document.createElement('div');
  59675. dropDownContent.className = createDropDownBoxParam.dropDownContent[0];
  59676. dropDownBox.appendChild(dropDownContent);
  59677. let scrollareaContent = document.createElement('div');
  59678. scrollareaContent.className = createDropDownBoxParam.scrollareaContent;
  59679. dropDownContent.appendChild(scrollareaContent);
  59680. let optionsArr = createDropDownBoxParam.optionsArr;
  59681. for (let i = 0; i < optionsArr.length; i++) {
  59682. this._createDropDownOption(optionsArr[i], scrollareaContent)
  59683. }
  59684. // 下拉框显示 & 隐藏事件
  59685. let triangleBtn = createDropDownBoxParam.triangleBtn;
  59686. this._dropDownClickEvent(dropDownBox, dropDownContent, triangleBtn);
  59687. this._eleOnblur(dropDownBox, dropDownContent, triangleBtn);
  59688. // 下拉框 options 点击事件
  59689. let scrollareaOptions = scrollareaContent.children;
  59690. for (let i = 0; i < scrollareaOptions.length; i++) {
  59691. scrollareaOptions[i].onclick = function () {
  59692. dropDownTopContainer.innerHTML = scrollareaOptions[i].outerHTML;
  59693. //evt.stopPropagation();
  59694. }
  59695. }
  59696. }
  59697. /**
  59698. * @function SuperMap.Components.DropDownBox.prototype._createDropDownOption
  59699. * @description 创建下拉框子元素。
  59700. * @private
  59701. */
  59702. _createDropDownOption(data, parentElement) {
  59703. let ele = document.createElement('div');
  59704. ele.className = 'component-dropdownbox__item';
  59705. let dataItem = data;
  59706. if (dataItem['dataValue']) {
  59707. ele.setAttribute('data-value', dataItem['dataValue']);
  59708. }
  59709. parentElement.appendChild(ele);
  59710. let imgContainer = document.createElement('div');
  59711. imgContainer.className = 'component-dropdownbox__item__img';
  59712. ele.appendChild(imgContainer);
  59713. let img = document.createElement('div');
  59714. if (dataItem.icon.className) {
  59715. img.className = dataItem.icon.className;
  59716. }
  59717. if (dataItem.icon.background) {
  59718. img.style.background = dataItem.icon.background;
  59719. }
  59720. imgContainer.appendChild(img);
  59721. let title = document.createElement('div');
  59722. title.className = 'component-dropdownbox__item__title';
  59723. title.title = dataItem.title;
  59724. title.innerHTML = dataItem.title;
  59725. ele.appendChild(title);
  59726. let remark = document.createElement('div');
  59727. remark.className = 'component-dropdownbox__item__remark';
  59728. remark.title = dataItem.remark;
  59729. remark.innerHTML = dataItem.remark;
  59730. ele.appendChild(remark);
  59731. }
  59732. /**
  59733. * @function SuperMap.Components.DropDownBox.prototype._dropDownClickEvent
  59734. * @description 下拉框点击事件。
  59735. * @private
  59736. */
  59737. _dropDownClickEvent(eventElement, contentElement, triangleBtn) {
  59738. eventElement.onclick = function (e) {
  59739. if (contentElement.style.display === "block") {
  59740. contentElement.style.display = "none";
  59741. triangleBtn.className = "component-triangle-down-img";
  59742. } else {
  59743. contentElement.style.display = "block";
  59744. triangleBtn.className = "triangle-up-img";
  59745. }
  59746. e.preventDefault();
  59747. e.stopPropagation()
  59748. };
  59749. eventElement.onmousedown = function (evt) {
  59750. //console.log('dropdownbox onmousedown '+evt.target.className);
  59751. if (evt.target !== this) {
  59752. this.focus();
  59753. evt.preventDefault();
  59754. evt.stopPropagation()
  59755. }
  59756. }
  59757. }
  59758. /**
  59759. * @function SuperMap.Components.DropDownBox.prototype._eleOnblur
  59760. * @description 下拉框失焦事件。
  59761. * @private
  59762. */
  59763. _eleOnblur(eventElement, contentElement, triangleBtn) {
  59764. eventElement.onblur = function () {
  59765. contentElement.style.display = "none";
  59766. triangleBtn.className = "component-triangle-down-img";
  59767. }
  59768. }
  59769. /**
  59770. * @function SuperMap.Components.DropDownBox.prototype._createElement
  59771. * @description 通用创建元素。
  59772. * @private
  59773. */
  59774. _createElement(tagName, className, parentEle) {
  59775. let ele = document.createElement(tagName || 'div');
  59776. className && (ele.className = className);
  59777. parentEle && parentEle.appendChild(ele);
  59778. return ele;
  59779. }
  59780. }
  59781. SuperMap.Components.DropDownBox = DropDownBox;
  59782. ;// CONCATENATED MODULE: ./src/common/components/templates/PopContainer.js
  59783. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59784. * This program are made available under the terms of the Apache License, Version 2.0
  59785. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59786. /**
  59787. * @class SuperMap.Components.PopContainer
  59788. * @classdesc 弹框组件。
  59789. * @version 9.1.1
  59790. * @param {Object} options - 组件配置参数。
  59791. * @param {string} options.id - 组件 dom 元素 id。
  59792. * @param {string} options.title - 弹框组件名称。
  59793. * @extends {SuperMap.Components.TemplateBase}
  59794. * @category Components Common
  59795. */
  59796. class PopContainer extends TemplateBase {
  59797. constructor(options) {
  59798. options = options ? options : {};
  59799. super(options);
  59800. options.title = options.title ? options.title : "";
  59801. this._initView(options.title);
  59802. }
  59803. /**
  59804. * @private
  59805. * @override
  59806. */
  59807. _initView(titile) {
  59808. const container = document.createElement("div");
  59809. container.setAttribute("class", "component-popcontainer");
  59810. //header
  59811. const header = document.createElement("div");
  59812. header.setAttribute("class", "component-popcontainer__header");
  59813. const title = document.createElement("label");
  59814. title.setAttribute("class", "component-popcontainer__header__title");
  59815. title.innerHTML = titile;
  59816. header.appendChild(title);
  59817. const closeBtn = document.createElement("span");
  59818. closeBtn.setAttribute("class", "supermapol-icons-clear component-popcontainer__header__close");
  59819. closeBtn.onclick = this.closeView.bind(this);
  59820. container.appendChild(closeBtn);
  59821. container.appendChild(header);
  59822. //content
  59823. const content = document.createElement("div");
  59824. content.setAttribute("class", "component-popcontainer__content");
  59825. this.content = content;
  59826. container.appendChild(content);
  59827. this.rootContainer = container;
  59828. }
  59829. /**
  59830. * @function SuperMap.Components.PopContainer.prototype.appendContent
  59831. * @description 追加内容。
  59832. * @param {Element} dom - 内容元素。
  59833. */
  59834. appendContent(dom) {
  59835. this.content.appendChild(dom);
  59836. }
  59837. }
  59838. SuperMap.Components.PopContainer = PopContainer;
  59839. ;// CONCATENATED MODULE: ./src/common/components/templates/AttributesPopContainer.js
  59840. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59841. * This program are made available under the terms of the Apache License, Version 2.0
  59842. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59843. /**
  59844. * @class SuperMap.Components.AttributesPopContainer
  59845. * @classdesc 属性弹框组件
  59846. * @version 9.1.1
  59847. * @param {Object} options - 组件配置参数。
  59848. * @param {string} options.id - 组件 dom 元素 id。
  59849. * @param {Object} options.title - 属性弹框组件名称。
  59850. * @param {Object} options.attributes - 组件需要显示的属性内容。
  59851. * @extends {SuperMap.Components.PopContainer}
  59852. * @category Components Common
  59853. */
  59854. class AttributesPopContainer extends PopContainer {
  59855. constructor(options) {
  59856. //默认为属性:
  59857. options.title = options.title ? options.title : "属性";
  59858. super(options);
  59859. this.rootContainer.firstChild.hidden = true;
  59860. options.attributes = options.attributes ? options.attributes : [];
  59861. this._createAttributesTable(options.attributes);
  59862. }
  59863. _createAttributesTable(attributes) {
  59864. const table = document.createElement("table");
  59865. table.setAttribute("class", "component-popcontainer__content__table");
  59866. const tbody = document.createElement("tbody");
  59867. let single = true;
  59868. for (let name in attributes) {
  59869. const tr = document.createElement("tr");
  59870. if (single) {
  59871. tr.setAttribute("class", "component-popcontainer__content__td--color");
  59872. }
  59873. const title = document.createElement("td");
  59874. const titleSpan = document.createElement("Span");
  59875. titleSpan.innerHTML = name;
  59876. title.appendChild(titleSpan);
  59877. const value = document.createElement("td");
  59878. value.innerHTML = attributes[name];
  59879. tr.appendChild(title);
  59880. tr.appendChild(value);
  59881. tbody.appendChild(tr);
  59882. single = !single;
  59883. }
  59884. table.appendChild(tbody);
  59885. this.appendContent(table);
  59886. }
  59887. }
  59888. SuperMap.Components.AttributesPopContainer = AttributesPopContainer;
  59889. ;// CONCATENATED MODULE: ./src/common/components/templates/IndexTabsPageContainer.js
  59890. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59891. * This program are made available under the terms of the Apache License, Version 2.0
  59892. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59893. /**
  59894. * @class SuperMap.Components.IndexTabsPageContainer
  59895. * @description 标签索引组件。
  59896. * @version 9.1.1
  59897. * @param {Object} options - 可选参数。
  59898. * @param {string} options.id - 组件 dom 元素 id。
  59899. * @category Components Common
  59900. * @extends {SuperMap.Components.TemplateBase}
  59901. */
  59902. class IndexTabsPageContainer extends TemplateBase {
  59903. constructor(options) {
  59904. super(options);
  59905. this._initView();
  59906. }
  59907. /**
  59908. * @private
  59909. * @override
  59910. */
  59911. _initView() {
  59912. const container = document.createElement("div");
  59913. container.setAttribute("class", "component-tabpage");
  59914. const header = document.createElement("ul");
  59915. this.header = header;
  59916. const content = document.createElement("div");
  59917. content.setAttribute("class", "component-tabpage__content");
  59918. this.content = content;
  59919. container.appendChild(header);
  59920. container.appendChild(content);
  59921. this.rootContainer = container;
  59922. }
  59923. /**
  59924. * @function SuperMap.Components.IndexTabsPageContainer.prototype.setTabs
  59925. * @description 设置标签元素。
  59926. * @param {Array.<Element>} tabs
  59927. */
  59928. setTabs(tabs) {
  59929. this.removeAllTabs();
  59930. this.appendTabs(tabs);
  59931. }
  59932. /**
  59933. * @function SuperMap.Components.IndexTabsPageContainer.prototype.appendTabs
  59934. * @description 追加标签元素。
  59935. * @param {Array.<Element>} tabs
  59936. */
  59937. appendTabs(tabs) {
  59938. for (let i = 0; i < tabs.length; i++) {
  59939. let title = document.createElement("span");
  59940. title.index = i;
  59941. title.appendChild(document.createTextNode(tabs[i].title));
  59942. //绑定标签切换对应页面:
  59943. title.onclick = this._changeTabsPage.bind(this);
  59944. let content = tabs[i].content;
  59945. content.index = i;
  59946. content.hidden = true;
  59947. this.header.appendChild(title);
  59948. this.content.appendChild(content);
  59949. }
  59950. //todo 确认是否两个子元素的 index 相互对应
  59951. //默认显示第一个标签对象
  59952. this.header.firstChild.setAttribute("class", "on");
  59953. this.content.firstChild.hidden = false;
  59954. }
  59955. /**
  59956. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeTab
  59957. * @description 删除某个标签页面。
  59958. * @param {number} index - 标签索引号。
  59959. */
  59960. removeTab(index) {
  59961. this.header.removeChild(this.header.children[index]);
  59962. this.content.removeChild(this.content.children[index]);
  59963. }
  59964. /**
  59965. * @function SuperMap.Components.IndexTabsPageContainer.prototype.removeAllTabs
  59966. * @description 删除所有标签。
  59967. */
  59968. removeAllTabs() {
  59969. for (let i = this.header.children.length; i > 0; i--) {
  59970. this.header.removeChild(this.header.children[i]);
  59971. this.content.removeChild(this.content.children[i]);
  59972. }
  59973. }
  59974. _changeTabsPage(e) {
  59975. const index = e.target.index;
  59976. for (let i = 0; i < this.header.children.length; i++) {
  59977. this.header.children[i].setAttribute("class", "");
  59978. this.content.children[i].hidden = true;
  59979. if (i === index) {
  59980. this.header.children[i].setAttribute("class", "on");
  59981. this.content.children[i].hidden = false;
  59982. }
  59983. }
  59984. }
  59985. }
  59986. SuperMap.Components.IndexTabsPageContainer = IndexTabsPageContainer;
  59987. ;// CONCATENATED MODULE: ./src/common/components/templates/CityTabsPage.js
  59988. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  59989. * This program are made available under the terms of the Apache License, Version 2.0
  59990. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  59991. /**
  59992. * @class SuperMap.Components.CityTabsPage
  59993. * @classdesc 城市地址匹配组件模板
  59994. * @version 9.1.1
  59995. * @param {Object} options - 组件配置参数。
  59996. * @param {string} options.id - 组件 dom 元素 id。
  59997. * @param {Object|Array.<string>} options.config - 城市名称配置列表,支持两种格式:{key1:{A:[],B:[]}, key2:{C:[],D:[]}} 或
  59998. * ["成都市","北京市"],用户可根据自己的项目需求进行配置
  59999. * @extends {SuperMap.Components.IndexTabsPageContainer}
  60000. * @category Components Common
  60001. */
  60002. class CityTabsPage extends IndexTabsPageContainer {
  60003. constructor(options) {
  60004. super(options);
  60005. //去掉默认的边框阴影样式:
  60006. this.rootContainer.classList.add("component-citytabpage--noneBoxShadow");
  60007. this.config = options.config;
  60008. //header,若 config为城市名称数组,则直接加载内容
  60009. if (Util.isArray(this.config)) {
  60010. this.header.hidden = true;
  60011. this._createCityItem("城市", this.config);
  60012. this.content.style.border = "none";
  60013. } else {
  60014. this._createTabs();
  60015. this.header.onclick = (e) => {
  60016. //关闭所有元素 是否有更简化的写法?
  60017. for (let i = 0; i < this.header.children.length; i++) {
  60018. this.header.children[i].setAttribute("class", "");
  60019. }
  60020. //打开点击内容元素
  60021. e.target.setAttribute("class", "on");
  60022. this._createCityContent(e.target.innerHTML);
  60023. };
  60024. }
  60025. }
  60026. /**
  60027. * @function SuperMap.Components.CityTabsPage.prototype._createTabs
  60028. * @description 创建 Tabs
  60029. * @private
  60030. */
  60031. _createTabs() {
  60032. //header
  60033. if (Util.isArray(this.config)) {
  60034. for (let i = 0; i < this.config.length; i++) {
  60035. let innerHTML = "";
  60036. for (const key in this.config[i]) {
  60037. innerHTML += key;
  60038. }
  60039. let li = document.createElement("li");
  60040. li.innerHTML = innerHTML;
  60041. this.header.appendChild(li);
  60042. }
  60043. } else {
  60044. for (const key in this.config) {
  60045. let li = document.createElement("li");
  60046. li.innerHTML = key;
  60047. this.header.appendChild(li);
  60048. }
  60049. }
  60050. this.header.firstChild.setAttribute("class", "on");
  60051. this._createCityContent(this.header.firstChild.innerHTML);
  60052. }
  60053. /**
  60054. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  60055. * @description 创建列表容器
  60056. * @private
  60057. */
  60058. _createCityContent(keyName) {
  60059. //清除元素:
  60060. for (let i = this.content.children.length; i > 0; i--) {
  60061. this.content.removeChild(this.content.children[i - 1]);
  60062. }
  60063. //创建对应元素
  60064. const cities = this.config[keyName];
  60065. for (let key in cities) {
  60066. this._createCityItem(key, cities[key]);
  60067. }
  60068. }
  60069. /**
  60070. * @function SuperMap.Components.CityTabsPage.prototype._createCityContent
  60071. * @description 创建列表容器
  60072. * @private
  60073. */
  60074. _createCityItem(key, cities) {
  60075. const city = document.createElement("div");
  60076. const cityClass = document.createElement("div");
  60077. cityClass.setAttribute("class", "component-citytabpag__py-key");
  60078. cityClass.innerHTML = key;
  60079. city.appendChild(cityClass);
  60080. const cityContent = document.createElement("div");
  60081. cityContent.setAttribute("class", "component-citytabpag__content");
  60082. for (let i = 0; i < cities.length; i++) {
  60083. let span = document.createElement("span");
  60084. span.innerHTML = cities[i];
  60085. cityContent.appendChild(span);
  60086. }
  60087. //HOT 元素长度单独微调:
  60088. if (key === "HOT") {
  60089. cityContent.style.width = "428px";
  60090. }
  60091. city.appendChild(cityContent);
  60092. this.content.appendChild(city);
  60093. }
  60094. }
  60095. SuperMap.Components.CityTabsPage = CityTabsPage;
  60096. ;// CONCATENATED MODULE: ./src/common/components/templates/NavTabsPage.js
  60097. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60098. * This program are made available under the terms of the Apache License, Version 2.0
  60099. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60100. /**
  60101. * @class SuperMap.Components.NavTabsPage
  60102. * @classdesc 标签页面组件。
  60103. * @version 9.1.1
  60104. * @param {Object} options - 组件配置参数。
  60105. * @param {string} optionsArr.id - 组件 dom 元素 id。
  60106. * @param {Array.<Object>} [options.tabs=[]] - 标签对象数组,形如:[{title: "",content: HTMLElement}],初始时,传入则创建页面。
  60107. * @extends {SuperMap.Components.TemplateBase}
  60108. * @category Components Common
  60109. */
  60110. // todo 思考拆分的控件应该以哪种方式使用
  60111. class NavTabsPage extends TemplateBase {
  60112. constructor(options) {
  60113. super(options);
  60114. this.navTabsTitle = null;
  60115. this.navTabsContent = null;
  60116. options.tabs = options.tabs ? options.tabs : [];
  60117. this._initView(options.tabs);
  60118. }
  60119. /**
  60120. * @override
  60121. * @private
  60122. */
  60123. _initView(tabs) {
  60124. const navTabsPage = document.createElement("div");
  60125. navTabsPage.setAttribute("class", "component-navtabspage");
  60126. //关闭按钮
  60127. const closeBtn = document.createElement("span");
  60128. closeBtn.setAttribute("class", "supermapol-icons-close");
  60129. closeBtn.onclick = this.closeView.bind(this);
  60130. navTabsPage.appendChild(closeBtn);
  60131. //标签
  60132. const navTabsTitle = document.createElement("div");
  60133. this.navTabsTitle = navTabsTitle;
  60134. navTabsTitle.setAttribute("class", "component-navtabspage__title");
  60135. navTabsPage.appendChild(navTabsTitle);
  60136. //内容
  60137. const navTabsContent = document.createElement("div");
  60138. this.navTabsContent = navTabsContent;
  60139. navTabsContent.setAttribute("class", "component-navtabspage__content");
  60140. navTabsPage.appendChild(navTabsContent);
  60141. //若 tabs 初始传入值,则
  60142. if (tabs.length > 0) {
  60143. this.appendTabs(tabs);
  60144. }
  60145. this.rootContainer = navTabsPage;
  60146. }
  60147. /**
  60148. * @function SuperMap.Components.NavTabsPage.prototype.setTabs
  60149. * @description 设置标签。
  60150. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  60151. */
  60152. setTabs(tabs) {
  60153. this.removeAllTabs();
  60154. this.appendTabs(tabs);
  60155. }
  60156. /**
  60157. * @function SuperMap.Components.NavTabsPage.prototype.appendTabs
  60158. * @description 添加标签页面。
  60159. * @param {Array.<Object>} tabs - 标签对象数组,形如:[{title: "",content: {}}]。
  60160. */
  60161. appendTabs(tabs) {
  60162. for (let i = 0; i < tabs.length; i++) {
  60163. let title = document.createElement("span");
  60164. title.index = i;
  60165. title.appendChild(document.createTextNode(tabs[i].title));
  60166. //绑定标签切换对应页面:
  60167. title.onclick = this._changeTabsPage.bind(this);
  60168. let content = tabs[i].content;
  60169. content.index = i;
  60170. content.hidden = true;
  60171. this.navTabsTitle.appendChild(title);
  60172. this.navTabsContent.appendChild(content);
  60173. }
  60174. //todo 确认是否两个子元素的 index 相互对应
  60175. //默认显示第一个标签对象
  60176. this.navTabsTitle.firstChild.setAttribute("class", "component-navtabspage__tabs--select");
  60177. this.navTabsContent.firstChild.hidden = false;
  60178. }
  60179. /**
  60180. * @function SuperMap.Components.NavTabsPage.prototype.removeTab
  60181. * @description 删除某个标签页面。
  60182. * @param {number} index - 标签索引号。
  60183. */
  60184. removeTab(index) {
  60185. this.navTabsTitle.removeChild(this.navTabsTitle.children[index]);
  60186. this.navTabsContent.removeChild(this.navTabsContent.children[index]);
  60187. }
  60188. /**
  60189. * @function SuperMap.Components.NavTabsPage.prototype.removeAllTabs
  60190. * @description 删除所有标签。
  60191. */
  60192. removeAllTabs() {
  60193. for (let i = this.navTabsTitle.children.length; i > 0; i--) {
  60194. this.navTabsTitle.removeChild(this.navTabsTitle.children[i]);
  60195. this.navTabsContent.removeChild(this.navTabsContent.children[i]);
  60196. }
  60197. }
  60198. _changeTabsPage(e) {
  60199. const index = e.target.index;
  60200. for (let i = 0; i < this.navTabsTitle.children.length; i++) {
  60201. this.navTabsTitle.children[i].setAttribute("class", "");
  60202. this.navTabsContent.children[i].hidden = true;
  60203. if (i === index) {
  60204. this.navTabsTitle.children[i].setAttribute("class", "component-navtabspage__tabs--select");
  60205. this.navTabsContent.children[i].hidden = false;
  60206. }
  60207. }
  60208. }
  60209. }
  60210. SuperMap.Components.NavTabsPage = NavTabsPage;
  60211. ;// CONCATENATED MODULE: ./src/common/components/templates/PaginationContainer.js
  60212. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60213. * This program are made available under the terms of the Apache License, Version 2.0
  60214. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60215. /**
  60216. * @class SuperMap.Components.PaginationContainer
  60217. * @classdesc 分页组件模板。
  60218. * @version 9.1.1
  60219. * @param {Object} options - 组件配置参数。
  60220. * @param {string} optionsArr.id - 组件 dom 元素 id。
  60221. * @param {HTMLElement} options.contents - 页面填充的 DOM 元素对象。
  60222. * @param {number} options.pageCounts - 页数。
  60223. * @extends {SuperMap.Components.TemplateBase}
  60224. * @category Components Common
  60225. */
  60226. class PaginationContainer extends TemplateBase {
  60227. constructor(options) {
  60228. options = options ? options : {};
  60229. super(options);
  60230. this.currentPage = 0;
  60231. this.pageNumberLis = [];
  60232. this.currentPageNumberLis = [];
  60233. this.linkageEvent = null;
  60234. options.contents = options.contents ? options.contents : null;
  60235. options.pageCounts = options.pageCounts ? options.pageCounts : 0;
  60236. this._initView(options.contents, options.pageCounts);
  60237. }
  60238. /**
  60239. * @function SuperMap.Components.PaginationContainer.prototype.setLinkageEvent
  60240. * @description 设置页面联动方法。
  60241. * @param {function} linkageEvent - 联动方法,实现指定功能。
  60242. */
  60243. setLinkageEvent(linkageEvent) {
  60244. this.linkageEvent = linkageEvent;
  60245. }
  60246. /**
  60247. * @private
  60248. * @override
  60249. */
  60250. _initView(contents, pageCounts) {
  60251. const container = document.createElement("div");
  60252. container.setAttribute("class", "component-pagination");
  60253. //content
  60254. const content = document.createElement("div");
  60255. content.setAttribute("class", "component-pagination__content");
  60256. container.appendChild(content);
  60257. this.content = content;
  60258. //link
  60259. const link = document.createElement("ul");
  60260. link.setAttribute("class", "component-pagination__link");
  60261. link.onclick = this._changePageEvent.bind(this);
  60262. container.appendChild(link);
  60263. this._createLink(link);
  60264. this.link = link;
  60265. //填充内容:
  60266. if (contents) {
  60267. this.setContent(contents);
  60268. }
  60269. if (pageCounts !== 0) {
  60270. this.setPageLink(pageCounts);
  60271. }
  60272. this.rootContainer = container;
  60273. }
  60274. /**---------以下是页面相关操作 **/
  60275. /**
  60276. * @function SuperMap.Components.PaginationContainer.prototype.setContent
  60277. * @description 设置页面内容。
  60278. * @param {Element} element - 页面内容元素。
  60279. */
  60280. setContent(element) {
  60281. this.clearContent();
  60282. this.appendContent(element);
  60283. }
  60284. /**
  60285. * @function SuperMap.Components.PaginationContainer.prototype.appendContent
  60286. * @description 追加内容。
  60287. * @param {Element} element - 页面内容元素。
  60288. */
  60289. appendContent(element) {
  60290. this.content.appendChild(element);
  60291. }
  60292. /**
  60293. * @function SuperMap.Components.PaginationContainer.prototype.clearContent
  60294. * @description 清空内容元素。
  60295. */
  60296. clearContent() {
  60297. for (let i = this.content.children.length - 1; i >= 0; i--) {
  60298. this.content.removeChild(this.content.children[i]);
  60299. }
  60300. }
  60301. /** -----以下是页码相关的操作:**/
  60302. /**
  60303. * @function SuperMap.Components.PaginationContainer.prototype.setPageLink
  60304. * @description 设置页码数。
  60305. * @param {number} pageNumber - 页码数。
  60306. */
  60307. setPageLink(pageNumber) {
  60308. //清空当前页码
  60309. this.pageNumberLis = [];
  60310. this.currentPageNumberLis = [];
  60311. this.clearPageLink();
  60312. //创建页码
  60313. this._createPageLi(pageNumber);
  60314. //添加页码到页码列表
  60315. this._appendPageLink();
  60316. }
  60317. /**
  60318. * @description 创建页码。
  60319. * @param pageNumber
  60320. * @private
  60321. */
  60322. _createPageLi(pageNumber) {
  60323. for (let i = 0; i < pageNumber; i++) {
  60324. const pageLi = document.createElement("li");
  60325. pageLi.innerHTML = i + 1;
  60326. /*const liContent = document.createElement("span");
  60327. liContent.innerHTML = i + 1;*/
  60328. // pageLi.appendChild(liContent);
  60329. this.pageNumberLis.push(pageLi);
  60330. }
  60331. this.pageNumberLis[0].setAttribute("class", "active");
  60332. this.currentPage = 1;
  60333. if (pageNumber < 5) {
  60334. this.currentPageNumberLis = this.pageNumberLis;
  60335. } else {
  60336. for (let i = 0; i < 5; i++) {
  60337. this.currentPageNumberLis.push(this.pageNumberLis[i]);
  60338. }
  60339. }
  60340. }
  60341. /**
  60342. * @description 添加页码到页码列表。
  60343. * @private
  60344. */
  60345. _appendPageLink() {
  60346. //todo 如何插入中间
  60347. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  60348. this.link.insertBefore(this.currentPageNumberLis[i], this.link.childNodes[this.link.children.length - 2]);
  60349. }
  60350. for (let i = 0; i < this.currentPageNumberLis.length; i++) {
  60351. //清空 active 状态
  60352. this.currentPageNumberLis[i].setAttribute("class", "");
  60353. //给当前选中的 li 赋值 active 状态
  60354. if (Number(this.currentPageNumberLis[i].innerHTML) === this.currentPage) {
  60355. this.currentPageNumberLis[i].setAttribute("class", "active");
  60356. }
  60357. }
  60358. //根据 currentPage 改变按钮状态
  60359. this._changeDisableState();
  60360. if (this.linkageEvent) {
  60361. this.linkageEvent(this.currentPage);
  60362. }
  60363. }
  60364. /**
  60365. * @function SuperMap.Components.PaginationContainer.prototype.clearPageLink
  60366. * @description 清除页码列表。
  60367. */
  60368. clearPageLink() {
  60369. for (let i = this.link.children.length - 3; i > 1; i--) {
  60370. this.link.removeChild(this.link.children[i]);
  60371. }
  60372. }
  60373. /**
  60374. * @description 创建页码按钮。
  60375. * @param ul
  60376. * @private
  60377. */
  60378. _createLink(ul) {
  60379. for (let i = 0; i < 4; i++) {
  60380. const li = document.createElement("li");
  60381. li.setAttribute("class", "disable");
  60382. const liContent = document.createElement("span");
  60383. li.appendChild(liContent);
  60384. if (i === 0) {
  60385. liContent.id = "first";
  60386. liContent.setAttribute("class", "supermapol-icons-first");
  60387. } else if (i === 1) {
  60388. liContent.id = "prev";
  60389. liContent.setAttribute("class", "supermapol-icons-prev");
  60390. } else if (i === 2) {
  60391. liContent.id = "next";
  60392. liContent.setAttribute("class", "supermapol-icons-next");
  60393. } else if (i === 3) {
  60394. liContent.id = "last";
  60395. liContent.setAttribute("class", "supermapol-icons-last");
  60396. }
  60397. ul.appendChild(li);
  60398. }
  60399. }
  60400. /**
  60401. * @description 点击页码事件。
  60402. * @param e
  60403. * @private
  60404. */
  60405. _changePageEvent(e) {
  60406. //todo
  60407. const trigger = e.target;
  60408. //若列表禁用,点击无效
  60409. if (trigger.parentElement.classList[0] === "disable") {
  60410. return;
  60411. }
  60412. let targetLi;
  60413. if (trigger.id) {
  60414. targetLi = trigger.id;
  60415. } else if (Number(trigger.innerHTML)) {
  60416. targetLi = Number(trigger.innerHTML);
  60417. } else {
  60418. return;
  60419. }
  60420. //页码预处理:
  60421. this._prePageNum(targetLi);
  60422. //根据 currentPageNumberLis 创建页码列表
  60423. this.clearPageLink();
  60424. this._appendPageLink();
  60425. }
  60426. /**
  60427. * @description 根据 currentPage 改变按钮状态。
  60428. * @private
  60429. */
  60430. _changeDisableState() {
  60431. this.link.children[0].setAttribute("class", "");
  60432. this.link.children[1].setAttribute("class", "");
  60433. this.link.children[this.link.children.length - 1].setAttribute("class", "");
  60434. this.link.children[this.link.children.length - 2].setAttribute("class", "");
  60435. if (this.currentPage === 1) {
  60436. this.link.children[0].setAttribute("class", "disable");
  60437. this.link.children[1].setAttribute("class", "disable");
  60438. }
  60439. if (this.currentPage === this.pageNumberLis.length) {
  60440. this.link.children[this.link.children.length - 1].setAttribute("class", "disable");
  60441. this.link.children[this.link.children.length - 2].setAttribute("class", "disable");
  60442. }
  60443. }
  60444. /**
  60445. * @description 根据点击页码列表事件准备需展现的页码列表。
  60446. * @param {string|number} targetLi - 被点击的列表对象 id 或 被点击的页码值。
  60447. * @private
  60448. */
  60449. _prePageNum(targetLi) {
  60450. const currentPageNumberLis = [];
  60451. if (targetLi === "first") {
  60452. this.currentPage = 1;
  60453. } else if (targetLi === "last") {
  60454. this.currentPage = this.pageNumberLis.length;
  60455. } else if (targetLi === "prev") {
  60456. this.currentPage = this.currentPage - 1;
  60457. } else if (targetLi === "next") {
  60458. this.currentPage = this.currentPage + 1;
  60459. } else {
  60460. this.currentPage = targetLi;
  60461. }
  60462. if (this.pageNumberLis.length <= 5) {
  60463. for (let i = 0; i < this.pageNumberLis.length; i++) {
  60464. currentPageNumberLis.push(this.pageNumberLis[i]);
  60465. }
  60466. } else {
  60467. //当前点击前三,都取前五
  60468. if (this.currentPage <= 3) {
  60469. for (let i = 0; i < 5; i++) {
  60470. currentPageNumberLis.push(this.pageNumberLis[i]);
  60471. }
  60472. } else if (this.currentPage >= this.pageNumberLis.length - 3) {
  60473. //点击后三,都取后5
  60474. for (let i = this.pageNumberLis.length - 5; i < this.pageNumberLis.length; i++) {
  60475. currentPageNumberLis.push(this.pageNumberLis[i]);
  60476. }
  60477. } else {
  60478. //其他,取中间:
  60479. for (let i = this.currentPage - 3; i <= this.currentPage + 1; i++) {
  60480. currentPageNumberLis.push(this.pageNumberLis[i]);
  60481. }
  60482. }
  60483. }
  60484. if (currentPageNumberLis.length > 0) {
  60485. this.currentPageNumberLis = currentPageNumberLis;
  60486. }
  60487. }
  60488. }
  60489. SuperMap.Components.PaginationContainer = PaginationContainer;
  60490. ;// CONCATENATED MODULE: ./src/common/components/util/Util.js
  60491. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60492. * This program are made available under the terms of the Apache License, Version 2.0
  60493. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60494. let ComponentsUtil = {
  60495. /**
  60496. * 获取上传文件类型
  60497. * @param fileName
  60498. */
  60499. getFileType(fileName) {
  60500. let regCSV = /^.*\.(?:csv)$/i;
  60501. let regExcel = /^.*\.(?:xls|xlsx)$/i; //文件名可以带空格
  60502. let regGeojson = /^.*\.(?:geojson|json)$/i;
  60503. if (regExcel.test(fileName)) { //校验不通过
  60504. return CommonTypes_FileTypes.EXCEL;
  60505. } else if (regCSV.test(fileName)) {
  60506. return CommonTypes_FileTypes.CSV;
  60507. } else if (regGeojson.test(fileName)) {
  60508. return CommonTypes_FileTypes.GEOJSON;
  60509. }
  60510. return null;
  60511. }
  60512. };
  60513. ;// CONCATENATED MODULE: ./src/common/components/util/index.js
  60514. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60515. * This program are made available under the terms of the Apache License, Version 2.0
  60516. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60517. ;// CONCATENATED MODULE: ./src/common/components/index.js
  60518. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60519. * This program are made available under the terms of the Apache License, Version 2.0
  60520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60521. //数据
  60522. //组件
  60523. //提示框组件
  60524. //图表组件
  60525. //公用模板:
  60526. //工具类
  60527. ;// CONCATENATED MODULE: ./src/common/lang/locales/en-US.js
  60528. 
  60529. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60530. * This program are made available under the terms of the Apache License, Version 2.0
  60531. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60532. /**
  60533. * Namespace: SuperMap.Lang["en"]
  60534. * Dictionary for English. Keys for entries are used in calls to
  60535. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  60536. * strings formatted for use with <SuperMap.String.format> calls.
  60537. */
  60538. let en = {
  60539. 'title_dataFlowService': 'Data Flow Service',
  60540. 'title_distributedAnalysis': 'Distributed Analysis',
  60541. 'title_clientComputing': 'Client Computing',
  60542. 'title_dataServiceQuery': 'Data Service Query',
  60543. 'title_searchCity':'Search city',
  60544. 'title_searchLayer':' Search layer',
  60545. 'text_input_value_inputDataFlowUrl': 'Please enter the data stream service address such as: ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  60546. 'text_displayFeaturesInfo': 'Display feature information',
  60547. 'text_subscribe': 'subscribe',
  60548. 'text_cancelSubscribe': 'unsubscribe',
  60549. 'text_densityAnalysis': 'Density Analysis',
  60550. 'text_CalculateTheValuePerUnitArea': 'Calculate the value per unit area within the neighborhood shape',
  60551. 'text_option_selectDataset':'Please select a dataset',
  60552. 'text_label_dataset': 'Dataset',
  60553. 'text_option_simplePointDensityAnalysis': 'Simple point density analysis',
  60554. 'text_option_nuclearDensityAnalysis': 'Nuclear density analysis',
  60555. 'text_label_analyticalMethod': 'Analytical method',
  60556. 'text_option_quadrilateral': 'Quadrilateral',
  60557. 'text_option_hexagon': 'hexagon',
  60558. 'text_label_meshType': 'Mesh type',
  60559. 'text_option_notSet': 'Not set',
  60560. 'text_label_weightField': 'Weight field',
  60561. 'text_label_gridSizeInMeters': 'Grid size',
  60562. 'text_label_searchRadius': 'Search radius',
  60563. 'text_label_queryRange': 'Scope of analysis',
  60564. 'text_label_areaUnit': 'Area unit',
  60565. 'text_option_equidistantSegmentation': 'Equidistant segmentation',
  60566. 'text_option_logarithm': 'Logarithm',
  60567. 'text_option_equalCountingSegment': 'Equal counting segment',
  60568. 'text_option_squareRootSegmentation': 'Square root segmentation',
  60569. 'text_label_thematicMapSegmentationMode': 'Thematic map segmentation mode',
  60570. 'text_label_thematicMapSegmentationParameters': 'Thematic map segmentation parameters',
  60571. 'text_option_greenOrangePurpleGradient': 'Green orange purple gradient',
  60572. 'text_option_greenOrangeRedGradient': 'Green orange red gradient',
  60573. 'text_option_rainbowGradient': 'Rainbow gradient',
  60574. 'text_option_spectralGradient': 'Spectral gradient',
  60575. 'text_option_terrainGradient': 'Terrain gradient',
  60576. 'text_label_thematicMapColorGradientMode': 'Thematic map color gradient mode',
  60577. 'text_label_resultLayerName': 'Result layer name',
  60578. 'text_chooseFile': 'Open File',
  60579. 'text_isoline': 'Isoline',
  60580. 'text_extractDiscreteValue': 'Extract discrete value generation curve',
  60581. 'text_buffer': 'Buffer',
  60582. 'text_specifyTheDistance': 'Specify the distance to create the surrounding area',
  60583. 'text_label_analysisLayer': 'Analysis layer',
  60584. 'text_label_extractField': 'Extract field',
  60585. 'text_label_extractedValue': 'Extracted value',
  60586. 'text_label_distanceAttenuation': 'Distance attenuation',
  60587. 'text_label_gridSize': 'gridSize',
  60588. 'text_label_bufferRadius': 'Buffer radius',
  60589. 'text_label_defaultkilometers': 'Default 10 kilometers',
  60590. 'text_label_kilometer': 'kilometer',
  60591. 'text_label_unit': 'unit',
  60592. 'text_retainOriginal': 'Retain original object field',
  60593. 'text_mergeBuffer': 'Merge buffer',
  60594. 'text_label_color': 'Color',
  60595. 'text_label_buffer': '[Buffer]',
  60596. 'text_label_isolines': '[Isolines]',
  60597. 'text_label_queryRangeTips': 'The default is the full range of input data. Example: -74.050, 40.650, -73.850, 40.850',
  60598. 'text_label_queryModel': 'Query mode',
  60599. 'text_label_IDArrayOfFeatures': 'ID array of features',
  60600. 'text_label_maxFeatures': 'The maximum number of features that can be returned',
  60601. 'text_label_bufferDistance': 'Buffer distance',
  60602. 'text_label_queryRange1': 'Query range',
  60603. 'text_label_spatialQueryMode': 'Spatial query mode',
  60604. 'text_label_featureFilter': 'Feature filter',
  60605. 'text_label_geometricObject': 'Geometric object',
  60606. 'text_label_queryMode': 'Query mode',
  60607. 'text_label_searchTips': 'Search for city locations or layer features',
  60608. 'text_label_chooseSearchLayers': 'Select a query layer',
  60609. 'text_loadSearchCriteria': 'Load search criteria',
  60610. 'text_saveSearchCriteria': 'Save search criteria',
  60611. "btn_analyze": "Analyze",
  60612. "btn_analyzing": "Analyzing",
  60613. "btn_emptyTheAnalysisLayer": "Empty the analysis layer",
  60614. "btn_cancelAnalysis": "Cancel",
  60615. "btn_query": "Query",
  60616. "btn_querying": "Querying",
  60617. "btn_emptyTheRresultLayer": "Clear all result layers",
  60618. 'msg_dataReturnedIsEmpty.': 'The request is successful and the data returned by the query is empty.',
  60619. 'msg_dataFlowServiceHasBeenSubscribed': 'The data stream service has been subscribed to.',
  60620. 'msg_inputDataFlowUrlFirst': 'Please enter the data stream service address first.',
  60621. 'msg_datasetOrMethodUnsupport': 'This dataset does not support this analysis type. Please reselect the dataset.',
  60622. 'msg_selectDataset': 'Please select a data set!',
  60623. 'msg_setTheWeightField': 'Please set the weight field!',
  60624. 'msg_theFieldNotSupportAnalysis': 'The field you currently select does not support analysis!',
  60625. 'msg_resultIsEmpty': 'The result of the analysis is empty!',
  60626. 'msg_openFileFail': 'Failed to open file!',
  60627. 'msg_fileTypeUnsupported': 'File format is not supported!',
  60628. 'msg_fileSizeExceeded': 'File size exceeded! The file size should not exceed 10M!',
  60629. 'msg_dataInWrongGeoJSONFormat': 'Wrong data format! Non standard GEOJSON format data!',
  60630. 'msg_dataInWrongFormat': 'Wrong data format! Non standard EXCEL, CSV or GEOJSON format data!',
  60631. 'msg_searchKeywords': "Search keywords cannot be empty. Please enter your search criteria.",
  60632. 'msg_searchGeocodeField':"Did not match the address matching service data!",
  60633. 'msg_cityGeocodeField':"The address matching service of the current city is not configured.",
  60634. 'msg_getFeatureField':"No related vector features found!",
  60635. 'msg_dataflowservicesubscribed':'The data stream service has been subscribed to.',
  60636. 'msg_subscribesucceeded':'The data stream service subscription was successful.',
  60637. 'msg_crsunsupport':'Does not support the coordinate system of the current map',
  60638. 'msg_tilematrixsetunsupport':'Incoming TileMatrixSet is not supported',
  60639. 'msg_jsonResolveFiled': 'JSON format parsing failure!',
  60640. 'msg_requestContentFiled': 'Failed to request data through iportal!',
  60641. 'msg_getdatafailed': 'Failed to get data!'
  60642. };
  60643. SuperMap.Lang["en-US"] = en;
  60644. ;// CONCATENATED MODULE: ./src/common/lang/locales/zh-CN.js
  60645. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60646. * This program are made available under the terms of the Apache License, Version 2.0
  60647. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60648. /**
  60649. * Namespace: SuperMap.Lang["zh-CN"]
  60650. * Dictionary for Simplified Chinese. Keys for entries are used in calls to
  60651. * <SuperMap.Lang.translate>. Entry bodies are normal strings or
  60652. * strings formatted for use with <SuperMap.String.format> calls.
  60653. */
  60654. let zh = {
  60655. 'title_dataFlowService': '数据流服务',
  60656. 'title_distributedAnalysis': '分布式分析',
  60657. 'title_clientComputing': '客户端计算',
  60658. 'title_dataServiceQuery': '数据服务查询',
  60659. 'title_searchCity':'搜索城市',
  60660. 'title_searchLayer':'搜索图层',
  60661. 'text_input_value_inputDataFlowUrl': '请输入数据流服务地址如:ws://{serviceRoot}/{dataFlowName}/dataflow/subscribe',
  60662. 'text_displayFeaturesInfo': '显示要素信息',
  60663. 'text_subscribe': '订阅',
  60664. 'text_cancelSubscribe': '取消订阅',
  60665. 'text_densityAnalysis': '密度分析',
  60666. 'text_CalculateTheValuePerUnitArea': '计算点指定邻域形状内的每单位面积量值',
  60667. 'text_option_selectDataset':'请选择数据集',
  60668. 'text_label_dataset': '数据集',
  60669. 'text_option_simplePointDensityAnalysis': '简单点密度分析',
  60670. 'text_option_nuclearDensityAnalysis': '核密度分析',
  60671. 'text_label_analyticalMethod': '分析方法',
  60672. 'text_option_quadrilateral': '四边形',
  60673. 'text_option_hexagon': '六边形',
  60674. 'text_label_meshType': '网格面类型',
  60675. 'text_option_notSet': '未设置',
  60676. 'text_label_weightField': '权重字段',
  60677. 'text_label_gridSizeInMeters': '网格大小',
  60678. 'text_label_searchRadius': '搜索半径',
  60679. 'text_label_queryRange': '分析范围',
  60680. 'text_label_areaUnit': '面积单位',
  60681. 'text_option_equidistantSegmentation': '等距离分段',
  60682. 'text_option_logarithm': '对数',
  60683. 'text_option_equalCountingSegment': '等计数分段',
  60684. 'text_option_squareRootSegmentation': '平方根分段',
  60685. 'text_label_thematicMapSegmentationMode': '专题图分段模式',
  60686. 'text_label_thematicMapSegmentationParameters': '专题图分段参数',
  60687. 'text_option_greenOrangePurpleGradient': '绿橙紫渐变',
  60688. 'text_option_greenOrangeRedGradient': '绿橙红渐变',
  60689. 'text_option_rainbowGradient': '彩虹渐变',
  60690. 'text_option_spectralGradient': '光谱渐变',
  60691. 'text_option_terrainGradient': '地形渐变',
  60692. 'text_label_thematicMapColorGradientMode': '专题图颜色渐变模式',
  60693. 'text_label_resultLayerName': '结果图层名称',
  60694. 'text_chooseFile': '选择文件',
  60695. 'text_isoline': '等值线',
  60696. 'text_extractDiscreteValue': '提取离散值生成曲线',
  60697. 'text_buffer': '缓冲区',
  60698. 'text_specifyTheDistance': '指定距离创建周边区域',
  60699. 'text_label_analysisLayer': '分析图层',
  60700. 'text_label_extractField': '提取字段',
  60701. 'text_label_extractedValue': '提取值',
  60702. 'text_label_distanceAttenuation': '距离衰减',
  60703. 'text_label_gridSize': '栅格大小',
  60704. 'text_label_bufferRadius': '缓冲半径',
  60705. 'text_label_defaultkilometers': '默认10千米',
  60706. 'text_option_kilometer': '千米',
  60707. 'text_label_unit': '单位',
  60708. 'text_retainOriginal': '保留原对象字段属性',
  60709. 'text_mergeBuffer': '合并缓冲区',
  60710. 'text_label_color': '颜色',
  60711. 'text_label_buffer': '[缓冲区]',
  60712. 'text_label_isolines': '[等值线]',
  60713. 'text_label_queryRangeTips': '默认为输入数据的全幅范围。范例:-74.050,40.650,-73.850,40.850',
  60714. 'text_label_IDArrayOfFeatures': '要素 ID 数组',
  60715. 'text_label_maxFeatures': '最多可返回的要素数量',
  60716. 'text_label_bufferDistance': '缓冲区距离',
  60717. 'text_label_queryRange1': '查询范围',
  60718. 'text_label_spatialQueryMode': '空间查询模式',
  60719. 'text_label_featureFilter': '要素过滤器',
  60720. 'text_label_geometricObject': '几何对象',
  60721. 'text_label_queryMode': '查询模式',
  60722. 'text_label_searchTips': '搜索城市地点或图层要素',
  60723. 'text_label_chooseSearchLayers': '选择查询图层',
  60724. 'text_loadSearchCriteria': '加载搜索条件',
  60725. 'text_saveSearchCriteria': '保存搜索条件',
  60726. "btn_analyze": "分析",
  60727. "btn_analyzing": "分析中",
  60728. "btn_emptyTheAnalysisLayer": "清空分析图层",
  60729. "btn_cancelAnalysis": "取消",
  60730. "btn_query": "查询",
  60731. "btn_querying": "查询中",
  60732. "btn_emptyTheRresultLayer": "清除所有结果图层",
  60733. 'msg_dataFlowServiceHasBeenSubscribed': '已订阅该数据流服务。',
  60734. 'msg_inputDataFlowUrlFirst': '请先输入数据流服务地址。',
  60735. 'msg_datasetOrMethodUnsupport': '该数据集不支持本分析类型,请重新选择数据集',
  60736. 'msg_selectDataset': '请选择数据集!',
  60737. 'msg_setTheWeightField': '请设置权重字段!',
  60738. 'msg_theFieldNotSupportAnalysis': '您当前选择的字段不支持分析!',
  60739. 'msg_resultIsEmpty': '分析的结果为空!',
  60740. 'msg_dataReturnedIsEmpty': '请求成功,查询返回的数据为空。',
  60741. 'msg_openFileFail': '打开文件失败!',
  60742. 'msg_fileTypeUnsupported': '不支持该文件格式!',
  60743. 'msg_fileSizeExceeded': '文件大小超限!文件大小不得超过 10M!',
  60744. 'msg_dataInWrongGeoJSONFormat': '数据格式错误!非标准的 GEOJSON 格式数据!',
  60745. 'msg_dataInWrongFormat': '数据格式错误!非标准的 EXCEL, CSV 或 GEOJSON 格式数据!',
  60746. 'msg_searchKeywords': "搜索关键字不能为空,请输入搜索条件。",
  60747. 'msg_searchGeocodeField':"未匹配到地址匹配服务数据!",
  60748. 'msg_cityGeocodeField':"未配置当前城市的地址匹配服务。",
  60749. 'msg_getFeatureField':"未查找到相关矢量要素!",
  60750. 'msg_dataflowservicesubscribed':'已订阅该数据流服务。',
  60751. 'msg_subscribesucceeded':'数据流服务订阅成功。',
  60752. 'msg_crsunsupport':'不支持当前地图的坐标系',
  60753. 'msg_tilematrixsetunsupport':'不支持传入的TileMatrixSet',
  60754. 'msg_jsonResolveFiled': 'json格式解析失败!',
  60755. 'msg_requestContentFiled': '通过iportal请求数据失败!',
  60756. 'msg_getdatafailed': '获取数据失败!'
  60757. };
  60758. SuperMap.Lang["zh-CN"] = zh;
  60759. ;// CONCATENATED MODULE: ./src/common/lang/index.js
  60760. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60761. * This program are made available under the terms of the Apache License, Version 2.0
  60762. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60763. ;// CONCATENATED MODULE: ./src/common/index.js
  60764. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60765. * This program are made available under the terms of the Apache License, Version 2.0
  60766. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60767. ;// CONCATENATED MODULE: ./src/openlayers/services/MapService.js
  60768. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60769. * This program are made available under the terms of the Apache License, Version 2.0
  60770. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60771. /**
  60772. * @class ol.supermap.MapService
  60773. * @category iServer Map
  60774. * @classdesc 地图信息服务类。
  60775. * @extends {ol.supermap.ServiceBase}
  60776. * @param {string} url - 地图服务地址。
  60777. * @param {Object} options - 参数。
  60778. * @param {string} [options.proxy] - 服务代理地址。
  60779. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  60780. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  60781. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  60782. * @param {Object} [options.headers] - 请求头。
  60783. * @example
  60784. * new ol.supermap.MapService(url)
  60785. * .getMapInfo(function(result){
  60786. * //doSomething
  60787. * })
  60788. */
  60789. class MapService extends ServiceBase {
  60790. constructor(url, options) {
  60791. super(url, options);
  60792. }
  60793. /**
  60794. * @function ol.supermap.MapService.prototype.getMapInfo
  60795. * @description 地图信息查询服务。
  60796. * @param {RequestCallback} callback - 回调函数。
  60797. * @returns {ol.supermap.MapService} 获取服务信息。
  60798. */
  60799. getMapInfo(callback) {
  60800. var me = this;
  60801. var getMapStatusService = new MapService_MapService(me.url, {
  60802. proxy: me.options.proxy,
  60803. withCredentials: me.options.withCredentials,
  60804. crossOrigin: me.options.crossOrigin,
  60805. headers: me.options.headers,
  60806. serverType: me.options.serverType,
  60807. eventListeners: {
  60808. scope: me,
  60809. processCompleted: callback,
  60810. processFailed: callback
  60811. }, projection: me.options.projection
  60812. });
  60813. getMapStatusService.processAsync();
  60814. }
  60815. /**
  60816. * @function ol.supermap.MapService.prototype.getTilesets
  60817. * @description 切片列表信息查询服务。
  60818. * @param {RequestCallback} callback - 回调函数。
  60819. * @returns {ol.supermap.MapService} 获取服务信息。
  60820. */
  60821. getTilesets(callback) {
  60822. var me = this;
  60823. var tilesetsService = new TilesetsService(me.url, {
  60824. proxy: me.options.proxy,
  60825. withCredentials: me.options.withCredentials,
  60826. crossOrigin: me.options.crossOrigin,
  60827. headers: me.options.headers,
  60828. serverType: me.options.serverType,
  60829. eventListeners: {
  60830. scope: me,
  60831. processCompleted: callback,
  60832. processFailed: callback
  60833. }
  60834. });
  60835. tilesetsService.processAsync();
  60836. }
  60837. }
  60838. ;// CONCATENATED MODULE: external "ol.control.Control"
  60839. const external_ol_control_Control_namespaceObject = ol.control.Control;
  60840. var external_ol_control_Control_default = /*#__PURE__*/__webpack_require__.n(external_ol_control_Control_namespaceObject);
  60841. ;// CONCATENATED MODULE: ./src/openlayers/control/ChangeTileVersion.js
  60842. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  60843. * This program are made available under the terms of the Apache License, Version 2.0
  60844. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  60845. /**
  60846. * @class ol.supermap.control.ChangeTileVersion
  60847. * @category Control
  60848. * @classdesc 版本切换控件(目前仅支持 IE10 及以上)暂时不支持自定义位置。
  60849. * @extends {ol/control/Control}
  60850. * @param {options} options -参数。
  60851. * @param {string} [options.title='switch tile version'] - 提示信息。
  60852. * @param {string} [options.tooltip='top'] - 提示显示位置 top | right | bottom | left。
  60853. * @param {boolean} [options.collapsed=true] - 是否折叠。
  60854. * @param {string} [options.lastText='-'] - 上一个版本的按钮布局。
  60855. * @param {string} [options.nextText='+'] - 下一个版本的按钮布局。
  60856. * @param {string} [options.ico='V'] - 控件显示的logo。
  60857. * @param {string} [options.orientation='horizontal'] - 方向 horizontal|vertical。
  60858. * @param {boolean} [options.switch=true] - 是否显示上/下一个版本切换控件。
  60859. * @example
  60860. * var control = new ol.supermap.control.ChangeTileVersion({
  60861. * layer: baseLayer,
  60862. * orientation: "horizontal"
  60863. * });
  60864. * map.addControl(control)
  60865. */
  60866. class ChangeTileVersion extends (external_ol_control_Control_default()) {
  60867. constructor(options) {
  60868. options = options || {};
  60869. //鼠标滑过时提示
  60870. if (!options.title) {
  60871. options.title = 'switch tile version';
  60872. }
  60873. //tooltip提示显示位置 top | right | bottom | left
  60874. if (!options.tooltip) {
  60875. options.tooltip = 'top';
  60876. }
  60877. //是否折叠
  60878. if (!options.collapsed) {
  60879. options.collapsed = true;
  60880. }
  60881. //上一个版本的按钮布局
  60882. if (!options.lastText) {
  60883. options.lastText = '-';
  60884. }
  60885. //下一个版本的按钮布局
  60886. if (!options.nextText) {
  60887. options.nextText = '+';
  60888. }
  60889. //控件显示的logo
  60890. if (!options.ico) {
  60891. options.ico = 'V';
  60892. }
  60893. //方向horizontal|vertical
  60894. if (options.orientation !== 'vertical') {
  60895. options.orientation = 'horizontal';
  60896. }
  60897. //是否显示上/下一个版本切换控件
  60898. if (!options.switch) {
  60899. options.switch = true;
  60900. }
  60901. super(options);
  60902. this.options = options;
  60903. this.element = options.element = initLayout.call(this);
  60904. if (options.layer) {
  60905. this.setLayer(options.layer);
  60906. }
  60907. /**
  60908. * @function ol.supermap.control.ChangeTileVersion.prototype.initLayout
  60909. * @description 初始化。
  60910. */
  60911. function initLayout() {
  60912. var className = 'ol-control-ctv';
  60913. this._container = createElement(
  60914. 'div',
  60915. className + ' ' + className + '-' + options.orientation + ' ol-unselectable ol-control'
  60916. );
  60917. //正常情况下显示btn
  60918. this._sliderBtn = createElement('button', className + '-toggle', this._container);
  60919. this._sliderBtn.setAttribute('title', options.title);
  60920. this._sliderBtn.innerHTML = options.ico;
  60921. //滑块拖动时值显示区域
  60922. this._sliderValue = createElement('p', className + '-value', this._container);
  60923. this._sliderValue.innerHTML = options.ico;
  60924. this._sliderValue.setAttribute('title', options.title);
  60925. var sliderClassName = 'ol-ctv-slider';
  60926. this._sliderContent = createElement('div', sliderClassName + '-main' + ' tooltip', this._container);
  60927. //tooltip提示框
  60928. if (options.orientation === 'vertical' && options.tooltip === 'top') {
  60929. options.tooltip = 'right';
  60930. }
  60931. this.tooltip = createElement(
  60932. 'span',
  60933. 'tooltip-text' + ' ' + 'tooltip-' + options.tooltip,
  60934. this._sliderContent
  60935. );
  60936. this.tooltip.innerHTML = options.ico;
  60937. //加控件
  60938. if (options.switch) {
  60939. this._next = createElement(
  60940. 'a',
  60941. sliderClassName + '-incdec' + ' ' + sliderClassName + '-next',
  60942. this._sliderContent
  60943. );
  60944. this._next.innerHTML = options.nextText;
  60945. addDomEvent(this._next, 'click', this.nextTilesVersion, this);
  60946. this._container.classList.add(className + '-incdec');
  60947. }
  60948. //滑块
  60949. this._sliderContainer = createElement('div', sliderClassName + '-container', this._sliderContent);
  60950. this.slider = createElement('input', sliderClassName, this._sliderContainer);
  60951. this.min = this.min == null || isNaN(this.min) ? 0 : parseInt(this.min);
  60952. this.slider.setAttribute('title', options.title);
  60953. this.slider.setAttribute('id', 'slider');
  60954. this.slider.setAttribute('type', 'range');
  60955. this.slider.setAttribute('min', this.min);
  60956. this.slider.setAttribute('max', 0);
  60957. this.slider.setAttribute('step', 1);
  60958. this.slider.setAttribute('value', 0);
  60959. // //判断浏览器是否支持Range滑动条
  60960. // if (this.slider.type == "text") {
  60961. // console.error("抱歉,您的浏览器不支持HTML5 range滑动条,请使用高版本浏览器");
  60962. // }
  60963. this.firstLoad = true;
  60964. if ('oninput' in this.slider || 'onchange' in this.slider) {
  60965. addDomEvent(this.slider, 'change', tilesVersion, this);
  60966. } else {
  60967. this.slider.onpropertychange = tilesVersion;
  60968. }
  60969. //减控件
  60970. if (options.switch) {
  60971. this._last = createElement(
  60972. 'a',
  60973. sliderClassName + '-incdec' + ' ' + sliderClassName + '-last',
  60974. this._sliderContent
  60975. );
  60976. this._last.innerHTML = options.lastText;
  60977. addDomEvent(this._last, 'click', this.lastTilesVersion, this);
  60978. }
  60979. // if (window.matchMedia("screen and (-webkit-min-device-pixel-ratio:0)").matches && options.orientation == 'vertical') {
  60980. if (options.orientation == 'vertical') {
  60981. this.slider.style.width = 170 + 'px';
  60982. this._sliderContainer.style.height = 170 + 'px';
  60983. } else {
  60984. this._sliderContainer.style.width = 150 + 'px';
  60985. }
  60986. /**
  60987. * @function ol.supermap.control.ChangeTileVersion.prototype.addDomEvent
  60988. * @description 为元素添加事件。
  60989. */
  60990. addDomEvent(
  60991. this._container,
  60992. 'click',
  60993. function(e) {
  60994. e.preventDefault();
  60995. e.stopPropagation();
  60996. },
  60997. this
  60998. );
  60999. if (options.collapsed) {
  61000. addDomEvent(this._container, 'mouseenter', expand, this);
  61001. addDomEvent(this._container, 'mouseleave', collapse, this);
  61002. addDomEvent(this._sliderBtn, 'click', function(e) {
  61003. e.preventDefault();
  61004. e.stopPropagation();
  61005. });
  61006. addDomEvent(this._sliderBtn, 'click', expand, this);
  61007. addDomEvent(this._sliderBtn, 'focus', expand, this);
  61008. } else {
  61009. expand();
  61010. }
  61011. return this._container;
  61012. }
  61013. /**
  61014. * @function ol.supermap.control.ChangeTileVersion.prototype.createElement
  61015. * @description 新建元素。
  61016. * @param {string} tagName - 标签名。
  61017. * @param {string} className - 类名。
  61018. * @param {Object} container - 容器。
  61019. * @returns {object|Element} 元素
  61020. */
  61021. function createElement(tagName, className, container) {
  61022. var el = document.createElement(tagName);
  61023. el.className = className || '';
  61024. if (container) {
  61025. container.appendChild(el);
  61026. }
  61027. return el;
  61028. }
  61029. /**
  61030. * @function ol.supermap.control.ChangeTileVersion.prototype.addDomEvent
  61031. * @description 为元素添加事件。
  61032. * @param {Object} obj - 事件对象集。
  61033. * @param {string} type - 事件类型。
  61034. * @param {Object} fn -容器。
  61035. * @param {Object} context -当前环境。
  61036. * @returns {addDomEvent} 添加的事件
  61037. */
  61038. function addDomEvent(obj, type, fn, context) {
  61039. var handler = function(e) {
  61040. if (fn) {
  61041. return fn.call(context || obj, e || window.event);
  61042. }
  61043. };
  61044. var originalHandler = handler;
  61045. if ('addEventListener' in obj) {
  61046. if (type === 'mousewheel') {
  61047. obj.addEventListener('onwheel' in obj ? 'wheel' : 'mousewheel', handler, false);
  61048. } else if (type === 'mouseenter' || type === 'mouseleave') {
  61049. handler = function(e) {
  61050. e = e || window.event;
  61051. if (isExternalTarget(obj, e)) {
  61052. originalHandler(e);
  61053. }
  61054. };
  61055. obj.addEventListener(type === 'mouseenter' ? 'mouseover' : 'mouseout', handler, false);
  61056. } else {
  61057. obj.addEventListener(type, handler, false);
  61058. }
  61059. } else if ('attachEvent' in obj) {
  61060. obj.attachEvent('on' + type, handler);
  61061. }
  61062. return this;
  61063. }
  61064. function isExternalTarget(el, e) {
  61065. var related = e.relatedTarget;
  61066. if (!related) {
  61067. return true;
  61068. }
  61069. try {
  61070. while (related && related !== el) {
  61071. related = related.parentNode;
  61072. }
  61073. } catch (err) {
  61074. return false;
  61075. }
  61076. return related !== el;
  61077. }
  61078. function expand() {
  61079. this._container.classList.add('ol-control-ctv-expanded');
  61080. }
  61081. function collapse() {
  61082. this._container.classList.remove('ol-control-ctv-expanded');
  61083. }
  61084. function tilesVersion() {
  61085. var version = this.getVersion();
  61086. this.tilesVersion(version);
  61087. }
  61088. }
  61089. /**
  61090. * @function ol.supermap.control.ChangeTileVersion.prototype.setContent
  61091. * @description 设置版本相关信息。
  61092. * @param {Object} version - 版本信息。
  61093. */
  61094. setContent(version) {
  61095. var content = version || {};
  61096. this.setVersionName(content.desc).setToolTip(content.desc);
  61097. }
  61098. /**
  61099. * @function ol.supermap.control.ChangeTileVersion.prototype.setVersionName
  61100. * @description 设置版本号
  61101. * @param {string} content -版本内容。
  61102. */
  61103. setVersionName(content) {
  61104. var value = content;
  61105. if (!content) {
  61106. value = this.getValue();
  61107. }
  61108. this._sliderValue.innerHTML = value;
  61109. return this;
  61110. }
  61111. /**
  61112. * @function ol.supermap.control.ChangeTileVersion.prototype.setToolTip
  61113. * @description 设置提示信息。
  61114. * @param {string} tooltip - 工具提示。
  61115. * @returns {this} this
  61116. */
  61117. setToolTip(tooltip) {
  61118. this.tooltip.innerHTML = tooltip;
  61119. return this;
  61120. }
  61121. /**
  61122. * @function ol.supermap.control.ChangeTileVersion.prototype.updateLength
  61123. * @description 更新进度条长度。
  61124. * @param {number} length - 进度条长度。
  61125. */
  61126. updateLength(length) {
  61127. if (length > 0) {
  61128. this.length = length;
  61129. this.max = this.length - 1;
  61130. this.slider.setAttribute('max', this.max);
  61131. }
  61132. }
  61133. /**
  61134. * @function ol.supermap.control.ChangeTileVersion.prototype.setLayer
  61135. * @description 绑定图层。
  61136. * @param {Object} layer - 图层。
  61137. */
  61138. setLayer(layer) {
  61139. if (layer) {
  61140. this.options.layer = layer;
  61141. }
  61142. var me = this;
  61143. var tileLayer = me.options.layer;
  61144. tileLayer.on('tilesetsinfoloaded', function(evt) {
  61145. var tileVersions = evt.value && evt.value.tileVersions;
  61146. me.update(tileVersions);
  61147. });
  61148. tileLayer.on('tileversionschanged', function(evt) {
  61149. var tileVersions = evt.value && evt.value.tileVersion;
  61150. me.setContent(tileVersions);
  61151. });
  61152. me.getTileSetsInfo();
  61153. }
  61154. /**
  61155. * @function ol.supermap.control.ChangeTileVersion.prototype.update
  61156. * @description 更新缓存切片集及进度条长度。
  61157. * @param {Object} tileVersions - 待更新的切片版本。
  61158. */
  61159. update(tileVersions) {
  61160. this.tileVersions = tileVersions;
  61161. this.updateLength(this.tileVersions.length);
  61162. }
  61163. /**
  61164. * @function ol.supermap.control.ChangeTileVersion.prototype.getTileSetsInfo
  61165. * @description 请求获取切片集信息。
  61166. */
  61167. getTileSetsInfo() {
  61168. var me = this;
  61169. if (me.options.layer) {
  61170. new MapService(me.options.layer._url).getTilesets(function getTilesInfoSucceed(info) {
  61171. me.options.layer.setTileSetsInfo(info.result);
  61172. });
  61173. }
  61174. }
  61175. /**
  61176. * @function ol.supermap.control.ChangeTileVersion.prototype.removeLayer
  61177. * @description 移除绑定的地图图层。
  61178. */
  61179. removeLayer() {
  61180. this.options.layer = null;
  61181. }
  61182. /**
  61183. * @function ol.supermap.control.ChangeTileVersion.prototype.nextTilesVersion
  61184. * @description 下一个版本,第一次不进行加减,是无版本的状态。
  61185. * @returns {this} this
  61186. */
  61187. nextTilesVersion() {
  61188. if (this.firstLoad) {
  61189. this.options.layer.nextTilesVersion();
  61190. this.firstLoad = !!0;
  61191. return this;
  61192. }
  61193. if (parseInt(this.slider.value) > this.max - 1) {
  61194. return this;
  61195. }
  61196. this.slider.value = parseInt(this.slider.value) + 1;
  61197. this.options.layer.nextTilesVersion();
  61198. return this;
  61199. }
  61200. /**
  61201. * @function ol.supermap.control.ChangeTileVersion.prototype.lastTilesVersion
  61202. * @description 获取上一个版本信息。
  61203. * @returns {this} this
  61204. */
  61205. lastTilesVersion() {
  61206. if (parseInt(this.slider.value) < this.min + 1) {
  61207. return this;
  61208. }
  61209. this.slider.value = parseInt(this.slider.value) - 1;
  61210. this.options.layer.lastTilesVersion();
  61211. return this;
  61212. }
  61213. /**
  61214. * @function ol.supermap.control.ChangeTileVersion.prototype.tilesVersion
  61215. * @description 根据指定版本号请求版本。
  61216. * @param {Object} version - 版本信息。
  61217. */
  61218. tilesVersion(version) {
  61219. var layer = this.options.layer,
  61220. tileVersions = this.tileVersions;
  61221. var len = tileVersions.length;
  61222. for (var i = 0; i < len; i++) {
  61223. if (tileVersions[i].name == version) {
  61224. layer.updateCurrentTileSetsIndex(i);
  61225. layer.changeTilesVersion();
  61226. break;
  61227. }
  61228. }
  61229. }
  61230. /**
  61231. * @function ol.supermap.control.ChangeTileVersion.prototype.getValue
  61232. * @description 获取进度条的值。注:(进度条的值并不是版本号)。
  61233. */
  61234. getValue() {
  61235. return this.slider.value;
  61236. }
  61237. /**
  61238. * @function ol.supermap.control.ChangeTileVersion.prototype.getVersion
  61239. * @description 获取当前进度条值对应的版本号。
  61240. */
  61241. getVersion() {
  61242. var version = this.tileVersions[this.getValue()];
  61243. return version && version.name;
  61244. }
  61245. }
  61246. ;// CONCATENATED MODULE: external "ol.control.ScaleLine"
  61247. const external_ol_control_ScaleLine_namespaceObject = ol.control.ScaleLine;
  61248. var external_ol_control_ScaleLine_default = /*#__PURE__*/__webpack_require__.n(external_ol_control_ScaleLine_namespaceObject);
  61249. ;// CONCATENATED MODULE: external "ol.proj"
  61250. const external_ol_proj_namespaceObject = ol.proj;
  61251. ;// CONCATENATED MODULE: external "ol.AssertionError"
  61252. const external_ol_AssertionError_namespaceObject = ol.AssertionError;
  61253. var external_ol_AssertionError_default = /*#__PURE__*/__webpack_require__.n(external_ol_AssertionError_namespaceObject);
  61254. ;// CONCATENATED MODULE: ./src/openlayers/control/ScaleLine.js
  61255. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61256. * This program are made available under the terms of the Apache License, Version 2.0
  61257. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61258. /**
  61259. * @class ol.supermap.control.ScaleLine
  61260. * @category Control
  61261. * @version 9.1.2
  61262. * @classdesc 比例尺控件。
  61263. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  61264. * <p style="color: #ce4844">Notice</p>
  61265. * <p style="font-size: 13px">该功能继承 {@link ol.control.ScaleLine },与 {@link ol.control.ScaleLine } 功能完全相同。仅为修复 `openlayers` v4.6.5 版本中 WGS84 等地理坐标系比例尺数值错误的问题。
  61266. * </div>
  61267. * @extends {ol/control/ScaleLine}
  61268. * @param {options} options -参数。
  61269. * @param {string} [options.className='ol-scale-line'] - CSS Class name.。
  61270. * @param {number} [options.minWidth=64] - 最小像素宽度。
  61271. * @param {(HTMLElement|string) } [options.target] - 指定比例尺控件目标容器。
  61272. * @param {(ol.control.ScaleLineUnits|string)} [options.units='metric'] - 上一个版本的按钮布局。
  61273. * @example
  61274. * var control = new ol.supermap.control.ScaleLine();
  61275. * map.addControl(control)
  61276. */
  61277. class ScaleLine extends (external_ol_control_ScaleLine_default()) {
  61278. constructor(options) {
  61279. options = options || {};
  61280. //需在super之前定义render,真正的调用是在初始化完成后
  61281. options.render = function (mapEvent) {
  61282. var frameState = mapEvent.frameState;
  61283. if (!frameState) {
  61284. this.viewState_ = null; //NOSONAR
  61285. } else {
  61286. this.viewState_ = frameState.viewState; //NOSONAR
  61287. }
  61288. this.updateElementRepair(); //NOSONAR
  61289. }
  61290. super(options); //NOSONAR
  61291. }
  61292. updateElementRepair() {
  61293. const viewState = this.viewState_ || this.o;
  61294. if (!viewState) {
  61295. this.renderedVisible_ = this.renderedVisible_ || this.j;
  61296. if (this.renderedVisible_) {
  61297. this.element_ = this.element_ || this.c;
  61298. this.element.style.display = 'none';
  61299. this.renderedVisible_ = false;
  61300. }
  61301. return;
  61302. }
  61303. const center = viewState.center;
  61304. const projection = viewState.projection;
  61305. const units = this.getUnits();
  61306. const pointResolutionUnits = units == "degrees" ?
  61307. "degrees" :
  61308. "m";
  61309. let pointResolution =
  61310. external_ol_proj_namespaceObject.getPointResolution(projection, viewState.resolution, center, pointResolutionUnits);
  61311. this.minWidth_ = this.minWidth_ || this.v;
  61312. let nominalCount = this.minWidth_ * pointResolution;
  61313. let suffix = '';
  61314. if (units == "degrees") {
  61315. const metersPerDegree = external_ol_proj_namespaceObject.METERS_PER_UNIT.degrees;
  61316. nominalCount *= metersPerDegree;
  61317. if (nominalCount < metersPerDegree / 60) {
  61318. suffix = '\u2033'; // seconds
  61319. pointResolution *= 3600;
  61320. } else if (nominalCount < metersPerDegree) {
  61321. suffix = '\u2032'; // minutes
  61322. pointResolution *= 60;
  61323. } else {
  61324. suffix = '\u00b0'; // degrees
  61325. }
  61326. } else if (units == "imperial") {
  61327. if (nominalCount < 0.9144) {
  61328. suffix = 'in';
  61329. pointResolution /= 0.0254;
  61330. } else if (nominalCount < 1609.344) {
  61331. suffix = 'ft';
  61332. pointResolution /= 0.3048;
  61333. } else {
  61334. suffix = 'mi';
  61335. pointResolution /= 1609.344;
  61336. }
  61337. } else if (units == "nautical") {
  61338. pointResolution /= 1852;
  61339. suffix = 'nm';
  61340. } else if (units == "metric") {
  61341. if (nominalCount < 0.001) {
  61342. suffix = 'μm';
  61343. pointResolution *= 1000000;
  61344. } else if (nominalCount < 1) {
  61345. suffix = 'mm';
  61346. pointResolution *= 1000;
  61347. } else if (nominalCount < 1000) {
  61348. suffix = 'm';
  61349. } else {
  61350. suffix = 'km';
  61351. pointResolution /= 1000;
  61352. }
  61353. } else if (units == "us") {
  61354. if (nominalCount < 0.9144) {
  61355. suffix = 'in';
  61356. pointResolution *= 39.37;
  61357. } else if (nominalCount < 1609.344) {
  61358. suffix = 'ft';
  61359. pointResolution /= 0.30480061;
  61360. } else {
  61361. suffix = 'mi';
  61362. pointResolution /= 1609.3472;
  61363. }
  61364. } else {
  61365. throw new (external_ol_AssertionError_default())(33); // Invalid units
  61366. }
  61367. var DIGITS = [1, 2, 5];
  61368. let i = 3 * Math.floor(
  61369. Math.log(this.minWidth_ * pointResolution) / Math.log(10));
  61370. let count, width, decimalCount;
  61371. while (true) { //eslint-disable-line no-constant-condition
  61372. decimalCount = Math.floor(i / 3);
  61373. const decimal = Math.pow(10, decimalCount);
  61374. count = DIGITS[((i % 3) + 3) % 3] * decimal;
  61375. width = Math.round(count / pointResolution);
  61376. if (isNaN(width)) {
  61377. this.element.style.display = 'none';
  61378. this.renderedVisible_ = false;
  61379. return;
  61380. } else if (width >= this.minWidth_) {
  61381. break;
  61382. }
  61383. ++i;
  61384. }
  61385. this.renderedHTML_ = this.renderedHTML_ || this.D;
  61386. this.innerElement_ = this.innerElement_ || this.l;
  61387. this.renderedWidth_ = this.renderedWidth_ || this.B;
  61388. this.renderedVisible_ = this.renderedVisible_ || this.j;
  61389. this.element_ = this.element_ || this.c;
  61390. let html= count.toFixed(decimalCount < 0 ? -decimalCount : 0) + ' ' + suffix;
  61391. if (this.renderedHTML_ != html) {
  61392. this.innerElement_.innerHTML = html;
  61393. this.renderedHTML_ = html;
  61394. }
  61395. if (this.renderedWidth_ != width) {
  61396. this.innerElement_.style.width = width + 'px';
  61397. this.renderedWidth_ = width;
  61398. }
  61399. if (!this.renderedVisible_) {
  61400. this.element.style.display = '';
  61401. this.renderedVisible_ = true;
  61402. }
  61403. }
  61404. }
  61405. ;// CONCATENATED MODULE: ./src/common/control/img/Logo.js
  61406. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61407. * This program are made available under the terms of the Apache License, Version 2.0
  61408. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61409. 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=";
  61410. ;// CONCATENATED MODULE: ./src/openlayers/control/Logo.js
  61411. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61412. * This program are made available under the terms of the Apache License, Version 2.0
  61413. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61414. /**
  61415. * @class ol.supermap.control.Logo
  61416. * @category Control
  61417. * @classdesc Logo控件。默认不显示,需手动添加控件。
  61418. * @extends {ol/control/Control}
  61419. * @example
  61420. * var control = new ol.supermap.control.Logo();
  61421. * map.addControl(control);
  61422. * @param {Object} options - logo 控件配置项。
  61423. * @param {string} [options.imageUrl] - logo 图片地址。
  61424. * @param {number} [options.width] - logo 图片宽。
  61425. * @param {number} [options.height] - logo 图片高。
  61426. * @param {string} [options.link='https://iclient.supermap.io'] - 跳转链接。
  61427. * @param {string} [options.alt='SuperMap iClient'] - logo 图片失效时显示文本。
  61428. */
  61429. class Logo extends (external_ol_control_Control_default()) {
  61430. constructor(options) {
  61431. options = options || {};
  61432. options.imageUrl = options.imageUrl || null;
  61433. options.width = options.width || null;
  61434. options.height = options.height || null;
  61435. options.link = options.link || "https://iclient.supermap.io";
  61436. options.alt = options.alt || "SuperMap iClient";
  61437. super(options);
  61438. this.options = options;
  61439. this.element = options.element = initLayerout.call(this);
  61440. /**
  61441. * @function ol.supermap.control.Logo.prototype.initLayerout
  61442. * @description 初始化图层信息。
  61443. */
  61444. function initLayerout() {
  61445. var className = 'ol-control-logo ol-unselectable ol-control';
  61446. var div = document.createElement("div");
  61447. div.className = className;
  61448. setDivStyle.call(this, div);
  61449. var imgSrc = LogoBase64;
  61450. if (this.options.imageUrl) {
  61451. imgSrc = this.options.imageUrl;
  61452. }
  61453. var alt = this.options.alt;
  61454. var link = this.options.link;
  61455. var imageWidth = "94px";
  61456. var imageHeight = "29px";
  61457. var styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  61458. if (this.options.imageUrl) {
  61459. imageWidth = this.options.width;
  61460. imageHeight = this.options.height;
  61461. styleSize = "width:" + imageWidth + ";height:" + imageHeight + ";";
  61462. if (!imageWidth || !imageHeight) {
  61463. styleSize = "";
  61464. }
  61465. }
  61466. div.innerHTML = "<a href='" + link + "' target='_blank' style='border: none;display: block;'>" +
  61467. "<img src=" + imgSrc + " alt='" + alt + "' style='border: none;" + styleSize + "white-space: nowrap;margin-bottom: 2px'></a>";
  61468. return div;
  61469. }
  61470. /**
  61471. * @function ol.supermap.control.Logo.prototype.setDivStyle
  61472. * @description 设置对象 style。
  61473. * @param {HTMLElement} 待设置的 div。
  61474. */
  61475. function setDivStyle(div) {
  61476. var attributionsElem = document.getElementsByClassName('ol-attribution');
  61477. attributionsElem = attributionsElem && attributionsElem[0];
  61478. var attrHeight = attributionsElem && attributionsElem.clientHeight || 29;
  61479. div.style.bottom = (parseInt(attrHeight) + 6) + "px";
  61480. div.style.right = "4px";
  61481. div.style.marginTop = 0;
  61482. div.style.marginLeft = 0;
  61483. div.style.marginBottom = 0;
  61484. div.style.marginRight = 0;
  61485. var logoStyle = document.createElement('style');
  61486. logoStyle.type = 'text/css';
  61487. logoStyle.innerHTML = '.ol-control-logo,.ol-control-logo:hover {' +
  61488. 'background-color: rgba(255,255,255,0);' +
  61489. '}';
  61490. document.getElementsByTagName('head')[0].appendChild(logoStyle);
  61491. }
  61492. }
  61493. }
  61494. ;// CONCATENATED MODULE: ./src/openlayers/control/index.js
  61495. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61496. * This program are made available under the terms of the Apache License, Version 2.0
  61497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61498. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/StyleMap.js
  61499. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61500. * This program are made available under the terms of the Apache License, Version 2.0
  61501. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61502. /**
  61503. * @constant ol.supermap.pointMap
  61504. * @description 点图。
  61505. * @private
  61506. */
  61507. var pointMap = {
  61508. "point-file": "pointFile",
  61509. "point-fill": "fillStyle",
  61510. "point-radius": "pointRadius",
  61511. "point-halo-radius": "pointHaloRadius",
  61512. "point-halo-color": "pointHaloColor",
  61513. "point-dx": "offsetX",
  61514. "point-dy": "offsetY",
  61515. "point-opacity": "globalAlpha",
  61516. "point-comp-op": "globalCompositeOperation"
  61517. };
  61518. /**
  61519. * @constant ol.supermap.lineMap
  61520. * @description 线图。
  61521. * @private
  61522. */
  61523. var lineMap = {
  61524. "line-color": "strokeStyle",
  61525. "line-width": "lineWidth",
  61526. "line-cap": "lineCap",
  61527. "line-join": "lineJoin",
  61528. "line-miterlimit": "miterLimit",
  61529. "line-dash-offset": "lineDashOffset",
  61530. /*expand*/
  61531. "line-opacity": "strokeOpacity",
  61532. "line-dasharray": "lineDasharray",
  61533. "line-offset": "offset",
  61534. "line-comp-op": "globalCompositeOperation"
  61535. };
  61536. /**
  61537. * @constant ol.supermap.polygonMap
  61538. * @description 面图。
  61539. * @private
  61540. */
  61541. var polygonMap = {
  61542. /*包括LINE的部分,用以设置面的外围边界*/
  61543. "line-color": "strokeStyle",
  61544. "line-width": "lineWidth",
  61545. "line-cap": "lineCap",
  61546. "line-join": "lineJoin",
  61547. "line-miterlimit": "miterLimit",
  61548. "line-dash-offset": "lineDashOffset",
  61549. /*expand*/
  61550. "line-opacity": "strokeOpacity",
  61551. "line-dasharray": "lineDasharray",
  61552. /*以下为面的特性*/
  61553. "polygon-fill": "fillStyle",
  61554. "polygon-dx": "offsetX",
  61555. "polygon-dy": "offsetY",
  61556. "polygon-opacity": "fillOpacity",
  61557. "polygon-comp-op": "globalCompositeOperation"
  61558. };
  61559. /**
  61560. * @constant ol.supermap.StyleMap
  61561. * @description 地图样式。
  61562. */
  61563. var StyleMap = {
  61564. /**
  61565. * @constant ol.supermap.StyleMap.prototype.CartoStyleMap
  61566. * @description CartoCSS 中的 style 属性名与 Canvas 的 style 属性名的对应表
  61567. */
  61568. CartoStyleMap: {
  61569. "TEXT": {
  61570. //前两个属性值组成font
  61571. "text-size": "fontSize",
  61572. "text-face-name": "fontFamily",
  61573. "text-align": "textAlign",
  61574. "text-vertical-alignment": "textBaseline",
  61575. "text-horizontal-alignment": "textAlign",
  61576. /*expand*/
  61577. 'text-bold': 'bold',
  61578. 'text-weight': 'fontWeight',
  61579. "text-name": "textName",
  61580. "text-halo-radius": "haloRadius",
  61581. "text-halo-color": "backColor",
  61582. "text-fill": "foreColor",
  61583. "text-opacity": "globalAlpha",
  61584. "text-dx": "offsetX",
  61585. "text-dy": "offsetY",
  61586. "text-comp-op": "globalCompositeOperation"
  61587. },
  61588. /*expand*/
  61589. "POINT": pointMap,
  61590. "MULTIPOINT": pointMap,
  61591. "LINE": lineMap,
  61592. "LINESTRING": lineMap,
  61593. "MULTILINESTRING": lineMap,
  61594. "REGION": polygonMap,
  61595. "POLYGON": polygonMap,
  61596. "MULTIPOLYGON": polygonMap
  61597. },
  61598. /**
  61599. * @constant ol.supermap.StyleMap.prototype.ServerStyleMap
  61600. * @description 服务端传过来的 style 属性名与 Canvas 的 style 属性名的对应表。
  61601. */
  61602. ServerStyleMap: {
  61603. fillBackOpaque: {
  61604. canvasStyle: "",
  61605. type: "bool",
  61606. defaultValue: true
  61607. },
  61608. lineWidth: {
  61609. canvasStyle: "lineWidth",
  61610. type: "number",
  61611. unit: "mm",
  61612. defaultValue: 0.1
  61613. },
  61614. fillBackColor: {
  61615. canvasStyle: "",
  61616. type: "color",
  61617. defaultValue: "rgba(0,0,0,0)"
  61618. },
  61619. markerWidth: {
  61620. canvasStyle: "",
  61621. type: "number",
  61622. unit: "mm",
  61623. defaultValue: ""
  61624. },
  61625. markerAngle: {
  61626. canvasStyle: "",
  61627. type: "number",
  61628. unit: "degree",
  61629. defaultValue: ""
  61630. },
  61631. fillForeColor: {
  61632. canvasStyle: "fillStyle",
  61633. type: "color",
  61634. defaultValue: "rgba(0,0,0,0)"
  61635. },
  61636. foreColor: {
  61637. canvasStyle: "fillStyle",
  61638. type: "color",
  61639. defaultValue: "rgba(0,0,0,0)"
  61640. },
  61641. markerSize: {
  61642. canvasStyle: "markerSize",
  61643. type: "number",
  61644. unit: "mm",
  61645. defaultValue: 2.4
  61646. },
  61647. fillGradientOffsetRatioX: {
  61648. canvasStyle: "",
  61649. type: "number",
  61650. defaultValue: 0
  61651. },
  61652. fillGradientOffsetRatioY: {
  61653. canvasStyle: "",
  61654. type: "number",
  61655. defaultValue: 0
  61656. },
  61657. lineColor: {
  61658. canvasStyle: "strokeStyle",
  61659. type: "color",
  61660. defaultValue: "rgba(0,0,0,0)"
  61661. },
  61662. fillOpaqueRate: {
  61663. canvasStyle: "",
  61664. type: "number",
  61665. defaultValue: 100
  61666. },
  61667. markerHeight: {
  61668. canvasStyle: "",
  61669. type: "number",
  61670. unit: "mm",
  61671. defaultValue: 0
  61672. },
  61673. fillGradientMode: {
  61674. canvasStyle: "",
  61675. type: "string",
  61676. defaultValue: "NONE"
  61677. },
  61678. fillSymbolID: {
  61679. canvasStyle: "",
  61680. type: "number",
  61681. defaultValue: 0
  61682. },
  61683. fillGradientAngle: {
  61684. canvasStyle: "",
  61685. type: "number",
  61686. unit: "degree",
  61687. defaultValue: 0
  61688. },
  61689. markerSymbolID: {
  61690. canvasStyle: "",
  61691. type: "number",
  61692. defaultValue: 0
  61693. },
  61694. lineSymbolID: {
  61695. canvasStyle: "",
  61696. type: "number",
  61697. defaultValue: 0
  61698. }
  61699. },
  61700. /**
  61701. * @constant ol.supermap.StyleMap.prototype.CartoCompOpMap
  61702. * @description Canvas 中的 globalCompositeOperation 属性值与 CartoCSS 中的 CompOp 属性值对照表。
  61703. */
  61704. CartoCompOpMap: {
  61705. "clear": "",
  61706. "src": "",
  61707. "dst": "",
  61708. "src-over": "source-over",
  61709. "dst-over": "destination-over",
  61710. "src-in": "source-in",
  61711. "dst-in": "destination-in",
  61712. "src-out": "source-out",
  61713. "dst-out": "destination-out",
  61714. "src-atop": "source-atop",
  61715. "dst-atop": "destination-atop",
  61716. "xor": "xor",
  61717. "plus": "lighter",
  61718. "minus": "",
  61719. "multiply": "",
  61720. "screen": "",
  61721. "overlay": "",
  61722. "darken": "",
  61723. "lighten": "lighter",
  61724. "color-dodge": "",
  61725. "color-burn": "",
  61726. "hard-light": "",
  61727. "soft-light": "",
  61728. "difference": "",
  61729. "exclusion": "",
  61730. "contrast": "",
  61731. "invert": "",
  61732. "invert-rgb": "",
  61733. "grain-merge": "",
  61734. "grain-extract": "",
  61735. "hue": "",
  61736. "saturation": "",
  61737. "color": "",
  61738. "value": ""
  61739. }
  61740. };
  61741. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/DeafultCanvasStyle.js
  61742. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61743. * This program are made available under the terms of the Apache License, Version 2.0
  61744. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61745. /**
  61746. * @constant ol.supermap.pointStyle
  61747. * @description 点属性名的对应表。
  61748. * @private
  61749. */
  61750. var pointStyle = {
  61751. pointFile: "",
  61752. /*expand*/
  61753. pointRadius: 3,
  61754. pointHaloRadius: 1,
  61755. pointHaloColor: "#c33",
  61756. offsetX: 0,
  61757. offsetY: 0,
  61758. fillStyle: "#fc0",
  61759. globalAlpha: 1,
  61760. globalCompositeOperation: "source-over",
  61761. imageSmoothingEnabled: true
  61762. };
  61763. /**
  61764. * @constant ol.supermap.lineStyle
  61765. * @description 线属性名的对应表。
  61766. * @private
  61767. */
  61768. var lineStyle = {
  61769. strokeStyle: "rgba(0,0,0,0)",
  61770. lineWidth: 1,
  61771. lineCap: "butt",
  61772. lineJoin: "round",
  61773. miterLimit: 10,
  61774. lineDashOffset: 0,
  61775. /*expand*/
  61776. lineDasharray: [],
  61777. strokeOpacity: 1,
  61778. offset: 0,
  61779. globalAlpha: 1,
  61780. globalCompositeOperation: "source-over",
  61781. imageSmoothingEnabled: true
  61782. };
  61783. /**
  61784. * @constant ol.supermap.polygonStyle
  61785. * @description 面属性名的对应表。
  61786. * @private
  61787. */
  61788. var polygonStyle = {
  61789. /*包含LINE的部分*/
  61790. strokeStyle: "rgba(0,0,0,0)",
  61791. lineWidth: 1,
  61792. lineCap: "butt",
  61793. lineJoin: "round",
  61794. miterLimit: 10,
  61795. lineDashOffset: 0,
  61796. /*expand*/
  61797. lineOpacity: 1,
  61798. fillOpacity: 1,
  61799. lineDasharray: [],
  61800. fillStyle: "rgba(0,0,0,0)",
  61801. polygonOpacity: 1,
  61802. /*expand*/
  61803. offsetX: 0,
  61804. offsetY: 0,
  61805. globalAlpha: 1,
  61806. globalCompositeOperation: "source-over",
  61807. imageSmoothingEnabled: true
  61808. };
  61809. /**
  61810. * @constant ol.supermap.DeafultCanvasStyle
  61811. * @description 默认画布属性名的对应表。
  61812. * @private
  61813. */
  61814. var DeafultCanvasStyle = {
  61815. /**
  61816. * @constant ol.supermap.DeafultCanvasStyle.prototype.TEXT
  61817. * @description 默认文本样式。
  61818. */
  61819. "TEXT": {
  61820. font: "10px sans-serif",
  61821. textAlign: "middle",
  61822. textBaseline: "center",
  61823. direction: "ltr",
  61824. /*expand*/
  61825. bold: false,
  61826. haloRadius: 0,
  61827. backColor: "rgba(255,255,255,1)",
  61828. foreColor: "rgba(0,0,0,1)",
  61829. // foreColor: "rgba(0,0,0,0)",
  61830. offsetX: 0,
  61831. offsetY: 0,
  61832. textHeight: 0,
  61833. globalAlpha: 1,
  61834. globalCompositeOperation: "source-over",
  61835. imageSmoothingEnabled: true
  61836. },
  61837. "POINT": pointStyle,
  61838. "MULTIPOINT": pointStyle,
  61839. "LINE": lineStyle,
  61840. "LINESTRING": lineStyle,
  61841. "MULTILINESTRING": lineStyle,
  61842. "REGION": polygonStyle,
  61843. "POLYGON": polygonStyle,
  61844. "MULTIPOLYGON": polygonStyle,
  61845. "SHADOW": {
  61846. shadowBlur: 0,
  61847. shadowColor: "rgba(0,0,0,0)",
  61848. shadowOffsetX: 0,
  61849. shadowOffsetY: 0
  61850. },
  61851. "GLOBAL": {
  61852. globalAlpha: 1,
  61853. globalCompositeOperation: "source-over",
  61854. imageSmoothingEnabled: true
  61855. }
  61856. };
  61857. ;// CONCATENATED MODULE: external "ol.geom.Point"
  61858. const external_ol_geom_Point_namespaceObject = ol.geom.Point;
  61859. var external_ol_geom_Point_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Point_namespaceObject);
  61860. ;// CONCATENATED MODULE: external "ol.format.GeoJSON"
  61861. const external_ol_format_GeoJSON_namespaceObject = ol.format.GeoJSON;
  61862. var external_ol_format_GeoJSON_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_GeoJSON_namespaceObject);
  61863. ;// CONCATENATED MODULE: ./src/openlayers/services/QueryService.js
  61864. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  61865. * This program are made available under the terms of the Apache License, Version 2.0
  61866. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  61867. /**
  61868. * @class ol.supermap.QueryService
  61869. * @category iServer Map QueryResults
  61870. * @classdesc 地图查询服务类。
  61871. * 提供:范围查询,SQL 查询,几何查询,距离查询。
  61872. * @extends {ol.supermap.ServiceBase}
  61873. * @param {string} url - 地图查询服务访问地址。
  61874. * @param {Object} options - 参数。
  61875. * @param {string} [options.proxy] - 服务代理地址。
  61876. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  61877. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  61878. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  61879. * @param {Object} [options.headers] - 请求头。
  61880. * @example
  61881. * new ol.supermap.QueryService(url)
  61882. * .queryByBounds(param,function(result){
  61883. * //doSomething
  61884. * })
  61885. */
  61886. class QueryService_QueryService extends ServiceBase {
  61887. constructor(url, options) {
  61888. super(url, options);
  61889. }
  61890. /**
  61891. * @function ol.supermap.QueryService.prototype.queryByBounds
  61892. * @description bounds 查询地图服务。
  61893. * @param {SuperMap.QueryByBoundsParameters} params - 通过 bounds 查询的相关参数类。
  61894. * @param {RequestCallback} callback - 回调函数。
  61895. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  61896. * @returns {ol.supermap.QueryService}
  61897. */
  61898. queryByBounds(params, callback, resultFormat) {
  61899. var me = this;
  61900. var queryService = new QueryByBoundsService(me.url, {
  61901. proxy: me.options.proxy,
  61902. withCredentials: me.options.withCredentials,
  61903. crossOrigin: me.options.crossOrigin,
  61904. headers: me.options.headers,
  61905. serverType: me.options.serverType,
  61906. eventListeners: {
  61907. scope: me,
  61908. processCompleted: callback,
  61909. processFailed: callback
  61910. },
  61911. format: me._processFormat(resultFormat)
  61912. });
  61913. queryService.processAsync(me._processParams(params));
  61914. }
  61915. /**
  61916. * @function ol.supermap.QueryService.prototype.queryByDistance
  61917. * @description 地图距离查询服务。
  61918. * @param {SuperMap.QueryByDistanceParameters} params - Distance 查询相关参数类。
  61919. * @param {RequestCallback} callback 回调函数。
  61920. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  61921. */
  61922. queryByDistance(params, callback, resultFormat) {
  61923. var me = this;
  61924. var queryByDistanceService = new QueryByDistanceService(me.url, {
  61925. proxy: me.options.proxy,
  61926. withCredentials: me.options.withCredentials,
  61927. crossOrigin: me.options.crossOrigin,
  61928. headers: me.options.headers,
  61929. serverType: me.options.serverType,
  61930. eventListeners: {
  61931. scope: me,
  61932. processCompleted: callback,
  61933. processFailed: callback
  61934. },
  61935. format: me._processFormat(resultFormat)
  61936. });
  61937. queryByDistanceService.processAsync(me._processParams(params));
  61938. }
  61939. /**
  61940. * @function ol.supermap.QueryService.prototype.queryBySQL
  61941. * @description 地图 SQL 查询服务。
  61942. * @param {SuperMap.QueryBySQLParameters} params - SQL 查询相关参数类。
  61943. * @param {RequestCallback} callback 回调函数。
  61944. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  61945. */
  61946. queryBySQL(params, callback, resultFormat) {
  61947. var me = this;
  61948. var queryBySQLService = new QueryBySQLService(me.url, {
  61949. proxy: me.options.proxy,
  61950. withCredentials: me.options.withCredentials,
  61951. crossOrigin: me.options.crossOrigin,
  61952. headers: me.options.headers,
  61953. serverType: me.options.serverType,
  61954. eventListeners: {
  61955. scope: me,
  61956. processCompleted: callback,
  61957. processFailed: callback
  61958. },
  61959. format: me._processFormat(resultFormat)
  61960. });
  61961. queryBySQLService.processAsync(me._processParams(params));
  61962. }
  61963. /**
  61964. * @function ol.supermap.QueryService.prototype.queryByGeometry
  61965. * @description 地图几何查询服务。
  61966. * @param {SuperMap.QueryByGeometryParameters} params - Geometry 查询相关参数类。
  61967. * @param {RequestCallback} callback 回调函数。
  61968. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  61969. */
  61970. queryByGeometry(params, callback, resultFormat) {
  61971. var me = this;
  61972. var queryByGeometryService = new QueryByGeometryService(me.url, {
  61973. proxy: me.options.proxy,
  61974. withCredentials: me.options.withCredentials,
  61975. crossOrigin: me.options.crossOrigin,
  61976. headers: me.options.headers,
  61977. serverType: me.options.serverType,
  61978. eventListeners: {
  61979. scope: me,
  61980. processCompleted: callback,
  61981. processFailed: callback
  61982. },
  61983. format: me._processFormat(resultFormat)
  61984. });
  61985. queryByGeometryService.processAsync(me._processParams(params));
  61986. }
  61987. _processParams(params) {
  61988. if (!params) {
  61989. return {};
  61990. }
  61991. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  61992. if (params.queryParams && !core_Util_Util.isArray(params.queryParams)) {
  61993. params.queryParams = [params.queryParams];
  61994. }
  61995. if (params.bounds) {
  61996. params.bounds = new Bounds(
  61997. params.bounds[0],
  61998. params.bounds[1],
  61999. params.bounds[2],
  62000. params.bounds[3]
  62001. );
  62002. }
  62003. if (params.geometry) {
  62004. if (params.geometry instanceof (external_ol_geom_Point_default())) {
  62005. params.geometry = new Point(params.geometry.getCoordinates()[0], params.geometry.getCoordinates()[1]);
  62006. } else {
  62007. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(params.geometry)));
  62008. }
  62009. }
  62010. return params;
  62011. }
  62012. _processFormat(resultFormat) {
  62013. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  62014. }
  62015. }
  62016. ;// CONCATENATED MODULE: ./src/openlayers/services/FeatureService.js
  62017. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62018. * This program are made available under the terms of the Apache License, Version 2.0
  62019. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62020. /**
  62021. * @class ol.supermap.FeatureService
  62022. * @constructs ol.supermap.FeatureService
  62023. * @category iServer Data Feature
  62024. * @classdesc 数据集类。提供:ID 查询,范围查询,SQL查询,几何查询,bounds 查询,缓冲区查询,地物编辑。
  62025. * @example
  62026. * new ol.supermap.FeatureService(url)
  62027. * .getFeaturesByIDs(param,function(result){
  62028. * //doSomething
  62029. * })
  62030. * @param {string} url - 与客户端交互的服务地址。
  62031. * @param {Object} options - 参数。
  62032. * @param {string} [options.proxy] - 服务代理地址。
  62033. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  62034. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  62035. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  62036. * @param {Object} [options.headers] - 请求头。
  62037. * @extends {ol.supermap.ServiceBase}
  62038. */
  62039. class FeatureService extends ServiceBase {
  62040. constructor(url, options) {
  62041. super(url, options);
  62042. }
  62043. /**
  62044. * @function ol.supermap.FeatureService.prototype.getFeaturesByIDs
  62045. * @description 数据集 ID 查询服务。
  62046. * @param {SuperMap.GetFeaturesByIDsParameters} params - 查询所需参数类。
  62047. * @param {RequestCallback} callback - 回调函数。
  62048. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  62049. */
  62050. getFeaturesByIDs(params, callback, resultFormat) {
  62051. var me = this;
  62052. var getFeaturesByIDsService = new GetFeaturesByIDsService(me.url, {
  62053. proxy: me.options.proxy,
  62054. withCredentials: me.options.withCredentials,
  62055. crossOrigin: me.options.crossOrigin,
  62056. headers: me.options.headers,
  62057. serverType: me.options.serverType,
  62058. eventListeners: {
  62059. processCompleted: callback,
  62060. processFailed: callback
  62061. },
  62062. format: me._processFormat(resultFormat)
  62063. });
  62064. getFeaturesByIDsService.processAsync(me._processParams(params));
  62065. }
  62066. /**
  62067. * @function ol.supermap.FeatureService.prototype.getFeaturesByBounds
  62068. * @description 数据集 Bounds 查询服务。
  62069. * @param {SuperMap.GetFeaturesByBoundsParameters} params - 查询所需参数类。
  62070. * @param {RequestCallback} callback - 回调函数。
  62071. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  62072. */
  62073. getFeaturesByBounds(params, callback, resultFormat) {
  62074. var me = this;
  62075. var getFeaturesByBoundsService = new GetFeaturesByBoundsService(me.url, {
  62076. proxy: me.options.proxy,
  62077. withCredentials: me.options.withCredentials,
  62078. crossOrigin: me.options.crossOrigin,
  62079. headers: me.options.headers,
  62080. serverType: me.options.serverType,
  62081. eventListeners: {
  62082. processCompleted: callback,
  62083. processFailed: callback
  62084. },
  62085. format: me._processFormat(resultFormat)
  62086. });
  62087. getFeaturesByBoundsService.processAsync(me._processParams(params));
  62088. }
  62089. /**
  62090. * @function ol.supermap.FeatureService.prototype.getFeaturesByBuffer
  62091. * @description 数据集 Buffer 查询服务。
  62092. * @param {SuperMap.GetFeaturesByBufferParameters} params - 查询所需参数类。
  62093. * @param {RequestCallback} callback - 回调函数。
  62094. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  62095. */
  62096. getFeaturesByBuffer(params, callback, resultFormat) {
  62097. var me = this;
  62098. var getFeatureService = new GetFeaturesByBufferService(me.url, {
  62099. proxy: me.options.proxy,
  62100. withCredentials: me.options.withCredentials,
  62101. crossOrigin: me.options.crossOrigin,
  62102. headers: me.options.headers,
  62103. serverType: me.options.serverType,
  62104. eventListeners: {
  62105. processCompleted: callback,
  62106. processFailed: callback
  62107. },
  62108. format: me._processFormat(resultFormat)
  62109. });
  62110. getFeatureService.processAsync(me._processParams(params));
  62111. }
  62112. /**
  62113. * @function ol.supermap.FeatureService.prototype.getFeaturesBySQL
  62114. * @description 数据集 SQL 查询服务。
  62115. * @param {SuperMap.GetFeaturesBySQLParameters} params - 查询所需参数类。
  62116. * @param {RequestCallback} callback - 回调函数。
  62117. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  62118. */
  62119. getFeaturesBySQL(params, callback, resultFormat) {
  62120. var me = this;
  62121. var getFeatureBySQLService = new GetFeaturesBySQLService(me.url, {
  62122. proxy: me.options.proxy,
  62123. withCredentials: me.options.withCredentials,
  62124. crossOrigin: me.options.crossOrigin,
  62125. headers: me.options.headers,
  62126. serverType: me.options.serverType,
  62127. eventListeners: {
  62128. processCompleted: callback,
  62129. processFailed: callback
  62130. },
  62131. format: me._processFormat(resultFormat)
  62132. });
  62133. getFeatureBySQLService.processAsync(me._processParams(params));
  62134. }
  62135. /**
  62136. * @function ol.supermap.FeatureService.prototype.getFeaturesByGeometry
  62137. * @description 数据集几何查询服务类。
  62138. * @param {SuperMap.GetFeaturesByGeometryParameters} params - 查询所需参数类。
  62139. * @param {RequestCallback} callback - 回调函数。
  62140. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的数据格式。
  62141. */
  62142. getFeaturesByGeometry(params, callback, resultFormat) {
  62143. var me = this;
  62144. var getFeaturesByGeometryService = new GetFeaturesByGeometryService(me.url, {
  62145. proxy: me.options.proxy,
  62146. withCredentials: me.options.withCredentials,
  62147. crossOrigin: me.options.crossOrigin,
  62148. headers: me.options.headers,
  62149. serverType: me.options.serverType,
  62150. eventListeners: {
  62151. processCompleted: callback,
  62152. processFailed: callback
  62153. },
  62154. format: me._processFormat(resultFormat)
  62155. });
  62156. getFeaturesByGeometryService.processAsync(me._processParams(params));
  62157. }
  62158. /**
  62159. * @function ol.supermap.FeatureService.prototype.editFeatures
  62160. * @description 地物编辑服务。
  62161. * @param {SuperMap.EditFeaturesParameters} params - 查询所需参数类。
  62162. * @param {RequestCallback} callback - 回调函数。
  62163. */
  62164. editFeatures(params, callback) {
  62165. if (!params || !params.dataSourceName || !params.dataSetName) {
  62166. return;
  62167. }
  62168. var me = this,
  62169. url = me.url,
  62170. dataSourceName = params.dataSourceName,
  62171. dataSetName = params.dataSetName;
  62172. url = Util.urlPathAppend(url, "datasources/" + dataSourceName + "/datasets/" + dataSetName);
  62173. var editFeatureService = new EditFeaturesService(url, {
  62174. proxy: me.options.proxy,
  62175. withCredentials: me.options.withCredentials,
  62176. crossOrigin: me.options.crossOrigin,
  62177. headers: me.options.headers,
  62178. serverType: me.options.serverType,
  62179. eventListeners: {
  62180. processCompleted: callback,
  62181. processFailed: callback
  62182. }
  62183. });
  62184. editFeatureService.processAsync(me._processParams(params));
  62185. }
  62186. _processParams(params) {
  62187. if (!params) {
  62188. return {};
  62189. }
  62190. var me = this;
  62191. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  62192. params.fromIndex = params.fromIndex ? params.fromIndex : 0;
  62193. params.toIndex = params.toIndex ? params.toIndex : -1;
  62194. if (params.bounds) {
  62195. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  62196. }
  62197. if (params.geometry) {
  62198. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(params.geometry)));
  62199. }
  62200. if (params.editType) {
  62201. params.editType = params.editType.toLowerCase();
  62202. }
  62203. if (params.features) {
  62204. var features = [];
  62205. if (core_Util_Util.isArray(params.features)) {
  62206. params.features.map(function (feature) {
  62207. features.push(me._createServerFeature(feature));
  62208. return feature;
  62209. });
  62210. } else {
  62211. features.push(me._createServerFeature(params.features));
  62212. }
  62213. params.features = features;
  62214. }
  62215. return params;
  62216. }
  62217. _createServerFeature(geoFeature) {
  62218. var feature = {},
  62219. fieldNames = [],
  62220. fieldValues = [];
  62221. var properties = geoFeature.getProperties();
  62222. for (var key in properties) {
  62223. if (key === geoFeature.getGeometryName()) {
  62224. continue;
  62225. }
  62226. fieldNames.push(key);
  62227. fieldValues.push(properties[key]);
  62228. }
  62229. feature.fieldNames = fieldNames;
  62230. feature.fieldValues = fieldValues;
  62231. if (geoFeature.getId()) {
  62232. feature.id = geoFeature.getId();
  62233. }
  62234. feature.geometry = core_Util_Util.toSuperMapGeometry((new (external_ol_format_GeoJSON_default())()).writeFeatureObject(geoFeature));
  62235. return feature;
  62236. }
  62237. _processFormat(resultFormat) {
  62238. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  62239. }
  62240. }
  62241. ;// CONCATENATED MODULE: external "ol.util"
  62242. const external_ol_util_namespaceObject = ol.util;
  62243. ;// CONCATENATED MODULE: external "ol.geom.Geometry"
  62244. const external_ol_geom_Geometry_namespaceObject = ol.geom.Geometry;
  62245. var external_ol_geom_Geometry_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Geometry_namespaceObject);
  62246. ;// CONCATENATED MODULE: external "ol.render"
  62247. const external_ol_render_namespaceObject = ol.render;
  62248. ;// CONCATENATED MODULE: external "ol.source.Vector"
  62249. const external_ol_source_Vector_namespaceObject = ol.source.Vector;
  62250. var external_ol_source_Vector_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_Vector_namespaceObject);
  62251. ;// CONCATENATED MODULE: external "ol.layer.Vector"
  62252. const external_ol_layer_Vector_namespaceObject = ol.layer.Vector;
  62253. var external_ol_layer_Vector_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Vector_namespaceObject);
  62254. ;// CONCATENATED MODULE: external "ol.style"
  62255. const external_ol_style_namespaceObject = ol.style;
  62256. ;// CONCATENATED MODULE: external "ol.Feature"
  62257. const external_ol_Feature_namespaceObject = ol.Feature;
  62258. var external_ol_Feature_default = /*#__PURE__*/__webpack_require__.n(external_ol_Feature_namespaceObject);
  62259. ;// CONCATENATED MODULE: ./src/openlayers/core/Util.js
  62260. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62261. * This program are made available under the terms of the Apache License, Version 2.0
  62262. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62263. /**
  62264. * @class ol.supermap.Util
  62265. * @category BaseTypes Util
  62266. * @classdesc 工具类。
  62267. */
  62268. class core_Util_Util {
  62269. constructor() {}
  62270. static getOlVersion() {
  62271. if (external_ol_util_namespaceObject && external_ol_util_namespaceObject.VERSION) {
  62272. return external_ol_util_namespaceObject.VERSION.split('.')[0];
  62273. }
  62274. if (window && window.ol) {
  62275. if (window.ol.util) {
  62276. return '6';
  62277. }
  62278. if (window.ol.WebGLMap) {
  62279. return '5';
  62280. }
  62281. }
  62282. return '4';
  62283. }
  62284. /**
  62285. * @function ol.supermap.Util.toGeoJSON
  62286. * @description 将传入对象转为 GeoJSON 格式。
  62287. * @param {Object} smObj - 待转参数。
  62288. */
  62289. static toGeoJSON(smObj) {
  62290. if (!smObj) {
  62291. return null;
  62292. }
  62293. return new GeoJSON().toGeoJSON(smObj);
  62294. }
  62295. /**
  62296. * @function ol.supermap.Util.toSuperMapGeometry
  62297. * @description 将 GeoJSON 对象转为 SuperMap 几何图形。
  62298. * @param {GeoJSONObject} geoJSON - GeoJSON 对象。
  62299. */
  62300. static toSuperMapGeometry(geoJSON) {
  62301. if (!geoJSON || !geoJSON.type) {
  62302. return null;
  62303. }
  62304. const result = new GeoJSON().read(geoJSON, 'FeatureCollection');
  62305. return result[0].geometry;
  62306. }
  62307. /**
  62308. * @function ol.supermap.Util.resolutionToScale
  62309. * @description 通过分辨率计算比例尺。
  62310. * @param {number} resolution - 分辨率。
  62311. * @param {number} dpi - 屏幕分辨率。
  62312. * @param {string} mapUnit - 地图单位。
  62313. * @returns {number} 比例尺。
  62314. */
  62315. static resolutionToScale(resolution, dpi, mapUnit) {
  62316. const inchPerMeter = 1 / 0.0254;
  62317. // 地球半径。
  62318. const meterPerMapUnit = this.getMeterPerMapUnit(mapUnit);
  62319. const scale = 1 / (resolution * dpi * inchPerMeter * meterPerMapUnit);
  62320. return scale;
  62321. }
  62322. /**
  62323. * @function ol.supermap.Util.toSuperMapBounds
  62324. * @description 转为 SuperMapBounds 格式。
  62325. * @param {Array.<number>} bounds - bounds 数组。
  62326. * @returns {SuperMap.Bounds} 返回 SuperMap 的 Bounds 对象。
  62327. */
  62328. static toSuperMapBounds(bounds) {
  62329. return new Bounds(bounds[0], bounds[1], bounds[2], bounds[3]);
  62330. }
  62331. /**
  62332. * @function ol.supermap.Util.toProcessingParam
  62333. * @description 将 Region 节点数组转为 Processing 服务需要的分析参数。
  62334. * @param {Array} points - Region 各个节点数组。
  62335. * @returns processing 服务裁剪、查询分析的分析参数。
  62336. */
  62337. static toProcessingParam(points) {
  62338. if (points.length < 1) {
  62339. return '';
  62340. }
  62341. const geometryParam = {};
  62342. const results = [];
  62343. for (let i = 0; i < points.length; i++) {
  62344. const point = { x: points[i][0], y: points[i][1] };
  62345. results.push(point);
  62346. }
  62347. results.push(results[0]);
  62348. geometryParam.type = 'REGION';
  62349. geometryParam.points = results;
  62350. return geometryParam;
  62351. }
  62352. /**
  62353. * @function ol.supermap.Util.scaleToResolution
  62354. * @description 通过比例尺计算分辨率。
  62355. * @param {number} scale - 比例尺。
  62356. * @param {number} dpi - 屏幕分辨率。
  62357. * @param {string} mapUnit - 地图单位。
  62358. * @returns {number} 分辨率。
  62359. */
  62360. static scaleToResolution(scale, dpi, mapUnit) {
  62361. const inchPerMeter = 1 / 0.0254;
  62362. const meterPerMapUnitValue = this.getMeterPerMapUnit(mapUnit);
  62363. const resolution = 1 / (scale * dpi * inchPerMeter * meterPerMapUnitValue);
  62364. return resolution;
  62365. }
  62366. /**
  62367. * @private
  62368. * @function ol.supermap.Util.getMeterPerMapUnit
  62369. * @description 获取每地图单位多少米。
  62370. * @param {string} mapUnit - 地图单位。
  62371. * @returns {number} 返回每地图单位多少米。
  62372. */
  62373. static getMeterPerMapUnit(mapUnit) {
  62374. const earchRadiusInMeters = 6378137;
  62375. let meterPerMapUnit;
  62376. if (mapUnit === REST_Unit.METER) {
  62377. meterPerMapUnit = 1;
  62378. } else if (mapUnit === REST_Unit.DEGREE) {
  62379. // 每度表示多少米。
  62380. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  62381. } else if (mapUnit === REST_Unit.KILOMETER) {
  62382. meterPerMapUnit = 1.0e-3;
  62383. } else if (mapUnit === REST_Unit.INCH) {
  62384. meterPerMapUnit = 1 / 2.5399999918e-2;
  62385. } else if (mapUnit === REST_Unit.FOOT) {
  62386. meterPerMapUnit = 0.3048;
  62387. } else {
  62388. return meterPerMapUnit;
  62389. }
  62390. return meterPerMapUnit;
  62391. }
  62392. /**
  62393. * @function ol.supermap.Util.isArray
  62394. * @description 判断是否为数组格式。
  62395. * @param {Object} obj - 待判断对象。
  62396. * @returns {boolean} 是否是数组。
  62397. */
  62398. static isArray(obj) {
  62399. return Object.prototype.toString.call(obj) === '[object Array]';
  62400. }
  62401. /**
  62402. * @function ol.supermap.Util.Csv2GeoJSON
  62403. * @description 将 csv 格式转为 GeoJSON。
  62404. * @param {Object} csv - csv 对象。
  62405. * @param {Object} options - 转换参数。
  62406. */
  62407. static Csv2GeoJSON(csv, options) {
  62408. const defaultOptions = {
  62409. titles: ['lon', 'lat'],
  62410. latitudeTitle: 'lat',
  62411. longitudeTitle: 'lon',
  62412. fieldSeparator: ',',
  62413. lineSeparator: '\n',
  62414. deleteDoubleQuotes: true,
  62415. firstLineTitles: false
  62416. };
  62417. options = options || defaultOptions;
  62418. const _propertiesNames = [];
  62419. if (typeof csv === 'string') {
  62420. let titulos = options.titles;
  62421. if (options.firstLineTitles) {
  62422. csv = csv.split(options.lineSeparator);
  62423. if (csv.length < 2) {
  62424. return;
  62425. }
  62426. titulos = csv[0];
  62427. csv.splice(0, 1);
  62428. csv = csv.join(options.lineSeparator);
  62429. titulos = titulos.trim().split(options.fieldSeparator);
  62430. for (let i = 0; i < titulos.length; i++) {
  62431. titulos[i] = _deleteDoubleQuotes(titulos[i]);
  62432. }
  62433. options.titles = titulos;
  62434. }
  62435. for (let i = 0; i < titulos.length; i++) {
  62436. let prop = titulos[i]
  62437. .toLowerCase()
  62438. .replace(/[^\w ]+/g, '')
  62439. .replace(/ +/g, '_');
  62440. if (prop === '' || prop === '_') {
  62441. prop = `prop-${i}`;
  62442. }
  62443. _propertiesNames[i] = prop;
  62444. }
  62445. csv = _csv2json(csv);
  62446. }
  62447. return csv;
  62448. function _deleteDoubleQuotes(cadena) {
  62449. if (options.deleteDoubleQuotes) {
  62450. cadena = cadena.trim().replace(/^"/, '').replace(/"$/, '');
  62451. }
  62452. return cadena;
  62453. }
  62454. function _csv2json(csv) {
  62455. const json = {};
  62456. json['type'] = 'FeatureCollection';
  62457. json['features'] = [];
  62458. const titulos = options.titles;
  62459. csv = csv.split(options.lineSeparator);
  62460. for (let num_linea = 0; num_linea < csv.length; num_linea++) {
  62461. const campos = csv[num_linea].trim().split(options.fieldSeparator),
  62462. lng = parseFloat(campos[titulos.indexOf(options.longitudeTitle)]),
  62463. lat = parseFloat(campos[titulos.indexOf(options.latitudeTitle)]);
  62464. const isInRange = lng < 180 && lng > -180 && lat < 90 && lat > -90;
  62465. if (!(campos.length === titulos.length && isInRange)) {
  62466. continue;
  62467. }
  62468. const feature = {};
  62469. feature['type'] = 'Feature';
  62470. feature['geometry'] = {};
  62471. feature['properties'] = {};
  62472. feature['geometry']['type'] = 'Point';
  62473. feature['geometry']['coordinates'] = [lng, lat];
  62474. for (let i = 0; i < titulos.length; i++) {
  62475. if (titulos[i] !== options.latitudeTitle && titulos[i] !== options.longitudeTitle) {
  62476. feature['properties'][_propertiesNames[i]] = _deleteDoubleQuotes(campos[i]);
  62477. }
  62478. }
  62479. json['features'].push(feature);
  62480. }
  62481. return json;
  62482. }
  62483. }
  62484. /**
  62485. * @function ol.supermap.Util.createCanvasContext2D
  62486. * @description 创建 2D 画布。
  62487. * @param {number} opt_width - 画布宽度。
  62488. * @param {number} opt_height - 画布高度。
  62489. */
  62490. static createCanvasContext2D(opt_width, opt_height) {
  62491. const canvas = document.createElement('CANVAS');
  62492. if (opt_width) {
  62493. canvas.width = opt_width;
  62494. }
  62495. if (opt_height) {
  62496. canvas.height = opt_height;
  62497. }
  62498. return canvas.getContext('2d');
  62499. }
  62500. /**
  62501. * @function ol.supermap.Util.supportWebGL2
  62502. * @description 是否支持 webgl2。
  62503. */
  62504. static supportWebGL2() {
  62505. const canvas = document.createElement('canvas');
  62506. return Boolean(canvas && canvas.getContext('webgl2'));
  62507. }
  62508. /**
  62509. * @function ol.supermap.Util.isString
  62510. * @description 是否为字符串
  62511. * @param {string} str - 需要判断的内容
  62512. * @returns {boolean}
  62513. */
  62514. static isString(str) {
  62515. return typeof str === 'string' && str.constructor === String;
  62516. }
  62517. /**
  62518. * @function ol.supermap.Util.isObject
  62519. * @description 是否为对象
  62520. * @param {any} obj - 需要判断的内容
  62521. * @returns {boolean}
  62522. */
  62523. static isObject(obj) {
  62524. return Object.prototype.toString.call(obj) === '[object Object]';
  62525. }
  62526. /**
  62527. * @function ol.supermap.Util.trim
  62528. * @description 字符串裁剪两边的空格
  62529. * @param {string} str - 需要裁剪的字符串
  62530. * @returns {boolean}
  62531. */
  62532. static trim(str = '') {
  62533. return str.replace(/(^\s*)|(\s*$)/g, '');
  62534. }
  62535. /**
  62536. * @function ol.supermap.Util.newGuid
  62537. * @description 随机生成id
  62538. * @param {string} attr - 几位数字的id
  62539. * @returns {string}
  62540. */
  62541. static newGuid(attr) {
  62542. let len = attr || 32;
  62543. let guid = '';
  62544. for (let i = 1; i < len; i++) {
  62545. let n = Math.floor(Math.random() * 16.0).toString(16);
  62546. guid += n;
  62547. }
  62548. return guid;
  62549. }
  62550. /**
  62551. * @function ol.supermap.Util.isNumber
  62552. * @description 检测数据是否为number
  62553. * @param {string} value - 值,未知数据类型
  62554. * @returns {boolean}
  62555. */
  62556. static isNumber(value) {
  62557. if (value === '') {
  62558. return false;
  62559. }
  62560. let mdata = Number(value);
  62561. if (mdata === 0) {
  62562. return true;
  62563. }
  62564. return !isNaN(mdata);
  62565. }
  62566. /**
  62567. * @function ol.supermap.Util.getFeatureBySQL
  62568. * @description 获取feature
  62569. * @param {string} url - 获取feature的请求地址
  62570. * @param {string} datasetNames - 数据集名称
  62571. * @param {object} serviceOptions - 服务类需要的参数
  62572. * @param {function} processCompleted - 成功请求的回调函数
  62573. * @param {function} processFaild - 失败请求的回调函数
  62574. * @param {string | number} targetEpsgCode - 动态投影的目标坐标系对应的 EPSG Code
  62575. */
  62576. static getFeatureBySQL(url, datasetNames, serviceOptions, processCompleted, processFaild, targetEpsgCode) {
  62577. let getFeatureParam = new FilterParameter({
  62578. name: datasetNames.join().replace(':', '@')
  62579. // attributeFilter: 'SMID > 0' // shp第三方发布的数据没有SMID字段,http://yt.ispeco.com:8099/issue/DV-131
  62580. }),
  62581. getFeatureBySQLParams = new GetFeaturesBySQLParameters({
  62582. queryParameter: getFeatureParam,
  62583. datasetNames: datasetNames,
  62584. fromIndex: 0,
  62585. toIndex: 100000,
  62586. maxFeatures: 100000,
  62587. returnContent: true,
  62588. targetEpsgCode
  62589. }),
  62590. callback = (serviceResult) => {
  62591. if (serviceResult.type === 'processCompleted') {
  62592. processCompleted && processCompleted(serviceResult);
  62593. } else {
  62594. processFaild && processFaild(serviceResult);
  62595. }
  62596. };
  62597. new FeatureService(url, serviceOptions).getFeaturesBySQL(getFeatureBySQLParams, callback);
  62598. }
  62599. static queryFeatureBySQL(
  62600. url,
  62601. layerName,
  62602. attributeFilter,
  62603. fields,
  62604. epsgCode,
  62605. processCompleted,
  62606. processFaild,
  62607. startRecord,
  62608. recordLength,
  62609. onlyAttribute
  62610. ) {
  62611. const queryParam = new FilterParameter({
  62612. name: layerName,
  62613. attributeFilter: attributeFilter
  62614. });
  62615. if (fields) {
  62616. queryParam.fields = fields;
  62617. }
  62618. const params = {
  62619. queryParams: [queryParam]
  62620. };
  62621. if (onlyAttribute) {
  62622. params.queryOption = QueryOption.ATTRIBUTE;
  62623. }
  62624. startRecord && (params.startRecord = startRecord);
  62625. recordLength && (params.expectCount = recordLength);
  62626. if (epsgCode) {
  62627. params.prjCoordSys = {
  62628. epsgCode: epsgCode
  62629. };
  62630. }
  62631. const queryBySQLParams = new QueryBySQLParameters(params);
  62632. const queryBySQLService = new QueryService_QueryService(url);
  62633. queryBySQLService.queryBySQL(queryBySQLParams, function (data) {
  62634. data.type === 'processCompleted' ? processCompleted(data) : processFaild(data);
  62635. });
  62636. }
  62637. /**
  62638. * @function ol.supermap.Util.getFeatureProperties
  62639. * @description 从feature中获取properties
  62640. * @param {array} features 要素数组
  62641. * @returns {array} 属性
  62642. */
  62643. static getFeatureProperties(features) {
  62644. let properties = [];
  62645. if (core_Util_Util.isArray(features) && features.length) {
  62646. features.forEach((feature) => {
  62647. let property = feature.get('attributes');
  62648. property && properties.push(property);
  62649. });
  62650. }
  62651. return properties;
  62652. }
  62653. /**
  62654. * @function ol.supermap.Util.isMatchAdministrativeName
  62655. * @param {string} featureName 原始数据中的地名
  62656. * @param {string} fieldName 需要匹配的地名
  62657. * @returns {boolean} 是否匹配
  62658. */
  62659. static isMatchAdministrativeName(featureName, fieldName) {
  62660. if (core_Util_Util.isString(fieldName)) {
  62661. let shortName = featureName.substr(0, 2);
  62662. // 张家口市和张家界市 特殊处理
  62663. if (shortName === '张家') {
  62664. shortName = featureName.substr(0, 3);
  62665. }
  62666. return !!fieldName.match(new RegExp(shortName));
  62667. }
  62668. return false;
  62669. }
  62670. /**
  62671. * @function ol.supermap.Util.getHighestMatchAdministration
  62672. * @param {string} featureName 初始匹配的要素数组
  62673. * @param {string} fieldName 要匹配的地名
  62674. * @returns {boolean} 是否匹配
  62675. */
  62676. static getHighestMatchAdministration(features, fieldName) {
  62677. let filterFeatures = features.filter(item => {
  62678. return core_Util_Util.isMatchAdministrativeName(item.properties.Name, fieldName);
  62679. })
  62680. let maxMatchPercent = 0, maxMatchFeature = null;
  62681. filterFeatures.forEach(feature => {
  62682. let count = 0;
  62683. Array.from(new Set(feature.properties.Name.split(''))).forEach((char) => {
  62684. if (fieldName.includes(char)) {
  62685. count++;
  62686. }
  62687. });
  62688. if (count > maxMatchPercent) {
  62689. maxMatchPercent = count;
  62690. maxMatchFeature = feature;
  62691. }
  62692. });
  62693. return maxMatchFeature;
  62694. }
  62695. /**
  62696. * @function ol.supermap.Util.setMask
  62697. * @description 为图层设置掩膜。
  62698. * @version 10.1.0
  62699. * @param {ol/layer/Layer|Array.<ol/layer/Layer>} layers 图层
  62700. * @param {ol/geom/Geometry|ol/feature} polygon 掩膜矢量要素,支持面类型的要素。
  62701. */
  62702. static setMask(layers, polygon) {
  62703. if (!polygon) {
  62704. return;
  62705. }
  62706. const geo = polygon instanceof (external_ol_Feature_default()) ? polygon.getGeometry() : polygon;
  62707. if (!(geo instanceof (external_ol_geom_Geometry_default())) && ['MultiPolygon', 'Polygon'].indexOf(polygon.getType()) < 0) {
  62708. return;
  62709. }
  62710. const feature = polygon instanceof (external_ol_Feature_default()) ? polygon : new (external_ol_Feature_default())(polygon);
  62711. const style = new external_ol_style_namespaceObject.Style({
  62712. fill: new external_ol_style_namespaceObject.Fill({
  62713. color: 'black'
  62714. })
  62715. });
  62716. const clipLayer = new (external_ol_layer_Vector_default())({
  62717. source: new (external_ol_source_Vector_default())({
  62718. features: [feature],
  62719. wrapX: false
  62720. })
  62721. });
  62722. const clipRender = function (e) {
  62723. const vectorContext = (0,external_ol_render_namespaceObject.getVectorContext)(e);
  62724. e.context.globalCompositeOperation = 'destination-in';
  62725. clipLayer.getSource().forEachFeature(function (feature) {
  62726. vectorContext.drawFeature(feature, style);
  62727. e.context.globalCompositeOperation = 'source-over';
  62728. });
  62729. };
  62730. const todoLayers = Array.isArray(layers) ? layers : [layers];
  62731. core_Util_Util.unsetMask(todoLayers);
  62732. todoLayers.forEach((layer) => {
  62733. layer.classNameBak_ = layer.className_;
  62734. layer.className_ = `ol_mask_layer_${layer.ol_uid}`;
  62735. layer.clipRender = clipRender;
  62736. layer.extentBak_ = layer.getExtent();
  62737. layer.setExtent(clipLayer.getSource().getExtent());
  62738. layer.on('postrender', clipRender);
  62739. layer.changed();
  62740. });
  62741. }
  62742. /**
  62743. * @function ol.supermap.Util.unsetMask
  62744. * @description 取消图层掩膜。
  62745. * @version 10.1.0
  62746. * @param {ol/layer/Layer|Array.<ol/layer/Layer>} layers 图层
  62747. */
  62748. static unsetMask(layers) {
  62749. const todoLayers = Array.isArray(layers) ? layers : [layers];
  62750. for (let index = 0; index < todoLayers.length; index++) {
  62751. const layer = todoLayers[index];
  62752. if (!layer.clipRender) {
  62753. continue;
  62754. }
  62755. layer.un('postrender', layer.clipRender);
  62756. layer.className_ = layer.classNameBak_;
  62757. layer.setExtent(layer.extentBak);
  62758. delete layer.classNameBak_;
  62759. delete layer.clipRender;
  62760. delete layer.extentBak_;
  62761. layer.changed();
  62762. }
  62763. }
  62764. }
  62765. ;// CONCATENATED MODULE: external "function(){try{return canvg}catch(e){return {}}}()"
  62766. const external_function_try_return_canvg_catch_e_return_namespaceObject = function(){try{return canvg}catch(e){return {}}}();
  62767. var external_function_try_return_canvg_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_canvg_catch_e_return_namespaceObject);
  62768. ;// CONCATENATED MODULE: external "ol.style.Style"
  62769. const external_ol_style_Style_namespaceObject = ol.style.Style;
  62770. var external_ol_style_Style_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Style_namespaceObject);
  62771. ;// CONCATENATED MODULE: external "ol.style.Icon"
  62772. const external_ol_style_Icon_namespaceObject = ol.style.Icon;
  62773. var external_ol_style_Icon_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Icon_namespaceObject);
  62774. ;// CONCATENATED MODULE: external "ol.style.Circle"
  62775. const external_ol_style_Circle_namespaceObject = ol.style.Circle;
  62776. var external_ol_style_Circle_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Circle_namespaceObject);
  62777. ;// CONCATENATED MODULE: external "ol.style.Fill"
  62778. const external_ol_style_Fill_namespaceObject = ol.style.Fill;
  62779. var external_ol_style_Fill_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Fill_namespaceObject);
  62780. ;// CONCATENATED MODULE: external "ol.style.Stroke"
  62781. const external_ol_style_Stroke_namespaceObject = ol.style.Stroke;
  62782. var external_ol_style_Stroke_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Stroke_namespaceObject);
  62783. ;// CONCATENATED MODULE: external "ol.style.Text"
  62784. const external_ol_style_Text_namespaceObject = ol.style.Text;
  62785. var external_ol_style_Text_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_Text_namespaceObject);
  62786. ;// CONCATENATED MODULE: ./src/openlayers/core/StyleUtils.js
  62787. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  62788. * This program are made available under the terms of the Apache License, Version 2.0
  62789. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  62790. var padding = 8, doublePadding = padding * 2;
  62791. const ZERO = 0.0000001;
  62792. /**
  62793. * @class ol.supermap.StyleUtils
  62794. * @classdesc 样式工具类。
  62795. * @private
  62796. */
  62797. class StyleUtils {
  62798. /**
  62799. * @function ol.supermap.StyleUtils.getValidStyleFromLayerInfo
  62800. * @description 通过图层信息获取有效的样式。
  62801. * @param {Object} layerInfo - 图层信息。
  62802. * @param {ol.Feature} feature - 要素。
  62803. * @param {string} url - 图层数据地址。
  62804. * @returns {ol/style/Style} 返回图层样式。
  62805. */
  62806. static getValidStyleFromLayerInfo(layerInfo, feature, url) {
  62807. var type = feature.getGeometry().getType().toUpperCase(),
  62808. shader = layerInfo.layerStyle,
  62809. style = this.getDefaultStyle(type);
  62810. if ((type === "POINT" || type === 'MULTIPOINT') && !feature.getProperties().textStyle && layerInfo.type !== 'LABEL' && !feature.getProperties().TEXT_FEATURE_CONTENT) {
  62811. if (shader) {
  62812. var symbolParameters = {
  62813. "transparent": true,
  62814. "resourceType": "SYMBOLMARKER",
  62815. "picWidth": Math.ceil(shader.markerSize * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT.mm) || 13,
  62816. "picHeight": Math.ceil(shader.markerSize * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT.mm) || 13,
  62817. "style": JSON.stringify(shader)
  62818. };
  62819. var imageUrl = Util.urlAppend(url + "/symbol.png", Util.getParameterString(symbolParameters));
  62820. style.pointFile = imageUrl;
  62821. return new (external_ol_style_Style_default())({
  62822. image: new (external_ol_style_Icon_default())({
  62823. src: style.pointFile
  62824. })
  62825. });
  62826. }
  62827. return this.toOLPointStyle(style);
  62828. } else if ((type === "POINT" || type === 'MULTIPOINT') && (feature.getProperties().textStyle || layerInfo.type === 'LABEL' || feature.getProperties().TEXT_STYLE_INFO)) {
  62829. style = this.getDefaultStyle('TEXT');
  62830. if (feature.getProperties().textStyle) {
  62831. shader = feature.getProperties().textStyle;
  62832. }
  62833. if (feature.getProperties().TEXT_STYLE_INFO) {
  62834. shader = JSON.parse(feature.getProperties().TEXT_STYLE_INFO).textStyle;
  62835. }
  62836. if (shader && shader !== "{}") {
  62837. var fontStr = "";
  62838. //设置文本是否倾斜
  62839. style.fontStyle = shader.italic ? "italic" : "normal";
  62840. //设置文本是否使用粗体
  62841. style.fontWeight = shader.bold ? shader.fontWeight : "normal";
  62842. //设置文本的尺寸(对应fontHeight属性)和行高,行高iserver不支持,默认5像素
  62843. //固定大小的时候单位是毫米
  62844. var text_h = shader.fontHeight * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT.mm * 0.85; //毫米转像素,服务端的字体貌似要稍微小一点
  62845. style.fontSize = text_h + "px";
  62846. //设置文本字体类型
  62847. //在桌面字体钱加@时为了解决对联那种形式,但是在canvas不支持,并且添加了@会导致
  62848. //字体大小被固定,这里需要去掉
  62849. if (shader.fontName.indexOf("@")) {
  62850. fontStr = shader.fontName.replace(/@/g, "");
  62851. } else {
  62852. fontStr = shader.fontName
  62853. }
  62854. style.fontFamily = fontStr;
  62855. style.textHeight = text_h;
  62856. //设置对齐方式
  62857. var alignStr = shader.align.replace(/TOP|MIDDLE|BASELINE|BOTTOM/, "");
  62858. style.textAlign = alignStr.toLowerCase();
  62859. var baselineStr = shader.align.replace(/LEFT|RIGHT|CENTER/, "");
  62860. if (baselineStr === "BASELINE") {
  62861. baselineStr = "alphabetic";
  62862. }
  62863. style.textBaseline = baselineStr.toLowerCase();
  62864. /*//首先判定是否需要绘制阴影,如果需要绘制,阴影应该在最下面
  62865. if(shader.shadow)
  62866. {
  62867. //桌面里面的阴影没有做模糊处理,这里统一设置为0,
  62868. style.shadowBlur=0;
  62869. //和桌面统一,往右下角偏移阴影,默认3像素
  62870. style.shadowOffsetX=3;
  62871. style.shadowOffsetY=3;
  62872. //颜色取一个灰色,调成半透明
  62873. style.shadowColor="rgba(50,50,50,0.5)";
  62874. }else{
  62875. style.shadowOffsetX=0;
  62876. style.shadowOffsetY=0;
  62877. }*/
  62878. style.haloRadius = shader.outline ? shader.outlineWidth : 0;
  62879. style.backColor = "rgba(" + shader.backColor.red + "," + shader.backColor.green + "," + shader.backColor.blue + ",1)";
  62880. style.foreColor = "rgba(" + shader.foreColor.red + "," + shader.foreColor.green + "," + shader.foreColor.blue + ",1)";
  62881. style.rotation = shader.rotation;
  62882. }
  62883. var text;
  62884. if (feature.getProperties().textStyle && feature.getProperties().texts) {
  62885. text = feature.getProperties().texts[0];
  62886. }
  62887. if (layerInfo.type === 'LABEL') {
  62888. var textField = layerInfo.textField;
  62889. if (textField && textField.indexOf('.')) {
  62890. var arr = textField.split('.');
  62891. textField = arr && arr.length > 0 && arr[arr.length - 1];
  62892. }
  62893. text = feature.getProperties().attributes ? feature.getProperties().attributes[textField] : feature.getProperties()[textField];
  62894. }
  62895. if (feature.getProperties().TEXT_FEATURE_CONTENT) {
  62896. text = feature.getProperties().TEXT_FEATURE_CONTENT;
  62897. }
  62898. if (!text) {
  62899. return this.toOLPointStyle(this.getDefaultStyle('POINT'));
  62900. }
  62901. return this.toOLTextStyle(style, text);
  62902. } else if (shader) {
  62903. //目前只实现桌面系统默认的几种symbolID,非系统默认的面用颜色填充替代,线则用实线来替代
  62904. var fillSymbolID = shader["fillSymbolID"] > 7 ? 0 : shader["fillSymbolID"];
  62905. var lineSymbolID = shader["lineSymbolID"] > 5 ? 0 : shader["lineSymbolID"];
  62906. for (var attr in shader) {
  62907. var obj = StyleMap.ServerStyleMap[attr];
  62908. var canvasStyle = obj.canvasStyle;
  62909. if (canvasStyle && canvasStyle != "") {
  62910. var value;
  62911. switch (obj.type) {
  62912. case "number":
  62913. value = shader[attr];
  62914. if (obj.unit) {
  62915. //将单位转换为像素单位
  62916. value = value * SuperMap.DOTS_PER_INCH * SuperMap.INCHES_PER_UNIT[obj.unit] * 2.5;
  62917. }
  62918. style[canvasStyle] = value;
  62919. break;
  62920. case "color":
  62921. var color = shader[attr];
  62922. var backColor = shader["fillBackColor"];
  62923. var alpha = 1;
  62924. if (canvasStyle === "fillStyle") {
  62925. if (fillSymbolID === 0 || fillSymbolID === 1) {
  62926. //当fillSymbolID为0时,用颜色填充,为1是无填充,即为透明填充,alpha通道为0
  62927. alpha = 1 - fillSymbolID;
  62928. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  62929. } else {
  62930. //当fillSymbolID为2~7时,用的纹理填充,但要按照前景色修改其颜色
  62931. try {
  62932. var tempCvs = document.createElement("canvas");
  62933. tempCvs.height = 8;
  62934. tempCvs.width = 8;
  62935. var tempCtx = tempCvs.getContext("2d");
  62936. var image = new Image();
  62937. if (this.layer && this.layer.fillImages) {
  62938. tempCtx.drawImage(this.layer.fillImages["System " + fillSymbolID], 0, 0);
  62939. }
  62940. var imageData = tempCtx.getImageData(0, 0, tempCvs.width, tempCvs.height);
  62941. var pix = imageData.data;
  62942. for (var i = 0, len = pix.length; i < len; i += 4) {
  62943. var r = pix[i], g = pix[i + 1], b = pix[i + 2];
  62944. //将符号图片中的灰色或者黑色的部分替换为前景色,其余为后景色
  62945. if (r < 225 && g < 225 && b < 225) {
  62946. pix[i] = color.red;
  62947. pix[i + 1] = color.green;
  62948. pix[i + 2] = color.blue;
  62949. } else if (backColor) {
  62950. pix[i] = backColor.red;
  62951. pix[i + 1] = backColor.green;
  62952. pix[i + 2] = backColor.blue;
  62953. }
  62954. }
  62955. tempCtx.putImageData(imageData, 0, 0);
  62956. image.src = tempCvs.toDataURL();
  62957. if (this.context) {
  62958. value = this.context.createPattern(image, "repeat");
  62959. }
  62960. } catch (e) {
  62961. throw Error(e.message);
  62962. }
  62963. }
  62964. } else if (canvasStyle === "strokeStyle") {
  62965. if (lineSymbolID === 0 || lineSymbolID === 5) {
  62966. //对于lineSymbolID为0时,线为实线,为lineSymbolID为5时,为无线模式,即线为透明,即alpha通道为0
  62967. alpha = lineSymbolID === 0 ? 1 : 0;
  62968. } else {
  62969. //以下几种linePattern分别模拟了桌面的SymbolID为1~4几种符号的linePattern
  62970. var linePattern = [1, 0];
  62971. switch (lineSymbolID) {
  62972. case 1:
  62973. linePattern = [9.7, 3.7];
  62974. break;
  62975. case 2:
  62976. linePattern = [3.7, 3.7];
  62977. break;
  62978. case 3:
  62979. linePattern = [9.7, 3.7, 2.3, 3.7];
  62980. break;
  62981. case 4:
  62982. linePattern = [9.7, 3.7, 2.3, 3.7, 2.3, 3.7];
  62983. break;
  62984. default:
  62985. break
  62986. }
  62987. style.lineDasharray = linePattern;
  62988. }
  62989. value = "rgba(" + color.red + "," + color.green + "," + color.blue + "," + alpha + ")";
  62990. }
  62991. style[canvasStyle] = value;
  62992. break;
  62993. default:
  62994. break;
  62995. }
  62996. }
  62997. }
  62998. }
  62999. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  63000. return this.toOLLineStyle(style);
  63001. }
  63002. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  63003. return this.toOLPolygonStyle(style);
  63004. }
  63005. }
  63006. /**
  63007. * @function ol.supermap.StyleUtils.getStyleFromCarto
  63008. * @description 从 Carto 中获取有效的样式。
  63009. * @param {number} zoom -缩放级别。
  63010. * @param {number} scale - 比例尺。
  63011. * @param {Array} shader - 渲染器对象数组。
  63012. * @param {Object} feature - 要素。
  63013. * @param {string} fromServer - 服务源。
  63014. * @param {string} url - 地址。
  63015. */
  63016. static getStyleFromCarto(zoom, scale, shader, feature, fromServer, url) {
  63017. var type = feature.getGeometry().getType().toUpperCase(),
  63018. attributes = {},
  63019. style = this.getDefaultStyle(type);
  63020. attributes.FEATUREID = feature.getProperties().id;
  63021. attributes.SCALE = scale;
  63022. var cartoStyleType = feature.getProperties().type === "TEXT" ? "TEXT" : type;
  63023. var cartoStyleMap = StyleMap.CartoStyleMap[cartoStyleType];
  63024. var fontSize, fontName;
  63025. if (shader) {
  63026. for (var i = 0, len = shader.length; i < len; i++) {
  63027. var _shader = shader[i];
  63028. var prop = cartoStyleMap[_shader.property];
  63029. var value = _shader.getValue(attributes, zoom, true);
  63030. if ((value !== null) && prop) {
  63031. if (prop === "fontSize") {
  63032. if (fromServer) {
  63033. value *= 0.8;
  63034. }
  63035. //斜杠后面为行间距,默认为0.5倍行间距
  63036. fontSize = value + "px";
  63037. style.fontSize = fontSize;
  63038. } else if (prop === "fontName") {
  63039. fontName = value;
  63040. style.fontName = fontName;
  63041. } else {
  63042. if (prop === "globalCompositeOperation") {
  63043. value = StyleMap.CartoCompOpMap[value];
  63044. if (!value) {
  63045. continue;
  63046. }
  63047. } else if (fromServer && prop === 'pointFile') {
  63048. value = url + '/tileFeature/symbols/' + value.replace(/(___)/gi, '@');
  63049. value = value.replace(/(__0__0__)/gi, '__8__8__');
  63050. }
  63051. if (prop === 'lineWidth' && value < 1) {
  63052. value = Math.ceil(value);
  63053. }
  63054. style[prop] = value;
  63055. }
  63056. }
  63057. }
  63058. }
  63059. if (feature.getProperties().type === 'TEXT') {
  63060. var text;
  63061. if (feature.getProperties().texts) {
  63062. text = feature.getProperties().texts[0];
  63063. }
  63064. if (text == null && style.textName) {
  63065. var textName = style.textName.substring(1, style.textName.length - 1);
  63066. text = feature.getProperties().attributes ? feature.getProperties().attributes[textName] : feature.getProperties()[textName];
  63067. if (text != null) {
  63068. var texts = feature.getProperties().texts || [];
  63069. texts.push(text);
  63070. feature.setProperties({ texts: texts });
  63071. }
  63072. }
  63073. return this.toOLTextStyle(style, text)
  63074. }
  63075. if (type === 'POINT' || type === 'MULTIPOINT') {
  63076. return this.toOLPointStyle(style);
  63077. }
  63078. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  63079. return this.toOLLineStyle(style);
  63080. }
  63081. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  63082. return this.toOLPolygonStyle(style);
  63083. }
  63084. }
  63085. /**
  63086. * @function ol.supermap.StyleUtils.toOLPointStyle
  63087. * @description 点样式。
  63088. * @param {Object} style - 样式参数。
  63089. * @returns {ol/style/Style} 获取点样式。
  63090. */
  63091. static toOLPointStyle(style) {
  63092. if (style.pointFile !== '') {
  63093. return new (external_ol_style_Style_default())({
  63094. image: new (external_ol_style_Icon_default())({
  63095. src: style.pointFile
  63096. })
  63097. });
  63098. }
  63099. return new (external_ol_style_Style_default())({
  63100. image: new (external_ol_style_Circle_default())({
  63101. radius: style.pointRadius,
  63102. fill: new (external_ol_style_Fill_default())({
  63103. color: style.fillStyle
  63104. }),
  63105. stroke: new (external_ol_style_Stroke_default())({
  63106. color: style.pointHaloColor,
  63107. width: style.pointHaloRadius
  63108. })
  63109. })
  63110. });
  63111. }
  63112. /**
  63113. * @function ol.supermap.StyleUtils.toOLLineStyle
  63114. * @description 线样式。
  63115. * @param {Object} style - 样式参数。
  63116. * @returns {ol/style/Style} 获取线的样式。
  63117. */
  63118. static toOLLineStyle(style) {
  63119. return new (external_ol_style_Style_default())({
  63120. stroke: new (external_ol_style_Stroke_default())({
  63121. color: style.strokeStyle,
  63122. width: style.lineWidth,
  63123. lineCap: style.lineCap,
  63124. lineDash: style.lineDasharray,
  63125. lineDashOffset: style.lineDashOffset,
  63126. lineJoin: style.lineJoin,
  63127. miterLimit: style.miterLimit
  63128. })
  63129. });
  63130. }
  63131. /**
  63132. * @function ol.supermap.StyleUtils.toOLPolygonStyle
  63133. * @description 面样式。
  63134. * @param {Object} style - 样式参数。
  63135. * @returns {ol/style/Style} 获取面的样式。
  63136. */
  63137. static toOLPolygonStyle(style) {
  63138. var fill = new (external_ol_style_Fill_default())({
  63139. color: style.fillStyle
  63140. });
  63141. var stroke = new (external_ol_style_Stroke_default())({
  63142. color: style.strokeStyle,
  63143. width: style.lineWidth,
  63144. lineCap: style.lineCap,
  63145. lineDash: style.lineDasharray,
  63146. lineDashOffset: style.lineDashOffset,
  63147. lineJoin: style.lineJoin,
  63148. miterLimit: style.miterLimit
  63149. });
  63150. return new (external_ol_style_Style_default())({
  63151. fill: fill,
  63152. stroke: stroke
  63153. });
  63154. }
  63155. /**
  63156. * @function ol.supermap.StyleUtils.toOLTextStyle
  63157. * @description 文本样式。
  63158. * @param {Object} style - 样式对象。
  63159. * @param {string} text - 文本参数。
  63160. * @returns {ol/style/Style} 获取的文本样式。
  63161. */
  63162. static toOLTextStyle(style, text) {
  63163. return new (external_ol_style_Style_default())({
  63164. text: new (external_ol_style_Text_default())({
  63165. font: (style.fontStyle || '') + ' ' + (style.fontWeight || '') + ' ' + (style.fontSize || '') + ' ' + style.fontFamily,
  63166. text: text,
  63167. textAlign: style.textAlign,
  63168. textBaseline: style.textBaseline,
  63169. fill: new (external_ol_style_Fill_default())({
  63170. color: style.foreColor
  63171. }),
  63172. stroke: new (external_ol_style_Stroke_default())({
  63173. color: style.backColor
  63174. }),
  63175. offsetX: style.offsetX,
  63176. offsetY: style.offsetY
  63177. })
  63178. })
  63179. }
  63180. /**
  63181. * @function ol.supermap.StyleUtils.dashStyle
  63182. * @description 符号样式。
  63183. * @param {Object} style - 样式参数。
  63184. * @param {number} widthFactor - 宽度系数。
  63185. */
  63186. static dashStyle(style, widthFactor) {
  63187. if (!style) {
  63188. return [];
  63189. }
  63190. var w = style.strokeWidth * widthFactor;
  63191. var str = style.strokeDashstyle || style.lineDash;
  63192. switch (str) {
  63193. case 'solid':
  63194. return [0];
  63195. case 'dot':
  63196. return [1, 4 * w];
  63197. case 'dash':
  63198. return [4 * w, 4 * w];
  63199. case 'dashdot':
  63200. return [4 * w, 4 * w, 1, 4 * w];
  63201. case 'longdash':
  63202. return [8 * w, 4 * w];
  63203. case 'longdashdot':
  63204. return [8 * w, 4 * w, 1, 4 * w];
  63205. default:
  63206. if (!str) {
  63207. return [];
  63208. }
  63209. if (Util.isArray(str)) {
  63210. return str;
  63211. }
  63212. str = StringExt.trim(str).replace(/\s+/g, ",");
  63213. return str.replace(/\[|\]/gi, "").split(",");
  63214. }
  63215. }
  63216. /**
  63217. * @function ol.supermap.StyleUtils.getStyleFromiPortalMarker
  63218. * @description 从 iPortal 标记获取样式。
  63219. * @param {Object} icon - 图标参数。
  63220. */
  63221. static getStyleFromiPortalMarker(icon) {
  63222. if (icon.indexOf("./") == 0) {
  63223. return null;
  63224. }
  63225. //兼容iportal示例的问题
  63226. if (icon.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  63227. icon = icon.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  63228. }
  63229. return new (external_ol_style_Style_default())({
  63230. image: new (external_ol_style_Icon_default())({
  63231. src: icon,
  63232. opacity: 1,
  63233. size: [48, 43],
  63234. anchor: [0.5, 1]
  63235. })
  63236. });
  63237. }
  63238. /**
  63239. * @function ol.supermap.StyleUtils.getStyleFromiPortalStyle
  63240. * @description 从 iPortal 标记获取样式。
  63241. * @param {Object} iPortalStyle - iportal 样式。
  63242. * @param {string} type - 样式类型。
  63243. * @param {Object} fStyle - 要素样式。
  63244. */
  63245. static getStyleFromiPortalStyle(iPortalStyle, type, fStyle) {
  63246. var featureStyle = fStyle ? JSON.parse(fStyle) : null;
  63247. var me = this;
  63248. if (type === 'Point' || type === 'MultiPoint') {
  63249. var pointStyle = featureStyle || iPortalStyle.pointStyle;
  63250. if (pointStyle.externalGraphic) {
  63251. if (pointStyle.externalGraphic.indexOf("./") == 0) {
  63252. return null;
  63253. }
  63254. //兼容iportal示例的问题
  63255. if (pointStyle.externalGraphic.indexOf("http://support.supermap.com.cn:8092/static/portal") == 0) {
  63256. pointStyle.externalGraphic = pointStyle.externalGraphic.replace("http://support.supermap.com.cn:8092/static/portal", "http://support.supermap.com.cn:8092/apps/viewer/static");
  63257. }
  63258. return new (external_ol_style_Style_default())({
  63259. image: new (external_ol_style_Icon_default())({
  63260. src: pointStyle.externalGraphic,
  63261. opacity: pointStyle.graphicOpacity,
  63262. size: [pointStyle.graphicWidth, pointStyle.graphicHeight]
  63263. //anchor: [-pointStyle.graphicXOffset / pointStyle.graphicWidth, -pointStyle.graphicYOffset / pointStyle.graphicHeight]
  63264. })
  63265. });
  63266. }
  63267. return new (external_ol_style_Style_default())({
  63268. image: new (external_ol_style_Circle_default())({
  63269. fill: new (external_ol_style_Fill_default())({
  63270. color: me.hexToRgba(pointStyle.fillColor, pointStyle.fillOpacity)
  63271. }),
  63272. stroke: new (external_ol_style_Stroke_default())({
  63273. color: me.hexToRgba(pointStyle.strokeColor, pointStyle.strokeOpacity),
  63274. lineCap: pointStyle.strokeLineCap,
  63275. lineDash: this.dashStyle(pointStyle, 1),
  63276. width: pointStyle.strokeWidth
  63277. }),
  63278. radius: pointStyle.pointRadius
  63279. })
  63280. });
  63281. }
  63282. if (type === 'LineString' || type === 'MultiLineString' || type === 'Box') {
  63283. var lineStyle = featureStyle || iPortalStyle.lineStyle;
  63284. return new (external_ol_style_Style_default())({
  63285. stroke: new (external_ol_style_Stroke_default())({
  63286. color: me.hexToRgba(lineStyle.strokeColor, lineStyle.strokeOpacity),
  63287. lineCap: lineStyle.strokeLineCap,
  63288. lineDash: this.dashStyle(lineStyle, 1),
  63289. width: lineStyle.strokeWidth
  63290. })
  63291. });
  63292. }
  63293. if (type === 'Polygon' || type === 'MultiPolygon') {
  63294. var polygonStyle = featureStyle || iPortalStyle.polygonStyle;
  63295. return new (external_ol_style_Style_default())({
  63296. fill: new (external_ol_style_Fill_default())({
  63297. color: me.hexToRgba(polygonStyle.fillColor, polygonStyle.fillOpacity)
  63298. }),
  63299. stroke: new (external_ol_style_Stroke_default())({
  63300. color: me.hexToRgba(polygonStyle.strokeColor, polygonStyle.strokeOpacity),
  63301. lineCap: polygonStyle.strokeLineCap,
  63302. lineDash: this.dashStyle(polygonStyle, 1),
  63303. width: polygonStyle.strokeWidth
  63304. })
  63305. });
  63306. }
  63307. }
  63308. /**
  63309. * @function ol.supermap.StyleUtils.hexToRgba
  63310. * @description 十六进制转 RGBA 格式。
  63311. * @param {Object} hex - 十六进制格式参数。
  63312. * @param {number} opacity -Alpha 参数。
  63313. * @returns {string} 生成的 RGBA 格式。
  63314. */
  63315. static hexToRgba(hex, opacity) {
  63316. var color = [], rgba = [];
  63317. hex = hex.replace(/#/, "");
  63318. if (hex.length == 3) {
  63319. var tmp = [];
  63320. for (let i = 0; i < 3; i++) {
  63321. tmp.push(hex.charAt(i) + hex.charAt(i));
  63322. }
  63323. hex = tmp.join("");
  63324. }
  63325. for (let i = 0; i < 6; i += 2) {
  63326. color[i] = "0x" + hex.substr(i, 2);
  63327. rgba.push(parseInt(Number(color[i])));
  63328. }
  63329. rgba.push(opacity);
  63330. return "rgba(" + rgba.join(",") + ")";
  63331. }
  63332. /**
  63333. * @function ol.supermap.StyleUtils.getDefaultStyle
  63334. * @description 获取默认风格
  63335. * @param {string} type - 类型参数。
  63336. * @returns {string}
  63337. */
  63338. static getDefaultStyle(type) {
  63339. var style = {};
  63340. var canvasStyle = DeafultCanvasStyle[type];
  63341. for (var prop in canvasStyle) {
  63342. var val = canvasStyle[prop];
  63343. style[prop] = val;
  63344. }
  63345. return style;
  63346. }
  63347. /**
  63348. * @function ol.supermap.StyleUtils.getDefaultStyle
  63349. * @description 将样式对象转换成openlayer要求的ol.style
  63350. * @param {string} style - 样式对象
  63351. * @param {string} type - feature的类型
  63352. * @returns {ol/style/Style}
  63353. */
  63354. static toOpenLayersStyle(style, type) {
  63355. style = style || this.getDefaultStyle();
  63356. let olStyle = new (external_ol_style_Style_default())();
  63357. let newImage, newFill, newStroke;
  63358. let {
  63359. fillColor,
  63360. fillOpacity,
  63361. strokeColor,
  63362. strokeWidth,
  63363. strokeOpacity,
  63364. radius,
  63365. lineCap,
  63366. src,
  63367. scale,
  63368. offsetX,
  63369. offsetY,
  63370. //size,
  63371. //imgSize,
  63372. anchor
  63373. } = style;
  63374. let fillColorArray = this.hexToRgb(fillColor);
  63375. if (fillColorArray) {
  63376. fillColorArray.push(fillOpacity);
  63377. }
  63378. let strokeColorArray = this.hexToRgb(strokeColor);
  63379. if (strokeColorArray) {
  63380. strokeColorArray.push(strokeOpacity);
  63381. }
  63382. if (type === "POINT") {
  63383. if (src) {
  63384. if (/.+(\.svg$)/.test(src)) {
  63385. if (!this.svgDiv) {
  63386. this.svgDiv = document.createElement('div');
  63387. document.body.appendChild(this.svgDiv);
  63388. }
  63389. this.getCanvasFromSVG(src, this.svgDiv, (canvas) => {
  63390. newImage = new (external_ol_style_Icon_default())({
  63391. img: canvas,
  63392. scale: radius / canvas.width,
  63393. imgSize: [canvas.width, canvas.height],
  63394. anchor: [0.5, 0.5]
  63395. })
  63396. })
  63397. } else {
  63398. newImage = new (external_ol_style_Icon_default())({
  63399. src: src,
  63400. scale: scale,
  63401. anchor: anchor
  63402. });
  63403. }
  63404. } else {
  63405. newImage = new (external_ol_style_Circle_default())({
  63406. radius,
  63407. fill: new (external_ol_style_Fill_default())({
  63408. color: fillColorArray
  63409. }),
  63410. stroke: new (external_ol_style_Stroke_default())({
  63411. width: strokeWidth || ZERO,
  63412. color: strokeColorArray
  63413. }),
  63414. displacement: this.getCircleDisplacement(radius, offsetX, offsetY)
  63415. });
  63416. }
  63417. olStyle.setImage(newImage);
  63418. } else if (type === "LINE" || type === "LINESTRING" || type === 'MULTILINESTRING' || type === 'LINEARRING') {
  63419. newStroke = new (external_ol_style_Stroke_default())({
  63420. width: strokeWidth || ZERO,
  63421. color: strokeColorArray,
  63422. lineCap: lineCap || 'round',
  63423. lineDash: this.dashStyle(style, 1)
  63424. });
  63425. olStyle.setStroke(newStroke);
  63426. } else if (type === 'POLYGON' ||
  63427. type === 'MULTIPOLYGON' || type === 'REGION') {
  63428. newFill = new (external_ol_style_Fill_default())({
  63429. color: fillColorArray
  63430. });
  63431. newStroke = new (external_ol_style_Stroke_default())({
  63432. width: strokeWidth || ZERO,
  63433. color: strokeColorArray,
  63434. lineCap: lineCap || 'round',
  63435. lineDash: this.dashStyle(style, 1)
  63436. });
  63437. olStyle.setFill(newFill);
  63438. olStyle.setStroke(newStroke);
  63439. } else {
  63440. let result = this.getCanvas(style);
  63441. newImage = new (external_ol_style_Icon_default())({
  63442. img: result.canvas,
  63443. imgSize: [result.width, result.height],
  63444. scale: 1,
  63445. anchor: [0.5, 0.5]
  63446. });
  63447. olStyle.setImage(newImage);
  63448. }
  63449. return olStyle;
  63450. }
  63451. /**
  63452. * @function ol.supermap.StyleUtils.getIconAnchor
  63453. * @description 获取图标的锚点
  63454. * @param {number} offsetX - X方向偏移分数
  63455. * @param {number} offsetY - Y方向偏移分数
  63456. * @returns {array}
  63457. */
  63458. static getIconAnchor(offsetX=0.5, offsetY=0.5) {
  63459. return [offsetX, offsetY];
  63460. }
  63461. /**
  63462. * @function ol.supermap.StyleUtils.getCircleDisplacement
  63463. * @description 获取圆圈的偏移
  63464. * @param {number} radius - 圆圈半径
  63465. * @param {number} offsetX - X方向偏移分数
  63466. * @param {number} offsetY - Y方向偏移分数
  63467. * @returns {array}
  63468. */
  63469. static getCircleDisplacement(radius, offsetX=0, offsetY=0) {
  63470. const dispX = radius*offsetX, dispY = radius*offsetY;
  63471. return [dispX, -dispY];
  63472. }
  63473. /**
  63474. * @function ol.supermap.StyleUtils.getTextOffset
  63475. * @description 获取字体图标的偏移值
  63476. * @param {string} fontSize - 字体大小,如12px
  63477. * @param {number} offsetX - X方向偏移分数
  63478. * @param {number} offsetY - Y方向偏移分数
  63479. * @returns {object}
  63480. */
  63481. static getTextOffset(fontSize, offsetX=0, offsetY=0) {
  63482. const radius = fontSize.substr(0, fontSize.length - 2) / 2;
  63483. return {
  63484. x: radius*offsetX,
  63485. y: radius*offsetY
  63486. };
  63487. }
  63488. /**
  63489. * 获取文字标注对应的canvas
  63490. * @param style
  63491. * @returns {{canvas: *, width: number, height: number}}
  63492. */
  63493. static getCanvas(style) {
  63494. let canvas;
  63495. if (style.canvas) {
  63496. if (document.querySelector("#" + style.canvas)) {
  63497. canvas = document.getElemntById(style.canvas);
  63498. } else {
  63499. canvas = this.createCanvas(style);
  63500. }
  63501. } else {
  63502. //不存在canvas,当前feature
  63503. canvas = this.createCanvas(style);
  63504. style.canvas = canvas.id;
  63505. }
  63506. canvas.style.display = "none";
  63507. var ctx = canvas.getContext("2d");
  63508. //行高
  63509. let lineHeight = Number(style.font.replace(/[^0-9]/ig, ""));
  63510. let textArray = style.text.split('\r\n');
  63511. let lenght = textArray.length;
  63512. //在改变canvas大小后再绘制。否则会被清除
  63513. ctx.font = style.font;
  63514. let size = this.drawRect(ctx, style, textArray, lineHeight, canvas);
  63515. this.positionY = padding;
  63516. if (lenght > 1) {
  63517. textArray.forEach(function (text, i) {
  63518. if (i !== 0) {
  63519. this.positionY = this.positionY + lineHeight;
  63520. }
  63521. this.canvasTextAutoLine(text, style, ctx, lineHeight, size.width);
  63522. }, this);
  63523. } else {
  63524. this.canvasTextAutoLine(textArray[0], style, ctx, lineHeight, size.width);
  63525. }
  63526. return {
  63527. canvas: canvas,
  63528. width: size.width,
  63529. height: size.height
  63530. };
  63531. }
  63532. /**
  63533. * 创建当前feature对应的canvas
  63534. * @param style {object}
  63535. * @returns {HTMLElement}
  63536. */
  63537. static createCanvas(style) {
  63538. let div = document.createElement('div');
  63539. document.body.appendChild(div);
  63540. let canvas = document.createElement('canvas');
  63541. canvas.id = style.canvas ? style.canvas : 'textCanvas' + core_Util_Util.newGuid(8);
  63542. div.appendChild(canvas);
  63543. return canvas;
  63544. }
  63545. /**
  63546. * 绘制矩形边框背景
  63547. * @param ctx
  63548. * @param style
  63549. * @param textArray
  63550. * @param lineHeight
  63551. * @param canvas
  63552. * @returns {{width: number, height: number}}
  63553. */
  63554. static drawRect(ctx, style, textArray, lineHeight, canvas) {
  63555. let backgroundFill = style.backgroundFill, maxWidth = style.maxWidth - doublePadding;
  63556. let width, height = 0, lineCount = 0, lineWidths = [];
  63557. //100的宽度,去掉左右两边3padding
  63558. textArray.forEach(function (arrText) {
  63559. let line = '', isOverMax;
  63560. lineCount++;
  63561. for (var n = 0; n < arrText.length; n++) {
  63562. let textLine = line + arrText[n];
  63563. let metrics = ctx.measureText(textLine);
  63564. let textWidth = metrics.width;
  63565. if ((textWidth > maxWidth && n > 0) || arrText[n] === '\n') {
  63566. line = arrText[n];
  63567. lineCount++;
  63568. //有换行,记录当前换行的width
  63569. isOverMax = true;
  63570. } else {
  63571. line = textLine;
  63572. width = textWidth;
  63573. }
  63574. }
  63575. if (isOverMax) {
  63576. lineWidths.push(maxWidth);
  63577. } else {
  63578. lineWidths.push(width);
  63579. }
  63580. }, this);
  63581. width = this.getCanvasWidth(lineWidths, maxWidth);
  63582. height = lineCount * lineHeight;
  63583. height += doublePadding;
  63584. canvas.width = width;
  63585. canvas.height = height;
  63586. ctx.fillStyle = backgroundFill;
  63587. ctx.fillRect(0, 0, width, height);
  63588. return {
  63589. width: width,
  63590. height: height
  63591. }
  63592. }
  63593. /**
  63594. * 获取自适应的宽度(如果没有超过最大宽度,就用文字的宽度)
  63595. * @param lineWidths
  63596. * @param maxWidth
  63597. * @returns {number}
  63598. */
  63599. static getCanvasWidth(lineWidths, maxWidth) {
  63600. let width = 0;
  63601. for (let i = 0; i < lineWidths.length; i++) {
  63602. let lineW = lineWidths[i];
  63603. if (lineW >= maxWidth) {
  63604. //有任何一行超过最大高度,就用最大高度
  63605. return maxWidth + doublePadding;
  63606. } else if (lineW > width) {
  63607. //自己换行,就要比较每行的最大宽度
  63608. width = lineW;
  63609. }
  63610. }
  63611. return width + doublePadding;
  63612. }
  63613. /**
  63614. * 绘制文字,解决换行问题
  63615. * @param text
  63616. * @param style
  63617. * @param ctx
  63618. * @param lineHeight
  63619. */
  63620. static canvasTextAutoLine(text, style, ctx, lineHeight, canvasWidth) {
  63621. // 字符分隔为数组
  63622. ctx.font = style.font;
  63623. let textAlign = style.textAlign;
  63624. let x = this.getPositionX(textAlign, canvasWidth);
  63625. let arrText = text.split('');
  63626. let line = '', fillColor = style.fillColor;
  63627. //每一行限制的高度
  63628. let maxWidth = style.maxWidth - doublePadding;
  63629. for (var n = 0; n < arrText.length; n++) {
  63630. let testLine = line + arrText[n];
  63631. let metrics = ctx.measureText(testLine);
  63632. let testWidth = metrics.width;
  63633. if ((testWidth > maxWidth && n > 0) || arrText[n] === '\n') {
  63634. ctx.fillStyle = fillColor;
  63635. ctx.textAlign = textAlign;
  63636. ctx.textBaseline = "top";
  63637. ctx.fillText(line, x, this.positionY);
  63638. line = arrText[n];
  63639. this.positionY += lineHeight;
  63640. } else {
  63641. line = testLine;
  63642. }
  63643. }
  63644. ctx.fillStyle = fillColor;
  63645. ctx.textAlign = textAlign;
  63646. ctx.textBaseline = "top";
  63647. ctx.fillText(line, x, this.positionY);
  63648. }
  63649. /**
  63650. * 得到绘制的起点位置,根据align不同,位置也不同
  63651. * @param textAlign
  63652. * @returns {number}
  63653. */
  63654. static getPositionX(textAlign, canvasWidth) {
  63655. let x;
  63656. let width = canvasWidth - doublePadding; //减去padding
  63657. switch (textAlign) {
  63658. case 'center':
  63659. x = width / 2;
  63660. break;
  63661. case 'right':
  63662. x = width;
  63663. break;
  63664. default:
  63665. x = 8;
  63666. break;
  63667. }
  63668. return x;
  63669. }
  63670. /**
  63671. * @function ol.supermap.StyleUtils.hexToRgb
  63672. * @description 将16进制的颜色,转换成rgb格式
  63673. * @param {string} hexColor 16进制颜色
  63674. * @returns {string} rgb格式的颜色
  63675. */
  63676. static hexToRgb(hexColor) {
  63677. if (!hexColor) {
  63678. return;
  63679. }
  63680. var s = hexColor.replace('#', '').split('');
  63681. var rgb = [s[0] + s[1], s[2] + s[3], s[4] + s[5]];
  63682. rgb = rgb.map(function (hex) {
  63683. return parseInt(hex, 16);
  63684. });
  63685. return rgb;
  63686. }
  63687. /**
  63688. * @function ol.supermap.StyleUtils.formatRGB
  63689. * @description 将颜色数组转换成标准的rgb颜色格式
  63690. * @param {Array} colorArray - 颜色数组
  63691. * @returns {String} 'rgb(0,0,0)'或者 rgba(0,0,0,0)
  63692. */
  63693. static formatRGB(colorArray) {
  63694. let rgb;
  63695. if (colorArray.length === 3) {
  63696. rgb = 'rgb(';
  63697. colorArray.forEach(function (color, index) {
  63698. index === 2 ? rgb += color : rgb += color + ',';
  63699. });
  63700. } else {
  63701. rgb = 'rgba(';
  63702. colorArray.forEach(function (color, index) {
  63703. index === 3 ? rgb += color : rgb += color + ',';
  63704. });
  63705. }
  63706. rgb += ")"
  63707. return rgb;
  63708. }
  63709. /**
  63710. * @function ol.supermap.StyleUtils.getCanvasFromSVG
  63711. * @description 将SVG转换成Canvas
  63712. * @param {string} svgUrl - 颜色数组
  63713. * @param {object} divDom - div的dom对象
  63714. * @param {function} callBack - 转换成功执行的回调函数
  63715. */
  63716. static getCanvasFromSVG(svgUrl, divDom, callBack) {
  63717. //一个图层对应一个canvas
  63718. let canvgs = window.canvg ? window.canvg : (external_function_try_return_canvg_catch_e_return_default());
  63719. let canvas = document.createElement('canvas');
  63720. canvas.id = 'dataviz-canvas-' + core_Util_Util.newGuid(8);
  63721. canvas.style.display = "none";
  63722. divDom.appendChild(canvas);
  63723. try {
  63724. canvgs(canvas.id, svgUrl, {
  63725. ignoreMouse: true,
  63726. ignoreAnimation: true,
  63727. renderCallback: function () {
  63728. if (canvas.width > 300 || canvas.height > 300) {
  63729. // Util.showMessage(DataViz.Language.sizeIsWrong,'WARNING');
  63730. return;
  63731. }
  63732. callBack(canvas);
  63733. },
  63734. forceRedraw: function () {
  63735. return false
  63736. }
  63737. });
  63738. } catch (e) {
  63739. return;
  63740. }
  63741. }
  63742. /**
  63743. * @function ol.supermap.StyleUtils.getMarkerDefaultStyle 获取默认标注图层feature的样式
  63744. * @param featureType {String} feature的类型
  63745. * @param server {String} 当前地图前缀
  63746. * @returns {Object} style对象
  63747. */
  63748. static getMarkerDefaultStyle(featureType, server) {
  63749. let style;
  63750. switch (featureType) {
  63751. case 'POINT':
  63752. style = {
  63753. src: `${server}apps/dataviz/static/imgs/markers/mark_red.png`,
  63754. scale: 1,
  63755. anchor: [0.5, 1]
  63756. };
  63757. break;
  63758. case 'LINE':
  63759. case 'LINESTRING':
  63760. case 'MULTILINESTRING':
  63761. style = {
  63762. strokeColor: '#3498db',
  63763. strokeOpacity: 1,
  63764. strokeWidth: 5,
  63765. lineCap: 'round',
  63766. lineDash: 'solid'
  63767. };
  63768. break;
  63769. case 'REGION':
  63770. case 'POLYGON':
  63771. case 'MULTIPOLYGON':
  63772. style = {
  63773. fillColor: '#1abd9c',
  63774. fillOpacity: 1,
  63775. strokeColor: '#3498db',
  63776. strokeOpacity: 1,
  63777. strokeWidth: 3,
  63778. lineCap: 'round',
  63779. lineDash: 'solid'
  63780. };
  63781. break;
  63782. }
  63783. return style;
  63784. }
  63785. /**
  63786. * @function ol.supermap.StyleUtils.getOpenlayerStyle 获取专题图对应的openlayers格式的style
  63787. * @param styleParams {String} 样式参数
  63788. * @param featureType {String} feature类型
  63789. * @param isRank {Boolean} 是否为等级符号
  63790. * @returns {Object} style对象
  63791. */
  63792. static getOpenlayersStyle(styleParams, featureType, isRank) {
  63793. let style;
  63794. if (styleParams.type === "BASIC_POINT") {
  63795. style = this.toOpenLayersStyle(styleParams, featureType);
  63796. } else if (styleParams.type === "SYMBOL_POINT") {
  63797. style = this.getSymbolStyle(styleParams, isRank);
  63798. } else if (styleParams.type === "SVG_POINT") {
  63799. style = this.getSVGStyle(styleParams);
  63800. } else if (styleParams.type === 'IMAGE_POINT') {
  63801. style = this.getImageStyle(styleParams);
  63802. }
  63803. return style;
  63804. }
  63805. /**
  63806. * @function ol.supermap.StyleUtils.getSymbolStyle 获取符号样式
  63807. * @param {object} parameters - 样式参数
  63808. * @returns {Object} style对象
  63809. */
  63810. static getSymbolStyle(parameters, isRank) {
  63811. let text = '';
  63812. if (parameters.unicode) {
  63813. text = String.fromCharCode(parseInt(parameters.unicode.replace(/^&#x/, ''), 16));
  63814. }
  63815. // 填充色 + 透明度
  63816. let fillColor = StyleUtils.hexToRgb(parameters.fillColor);
  63817. fillColor.push(parameters.fillOpacity);
  63818. // 边框充色 + 透明度
  63819. let strokeColor = StyleUtils.hexToRgb(parameters.strokeColor);
  63820. strokeColor.push(parameters.strokeOpacity);
  63821. let fontSize = isRank ? 2 * parameters.radius + "px" : parameters.fontSize;
  63822. const {offsetX, offsetY, rotation=0} = parameters;
  63823. const offset = StyleUtils.getTextOffset(fontSize, offsetX, offsetY);
  63824. return new (external_ol_style_Style_default())({
  63825. text: new (external_ol_style_Text_default())({
  63826. text: text,
  63827. font: fontSize + " supermapol-icons",
  63828. placement: 'point',
  63829. textAlign: 'center',
  63830. fill: new (external_ol_style_Fill_default())({
  63831. color: fillColor
  63832. }),
  63833. backgroundFill: new (external_ol_style_Fill_default())({
  63834. color: [0, 0, 0, 0]
  63835. }),
  63836. stroke: new (external_ol_style_Stroke_default())({
  63837. width: parameters.strokeWidth || 0.000001,
  63838. color: strokeColor
  63839. }),
  63840. offsetX: offset.x,
  63841. offsetY: offset.y,
  63842. rotation
  63843. })
  63844. });
  63845. }
  63846. /**
  63847. * @function ol.supermap.StyleUtils.getSVGStyle 获取svg的样式
  63848. * @param {object} styleParams - 样式参数
  63849. * @returns {Object} style对象
  63850. */
  63851. static getSVGStyle(styleParams) {
  63852. let style, that = this;
  63853. if (!that.svgDiv) {
  63854. that.svgDiv = document.createElement('div');
  63855. document.body.appendChild(that.svgDiv);
  63856. }
  63857. const { url, radius, offsetX, offsetY, fillOpacity, rotation } = styleParams;
  63858. let anchor = this.getIconAnchor(offsetX, offsetY);
  63859. StyleUtils.getCanvasFromSVG(url, that.svgDiv, function (canvas) {
  63860. style = new (external_ol_style_Style_default())({
  63861. image: new (external_ol_style_Icon_default())({
  63862. img: that.setColorToCanvas(canvas, styleParams),
  63863. scale: 2 * radius / canvas.width,
  63864. imgSize: [canvas.width, canvas.height],
  63865. anchor: anchor || [0.5, 0.5],
  63866. opacity: fillOpacity,
  63867. anchorOrigin: 'bottom-right',
  63868. rotation
  63869. })
  63870. });
  63871. });
  63872. return style;
  63873. }
  63874. /**
  63875. * @function ol.supermap.StyleUtils.setColorToCanvas 将颜色,透明度等样式设置到canvas上
  63876. * @param {object} canvas - 渲染的canvas对象
  63877. * @param {object} parameters - 样式参数
  63878. * @returns {Object} style对象
  63879. */
  63880. static setColorToCanvas(canvas, parameters) {
  63881. let context = canvas.getContext('2d');
  63882. let fillColor = StyleUtils.hexToRgb(parameters.fillColor);
  63883. fillColor && fillColor.push(parameters.fillOpacity);
  63884. let strokeColor = StyleUtils.hexToRgb(parameters.strokeColor);
  63885. strokeColor && strokeColor.push(parameters.strokeOpacity);
  63886. context.fillStyle = StyleUtils.formatRGB(fillColor);
  63887. context.fill();
  63888. context.strokeStyle = StyleUtils.formatRGB(strokeColor);
  63889. context.lineWidth = parameters.strokeWidth;
  63890. context.stroke();
  63891. return canvas;
  63892. }
  63893. /**
  63894. * @function ol.supermap.StyleUtils.getImageStyle 获取图片样式
  63895. * @param {object} styleParams - 样式参数
  63896. * @returns {Object} style对象
  63897. */
  63898. static getImageStyle(styleParams) {
  63899. let size = styleParams.imageInfo.size,
  63900. scale = 2 * styleParams.radius / size.w;
  63901. let imageInfo = styleParams.imageInfo;
  63902. let imgDom = imageInfo.img;
  63903. if (!imgDom || !imgDom.src) {
  63904. imgDom = new Image();
  63905. //要组装成完整的url
  63906. imgDom.src = imageInfo.url;
  63907. }
  63908. const { offsetX, offsetY, rotation } = styleParams;
  63909. let anchor = this.getIconAnchor(offsetX, offsetY);
  63910. return new (external_ol_style_Style_default())({
  63911. image: new (external_ol_style_Icon_default())({
  63912. img: imgDom,
  63913. scale,
  63914. imgSize: [size.w, size.h],
  63915. anchor: anchor || [0.5, 0.5],
  63916. anchorOrigin: 'bottom-right',
  63917. rotation
  63918. })
  63919. });
  63920. }
  63921. /**
  63922. * @function ol.supermap.StyleUtils.getRoadPath 获取道路样式
  63923. * @param {object} style - 样式参数
  63924. * @param {object} outlineStyle - 轮廓样式参数
  63925. * @returns {Object} style对象
  63926. */
  63927. static getRoadPath(style, outlineStyle) {
  63928. const { strokeWidth=ZERO, lineCap, strokeColor, strokeOpacity } = style;
  63929. // 道路线都是solid
  63930. let strokeColorArray = this.hexToRgb(strokeColor);
  63931. strokeColorArray && strokeColorArray.push(strokeOpacity);
  63932. var stroke = new (external_ol_style_Style_default())({
  63933. stroke: new (external_ol_style_Stroke_default())({
  63934. width: strokeWidth || ZERO,
  63935. color: strokeColorArray,
  63936. lineCap: lineCap || 'round',
  63937. lineDash: [0]
  63938. })
  63939. });
  63940. const { strokeColor: outlineColor } = outlineStyle;
  63941. let outlineColorArray = this.hexToRgb(outlineColor);
  63942. // opacity使用style的透明度。保持两根线透明度一致
  63943. outlineColorArray && outlineColorArray.push(strokeOpacity);
  63944. let outlineWidth = strokeWidth === 0 ? ZERO : strokeWidth + 2; //外部宽度=内部样式宽度 + 2
  63945. var outlineStroke = new (external_ol_style_Style_default())({
  63946. stroke: new (external_ol_style_Stroke_default())({
  63947. width: outlineWidth, //外部宽度=内部样式宽度 + 2
  63948. color: outlineColorArray,
  63949. lineCap: lineCap || 'round',
  63950. lineDash: [0]
  63951. })
  63952. });
  63953. return [outlineStroke, stroke];
  63954. }
  63955. /**
  63956. * @function ol.supermap.StyleUtils.getPathway 获取铁路样式
  63957. * @param {object} style - 样式参数
  63958. * @param {object} outlineStyle - 轮廓样式参数
  63959. * @returns {Object} style对象
  63960. */
  63961. static getPathway(style, outlineStyle) {
  63962. let { strokeWidth=ZERO, strokeColor, strokeOpacity } = style;
  63963. // 道路线都是solid, lineCap都是直角
  63964. const lineDash = (w => [w, w + strokeWidth * 2])(4 * strokeWidth), lineCap= 'square';
  63965. let strokeColorArray = this.hexToRgb(strokeColor);
  63966. strokeColorArray && strokeColorArray.push(strokeOpacity);
  63967. var stroke = new (external_ol_style_Style_default())({
  63968. stroke: new (external_ol_style_Stroke_default())({
  63969. width: strokeWidth*0.5 || ZERO,
  63970. color: strokeColorArray,
  63971. lineCap,
  63972. lineDash
  63973. })
  63974. });
  63975. const { strokeColor: outlineColor } = outlineStyle;
  63976. let outlineColorArray = this.hexToRgb(outlineColor);
  63977. // opacity使用style的透明度。保持两根线透明度一致
  63978. outlineColorArray && outlineColorArray.push(strokeOpacity);
  63979. var outlineStroke = new (external_ol_style_Style_default())({
  63980. stroke: new (external_ol_style_Stroke_default())({
  63981. width: strokeWidth || ZERO,
  63982. color: outlineColorArray,
  63983. lineCap
  63984. })
  63985. });
  63986. return [outlineStroke, stroke];
  63987. }
  63988. }
  63989. ;// CONCATENATED MODULE: external "ol.Map"
  63990. const external_ol_Map_namespaceObject = ol.Map;
  63991. var external_ol_Map_default = /*#__PURE__*/__webpack_require__.n(external_ol_Map_namespaceObject);
  63992. ;// CONCATENATED MODULE: external "ol.layer.Group"
  63993. const external_ol_layer_Group_namespaceObject = ol.layer.Group;
  63994. var external_ol_layer_Group_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Group_namespaceObject);
  63995. ;// CONCATENATED MODULE: ./src/openlayers/core/MapExtend.js
  63996. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  63997. * This program are made available under the terms of the Apache License, Version 2.0
  63998. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  63999. /**
  64000. * @function MapExtend
  64001. * @description 扩展 OpenLayers 的一些原始方法。
  64002. * @private
  64003. */
  64004. var MapExtend = function () {
  64005. const fun = function (layer, coordinate, resolution, callback, pixel, e) {
  64006. if (layer instanceof (external_ol_layer_Group_default())) {
  64007. layer.getLayers().forEach(function (subLayer) {
  64008. fun(subLayer, coordinate, resolution, callback, pixel, e)
  64009. });
  64010. } else {
  64011. //当前高效率点图层满足筛选条件/并且可视时,可被选中:
  64012. if (layer.getSource()._forEachFeatureAtCoordinate) {
  64013. layer.getSource()._forEachFeatureAtCoordinate(coordinate, resolution, (feature) => {
  64014. callback(feature, layer)
  64015. }, pixel, e);
  64016. }
  64017. }
  64018. }
  64019. ;(external_ol_Map_default()).prototype.forEachFeatureAtPixelDefault = (external_ol_Map_default()).prototype.forEachFeatureAtPixel;
  64020. ;(external_ol_Map_default()).prototype.forEachFeatureAtPixel = (external_ol_Map_default()).prototype.Tc = function (pixel, callback, opt_options, e) {
  64021. //如果满足高效率图层选取要求优先返回高效率图层选中结果
  64022. const layerFilter = (opt_options && opt_options.layerFilter) ? opt_options.layerFilter : () => {
  64023. return true;
  64024. };
  64025. const layers = this.getLayers().getArray();
  64026. const resolution = this.getView().getResolution();
  64027. const coordinate = this.getCoordinateFromPixel(pixel);
  64028. for (let i = 0; i < layers.length; i++) {
  64029. const layer = layers[i];
  64030. if (layer.getVisible() && layerFilter.call(null, layer)) {
  64031. fun(layer, coordinate, resolution, callback, pixel, e)
  64032. }
  64033. }
  64034. return this.forEachFeatureAtPixelDefault(pixel, callback, opt_options);
  64035. }
  64036. }();
  64037. ;// CONCATENATED MODULE: ./src/openlayers/core/index.js
  64038. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64039. * This program are made available under the terms of the Apache License, Version 2.0
  64040. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64041. ;// CONCATENATED MODULE: external "ol.source.TileImage"
  64042. const external_ol_source_TileImage_namespaceObject = ol.source.TileImage;
  64043. var external_ol_source_TileImage_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_TileImage_namespaceObject);
  64044. ;// CONCATENATED MODULE: external "ol.asserts"
  64045. const external_ol_asserts_namespaceObject = ol.asserts;
  64046. ;// CONCATENATED MODULE: external "ol.tilegrid.TileGrid"
  64047. const external_ol_tilegrid_TileGrid_namespaceObject = ol.tilegrid.TileGrid;
  64048. var external_ol_tilegrid_TileGrid_default = /*#__PURE__*/__webpack_require__.n(external_ol_tilegrid_TileGrid_namespaceObject);
  64049. ;// CONCATENATED MODULE: ./src/openlayers/mapping/BaiduMap.js
  64050. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64051. * This program are made available under the terms of the Apache License, Version 2.0
  64052. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64053. /**
  64054. * @class ol.source.BaiduMap
  64055. * @category ThirdPartyMap
  64056. * @classdesc 百度地图图层源。
  64057. * @param {Object} opt_options - 参数。
  64058. * @param {string} [opt_options.url='http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408'] - 服务地址。
  64059. * @param {string} [opt_options.tileProxy] - 代理地址。
  64060. * @param {boolean} [hidpi = false] - 是否使用高分辨率地图。
  64061. * @extends {ol/source/TileImage}
  64062. */
  64063. class BaiduMap extends (external_ol_source_TileImage_default()) {
  64064. constructor(opt_options) {
  64065. var options = opt_options || {};
  64066. var attributions =
  64067. options.attributions ||
  64068. "Map Data © 2018 Baidu - GS(2016)2089号 - Data © 长地万方 with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>";
  64069. var tileGrid = BaiduMap.defaultTileGrid();
  64070. var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
  64071. var url =
  64072. options.url !== undefined
  64073. ? options.url
  64074. : 'http://online1.map.bdimg.com/onlinelabel/?qt=tile&x={x}&y={y}&z={z}&styles={styles}&udt=20170408';
  64075. var hidpi =
  64076. options.hidpi || (window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI) > 1;
  64077. url = url.replace('{styles}', hidpi ? 'ph' : 'pl');
  64078. super({
  64079. attributions: attributions,
  64080. cacheSize: options.cacheSize,
  64081. crossOrigin: crossOrigin,
  64082. opaque: options.opaque !== undefined ? options.opaque : true,
  64083. maxZoom: options.maxZoom !== undefined ? options.maxZoom : 19,
  64084. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  64085. tileLoadFunction: options.tileLoadFunction,
  64086. projection: 'EPSG:3857',
  64087. wrapX: options.wrapX,
  64088. tilePixelRatio: hidpi ? 2 : 1,
  64089. tileGrid: tileGrid,
  64090. tileUrlFunction: tileUrlFunction
  64091. });
  64092. if (options.tileProxy) {
  64093. this.tileProxy = options.tileProxy;
  64094. }
  64095. var me = this;
  64096. // eslint-disable-next-line no-unused-vars
  64097. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  64098. var tempUrl = url
  64099. .replace('{z}', tileCoord[0].toString())
  64100. .replace('{x}', tileCoord[1].toString())
  64101. .replace('{y}', function() {
  64102. console.log(core_Util_Util.getOlVersion());
  64103. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? tileCoord[2] : -tileCoord[2] - 1;
  64104. return y.toString();
  64105. })
  64106. .replace('{-y}', function() {
  64107. var z = tileCoord[0];
  64108. var range = tileGrid.getFullTileRange(z);
  64109. external_ol_asserts_namespaceObject.assert(range, 55); // The {-y} placeholder requires a tile grid with extent
  64110. var y = range.getHeight() + tileCoord[2];
  64111. return y.toString();
  64112. });
  64113. //支持代理
  64114. if (me.tileProxy) {
  64115. tempUrl = me.tileProxy + encodeURIComponent(tempUrl);
  64116. }
  64117. return tempUrl;
  64118. }
  64119. }
  64120. // TODO 确认这个方法是否要开出去
  64121. /**
  64122. * @function ol.source.BaiduMap.defaultTileGrid
  64123. * @description 获取默认瓦片格网。
  64124. * @returns {ol/tilegrid/TileGrid} 返回瓦片格网对象。
  64125. */
  64126. static defaultTileGrid() {
  64127. var tileGird = new (external_ol_tilegrid_TileGrid_default())({
  64128. extent: [-33554432, -33554432, 33554432, 33554432],
  64129. resolutions: [
  64130. 131072 * 2,
  64131. 131072,
  64132. 65536,
  64133. 32768,
  64134. 16284,
  64135. 8192,
  64136. 4096,
  64137. 2048,
  64138. 1024,
  64139. 512,
  64140. 256,
  64141. 128,
  64142. 64,
  64143. 32,
  64144. 16,
  64145. 8,
  64146. 4,
  64147. 2,
  64148. 1,
  64149. 0.5
  64150. ],
  64151. origin: [0, 0],
  64152. minZoom: 3
  64153. });
  64154. return tileGird;
  64155. }
  64156. }
  64157. ;// CONCATENATED MODULE: external "ol.size"
  64158. const external_ol_size_namespaceObject = ol.size;
  64159. ;// CONCATENATED MODULE: external "ol.tilegrid"
  64160. const external_ol_tilegrid_namespaceObject = ol.tilegrid;
  64161. ;// CONCATENATED MODULE: ./src/openlayers/mapping/ImageSuperMapRest.js
  64162. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64163. * This program are made available under the terms of the Apache License, Version 2.0
  64164. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64165. /**
  64166. * @class ol.source.ImageSuperMapRest
  64167. * @category iServer Map
  64168. * @classdesc SuperMap iServer Image 图层源。
  64169. * @param {Object} options - 参数。
  64170. * @param {string} options.url - 地图服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  64171. * @param {ol/tilegrid/TileGrid} [options.tileGrid] - 瓦片网格对象。
  64172. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
  64173. * @param {boolean} [options.redirect=false] - 是否重定向。
  64174. * @param {boolean} [options.transparent=true] - 瓦片是否透明。
  64175. * @param {boolean} [options.cacheEnabled=true] - 是否使用服务端的缓存,true 表示使用服务端的缓存。
  64176. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时, 系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  64177. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。
  64178. * @param {boolean} [options.clipRegionEnabled = false] - 是否地图只显示该区域覆盖的部分。true 表示地图只显示该区域覆盖的部分。
  64179. * @param {(ol/geom/Geometry|ol/geom/Geometry)} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  64180. * @param {boolean} [options.overlapDisplayed=false] - 地图对象在同一范围内时,是否重叠显示。如果为 true,则同一范围内的对象会直接压盖;如果为 false 则通过 overlapDisplayedOptions 控制对象不压盖显示。
  64181. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
  64182. * @param {string} [options.tileversion] - 切片版本名称,_cache 为 true 时有效。
  64183. * @param {string} [options.tileProxy] - 代理地址。
  64184. * @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  64185. * @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片类型。
  64186. * @extends {ol/source/TileImage}
  64187. */
  64188. class ImageSuperMapRest extends (external_ol_source_TileImage_default()) {
  64189. constructor(options) {
  64190. if (options.url === undefined) {
  64191. return;
  64192. }
  64193. options.attributions =
  64194. options.attributions || "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <a href='https://iclient.supermap.io/'>© SuperMap iClient</a>"
  64195. options.format = options.format ? options.format : 'png'
  64196. var layerUrl = Util.urlPathAppend(options.url, "image." + options.format);
  64197. options.serverType = options.serverType || ServerType.ISERVER;
  64198. //为url添加安全认证信息片段
  64199. layerUrl = appendCredential(options.url, layerUrl, options.serverType);
  64200. /**
  64201. * @function ol.source.ImageSuperMapRest.prototype.appendCredential
  64202. * @description 添加凭据。
  64203. * @param {string} url - 地址。
  64204. * @param {Object} [serverType=SuperMap.ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
  64205. * @returns {string} 添加生成后的新地址。
  64206. */
  64207. function appendCredential(id, url, serverType) {
  64208. var newUrl = url,
  64209. credential,
  64210. value;
  64211. switch (serverType) {
  64212. case ServerType.IPORTAL:
  64213. value = SecurityManager.getToken(id);
  64214. credential = value ? new Credential(value, 'token') : null;
  64215. if (!credential) {
  64216. value = SecurityManager.getKey(id);
  64217. credential = value ? new Credential(value, 'key') : null;
  64218. }
  64219. break;
  64220. case ServerType.ONLINE:
  64221. value = SecurityManager.getKey(id);
  64222. credential = value ? new Credential(value, 'key') : null;
  64223. break;
  64224. default:
  64225. //iserver or others
  64226. value = SecurityManager.getToken(id);
  64227. credential = value ? new Credential(value, 'token') : null;
  64228. break;
  64229. }
  64230. if (credential) {
  64231. newUrl = Util.urlAppend(newUrl,credential.getUrlParameters());
  64232. }
  64233. return newUrl;
  64234. }
  64235. const params = {};
  64236. //切片是否透明
  64237. var transparent = options.transparent !== undefined ? options.transparent : true;
  64238. params['transparent'] = transparent;
  64239. //是否使用缓存吗,默认为true
  64240. var cacheEnabled = options.cacheEnabled !== undefined ? options.cacheEnabled : true;
  64241. params['cacheEnabled'] = cacheEnabled;
  64242. //如果有layersID,则是在使用专题图
  64243. if (options.layersID !== undefined) {
  64244. params['layersID'] = options.layersID;
  64245. }
  64246. //是否重定向,默认为false
  64247. var redirect = false;
  64248. if (options.redirect !== undefined) {
  64249. redirect = options.redirect;
  64250. }
  64251. params['redirect'] = redirect;
  64252. if (options.prjCoordSys) {
  64253. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  64254. }
  64255. if (options.clipRegionEnabled && options.clipRegion instanceof (external_ol_geom_Geometry_default())) {
  64256. options.clipRegion = core_Util_Util.toSuperMapGeometry(new (external_ol_format_GeoJSON_default())().writeGeometryObject(options.clipRegion));
  64257. options.clipRegion = Util.toJSON(ServerGeometry.fromGeometry(options.clipRegion));
  64258. params['clipRegionEnabled'] = options.clipRegionEnabled;
  64259. params['clipRegion'] = JSON.stringify(options.clipRegion);
  64260. }
  64261. if (!!options.overlapDisplayed && options.overlapDisplayedOptions) {
  64262. // options.overlapDisplayedOptions = options.overlapDisplayedOptions;
  64263. params['overlapDisplayed'] = options.overlapDisplayed;
  64264. params['overlapDisplayedOptions'] = options.overlapDisplayedOptions.toString();
  64265. }
  64266. if (cacheEnabled === true && options.tileversion) {
  64267. params['tileversion'] = options.tileversion;
  64268. }
  64269. if (options.rasterfunction) {
  64270. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  64271. }
  64272. layerUrl = Util.urlAppend(encodeURI(layerUrl), Util.getParameterString(params));
  64273. super({
  64274. attributions: options.attributions,
  64275. cacheSize: options.cacheSize,
  64276. crossOrigin: options.crossOrigin,
  64277. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  64278. opaque: options.opaque,
  64279. projection: options.projection,
  64280. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  64281. state: options.state,
  64282. tileClass: options.tileClass,
  64283. tileGrid: options.tileGrid,
  64284. tileLoadFunction: options.tileLoadFunction,
  64285. tilePixelRatio: options.tilePixelRatio,
  64286. tileUrlFunction: tileUrlFunction,
  64287. wrapX: options.wrapX !== undefined ? options.wrapX : false,
  64288. cacheEnabled: options.cacheEnabled,
  64289. layersID: options.layersID
  64290. });
  64291. //存储一个cacheEnabled
  64292. this.cacheEnabled = cacheEnabled;
  64293. if (options.tileProxy) {
  64294. this.tileProxy = options.tileProxy;
  64295. }
  64296. var me = this;
  64297. /**
  64298. * @function ol.source.ImageSuperMapRest.prototype.tileUrlFunction
  64299. * @param {Object} tileCoord - 瓦片坐标系。
  64300. * @param {Object} pixelRatio - 像素密度。
  64301. * @param {string} projection - 投影参考系。
  64302. * @description 瓦片地址参数。
  64303. * @returns {string} 返回瓦片地址参数
  64304. */
  64305. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  64306. if (!this.tileGrid) {
  64307. this.tileGrid = this.getTileGridForProjection && this.getTileGridForProjection(projection);
  64308. }
  64309. if (!this.tileGrid) {
  64310. if (options.extent) {
  64311. this.tileGrid = ImageSuperMapRest.createTileGrid(options.extent);
  64312. if (this.resolutions) {
  64313. this.tileGrid.resolutions = me.resolutions;
  64314. }
  64315. } else {
  64316. if (projection.getCode() === 'EPSG:3857') {
  64317. this.tileGrid = ImageSuperMapRest.createTileGrid([
  64318. -20037508.3427892,
  64319. -20037508.3427892,
  64320. 20037508.3427892,
  64321. 20037508.3427892
  64322. ]);
  64323. this.extent = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892];
  64324. }
  64325. if (projection.getCode() === 'EPSG:4326') {
  64326. this.tileGrid = ImageSuperMapRest.createTileGrid([-180, -90, 180, 90]);
  64327. this.extent = [-180, -90, 180, 90];
  64328. }
  64329. }
  64330. }
  64331. var tileExtent = this.tileGrid.getTileCoordExtent(tileCoord, this.tmpExtent_);
  64332. var tileSize = external_ol_size_namespaceObject.toSize(this.tileGrid.getTileSize(tileCoord[0]), this.tmpSize);
  64333. var url =
  64334. layerUrl +
  64335. encodeURI(
  64336. '&width=' +
  64337. tileSize[0] +
  64338. '&height=' +
  64339. tileSize[1] +
  64340. '&viewBounds=' +
  64341. '{"leftBottom" : {"x":' +
  64342. tileExtent[0] +
  64343. ',"y":' +
  64344. tileExtent[1] +
  64345. '},"rightTop" : {"x":' +
  64346. tileExtent[2] +
  64347. ',"y":' +
  64348. tileExtent[3] +
  64349. '}}'
  64350. );
  64351. //支持代理
  64352. if (me.tileProxy) {
  64353. url = me.tileProxy + encodeURIComponent(url);
  64354. }
  64355. //不启用缓存时启用时间戳
  64356. if (!me.cacheEnabled) {
  64357. url += '&_t=' + new Date().getTime();
  64358. }
  64359. return url;
  64360. }
  64361. }
  64362. /**
  64363. * @function ol.source.ImageSuperMapRest.optionsFromMapJSON
  64364. * @param {string} url - 地址。
  64365. * @param {Object} mapJSONObj - 地图 JSON。
  64366. * @description 获取地图 JSON 信息。
  64367. */
  64368. static optionsFromMapJSON(url, mapJSONObj) {
  64369. var options = {};
  64370. options.url = url;
  64371. options.crossOrigin = 'anonymous';
  64372. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  64373. var resolutions = getResolutions();
  64374. function getResolutions() {
  64375. var level = 17;
  64376. var dpi = 96;
  64377. var width = extent[2] - extent[0];
  64378. var height = extent[3] - extent[1];
  64379. var tileSize = width >= height ? width : height;
  64380. var maxReolution;
  64381. if (tileSize === width) {
  64382. maxReolution = tileSize / mapJSONObj.viewer.width;
  64383. } else {
  64384. maxReolution = tileSize / mapJSONObj.viewer.height;
  64385. }
  64386. var resolutions = [];
  64387. var unit = REST_Unit.METER;
  64388. if (mapJSONObj.coordUnit === REST_Unit.DEGREE) {
  64389. unit = REST_Unit.DEGREE;
  64390. }
  64391. if (mapJSONObj.visibleScales.length > 0) {
  64392. for (let i = 0; i < mapJSONObj.visibleScales.length; i++) {
  64393. resolutions.push(core_Util_Util.scaleToResolution(mapJSONObj.visibleScales[i], dpi, unit));
  64394. }
  64395. } else {
  64396. for (let i = 0; i < level; i++) {
  64397. resolutions.push(maxReolution / Math.pow(2, i));
  64398. }
  64399. }
  64400. function sortNumber(a, b) {
  64401. return b - a;
  64402. }
  64403. return resolutions.sort(sortNumber);
  64404. }
  64405. options.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  64406. extent: extent,
  64407. resolutions: resolutions
  64408. });
  64409. return options;
  64410. }
  64411. /**
  64412. * @function ol.source.ImageSuperMapRest.createTileGrid
  64413. * @param {number} extent - 长度。
  64414. * @param {number} maxZoom - 最大的放大级别。
  64415. * @param {number} minZoom - 最小的放大级别。
  64416. * @param {number} tileSize - 瓦片的尺寸。
  64417. * @param {number} origin - 原点。
  64418. * @description 创建网格切片。
  64419. * @returns {ol/tilegrid/TileGrid} 创建的网格切片
  64420. */
  64421. static createTileGrid(extent, maxZoom, minZoom, tileSize, origin) {
  64422. var tilegrid = external_ol_tilegrid_namespaceObject.createXYZ({
  64423. extent: extent,
  64424. maxZoom: maxZoom,
  64425. minZoom: minZoom,
  64426. tileSize: tileSize
  64427. });
  64428. return new (external_ol_tilegrid_TileGrid_default())({
  64429. extent: extent,
  64430. minZoom: minZoom,
  64431. origin: origin,
  64432. resolutions: tilegrid.getResolutions(),
  64433. tileSize: tilegrid.getTileSize()
  64434. });
  64435. }
  64436. }
  64437. ;// CONCATENATED MODULE: external "ol.source.XYZ"
  64438. const external_ol_source_XYZ_namespaceObject = ol.source.XYZ;
  64439. var external_ol_source_XYZ_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_XYZ_namespaceObject);
  64440. ;// CONCATENATED MODULE: ./src/openlayers/mapping/SuperMapCloud.js
  64441. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64442. * This program are made available under the terms of the Apache License, Version 2.0
  64443. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64444. /**
  64445. * @class ol.source.SuperMapCloud
  64446. * @category ThirdPartyMap
  64447. * @classdesc 超图云地图图层源。
  64448. * @param {Object} opt_options - 参数。
  64449. * @param {string} [opt_options.url='http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}'] - 服务地址。
  64450. * @param {string} [opt_options.tileProxy] - 代理地址。
  64451. * @extends {ol/source/XYZ}
  64452. */
  64453. class SuperMapCloud extends (external_ol_source_XYZ_default()) {
  64454. constructor(opt_options) {
  64455. var options = opt_options || {};
  64456. var attributions = options.attributions || "Map Data ©2014 SuperMap - GS(2014)6070号-data©Navinfo with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>"
  64457. var mapName = options.mapName || 'quanguo';
  64458. var mapType = options.mapType || 'web';
  64459. var url = options.url || 'http://t2.dituhui.com/FileService/image?map={mapName}&type={type}&x={x}&y={y}&z={z}';
  64460. url = url.replace('{mapName}', mapName).replace('{type}', mapType);
  64461. var superOptions = {
  64462. attributions: attributions,
  64463. cacheSize: options.cacheSize,
  64464. crossOrigin: options.crossOrigin,
  64465. opaque: options.opaque === undefined ? true : options.opaque,
  64466. maxZoom: options.maxZoom || 18,
  64467. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  64468. url: url,
  64469. wrapX: options.wrapX
  64470. };
  64471. //需要代理时走自定义 tileLoadFunction,否则走默认的tileLoadFunction
  64472. if (options.tileProxy) {
  64473. superOptions.tileLoadFunction = tileLoadFunction;
  64474. }
  64475. super(superOptions);
  64476. if (options.tileProxy) {
  64477. this.tileProxy = options.tileProxy;
  64478. }
  64479. //需要代理时,走以下代码
  64480. var me = this;
  64481. function tileLoadFunction(imageTile, src) {
  64482. //支持代理
  64483. imageTile.getImage().src = me.tileProxy + encodeURIComponent(src);
  64484. }
  64485. }
  64486. }
  64487. ;// CONCATENATED MODULE: external "ol.source.WMTS"
  64488. const external_ol_source_WMTS_namespaceObject = ol.source.WMTS;
  64489. var external_ol_source_WMTS_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_WMTS_namespaceObject);
  64490. ;// CONCATENATED MODULE: external "ol.tilegrid.WMTS"
  64491. const external_ol_tilegrid_WMTS_namespaceObject = ol.tilegrid.WMTS;
  64492. var external_ol_tilegrid_WMTS_default = /*#__PURE__*/__webpack_require__.n(external_ol_tilegrid_WMTS_namespaceObject);
  64493. ;// CONCATENATED MODULE: ./src/openlayers/mapping/Tianditu.js
  64494. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64495. * This program are made available under the terms of the Apache License, Version 2.0
  64496. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64497. /**
  64498. * @class ol.source.Tianditu
  64499. * @category ThirdPartyMap
  64500. * @classdesc 天地图图层源。
  64501. * @param {Object} opt_options - 参数。
  64502. * @param {string} [opt_options.url='http://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?'] - 服务地址。
  64503. * @param {string} opt_options.key - 天地图服务密钥。详见{@link http://lbs.tianditu.gov.cn/server/MapService.html}
  64504. * @param {string} [opt_options.layerType='vec'] - 图层类型。(vec:矢量图层,img:影像图层,ter:地形图层)
  64505. * @param {string} [opt_options.attributions] - 版权描述信息。
  64506. * @param {number} [opt_options.cacheSize = 2048] - 缓冲大小。
  64507. * @param {function} [opt_options.tileLoadFunction] - 切片加载完成后执行函数。
  64508. * @param {string} [opt_options.style] - 图层风格。
  64509. * @param {string} [opt_options.format='tiles'] - 格式。
  64510. * @param {boolean} [opt_options.isLabel] - 是否是标注图层。
  64511. * @param {boolean} [opt_options.opaque=true] - 是否透明。
  64512. * @param {string} [opt_options.tileProxy] - 代理地址。
  64513. * @extends {ol/source/WMTS}
  64514. */
  64515. class Tianditu extends (external_ol_source_WMTS_default()) {
  64516. constructor(opt_options) {
  64517. var layerLabelMap = {
  64518. "vec": "cva",
  64519. "ter": "cta",
  64520. "img": "cia"
  64521. }
  64522. var layerZoomMap = {
  64523. "vec": 18,
  64524. "ter": 14,
  64525. "img": 18
  64526. }
  64527. var options = opt_options || {};
  64528. var attributions = options.attributions || "Map Data <a href='http://www.tianditu.gov.cn' target='_blank'><img style='background-color:transparent;bottom:2px;opacity:1;' " +
  64529. "src='http://api.tianditu.gov.cn/img/map/logo.png' width='53px' height='22px' opacity='0'></a> with " +
  64530. "<span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>"
  64531. options.layerType = options.layerType || "vec";
  64532. options.layerType = options.isLabel ? layerLabelMap[options.layerType] : options.layerType;
  64533. options.matrixSet = (options.projection === 'EPSG:4326' || options.projection === 'EPSG:4490') ? "c" : "w";
  64534. if (!options.url && !options.urls) {
  64535. options.url = "http://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?"
  64536. }
  64537. if (options.key) {
  64538. options.url = `${options.url}tk=${options.key}`;
  64539. }
  64540. options.url = options.url.replace("{layer}", options.layerType).replace("{proj}", options.matrixSet);
  64541. var tileGrid = options.tileGrid || Tianditu.getTileGrid(options.projection || 'EPSG:3857');
  64542. var crossOrigin = options.crossOrigin !== undefined ? options.crossOrigin : 'anonymous';
  64543. var superOptions = {
  64544. version: options.version || '1.0.0',
  64545. format: options.format || 'tiles',
  64546. dimensions: options.dimensions || {},
  64547. layer: options.layerType,
  64548. matrixSet: options.matrixSet,
  64549. tileGrid: tileGrid,
  64550. style: options.style || 'default',
  64551. attributions: attributions,
  64552. cacheSize: options.cacheSize,
  64553. crossOrigin: crossOrigin,
  64554. opaque: options.opaque === undefined ? true : options.opaque,
  64555. maxZoom: layerZoomMap[options.layerType],
  64556. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  64557. url: options.url,
  64558. urls: options.urls,
  64559. projection: options.projection || 'EPSG:3857',
  64560. wrapX: options.wrapX
  64561. };
  64562. //需要代理时走自定义 tileLoadFunction,否则走默认的tileLoadFunction
  64563. if (options.tileProxy) {
  64564. superOptions.tileLoadFunction = tileLoadFunction;
  64565. }
  64566. super(superOptions);
  64567. if (options.tileProxy) {
  64568. this.tileProxy = options.tileProxy;
  64569. }
  64570. //需要代理时,走以下代码
  64571. var me = this;
  64572. function tileLoadFunction(imageTile, src) {
  64573. //支持代理
  64574. imageTile.getImage().src = me.tileProxy + encodeURIComponent(src);
  64575. }
  64576. }
  64577. /**
  64578. * @function ol.source.Tianditu.getTileGrid
  64579. * @description 获取瓦片网格。
  64580. * @param {Object} projection - 投影参考对象。
  64581. * @returns {ol/tilegrid/WMTS} 返回瓦片网格对象
  64582. */
  64583. static getTileGrid(projection) {
  64584. if (projection === "EPSG:4326" || projection === "EPSG:4490") {
  64585. return Tianditu.default4326TileGrid();
  64586. }
  64587. return Tianditu.default3857TileGrid();
  64588. }
  64589. /**
  64590. * @function ol.source.Tianditu.default4326TileGrid
  64591. * @description 获取默认 4326 网格瓦片。
  64592. * @returns {ol/tilegrid/WMTS} 返回默认 4326 网格瓦片对象。
  64593. */
  64594. static default4326TileGrid() {
  64595. var tdt_WGS84_resolutions = [];
  64596. var matrixIds = [];
  64597. for (var i = 1; i < 19; i++) {
  64598. tdt_WGS84_resolutions.push(0.703125 * 2 / (Math.pow(2, i)));
  64599. matrixIds.push(i);
  64600. }
  64601. var tileGird = new (external_ol_tilegrid_WMTS_default())({
  64602. extent: [-180, -90, 180, 90],
  64603. resolutions: tdt_WGS84_resolutions,
  64604. origin: [-180, 90],
  64605. matrixIds: matrixIds,
  64606. minZoom: 1
  64607. });
  64608. return tileGird;
  64609. }
  64610. /**
  64611. * @function ol.source.Tianditu.default3857TileGrid
  64612. * @description 获取默认 3857 网格瓦片。
  64613. * @returns {ol/tilegrid/WMTS} 返回默认 3857 网格瓦片对象。
  64614. */
  64615. static default3857TileGrid() {
  64616. var tdt_Mercator_resolutions = [];
  64617. var matrixIds = [];
  64618. for (var i = 1; i < 19; i++) {
  64619. tdt_Mercator_resolutions.push(78271.5169640203125 * 2 / (Math.pow(2, i)));
  64620. matrixIds.push(i);
  64621. }
  64622. var tileGird = new (external_ol_tilegrid_WMTS_default())({
  64623. extent: [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892],
  64624. resolutions: tdt_Mercator_resolutions,
  64625. matrixIds: matrixIds,
  64626. origin: [-20037508.3427892, 20037508.3427892],
  64627. minZoom: 1
  64628. });
  64629. return tileGird;
  64630. }
  64631. }
  64632. ;// CONCATENATED MODULE: ./src/openlayers/mapping/TileSuperMapRest.js
  64633. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  64634. * This program are made available under the terms of the Apache License, Version 2.0
  64635. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  64636. /**
  64637. * @class ol.source.TileSuperMapRest
  64638. * @category iServer Map
  64639. * @classdesc SuperMap iServer TileImage 图层源。
  64640. * @param {Object} options - 参数。
  64641. * @param {string} options.url - 地图服务地址,例如: http://{ip}:{port}/iserver/services/map-world/rest/maps/World。
  64642. * @param {ol/tilegrid/TileGrid} [options.tileGrid] - 瓦片网格对象。当不指定时,会通过 options.extent 或投影范围生成。
  64643. * @param {SuperMap.ServerType} [options.serverType=ServerType.ISERVER] - 服务类型 ISERVER|IPORTAL|ONLINE。
  64644. * @param {boolean} [options.redirect = false] - 是否重定向。
  64645. * @param {boolean} [options.transparent = true] - 瓦片是否透明。
  64646. * @param {boolean} [options.cacheEnabled = true] - 是否使用服务端的缓存。
  64647. * @param {Object} [options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时, 系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  64648. * @param {string} [options.layersID] - 获取进行切片的地图图层 ID,即指定进行地图切片的图层,可以是临时图层集,也可以是当前地图中图层的组合。
  64649. * @param {boolean} [options.clipRegionEnabled = false] - 是否只地图只显示该区域覆盖的部分。true 表示地图只显示该区域覆盖的部分。
  64650. * @param {(ol/geom/Geometry|ol/geom/Geometry)} [options.clipRegion] - 地图显示裁剪的区域。是一个面对象,当 clipRegionEnabled = true 时有效,即地图只显示该区域覆盖的部分。
  64651. * @param {boolean} [options.overlapDisplayed = false] - 地图对象在同一范围内时,是否重叠显示。如果为 true,则同一范围内的对象会直接压盖;如果为 false 则通过 overlapDisplayedOptions 控制对象不压盖显示。
  64652. * @param {SuperMap.OverlapDisplayedOptions} [options.overlapDisplayedOptions] - 避免地图对象压盖显示的过滤选项,当 overlapDisplayed 为 false 时有效,用来增强对地图对象压盖时的处理。
  64653. * @param {string} [options.tileversion] - 切片版本名称,_cache 为 true 时有效。
  64654. * @param {string} [options.tileProxy] - 代理地址。
  64655. * @param {string} [options.format = 'png'] - 瓦片表述类型,支持 "png" 、"webp"、"bmp" 、"jpg"、 "gif" 等图片类型。
  64656. * @param {(SuperMap.NDVIParameter|SuperMap.HillshadeParameter)} [options.rasterfunction] - 栅格分析参数。
  64657. * @extends {ol/source/TileImage}
  64658. */
  64659. class TileSuperMapRest extends (external_ol_source_TileImage_default()) {
  64660. constructor(options) {
  64661. options = options || {};
  64662. if (options.url === undefined) {
  64663. return;
  64664. }
  64665. options.attributions =
  64666. options.attributions ||
  64667. "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>";
  64668. options.format = options.format ? options.format : 'png';
  64669. options.serverType = options.serverType || ServerType.ISERVER;
  64670. super({
  64671. attributions: options.attributions,
  64672. cacheSize: options.cacheSize,
  64673. crossOrigin: options.crossOrigin,
  64674. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  64675. opaque: options.opaque,
  64676. projection: options.projection,
  64677. reprojectionErrorThreshold: options.reprojectionErrorThreshold,
  64678. state: options.state,
  64679. tileClass: options.tileClass,
  64680. tileGrid: options.tileGrid,
  64681. tileLoadFunction: options.tileLoadFunction,
  64682. tilePixelRatio: options.tilePixelRatio,
  64683. tileUrlFunction: tileUrlFunction,
  64684. wrapX: options.wrapX !== undefined ? options.wrapX : false,
  64685. cacheEnabled: options.cacheEnabled,
  64686. layersID: options.layersID
  64687. });
  64688. if (options.tileProxy) {
  64689. this.tileProxy = options.tileProxy;
  64690. }
  64691. this.options = options;
  64692. this._url = options.url;
  64693. //当前切片在切片集中的index
  64694. this.tileSetsIndex = -1;
  64695. this.tempIndex = -1;
  64696. this.dpi = this.options.dpi || 96;
  64697. var me = this;
  64698. var layerUrl = Util.urlPathAppend(options.url, 'tileImage.' + options.format);
  64699. function appendCredential(url, serverType) {
  64700. var newUrl = url,
  64701. credential,
  64702. value;
  64703. switch (serverType) {
  64704. case ServerType.IPORTAL:
  64705. value = SecurityManager.getToken(me._url);
  64706. credential = value ? new Credential(value, 'token') : null;
  64707. if (!credential) {
  64708. value = SecurityManager.getKey(me._url);
  64709. credential = value ? new Credential(value, 'key') : null;
  64710. }
  64711. break;
  64712. case ServerType.ONLINE:
  64713. value = SecurityManager.getKey(me._url);
  64714. credential = value ? new Credential(value, 'key') : null;
  64715. break;
  64716. default:
  64717. //iserver or others
  64718. value = SecurityManager.getToken(me._url);
  64719. credential = value ? new Credential(value, 'token') : null;
  64720. break;
  64721. }
  64722. if (credential) {
  64723. newUrl = Util.urlAppend(newUrl, credential.getUrlParameters());
  64724. }
  64725. return newUrl;
  64726. }
  64727. /**
  64728. * @function ol.source.TileSuperMapRest.prototype.getAllRequestParams
  64729. * @description 获取全部请求参数。
  64730. */
  64731. function getAllRequestParams() {
  64732. var me = this,
  64733. params = {};
  64734. params['redirect'] = options.redirect !== undefined ? options.redirect : false;
  64735. //切片是否透明
  64736. params['transparent'] = options.transparent !== undefined ? options.transparent : true;
  64737. params['cacheEnabled'] = !(options.cacheEnabled === false);
  64738. //存储一个cacheEnabled参数
  64739. me.cacheEnabled = params['cacheEnabled'];
  64740. params['_cache'] = params['cacheEnabled'];
  64741. //设置切片原点
  64742. if (this.origin) {
  64743. params['origin'] = JSON.stringify({
  64744. x: this.origin[0],
  64745. y: this.origin[1]
  64746. });
  64747. }
  64748. if (options.prjCoordSys) {
  64749. params['prjCoordSys'] = JSON.stringify(options.prjCoordSys);
  64750. }
  64751. if (options.layersID) {
  64752. params['layersID'] = options.layersID.toString();
  64753. }
  64754. if (options.clipRegion instanceof (external_ol_geom_Geometry_default())) {
  64755. options.clipRegionEnabled = true;
  64756. options.clipRegion = core_Util_Util.toSuperMapGeometry(new (external_ol_format_GeoJSON_default())().writeGeometryObject(options.clipRegion));
  64757. options.clipRegion = Util.toJSON(ServerGeometry.fromGeometry(options.clipRegion));
  64758. params['clipRegionEnabled'] = options.clipRegionEnabled;
  64759. params['clipRegion'] = JSON.stringify(options.clipRegion);
  64760. }
  64761. if (!options.overlapDisplayed) {
  64762. params['overlapDisplayed'] = false;
  64763. if (options.overlapDisplayedOptions) {
  64764. params['overlapDisplayedOptions'] = me.overlapDisplayedOptions.toString();
  64765. }
  64766. } else {
  64767. params['overlapDisplayed'] = true;
  64768. }
  64769. if (params.cacheEnabled && options.tileversion) {
  64770. params['tileversion'] = options.tileversion.toString();
  64771. }
  64772. if (options.rasterfunction) {
  64773. params['rasterfunction'] = JSON.stringify(options.rasterfunction);
  64774. }
  64775. return params;
  64776. }
  64777. /**
  64778. * @function ol.source.TileSuperMapRest.prototype.getFullRequestUrl
  64779. * @description 获取完整的请求地址。
  64780. */
  64781. function getFullRequestUrl() {
  64782. if (this._paramsChanged) {
  64783. this._layerUrl = createLayerUrl.call(this);
  64784. this._paramsChanged = false;
  64785. }
  64786. return this._layerUrl || createLayerUrl.call(this);
  64787. }
  64788. /**
  64789. * @function ol.source.TileSuperMapRest.prototype.createLayerUrl
  64790. * @description 获取新建图层地址。
  64791. */
  64792. function createLayerUrl() {
  64793. this.requestParams = this.requestParams || getAllRequestParams.call(this);
  64794. this._layerUrl = Util.urlAppend(layerUrl, Util.getParameterString(this.requestParams));
  64795. //为url添加安全认证信息片段
  64796. this._layerUrl = appendCredential(this._layerUrl, options.serverType);
  64797. return this._layerUrl;
  64798. }
  64799. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  64800. if (!me.tileGrid) {
  64801. if (options.extent) {
  64802. me.tileGrid = TileSuperMapRest.createTileGrid(options.extent);
  64803. if (me.resolutions) {
  64804. me.tileGrid.resolutions = me.resolutions;
  64805. }
  64806. } else {
  64807. if (projection.getCode() === 'EPSG:3857') {
  64808. me.tileGrid = TileSuperMapRest.createTileGrid([
  64809. -20037508.3427892,
  64810. -20037508.3427892,
  64811. 20037508.3427892,
  64812. 20037508.3427892
  64813. ]);
  64814. me.extent = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892];
  64815. }
  64816. if (projection.getCode() === 'EPSG:4326') {
  64817. me.tileGrid = TileSuperMapRest.createTileGrid([-180, -90, 180, 90]);
  64818. me.extent = [-180, -90, 180, 90];
  64819. }
  64820. }
  64821. }
  64822. me.origin = me.tileGrid.getOrigin(0);
  64823. var z = tileCoord[0];
  64824. var x = tileCoord[1];
  64825. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  64826. var resolution = me.tileGrid.getResolution(z);
  64827. var dpi = me.dpi || 96;
  64828. var unit = projection.getUnits() || REST_Unit.DEGREE;
  64829. // OGC WKT 解析出单位是 degree
  64830. if (unit === 'degrees' || unit === 'degree') {
  64831. unit = REST_Unit.DEGREE;
  64832. }
  64833. //通过wkt方式自定义坐标系的时候,是meter
  64834. if (unit === 'm' || unit === 'meter') {
  64835. unit = REST_Unit.METER;
  64836. }
  64837. var scale = core_Util_Util.resolutionToScale(resolution, dpi, unit);
  64838. var tileSize = external_ol_size_namespaceObject.toSize(me.tileGrid.getTileSize(z, me.tmpSize));
  64839. var layerUrl = getFullRequestUrl.call(me);
  64840. var url =
  64841. layerUrl +
  64842. encodeURI(
  64843. '&x=' + x + '&y=' + y + '&width=' + tileSize[0] + '&height=' + tileSize[1] + '&scale=' + scale
  64844. );
  64845. //支持代理
  64846. if (me.tileProxy) {
  64847. url = me.tileProxy + encodeURIComponent(url);
  64848. }
  64849. if (!me.cacheEnabled) {
  64850. url += '&_t=' + new Date().getTime();
  64851. }
  64852. return url;
  64853. }
  64854. }
  64855. /**
  64856. * @function ol.source.TileSuperMapRest.prototype.setTileSetsInfo
  64857. * @description 设置瓦片集信息。
  64858. * @param {Object} tileSets - 瓦片集合。
  64859. */
  64860. setTileSetsInfo(tileSets) {
  64861. this.tileSets = tileSets;
  64862. if (core_Util_Util.isArray(this.tileSets)) {
  64863. this.tileSets = tileSets[0];
  64864. }
  64865. if (!this.tileSets) {
  64866. return;
  64867. }
  64868. this.dispatchEvent({
  64869. type: 'tilesetsinfoloaded',
  64870. value: {
  64871. tileVersions: this.tileSets.tileVersions
  64872. }
  64873. });
  64874. this.changeTilesVersion();
  64875. }
  64876. /**
  64877. * @function ol.source.TileSuperMapRest.prototype.lastTilesVersion
  64878. * @description 请求上一个版本切片,并重新绘制。
  64879. */
  64880. lastTilesVersion() {
  64881. this.tempIndex = this.tileSetsIndex - 1;
  64882. this.changeTilesVersion();
  64883. }
  64884. /**
  64885. * @function ol.source.TileSuperMapRest.prototype.nextTilesVersion
  64886. * @description 请求下一个版本切片,并重新绘制。
  64887. */
  64888. nextTilesVersion() {
  64889. this.tempIndex = this.tileSetsIndex + 1;
  64890. this.changeTilesVersion();
  64891. }
  64892. /**
  64893. * @function ol.source.TileSuperMapRest.prototype.changeTilesVersion
  64894. * @description 切换到某一版本的切片,并重绘。通过 this.tempIndex 保存需要切换的版本索引。
  64895. */
  64896. changeTilesVersion() {
  64897. var me = this;
  64898. //切片版本集信息是否存在
  64899. if (me.tileSets == null) {
  64900. return;
  64901. }
  64902. if (me.tempIndex === me.tileSetsIndex || this.tempIndex < 0) {
  64903. return;
  64904. }
  64905. //检测index是否可用
  64906. var tileVersions = me.tileSets.tileVersions;
  64907. if (tileVersions && me.tempIndex < tileVersions.length && me.tempIndex >= 0) {
  64908. var name = tileVersions[me.tempIndex].name;
  64909. var result = me.mergeTileVersionParam(name);
  64910. if (result) {
  64911. me.tileSetsIndex = me.tempIndex;
  64912. me.dispatchEvent({
  64913. type: 'tileversionschanged',
  64914. value: {
  64915. tileVersion: tileVersions[me.tempIndex]
  64916. }
  64917. });
  64918. }
  64919. }
  64920. }
  64921. /**
  64922. * @function ol.source.TileSuperMapRest.prototype.updateCurrentTileSetsIndex
  64923. * @description 更新当前切片集索引,目前主要提供给控件使用。
  64924. * @param {number} index - 索引号。
  64925. */
  64926. updateCurrentTileSetsIndex(index) {
  64927. this.tempIndex = index;
  64928. }
  64929. /**
  64930. * @function ol.source.TileSuperMapRest.prototype.mergeTileVersionParam
  64931. * @description 更改 URL 请求参数中的切片版本号,并重绘。
  64932. * @param {Object} version - 版本信息。
  64933. * @returns {boolean} 是否成功。
  64934. */
  64935. mergeTileVersionParam(version) {
  64936. if (version) {
  64937. this.requestParams['tileversion'] = version;
  64938. this._paramsChanged = true;
  64939. this.refresh();
  64940. return true;
  64941. }
  64942. return false;
  64943. }
  64944. /**
  64945. * @function ol.source.TileSuperMapRest.optionsFromMapJSON
  64946. * @description 从 MapJSON 中获取参数对象。
  64947. * @param {string} url - 地址。
  64948. * @param {Object} mapJSONObj - 地图 JSON 对象。
  64949. */
  64950. static optionsFromMapJSON(url, mapJSONObj) {
  64951. var options = {};
  64952. options.url = url;
  64953. options.crossOrigin = 'anonymous';
  64954. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  64955. var resolutions = getResolutions();
  64956. function getResolutions() {
  64957. var level = 22;
  64958. var dpi = 96;
  64959. var width = extent[2] - extent[0];
  64960. var height = extent[3] - extent[1];
  64961. var tileSize = width >= height ? width : height;
  64962. var maxReolution;
  64963. if (tileSize === width) {
  64964. maxReolution = tileSize / mapJSONObj.viewer.width;
  64965. } else {
  64966. maxReolution = tileSize / mapJSONObj.viewer.height;
  64967. }
  64968. var resolutions = [];
  64969. var unit = REST_Unit.METER;
  64970. if (mapJSONObj.coordUnit === REST_Unit.DEGREE) {
  64971. unit = REST_Unit.DEGREE;
  64972. }
  64973. if (mapJSONObj.visibleScalesEnabled && mapJSONObj.visibleScales && mapJSONObj.visibleScales.length > 0) {
  64974. for (let i = 0; i < mapJSONObj.visibleScales.length; i++) {
  64975. resolutions.push(core_Util_Util.scaleToResolution(mapJSONObj.visibleScales[i], dpi, unit));
  64976. }
  64977. } else {
  64978. for (let i = 0; i < level; i++) {
  64979. resolutions.push(maxReolution / Math.pow(2, i));
  64980. }
  64981. }
  64982. function sortNumber(a, b) {
  64983. return b - a;
  64984. }
  64985. return resolutions.sort(sortNumber);
  64986. }
  64987. options.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  64988. extent: extent,
  64989. resolutions: resolutions
  64990. });
  64991. return options;
  64992. }
  64993. /**
  64994. * @function ol.source.TileSuperMapRest.createTileGrid
  64995. * @description 创建切片网格。
  64996. * @param {number} extent - 长度。
  64997. * @param {number} maxZoom - 最大的放大级别。
  64998. * @param {number} minZoom - 最小的放大级别。
  64999. * @param {number} tileSize - 瓦片的尺寸。
  65000. * @param {number} origin - 原点。
  65001. * */
  65002. static createTileGrid(extent, maxZoom, minZoom, tileSize, origin) {
  65003. var tilegrid = external_ol_tilegrid_namespaceObject.createXYZ({
  65004. extent: extent,
  65005. maxZoom: maxZoom,
  65006. minZoom: minZoom,
  65007. tileSize: tileSize
  65008. });
  65009. return new (external_ol_tilegrid_TileGrid_default())({
  65010. extent: extent,
  65011. minZoom: minZoom,
  65012. origin: origin,
  65013. resolutions: tilegrid.getResolutions(),
  65014. tileSize: tilegrid.getTileSize()
  65015. });
  65016. }
  65017. }
  65018. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/global.js
  65019. /* harmony default export */ function global(defs) {
  65020. defs('EPSG:4326', "+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees");
  65021. defs('EPSG:4269', "+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees");
  65022. 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");
  65023. defs.WGS84 = defs['EPSG:4326'];
  65024. defs['EPSG:3785'] = defs['EPSG:3857']; // maintain backward compat, official code is 3857
  65025. defs.GOOGLE = defs['EPSG:3857'];
  65026. defs['EPSG:900913'] = defs['EPSG:3857'];
  65027. defs['EPSG:102113'] = defs['EPSG:3857'];
  65028. }
  65029. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/values.js
  65030. var PJD_3PARAM = 1;
  65031. var PJD_7PARAM = 2;
  65032. var PJD_WGS84 = 4; // WGS84 or equivalent
  65033. var PJD_NODATUM = 5; // WGS84 or equivalent
  65034. var SEC_TO_RAD = 4.84813681109535993589914102357e-6;
  65035. var HALF_PI = Math.PI/2;
  65036. // ellipoid pj_set_ell.c
  65037. var SIXTH = 0.1666666666666666667;
  65038. /* 1/6 */
  65039. var RA4 = 0.04722222222222222222;
  65040. /* 17/360 */
  65041. var RA6 = 0.02215608465608465608;
  65042. var EPSLN = 1.0e-10;
  65043. // you'd think you could use Number.EPSILON above but that makes
  65044. // Mollweide get into an infinate loop.
  65045. var D2R = 0.01745329251994329577;
  65046. var R2D = 57.29577951308232088;
  65047. var FORTPI = Math.PI/4;
  65048. var TWO_PI = Math.PI * 2;
  65049. // SPI is slightly greater than Math.PI, so values that exceed the -180..180
  65050. // degree range by a tiny amount don't get wrapped. This prevents points that
  65051. // have drifted from their original location along the 180th meridian (due to
  65052. // floating point error) from changing their sign.
  65053. var SPI = 3.14159265359;
  65054. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/PrimeMeridian.js
  65055. var PrimeMeridian_exports = {};
  65056. PrimeMeridian_exports.greenwich = 0.0; //"0dE",
  65057. PrimeMeridian_exports.lisbon = -9.131906111111; //"9d07'54.862\"W",
  65058. PrimeMeridian_exports.paris = 2.337229166667; //"2d20'14.025\"E",
  65059. PrimeMeridian_exports.bogota = -74.080916666667; //"74d04'51.3\"W",
  65060. PrimeMeridian_exports.madrid = -3.687938888889; //"3d41'16.58\"W",
  65061. PrimeMeridian_exports.rome = 12.452333333333; //"12d27'8.4\"E",
  65062. PrimeMeridian_exports.bern = 7.439583333333; //"7d26'22.5\"E",
  65063. PrimeMeridian_exports.jakarta = 106.807719444444; //"106d48'27.79\"E",
  65064. PrimeMeridian_exports.ferro = -17.666666666667; //"17d40'W",
  65065. PrimeMeridian_exports.brussels = 4.367975; //"4d22'4.71\"E",
  65066. PrimeMeridian_exports.stockholm = 18.058277777778; //"18d3'29.8\"E",
  65067. PrimeMeridian_exports.athens = 23.7163375; //"23d42'58.815\"E",
  65068. PrimeMeridian_exports.oslo = 10.722916666667; //"10d43'22.5\"E"
  65069. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/units.js
  65070. /* harmony default export */ const units = ({
  65071. ft: {to_meter: 0.3048},
  65072. 'us-ft': {to_meter: 1200 / 3937}
  65073. });
  65074. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/match.js
  65075. var ignoredChar = /[\s_\-\/\(\)]/g;
  65076. function match(obj, key) {
  65077. if (obj[key]) {
  65078. return obj[key];
  65079. }
  65080. var keys = Object.keys(obj);
  65081. var lkey = key.toLowerCase().replace(ignoredChar, '');
  65082. var i = -1;
  65083. var testkey, processedKey;
  65084. while (++i < keys.length) {
  65085. testkey = keys[i];
  65086. processedKey = testkey.toLowerCase().replace(ignoredChar, '');
  65087. if (processedKey === lkey) {
  65088. return obj[testkey];
  65089. }
  65090. }
  65091. }
  65092. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projString.js
  65093. /* harmony default export */ function projString(defData) {
  65094. var self = {};
  65095. var paramObj = defData.split('+').map(function(v) {
  65096. return v.trim();
  65097. }).filter(function(a) {
  65098. return a;
  65099. }).reduce(function(p, a) {
  65100. var split = a.split('=');
  65101. split.push(true);
  65102. p[split[0].toLowerCase()] = split[1];
  65103. return p;
  65104. }, {});
  65105. var paramName, paramVal, paramOutname;
  65106. var params = {
  65107. proj: 'projName',
  65108. datum: 'datumCode',
  65109. rf: function(v) {
  65110. self.rf = parseFloat(v);
  65111. },
  65112. lat_0: function(v) {
  65113. self.lat0 = v * D2R;
  65114. },
  65115. lat_1: function(v) {
  65116. self.lat1 = v * D2R;
  65117. },
  65118. lat_2: function(v) {
  65119. self.lat2 = v * D2R;
  65120. },
  65121. lat_ts: function(v) {
  65122. self.lat_ts = v * D2R;
  65123. },
  65124. lon_0: function(v) {
  65125. self.long0 = v * D2R;
  65126. },
  65127. lon_1: function(v) {
  65128. self.long1 = v * D2R;
  65129. },
  65130. lon_2: function(v) {
  65131. self.long2 = v * D2R;
  65132. },
  65133. alpha: function(v) {
  65134. self.alpha = parseFloat(v) * D2R;
  65135. },
  65136. lonc: function(v) {
  65137. self.longc = v * D2R;
  65138. },
  65139. x_0: function(v) {
  65140. self.x0 = parseFloat(v);
  65141. },
  65142. y_0: function(v) {
  65143. self.y0 = parseFloat(v);
  65144. },
  65145. k_0: function(v) {
  65146. self.k0 = parseFloat(v);
  65147. },
  65148. k: function(v) {
  65149. self.k0 = parseFloat(v);
  65150. },
  65151. a: function(v) {
  65152. self.a = parseFloat(v);
  65153. },
  65154. b: function(v) {
  65155. self.b = parseFloat(v);
  65156. },
  65157. r_a: function() {
  65158. self.R_A = true;
  65159. },
  65160. zone: function(v) {
  65161. self.zone = parseInt(v, 10);
  65162. },
  65163. south: function() {
  65164. self.utmSouth = true;
  65165. },
  65166. towgs84: function(v) {
  65167. self.datum_params = v.split(",").map(function(a) {
  65168. return parseFloat(a);
  65169. });
  65170. },
  65171. to_meter: function(v) {
  65172. self.to_meter = parseFloat(v);
  65173. },
  65174. units: function(v) {
  65175. self.units = v;
  65176. var unit = match(units, v);
  65177. if (unit) {
  65178. self.to_meter = unit.to_meter;
  65179. }
  65180. },
  65181. from_greenwich: function(v) {
  65182. self.from_greenwich = v * D2R;
  65183. },
  65184. pm: function(v) {
  65185. var pm = match(PrimeMeridian_exports, v);
  65186. self.from_greenwich = (pm ? pm : parseFloat(v)) * D2R;
  65187. },
  65188. nadgrids: function(v) {
  65189. if (v === '@null') {
  65190. self.datumCode = 'none';
  65191. }
  65192. else {
  65193. self.nadgrids = v;
  65194. }
  65195. },
  65196. axis: function(v) {
  65197. var legalAxis = "ewnsud";
  65198. 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) {
  65199. self.axis = v;
  65200. }
  65201. }
  65202. };
  65203. for (paramName in paramObj) {
  65204. paramVal = paramObj[paramName];
  65205. if (paramName in params) {
  65206. paramOutname = params[paramName];
  65207. if (typeof paramOutname === 'function') {
  65208. paramOutname(paramVal);
  65209. }
  65210. else {
  65211. self[paramOutname] = paramVal;
  65212. }
  65213. }
  65214. else {
  65215. self[paramName] = paramVal;
  65216. }
  65217. }
  65218. if(typeof self.datumCode === 'string' && self.datumCode !== "WGS84"){
  65219. self.datumCode = self.datumCode.toLowerCase();
  65220. }
  65221. return self;
  65222. }
  65223. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/parser.js
  65224. /* harmony default export */ const parser = (parseString);
  65225. var NEUTRAL = 1;
  65226. var KEYWORD = 2;
  65227. var NUMBER = 3;
  65228. var QUOTED = 4;
  65229. var AFTERQUOTE = 5;
  65230. var ENDED = -1;
  65231. var whitespace = /\s/;
  65232. var latin = /[A-Za-z]/;
  65233. var keyword = /[A-Za-z84]/;
  65234. var endThings = /[,\]]/;
  65235. var digets = /[\d\.E\-\+]/;
  65236. // const ignoredChar = /[\s_\-\/\(\)]/g;
  65237. function Parser(text) {
  65238. if (typeof text !== 'string') {
  65239. throw new Error('not a string');
  65240. }
  65241. this.text = text.trim();
  65242. this.level = 0;
  65243. this.place = 0;
  65244. this.root = null;
  65245. this.stack = [];
  65246. this.currentObject = null;
  65247. this.state = NEUTRAL;
  65248. }
  65249. Parser.prototype.readCharicter = function() {
  65250. var char = this.text[this.place++];
  65251. if (this.state !== QUOTED) {
  65252. while (whitespace.test(char)) {
  65253. if (this.place >= this.text.length) {
  65254. return;
  65255. }
  65256. char = this.text[this.place++];
  65257. }
  65258. }
  65259. switch (this.state) {
  65260. case NEUTRAL:
  65261. return this.neutral(char);
  65262. case KEYWORD:
  65263. return this.keyword(char)
  65264. case QUOTED:
  65265. return this.quoted(char);
  65266. case AFTERQUOTE:
  65267. return this.afterquote(char);
  65268. case NUMBER:
  65269. return this.number(char);
  65270. case ENDED:
  65271. return;
  65272. }
  65273. };
  65274. Parser.prototype.afterquote = function(char) {
  65275. if (char === '"') {
  65276. this.word += '"';
  65277. this.state = QUOTED;
  65278. return;
  65279. }
  65280. if (endThings.test(char)) {
  65281. this.word = this.word.trim();
  65282. this.afterItem(char);
  65283. return;
  65284. }
  65285. throw new Error('havn\'t handled "' +char + '" in afterquote yet, index ' + this.place);
  65286. };
  65287. Parser.prototype.afterItem = function(char) {
  65288. if (char === ',') {
  65289. if (this.word !== null) {
  65290. this.currentObject.push(this.word);
  65291. }
  65292. this.word = null;
  65293. this.state = NEUTRAL;
  65294. return;
  65295. }
  65296. if (char === ']') {
  65297. this.level--;
  65298. if (this.word !== null) {
  65299. this.currentObject.push(this.word);
  65300. this.word = null;
  65301. }
  65302. this.state = NEUTRAL;
  65303. this.currentObject = this.stack.pop();
  65304. if (!this.currentObject) {
  65305. this.state = ENDED;
  65306. }
  65307. return;
  65308. }
  65309. };
  65310. Parser.prototype.number = function(char) {
  65311. if (digets.test(char)) {
  65312. this.word += char;
  65313. return;
  65314. }
  65315. if (endThings.test(char)) {
  65316. this.word = parseFloat(this.word);
  65317. this.afterItem(char);
  65318. return;
  65319. }
  65320. throw new Error('havn\'t handled "' +char + '" in number yet, index ' + this.place);
  65321. };
  65322. Parser.prototype.quoted = function(char) {
  65323. if (char === '"') {
  65324. this.state = AFTERQUOTE;
  65325. return;
  65326. }
  65327. this.word += char;
  65328. return;
  65329. };
  65330. Parser.prototype.keyword = function(char) {
  65331. if (keyword.test(char)) {
  65332. this.word += char;
  65333. return;
  65334. }
  65335. if (char === '[') {
  65336. var newObjects = [];
  65337. newObjects.push(this.word);
  65338. this.level++;
  65339. if (this.root === null) {
  65340. this.root = newObjects;
  65341. } else {
  65342. this.currentObject.push(newObjects);
  65343. }
  65344. this.stack.push(this.currentObject);
  65345. this.currentObject = newObjects;
  65346. this.state = NEUTRAL;
  65347. return;
  65348. }
  65349. if (endThings.test(char)) {
  65350. this.afterItem(char);
  65351. return;
  65352. }
  65353. throw new Error('havn\'t handled "' +char + '" in keyword yet, index ' + this.place);
  65354. };
  65355. Parser.prototype.neutral = function(char) {
  65356. if (latin.test(char)) {
  65357. this.word = char;
  65358. this.state = KEYWORD;
  65359. return;
  65360. }
  65361. if (char === '"') {
  65362. this.word = '';
  65363. this.state = QUOTED;
  65364. return;
  65365. }
  65366. if (digets.test(char)) {
  65367. this.word = char;
  65368. this.state = NUMBER;
  65369. return;
  65370. }
  65371. if (endThings.test(char)) {
  65372. this.afterItem(char);
  65373. return;
  65374. }
  65375. throw new Error('havn\'t handled "' +char + '" in neutral yet, index ' + this.place);
  65376. };
  65377. Parser.prototype.output = function() {
  65378. while (this.place < this.text.length) {
  65379. this.readCharicter();
  65380. }
  65381. if (this.state === ENDED) {
  65382. return this.root;
  65383. }
  65384. throw new Error('unable to parse string "' +this.text + '". State is ' + this.state);
  65385. };
  65386. function parseString(txt) {
  65387. var parser = new Parser(txt);
  65388. return parser.output();
  65389. }
  65390. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/process.js
  65391. function mapit(obj, key, value) {
  65392. if (Array.isArray(key)) {
  65393. value.unshift(key);
  65394. key = null;
  65395. }
  65396. var thing = key ? {} : obj;
  65397. var out = value.reduce(function(newObj, item) {
  65398. sExpr(item, newObj);
  65399. return newObj
  65400. }, thing);
  65401. if (key) {
  65402. obj[key] = out;
  65403. }
  65404. }
  65405. function sExpr(v, obj) {
  65406. if (!Array.isArray(v)) {
  65407. obj[v] = true;
  65408. return;
  65409. }
  65410. var key = v.shift();
  65411. if (key === 'PARAMETER') {
  65412. key = v.shift();
  65413. }
  65414. if (v.length === 1) {
  65415. if (Array.isArray(v[0])) {
  65416. obj[key] = {};
  65417. sExpr(v[0], obj[key]);
  65418. return;
  65419. }
  65420. obj[key] = v[0];
  65421. return;
  65422. }
  65423. if (!v.length) {
  65424. obj[key] = true;
  65425. return;
  65426. }
  65427. if (key === 'TOWGS84') {
  65428. obj[key] = v;
  65429. return;
  65430. }
  65431. if (key === 'AXIS') {
  65432. if (!(key in obj)) {
  65433. obj[key] = [];
  65434. }
  65435. obj[key].push(v);
  65436. return;
  65437. }
  65438. if (!Array.isArray(key)) {
  65439. obj[key] = {};
  65440. }
  65441. var i;
  65442. switch (key) {
  65443. case 'UNIT':
  65444. case 'PRIMEM':
  65445. case 'VERT_DATUM':
  65446. obj[key] = {
  65447. name: v[0].toLowerCase(),
  65448. convert: v[1]
  65449. };
  65450. if (v.length === 3) {
  65451. sExpr(v[2], obj[key]);
  65452. }
  65453. return;
  65454. case 'SPHEROID':
  65455. case 'ELLIPSOID':
  65456. obj[key] = {
  65457. name: v[0],
  65458. a: v[1],
  65459. rf: v[2]
  65460. };
  65461. if (v.length === 4) {
  65462. sExpr(v[3], obj[key]);
  65463. }
  65464. return;
  65465. case 'PROJECTEDCRS':
  65466. case 'PROJCRS':
  65467. case 'GEOGCS':
  65468. case 'GEOCCS':
  65469. case 'PROJCS':
  65470. case 'LOCAL_CS':
  65471. case 'GEODCRS':
  65472. case 'GEODETICCRS':
  65473. case 'GEODETICDATUM':
  65474. case 'EDATUM':
  65475. case 'ENGINEERINGDATUM':
  65476. case 'VERT_CS':
  65477. case 'VERTCRS':
  65478. case 'VERTICALCRS':
  65479. case 'COMPD_CS':
  65480. case 'COMPOUNDCRS':
  65481. case 'ENGINEERINGCRS':
  65482. case 'ENGCRS':
  65483. case 'FITTED_CS':
  65484. case 'LOCAL_DATUM':
  65485. case 'DATUM':
  65486. v[0] = ['name', v[0]];
  65487. mapit(obj, key, v);
  65488. return;
  65489. default:
  65490. i = -1;
  65491. while (++i < v.length) {
  65492. if (!Array.isArray(v[i])) {
  65493. return sExpr(v, obj[key]);
  65494. }
  65495. }
  65496. return mapit(obj, key, v);
  65497. }
  65498. }
  65499. ;// CONCATENATED MODULE: ./node_modules/wkt-parser/index.js
  65500. var wkt_parser_D2R = 0.01745329251994329577;
  65501. function rename(obj, params) {
  65502. var outName = params[0];
  65503. var inName = params[1];
  65504. if (!(outName in obj) && (inName in obj)) {
  65505. obj[outName] = obj[inName];
  65506. if (params.length === 3) {
  65507. obj[outName] = params[2](obj[outName]);
  65508. }
  65509. }
  65510. }
  65511. function d2r(input) {
  65512. return input * wkt_parser_D2R;
  65513. }
  65514. function cleanWKT(wkt) {
  65515. if (wkt.type === 'GEOGCS') {
  65516. wkt.projName = 'longlat';
  65517. } else if (wkt.type === 'LOCAL_CS') {
  65518. wkt.projName = 'identity';
  65519. wkt.local = true;
  65520. } else {
  65521. if (typeof wkt.PROJECTION === 'object') {
  65522. wkt.projName = Object.keys(wkt.PROJECTION)[0];
  65523. } else {
  65524. wkt.projName = wkt.PROJECTION;
  65525. }
  65526. }
  65527. if (wkt.AXIS) {
  65528. var axisOrder = '';
  65529. for (var i = 0, ii = wkt.AXIS.length; i < ii; ++i) {
  65530. var axis = wkt.AXIS[i];
  65531. var descriptor = axis[0].toLowerCase();
  65532. if (descriptor.indexOf('north') !== -1) {
  65533. axisOrder += 'n';
  65534. } else if (descriptor.indexOf('south') !== -1) {
  65535. axisOrder += 's';
  65536. } else if (descriptor.indexOf('east') !== -1) {
  65537. axisOrder += 'e';
  65538. } else if (descriptor.indexOf('west') !== -1) {
  65539. axisOrder += 'w';
  65540. }
  65541. }
  65542. if (axisOrder.length === 2) {
  65543. axisOrder += 'u';
  65544. }
  65545. if (axisOrder.length === 3) {
  65546. wkt.axis = axisOrder;
  65547. }
  65548. }
  65549. if (wkt.UNIT) {
  65550. wkt.units = wkt.UNIT.name.toLowerCase();
  65551. if (wkt.units === 'metre') {
  65552. wkt.units = 'meter';
  65553. }
  65554. if (wkt.UNIT.convert) {
  65555. if (wkt.type === 'GEOGCS') {
  65556. if (wkt.DATUM && wkt.DATUM.SPHEROID) {
  65557. wkt.to_meter = wkt.UNIT.convert*wkt.DATUM.SPHEROID.a;
  65558. }
  65559. } else {
  65560. wkt.to_meter = wkt.UNIT.convert;
  65561. }
  65562. }
  65563. }
  65564. var geogcs = wkt.GEOGCS;
  65565. if (wkt.type === 'GEOGCS') {
  65566. geogcs = wkt;
  65567. }
  65568. if (geogcs) {
  65569. //if(wkt.GEOGCS.PRIMEM&&wkt.GEOGCS.PRIMEM.convert){
  65570. // wkt.from_greenwich=wkt.GEOGCS.PRIMEM.convert*D2R;
  65571. //}
  65572. if (geogcs.DATUM) {
  65573. wkt.datumCode = geogcs.DATUM.name.toLowerCase();
  65574. } else {
  65575. wkt.datumCode = geogcs.name.toLowerCase();
  65576. }
  65577. if (wkt.datumCode.slice(0, 2) === 'd_') {
  65578. wkt.datumCode = wkt.datumCode.slice(2);
  65579. }
  65580. if (wkt.datumCode === 'new_zealand_geodetic_datum_1949' || wkt.datumCode === 'new_zealand_1949') {
  65581. wkt.datumCode = 'nzgd49';
  65582. }
  65583. if (wkt.datumCode === 'wgs_1984' || wkt.datumCode === 'world_geodetic_system_1984') {
  65584. if (wkt.PROJECTION === 'Mercator_Auxiliary_Sphere') {
  65585. wkt.sphere = true;
  65586. }
  65587. wkt.datumCode = 'wgs84';
  65588. }
  65589. if (wkt.datumCode.slice(-6) === '_ferro') {
  65590. wkt.datumCode = wkt.datumCode.slice(0, - 6);
  65591. }
  65592. if (wkt.datumCode.slice(-8) === '_jakarta') {
  65593. wkt.datumCode = wkt.datumCode.slice(0, - 8);
  65594. }
  65595. if (~wkt.datumCode.indexOf('belge')) {
  65596. wkt.datumCode = 'rnb72';
  65597. }
  65598. if (geogcs.DATUM && geogcs.DATUM.SPHEROID) {
  65599. wkt.ellps = geogcs.DATUM.SPHEROID.name.replace('_19', '').replace(/[Cc]larke\_18/, 'clrk');
  65600. if (wkt.ellps.toLowerCase().slice(0, 13) === 'international') {
  65601. wkt.ellps = 'intl';
  65602. }
  65603. wkt.a = geogcs.DATUM.SPHEROID.a;
  65604. wkt.rf = parseFloat(geogcs.DATUM.SPHEROID.rf, 10);
  65605. }
  65606. if (geogcs.DATUM && geogcs.DATUM.TOWGS84) {
  65607. wkt.datum_params = geogcs.DATUM.TOWGS84;
  65608. }
  65609. if (~wkt.datumCode.indexOf('osgb_1936')) {
  65610. wkt.datumCode = 'osgb36';
  65611. }
  65612. if (~wkt.datumCode.indexOf('osni_1952')) {
  65613. wkt.datumCode = 'osni52';
  65614. }
  65615. if (~wkt.datumCode.indexOf('tm65')
  65616. || ~wkt.datumCode.indexOf('geodetic_datum_of_1965')) {
  65617. wkt.datumCode = 'ire65';
  65618. }
  65619. if (wkt.datumCode === 'ch1903+') {
  65620. wkt.datumCode = 'ch1903';
  65621. }
  65622. if (~wkt.datumCode.indexOf('israel')) {
  65623. wkt.datumCode = 'isr93';
  65624. }
  65625. }
  65626. if (wkt.b && !isFinite(wkt.b)) {
  65627. wkt.b = wkt.a;
  65628. }
  65629. function toMeter(input) {
  65630. var ratio = wkt.to_meter || 1;
  65631. return input * ratio;
  65632. }
  65633. var renamer = function(a) {
  65634. return rename(wkt, a);
  65635. };
  65636. var list = [
  65637. ['standard_parallel_1', 'Standard_Parallel_1'],
  65638. ['standard_parallel_2', 'Standard_Parallel_2'],
  65639. ['false_easting', 'False_Easting'],
  65640. ['false_northing', 'False_Northing'],
  65641. ['central_meridian', 'Central_Meridian'],
  65642. ['latitude_of_origin', 'Latitude_Of_Origin'],
  65643. ['latitude_of_origin', 'Central_Parallel'],
  65644. ['scale_factor', 'Scale_Factor'],
  65645. ['k0', 'scale_factor'],
  65646. ['latitude_of_center', 'Latitude_Of_Center'],
  65647. ['latitude_of_center', 'Latitude_of_center'],
  65648. ['lat0', 'latitude_of_center', d2r],
  65649. ['longitude_of_center', 'Longitude_Of_Center'],
  65650. ['longitude_of_center', 'Longitude_of_center'],
  65651. ['longc', 'longitude_of_center', d2r],
  65652. ['x0', 'false_easting', toMeter],
  65653. ['y0', 'false_northing', toMeter],
  65654. ['long0', 'central_meridian', d2r],
  65655. ['lat0', 'latitude_of_origin', d2r],
  65656. ['lat0', 'standard_parallel_1', d2r],
  65657. ['lat1', 'standard_parallel_1', d2r],
  65658. ['lat2', 'standard_parallel_2', d2r],
  65659. ['azimuth', 'Azimuth'],
  65660. ['alpha', 'azimuth', d2r],
  65661. ['srsCode', 'name']
  65662. ];
  65663. list.forEach(renamer);
  65664. if (!wkt.long0 && wkt.longc && (wkt.projName === 'Albers_Conic_Equal_Area' || wkt.projName === 'Lambert_Azimuthal_Equal_Area')) {
  65665. wkt.long0 = wkt.longc;
  65666. }
  65667. if (!wkt.lat_ts && wkt.lat1 && (wkt.projName === 'Stereographic_South_Pole' || wkt.projName === 'Polar Stereographic (variant B)')) {
  65668. wkt.lat0 = d2r(wkt.lat1 > 0 ? 90 : -90);
  65669. wkt.lat_ts = wkt.lat1;
  65670. }
  65671. }
  65672. /* harmony default export */ function wkt_parser(wkt) {
  65673. var lisp = parser(wkt);
  65674. var type = lisp.shift();
  65675. var name = lisp.shift();
  65676. lisp.unshift(['name', name]);
  65677. lisp.unshift(['type', type]);
  65678. var obj = {};
  65679. sExpr(lisp, obj);
  65680. cleanWKT(obj);
  65681. return obj;
  65682. }
  65683. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/defs.js
  65684. function defs(name) {
  65685. /*global console*/
  65686. var that = this;
  65687. if (arguments.length === 2) {
  65688. var def = arguments[1];
  65689. if (typeof def === 'string') {
  65690. if (def.charAt(0) === '+') {
  65691. defs[name] = projString(arguments[1]);
  65692. }
  65693. else {
  65694. defs[name] = wkt_parser(arguments[1]);
  65695. }
  65696. } else {
  65697. defs[name] = def;
  65698. }
  65699. }
  65700. else if (arguments.length === 1) {
  65701. if (Array.isArray(name)) {
  65702. return name.map(function(v) {
  65703. if (Array.isArray(v)) {
  65704. defs.apply(that, v);
  65705. }
  65706. else {
  65707. defs(v);
  65708. }
  65709. });
  65710. }
  65711. else if (typeof name === 'string') {
  65712. if (name in defs) {
  65713. return defs[name];
  65714. }
  65715. }
  65716. else if ('EPSG' in name) {
  65717. defs['EPSG:' + name.EPSG] = name;
  65718. }
  65719. else if ('ESRI' in name) {
  65720. defs['ESRI:' + name.ESRI] = name;
  65721. }
  65722. else if ('IAU2000' in name) {
  65723. defs['IAU2000:' + name.IAU2000] = name;
  65724. }
  65725. else {
  65726. console.log(name);
  65727. }
  65728. return;
  65729. }
  65730. }
  65731. global(defs);
  65732. /* harmony default export */ const lib_defs = (defs);
  65733. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/parseCode.js
  65734. function testObj(code){
  65735. return typeof code === 'string';
  65736. }
  65737. function testDef(code){
  65738. return code in lib_defs;
  65739. }
  65740. var codeWords = ['PROJECTEDCRS', 'PROJCRS', 'GEOGCS','GEOCCS','PROJCS','LOCAL_CS', 'GEODCRS', 'GEODETICCRS', 'GEODETICDATUM', 'ENGCRS', 'ENGINEERINGCRS'];
  65741. function testWKT(code){
  65742. return codeWords.some(function (word) {
  65743. return code.indexOf(word) > -1;
  65744. });
  65745. }
  65746. var codes = ['3857', '900913', '3785', '102113'];
  65747. function checkMercator(item) {
  65748. var auth = match(item, 'authority');
  65749. if (!auth) {
  65750. return;
  65751. }
  65752. var code = match(auth, 'epsg');
  65753. return code && codes.indexOf(code) > -1;
  65754. }
  65755. function checkProjStr(item) {
  65756. var ext = match(item, 'extension');
  65757. if (!ext) {
  65758. return;
  65759. }
  65760. return match(ext, 'proj4');
  65761. }
  65762. function testProj(code){
  65763. return code[0] === '+';
  65764. }
  65765. function parse(code){
  65766. if (testObj(code)) {
  65767. //check to see if this is a WKT string
  65768. if (testDef(code)) {
  65769. return lib_defs[code];
  65770. }
  65771. if (testWKT(code)) {
  65772. var out = wkt_parser(code);
  65773. // test of spetial case, due to this being a very common and often malformed
  65774. if (checkMercator(out)) {
  65775. return lib_defs["EPSG:3857"];
  65776. }
  65777. var maybeProjStr = checkProjStr(out);
  65778. if (maybeProjStr) {
  65779. return projString(maybeProjStr);
  65780. }
  65781. return out;
  65782. }
  65783. if (testProj(code)) {
  65784. return projString(code);
  65785. }
  65786. }else{
  65787. return code;
  65788. }
  65789. }
  65790. /* harmony default export */ const parseCode = (parse);
  65791. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/extend.js
  65792. /* harmony default export */ function extend(destination, source) {
  65793. destination = destination || {};
  65794. var value, property;
  65795. if (!source) {
  65796. return destination;
  65797. }
  65798. for (property in source) {
  65799. value = source[property];
  65800. if (value !== undefined) {
  65801. destination[property] = value;
  65802. }
  65803. }
  65804. return destination;
  65805. }
  65806. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/msfnz.js
  65807. /* harmony default export */ function msfnz(eccent, sinphi, cosphi) {
  65808. var con = eccent * sinphi;
  65809. return cosphi / (Math.sqrt(1 - con * con));
  65810. }
  65811. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sign.js
  65812. /* harmony default export */ function sign(x) {
  65813. return x<0 ? -1 : 1;
  65814. }
  65815. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lon.js
  65816. /* harmony default export */ function adjust_lon(x) {
  65817. return (Math.abs(x) <= SPI) ? x : (x - (sign(x) * TWO_PI));
  65818. }
  65819. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/tsfnz.js
  65820. /* harmony default export */ function tsfnz(eccent, phi, sinphi) {
  65821. var con = eccent * sinphi;
  65822. var com = 0.5 * eccent;
  65823. con = Math.pow(((1 - con) / (1 + con)), com);
  65824. return (Math.tan(0.5 * (HALF_PI - phi)) / con);
  65825. }
  65826. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/phi2z.js
  65827. /* harmony default export */ function phi2z(eccent, ts) {
  65828. var eccnth = 0.5 * eccent;
  65829. var con, dphi;
  65830. var phi = HALF_PI - 2 * Math.atan(ts);
  65831. for (var i = 0; i <= 15; i++) {
  65832. con = eccent * Math.sin(phi);
  65833. dphi = HALF_PI - 2 * Math.atan(ts * (Math.pow(((1 - con) / (1 + con)), eccnth))) - phi;
  65834. phi += dphi;
  65835. if (Math.abs(dphi) <= 0.0000000001) {
  65836. return phi;
  65837. }
  65838. }
  65839. //console.log("phi2z has NoConvergence");
  65840. return -9999;
  65841. }
  65842. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/merc.js
  65843. function init() {
  65844. var con = this.b / this.a;
  65845. this.es = 1 - con * con;
  65846. if(!('x0' in this)){
  65847. this.x0 = 0;
  65848. }
  65849. if(!('y0' in this)){
  65850. this.y0 = 0;
  65851. }
  65852. this.e = Math.sqrt(this.es);
  65853. if (this.lat_ts) {
  65854. if (this.sphere) {
  65855. this.k0 = Math.cos(this.lat_ts);
  65856. }
  65857. else {
  65858. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  65859. }
  65860. }
  65861. else {
  65862. if (!this.k0) {
  65863. if (this.k) {
  65864. this.k0 = this.k;
  65865. }
  65866. else {
  65867. this.k0 = 1;
  65868. }
  65869. }
  65870. }
  65871. }
  65872. /* Mercator forward equations--mapping lat,long to x,y
  65873. --------------------------------------------------*/
  65874. function forward(p) {
  65875. var lon = p.x;
  65876. var lat = p.y;
  65877. // convert to radians
  65878. if (lat * R2D > 90 && lat * R2D < -90 && lon * R2D > 180 && lon * R2D < -180) {
  65879. return null;
  65880. }
  65881. var x, y;
  65882. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  65883. return null;
  65884. }
  65885. else {
  65886. if (this.sphere) {
  65887. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  65888. y = this.y0 + this.a * this.k0 * Math.log(Math.tan(FORTPI + 0.5 * lat));
  65889. }
  65890. else {
  65891. var sinphi = Math.sin(lat);
  65892. var ts = tsfnz(this.e, lat, sinphi);
  65893. x = this.x0 + this.a * this.k0 * adjust_lon(lon - this.long0);
  65894. y = this.y0 - this.a * this.k0 * Math.log(ts);
  65895. }
  65896. p.x = x;
  65897. p.y = y;
  65898. return p;
  65899. }
  65900. }
  65901. /* Mercator inverse equations--mapping x,y to lat/long
  65902. --------------------------------------------------*/
  65903. function inverse(p) {
  65904. var x = p.x - this.x0;
  65905. var y = p.y - this.y0;
  65906. var lon, lat;
  65907. if (this.sphere) {
  65908. lat = HALF_PI - 2 * Math.atan(Math.exp(-y / (this.a * this.k0)));
  65909. }
  65910. else {
  65911. var ts = Math.exp(-y / (this.a * this.k0));
  65912. lat = phi2z(this.e, ts);
  65913. if (lat === -9999) {
  65914. return null;
  65915. }
  65916. }
  65917. lon = adjust_lon(this.long0 + x / (this.a * this.k0));
  65918. p.x = lon;
  65919. p.y = lat;
  65920. return p;
  65921. }
  65922. var names = ["Mercator", "Popular Visualisation Pseudo Mercator", "Mercator_1SP", "Mercator_Auxiliary_Sphere", "merc"];
  65923. /* harmony default export */ const merc = ({
  65924. init: init,
  65925. forward: forward,
  65926. inverse: inverse,
  65927. names: names
  65928. });
  65929. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/longlat.js
  65930. function longlat_init() {
  65931. //no-op for longlat
  65932. }
  65933. function identity(pt) {
  65934. return pt;
  65935. }
  65936. var longlat_names = ["longlat", "identity"];
  65937. /* harmony default export */ const longlat = ({
  65938. init: longlat_init,
  65939. forward: identity,
  65940. inverse: identity,
  65941. names: longlat_names
  65942. });
  65943. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections.js
  65944. var projs = [merc, longlat];
  65945. var projections_names = {};
  65946. var projStore = [];
  65947. function add(proj, i) {
  65948. var len = projStore.length;
  65949. if (!proj.names) {
  65950. console.log(i);
  65951. return true;
  65952. }
  65953. projStore[len] = proj;
  65954. proj.names.forEach(function(n) {
  65955. projections_names[n.toLowerCase()] = len;
  65956. });
  65957. return this;
  65958. }
  65959. function get(name) {
  65960. if (!name) {
  65961. return false;
  65962. }
  65963. var n = name.toLowerCase();
  65964. if (typeof projections_names[n] !== 'undefined' && projStore[projections_names[n]]) {
  65965. return projStore[projections_names[n]];
  65966. }
  65967. }
  65968. function start() {
  65969. projs.forEach(add);
  65970. }
  65971. /* harmony default export */ const projections = ({
  65972. start: start,
  65973. add: add,
  65974. get: get
  65975. });
  65976. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Ellipsoid.js
  65977. var Ellipsoid_exports = {};
  65978. Ellipsoid_exports.MERIT = {
  65979. a: 6378137.0,
  65980. rf: 298.257,
  65981. ellipseName: "MERIT 1983"
  65982. };
  65983. Ellipsoid_exports.SGS85 = {
  65984. a: 6378136.0,
  65985. rf: 298.257,
  65986. ellipseName: "Soviet Geodetic System 85"
  65987. };
  65988. Ellipsoid_exports.GRS80 = {
  65989. a: 6378137.0,
  65990. rf: 298.257222101,
  65991. ellipseName: "GRS 1980(IUGG, 1980)"
  65992. };
  65993. Ellipsoid_exports.IAU76 = {
  65994. a: 6378140.0,
  65995. rf: 298.257,
  65996. ellipseName: "IAU 1976"
  65997. };
  65998. Ellipsoid_exports.airy = {
  65999. a: 6377563.396,
  66000. b: 6356256.910,
  66001. ellipseName: "Airy 1830"
  66002. };
  66003. Ellipsoid_exports.APL4 = {
  66004. a: 6378137,
  66005. rf: 298.25,
  66006. ellipseName: "Appl. Physics. 1965"
  66007. };
  66008. Ellipsoid_exports.NWL9D = {
  66009. a: 6378145.0,
  66010. rf: 298.25,
  66011. ellipseName: "Naval Weapons Lab., 1965"
  66012. };
  66013. Ellipsoid_exports.mod_airy = {
  66014. a: 6377340.189,
  66015. b: 6356034.446,
  66016. ellipseName: "Modified Airy"
  66017. };
  66018. Ellipsoid_exports.andrae = {
  66019. a: 6377104.43,
  66020. rf: 300.0,
  66021. ellipseName: "Andrae 1876 (Den., Iclnd.)"
  66022. };
  66023. Ellipsoid_exports.aust_SA = {
  66024. a: 6378160.0,
  66025. rf: 298.25,
  66026. ellipseName: "Australian Natl & S. Amer. 1969"
  66027. };
  66028. Ellipsoid_exports.GRS67 = {
  66029. a: 6378160.0,
  66030. rf: 298.2471674270,
  66031. ellipseName: "GRS 67(IUGG 1967)"
  66032. };
  66033. Ellipsoid_exports.bessel = {
  66034. a: 6377397.155,
  66035. rf: 299.1528128,
  66036. ellipseName: "Bessel 1841"
  66037. };
  66038. Ellipsoid_exports.bess_nam = {
  66039. a: 6377483.865,
  66040. rf: 299.1528128,
  66041. ellipseName: "Bessel 1841 (Namibia)"
  66042. };
  66043. Ellipsoid_exports.clrk66 = {
  66044. a: 6378206.4,
  66045. b: 6356583.8,
  66046. ellipseName: "Clarke 1866"
  66047. };
  66048. Ellipsoid_exports.clrk80 = {
  66049. a: 6378249.145,
  66050. rf: 293.4663,
  66051. ellipseName: "Clarke 1880 mod."
  66052. };
  66053. Ellipsoid_exports.clrk58 = {
  66054. a: 6378293.645208759,
  66055. rf: 294.2606763692654,
  66056. ellipseName: "Clarke 1858"
  66057. };
  66058. Ellipsoid_exports.CPM = {
  66059. a: 6375738.7,
  66060. rf: 334.29,
  66061. ellipseName: "Comm. des Poids et Mesures 1799"
  66062. };
  66063. Ellipsoid_exports.delmbr = {
  66064. a: 6376428.0,
  66065. rf: 311.5,
  66066. ellipseName: "Delambre 1810 (Belgium)"
  66067. };
  66068. Ellipsoid_exports.engelis = {
  66069. a: 6378136.05,
  66070. rf: 298.2566,
  66071. ellipseName: "Engelis 1985"
  66072. };
  66073. Ellipsoid_exports.evrst30 = {
  66074. a: 6377276.345,
  66075. rf: 300.8017,
  66076. ellipseName: "Everest 1830"
  66077. };
  66078. Ellipsoid_exports.evrst48 = {
  66079. a: 6377304.063,
  66080. rf: 300.8017,
  66081. ellipseName: "Everest 1948"
  66082. };
  66083. Ellipsoid_exports.evrst56 = {
  66084. a: 6377301.243,
  66085. rf: 300.8017,
  66086. ellipseName: "Everest 1956"
  66087. };
  66088. Ellipsoid_exports.evrst69 = {
  66089. a: 6377295.664,
  66090. rf: 300.8017,
  66091. ellipseName: "Everest 1969"
  66092. };
  66093. Ellipsoid_exports.evrstSS = {
  66094. a: 6377298.556,
  66095. rf: 300.8017,
  66096. ellipseName: "Everest (Sabah & Sarawak)"
  66097. };
  66098. Ellipsoid_exports.fschr60 = {
  66099. a: 6378166.0,
  66100. rf: 298.3,
  66101. ellipseName: "Fischer (Mercury Datum) 1960"
  66102. };
  66103. Ellipsoid_exports.fschr60m = {
  66104. a: 6378155.0,
  66105. rf: 298.3,
  66106. ellipseName: "Fischer 1960"
  66107. };
  66108. Ellipsoid_exports.fschr68 = {
  66109. a: 6378150.0,
  66110. rf: 298.3,
  66111. ellipseName: "Fischer 1968"
  66112. };
  66113. Ellipsoid_exports.helmert = {
  66114. a: 6378200.0,
  66115. rf: 298.3,
  66116. ellipseName: "Helmert 1906"
  66117. };
  66118. Ellipsoid_exports.hough = {
  66119. a: 6378270.0,
  66120. rf: 297.0,
  66121. ellipseName: "Hough"
  66122. };
  66123. Ellipsoid_exports.intl = {
  66124. a: 6378388.0,
  66125. rf: 297.0,
  66126. ellipseName: "International 1909 (Hayford)"
  66127. };
  66128. Ellipsoid_exports.kaula = {
  66129. a: 6378163.0,
  66130. rf: 298.24,
  66131. ellipseName: "Kaula 1961"
  66132. };
  66133. Ellipsoid_exports.lerch = {
  66134. a: 6378139.0,
  66135. rf: 298.257,
  66136. ellipseName: "Lerch 1979"
  66137. };
  66138. Ellipsoid_exports.mprts = {
  66139. a: 6397300.0,
  66140. rf: 191.0,
  66141. ellipseName: "Maupertius 1738"
  66142. };
  66143. Ellipsoid_exports.new_intl = {
  66144. a: 6378157.5,
  66145. b: 6356772.2,
  66146. ellipseName: "New International 1967"
  66147. };
  66148. Ellipsoid_exports.plessis = {
  66149. a: 6376523.0,
  66150. rf: 6355863.0,
  66151. ellipseName: "Plessis 1817 (France)"
  66152. };
  66153. Ellipsoid_exports.krass = {
  66154. a: 6378245.0,
  66155. rf: 298.3,
  66156. ellipseName: "Krassovsky, 1942"
  66157. };
  66158. Ellipsoid_exports.SEasia = {
  66159. a: 6378155.0,
  66160. b: 6356773.3205,
  66161. ellipseName: "Southeast Asia"
  66162. };
  66163. Ellipsoid_exports.walbeck = {
  66164. a: 6376896.0,
  66165. b: 6355834.8467,
  66166. ellipseName: "Walbeck"
  66167. };
  66168. Ellipsoid_exports.WGS60 = {
  66169. a: 6378165.0,
  66170. rf: 298.3,
  66171. ellipseName: "WGS 60"
  66172. };
  66173. Ellipsoid_exports.WGS66 = {
  66174. a: 6378145.0,
  66175. rf: 298.25,
  66176. ellipseName: "WGS 66"
  66177. };
  66178. Ellipsoid_exports.WGS7 = {
  66179. a: 6378135.0,
  66180. rf: 298.26,
  66181. ellipseName: "WGS 72"
  66182. };
  66183. var WGS84 = Ellipsoid_exports.WGS84 = {
  66184. a: 6378137.0,
  66185. rf: 298.257223563,
  66186. ellipseName: "WGS 84"
  66187. };
  66188. Ellipsoid_exports.sphere = {
  66189. a: 6370997.0,
  66190. b: 6370997.0,
  66191. ellipseName: "Normal Sphere (r=6370997)"
  66192. };
  66193. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/deriveConstants.js
  66194. function eccentricity(a, b, rf, R_A) {
  66195. var a2 = a * a; // used in geocentric
  66196. var b2 = b * b; // used in geocentric
  66197. var es = (a2 - b2) / a2; // e ^ 2
  66198. var e = 0;
  66199. if (R_A) {
  66200. a *= 1 - es * (SIXTH + es * (RA4 + es * RA6));
  66201. a2 = a * a;
  66202. es = 0;
  66203. } else {
  66204. e = Math.sqrt(es); // eccentricity
  66205. }
  66206. var ep2 = (a2 - b2) / b2; // used in geocentric
  66207. return {
  66208. es: es,
  66209. e: e,
  66210. ep2: ep2
  66211. };
  66212. }
  66213. function sphere(a, b, rf, ellps, sphere) {
  66214. if (!a) { // do we have an ellipsoid?
  66215. var ellipse = match(Ellipsoid_exports, ellps);
  66216. if (!ellipse) {
  66217. ellipse = WGS84;
  66218. }
  66219. a = ellipse.a;
  66220. b = ellipse.b;
  66221. rf = ellipse.rf;
  66222. }
  66223. if (rf && !b) {
  66224. b = (1.0 - 1.0 / rf) * a;
  66225. }
  66226. if (rf === 0 || Math.abs(a - b) < EPSLN) {
  66227. sphere = true;
  66228. b = a;
  66229. }
  66230. return {
  66231. a: a,
  66232. b: b,
  66233. rf: rf,
  66234. sphere: sphere
  66235. };
  66236. }
  66237. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/constants/Datum.js
  66238. var Datum_exports = {};
  66239. Datum_exports.wgs84 = {
  66240. towgs84: "0,0,0",
  66241. ellipse: "WGS84",
  66242. datumName: "WGS84"
  66243. };
  66244. Datum_exports.ch1903 = {
  66245. towgs84: "674.374,15.056,405.346",
  66246. ellipse: "bessel",
  66247. datumName: "swiss"
  66248. };
  66249. Datum_exports.ggrs87 = {
  66250. towgs84: "-199.87,74.79,246.62",
  66251. ellipse: "GRS80",
  66252. datumName: "Greek_Geodetic_Reference_System_1987"
  66253. };
  66254. Datum_exports.nad83 = {
  66255. towgs84: "0,0,0",
  66256. ellipse: "GRS80",
  66257. datumName: "North_American_Datum_1983"
  66258. };
  66259. Datum_exports.nad27 = {
  66260. nadgrids: "@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",
  66261. ellipse: "clrk66",
  66262. datumName: "North_American_Datum_1927"
  66263. };
  66264. Datum_exports.potsdam = {
  66265. towgs84: "606.0,23.0,413.0",
  66266. ellipse: "bessel",
  66267. datumName: "Potsdam Rauenberg 1950 DHDN"
  66268. };
  66269. Datum_exports.carthage = {
  66270. towgs84: "-263.0,6.0,431.0",
  66271. ellipse: "clark80",
  66272. datumName: "Carthage 1934 Tunisia"
  66273. };
  66274. Datum_exports.hermannskogel = {
  66275. towgs84: "653.0,-212.0,449.0",
  66276. ellipse: "bessel",
  66277. datumName: "Hermannskogel"
  66278. };
  66279. Datum_exports.osni52 = {
  66280. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  66281. ellipse: "airy",
  66282. datumName: "Irish National"
  66283. };
  66284. Datum_exports.ire65 = {
  66285. towgs84: "482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",
  66286. ellipse: "mod_airy",
  66287. datumName: "Ireland 1965"
  66288. };
  66289. Datum_exports.rassadiran = {
  66290. towgs84: "-133.63,-157.5,-158.62",
  66291. ellipse: "intl",
  66292. datumName: "Rassadiran"
  66293. };
  66294. Datum_exports.nzgd49 = {
  66295. towgs84: "59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",
  66296. ellipse: "intl",
  66297. datumName: "New Zealand Geodetic Datum 1949"
  66298. };
  66299. Datum_exports.osgb36 = {
  66300. towgs84: "446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",
  66301. ellipse: "airy",
  66302. datumName: "Airy 1830"
  66303. };
  66304. Datum_exports.s_jtsk = {
  66305. towgs84: "589,76,480",
  66306. ellipse: 'bessel',
  66307. datumName: 'S-JTSK (Ferro)'
  66308. };
  66309. Datum_exports.beduaram = {
  66310. towgs84: '-106,-87,188',
  66311. ellipse: 'clrk80',
  66312. datumName: 'Beduaram'
  66313. };
  66314. Datum_exports.gunung_segara = {
  66315. towgs84: '-403,684,41',
  66316. ellipse: 'bessel',
  66317. datumName: 'Gunung Segara Jakarta'
  66318. };
  66319. Datum_exports.rnb72 = {
  66320. towgs84: "106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",
  66321. ellipse: "intl",
  66322. datumName: "Reseau National Belge 1972"
  66323. };
  66324. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum.js
  66325. function datum(datumCode, datum_params, a, b, es, ep2) {
  66326. var out = {};
  66327. if (datumCode === undefined || datumCode === 'none') {
  66328. out.datum_type = PJD_NODATUM;
  66329. } else {
  66330. out.datum_type = PJD_WGS84;
  66331. }
  66332. if (datum_params) {
  66333. out.datum_params = datum_params.map(parseFloat);
  66334. if (out.datum_params[0] !== 0 || out.datum_params[1] !== 0 || out.datum_params[2] !== 0) {
  66335. out.datum_type = PJD_3PARAM;
  66336. }
  66337. if (out.datum_params.length > 3) {
  66338. if (out.datum_params[3] !== 0 || out.datum_params[4] !== 0 || out.datum_params[5] !== 0 || out.datum_params[6] !== 0) {
  66339. out.datum_type = PJD_7PARAM;
  66340. out.datum_params[3] *= SEC_TO_RAD;
  66341. out.datum_params[4] *= SEC_TO_RAD;
  66342. out.datum_params[5] *= SEC_TO_RAD;
  66343. out.datum_params[6] = (out.datum_params[6] / 1000000.0) + 1.0;
  66344. }
  66345. }
  66346. }
  66347. out.a = a; //datum object also uses these values
  66348. out.b = b;
  66349. out.es = es;
  66350. out.ep2 = ep2;
  66351. return out;
  66352. }
  66353. /* harmony default export */ const lib_datum = (datum);
  66354. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Proj.js
  66355. function Projection(srsCode,callback) {
  66356. if (!(this instanceof Projection)) {
  66357. return new Projection(srsCode);
  66358. }
  66359. callback = callback || function(error){
  66360. if(error){
  66361. throw error;
  66362. }
  66363. };
  66364. var json = parseCode(srsCode);
  66365. if(typeof json !== 'object'){
  66366. callback(srsCode);
  66367. return;
  66368. }
  66369. var ourProj = Projection.projections.get(json.projName);
  66370. if(!ourProj){
  66371. callback(srsCode);
  66372. return;
  66373. }
  66374. if (json.datumCode && json.datumCode !== 'none') {
  66375. var datumDef = match(Datum_exports, json.datumCode);
  66376. if (datumDef) {
  66377. json.datum_params = datumDef.towgs84 ? datumDef.towgs84.split(',') : null;
  66378. json.ellps = datumDef.ellipse;
  66379. json.datumName = datumDef.datumName ? datumDef.datumName : json.datumCode;
  66380. }
  66381. }
  66382. json.k0 = json.k0 || 1.0;
  66383. json.axis = json.axis || 'enu';
  66384. json.ellps = json.ellps || 'wgs84';
  66385. var sphere_ = sphere(json.a, json.b, json.rf, json.ellps, json.sphere);
  66386. var ecc = eccentricity(sphere_.a, sphere_.b, sphere_.rf, json.R_A);
  66387. var datumObj = json.datum || lib_datum(json.datumCode, json.datum_params, sphere_.a, sphere_.b, ecc.es, ecc.ep2);
  66388. extend(this, json); // transfer everything over from the projection because we don't know what we'll need
  66389. extend(this, ourProj); // transfer all the methods from the projection
  66390. // copy the 4 things over we calulated in deriveConstants.sphere
  66391. this.a = sphere_.a;
  66392. this.b = sphere_.b;
  66393. this.rf = sphere_.rf;
  66394. this.sphere = sphere_.sphere;
  66395. // copy the 3 things we calculated in deriveConstants.eccentricity
  66396. this.es = ecc.es;
  66397. this.e = ecc.e;
  66398. this.ep2 = ecc.ep2;
  66399. // add in the datum object
  66400. this.datum = datumObj;
  66401. // init the projection
  66402. this.init();
  66403. // legecy callback from back in the day when it went to spatialreference.org
  66404. callback(null, this);
  66405. }
  66406. Projection.projections = projections;
  66407. Projection.projections.start();
  66408. /* harmony default export */ const Proj = (Projection);
  66409. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datumUtils.js
  66410. function compareDatums(source, dest) {
  66411. if (source.datum_type !== dest.datum_type) {
  66412. return false; // false, datums are not equal
  66413. } else if (source.a !== dest.a || Math.abs(source.es - dest.es) > 0.000000000050) {
  66414. // the tolerance for es is to ensure that GRS80 and WGS84
  66415. // are considered identical
  66416. return false;
  66417. } else if (source.datum_type === PJD_3PARAM) {
  66418. 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]);
  66419. } else if (source.datum_type === PJD_7PARAM) {
  66420. 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]);
  66421. } else {
  66422. return true; // datums are equal
  66423. }
  66424. } // cs_compare_datums()
  66425. /*
  66426. * The function Convert_Geodetic_To_Geocentric converts geodetic coordinates
  66427. * (latitude, longitude, and height) to geocentric coordinates (X, Y, Z),
  66428. * according to the current ellipsoid parameters.
  66429. *
  66430. * Latitude : Geodetic latitude in radians (input)
  66431. * Longitude : Geodetic longitude in radians (input)
  66432. * Height : Geodetic height, in meters (input)
  66433. * X : Calculated Geocentric X coordinate, in meters (output)
  66434. * Y : Calculated Geocentric Y coordinate, in meters (output)
  66435. * Z : Calculated Geocentric Z coordinate, in meters (output)
  66436. *
  66437. */
  66438. function geodeticToGeocentric(p, es, a) {
  66439. var Longitude = p.x;
  66440. var Latitude = p.y;
  66441. var Height = p.z ? p.z : 0; //Z value not always supplied
  66442. var Rn; /* Earth radius at location */
  66443. var Sin_Lat; /* Math.sin(Latitude) */
  66444. var Sin2_Lat; /* Square of Math.sin(Latitude) */
  66445. var Cos_Lat; /* Math.cos(Latitude) */
  66446. /*
  66447. ** Don't blow up if Latitude is just a little out of the value
  66448. ** range as it may just be a rounding issue. Also removed longitude
  66449. ** test, it should be wrapped by Math.cos() and Math.sin(). NFW for PROJ.4, Sep/2001.
  66450. */
  66451. if (Latitude < -HALF_PI && Latitude > -1.001 * HALF_PI) {
  66452. Latitude = -HALF_PI;
  66453. } else if (Latitude > HALF_PI && Latitude < 1.001 * HALF_PI) {
  66454. Latitude = HALF_PI;
  66455. } else if (Latitude < -HALF_PI) {
  66456. /* Latitude out of range */
  66457. //..reportError('geocent:lat out of range:' + Latitude);
  66458. return { x: -Infinity, y: -Infinity, z: p.z };
  66459. } else if (Latitude > HALF_PI) {
  66460. /* Latitude out of range */
  66461. return { x: Infinity, y: Infinity, z: p.z };
  66462. }
  66463. if (Longitude > Math.PI) {
  66464. Longitude -= (2 * Math.PI);
  66465. }
  66466. Sin_Lat = Math.sin(Latitude);
  66467. Cos_Lat = Math.cos(Latitude);
  66468. Sin2_Lat = Sin_Lat * Sin_Lat;
  66469. Rn = a / (Math.sqrt(1.0e0 - es * Sin2_Lat));
  66470. return {
  66471. x: (Rn + Height) * Cos_Lat * Math.cos(Longitude),
  66472. y: (Rn + Height) * Cos_Lat * Math.sin(Longitude),
  66473. z: ((Rn * (1 - es)) + Height) * Sin_Lat
  66474. };
  66475. } // cs_geodetic_to_geocentric()
  66476. function geocentricToGeodetic(p, es, a, b) {
  66477. /* local defintions and variables */
  66478. /* end-criterium of loop, accuracy of sin(Latitude) */
  66479. var genau = 1e-12;
  66480. var genau2 = (genau * genau);
  66481. var maxiter = 30;
  66482. var P; /* distance between semi-minor axis and location */
  66483. var RR; /* distance between center and location */
  66484. var CT; /* sin of geocentric latitude */
  66485. var ST; /* cos of geocentric latitude */
  66486. var RX;
  66487. var RK;
  66488. var RN; /* Earth radius at location */
  66489. var CPHI0; /* cos of start or old geodetic latitude in iterations */
  66490. var SPHI0; /* sin of start or old geodetic latitude in iterations */
  66491. var CPHI; /* cos of searched geodetic latitude */
  66492. var SPHI; /* sin of searched geodetic latitude */
  66493. var SDPHI; /* end-criterium: addition-theorem of sin(Latitude(iter)-Latitude(iter-1)) */
  66494. var iter; /* # of continous iteration, max. 30 is always enough (s.a.) */
  66495. var X = p.x;
  66496. var Y = p.y;
  66497. var Z = p.z ? p.z : 0.0; //Z value not always supplied
  66498. var Longitude;
  66499. var Latitude;
  66500. var Height;
  66501. P = Math.sqrt(X * X + Y * Y);
  66502. RR = Math.sqrt(X * X + Y * Y + Z * Z);
  66503. /* special cases for latitude and longitude */
  66504. if (P / a < genau) {
  66505. /* special case, if P=0. (X=0., Y=0.) */
  66506. Longitude = 0.0;
  66507. /* if (X,Y,Z)=(0.,0.,0.) then Height becomes semi-minor axis
  66508. * of ellipsoid (=center of mass), Latitude becomes PI/2 */
  66509. if (RR / a < genau) {
  66510. Latitude = HALF_PI;
  66511. Height = -b;
  66512. return {
  66513. x: p.x,
  66514. y: p.y,
  66515. z: p.z
  66516. };
  66517. }
  66518. } else {
  66519. /* ellipsoidal (geodetic) longitude
  66520. * interval: -PI < Longitude <= +PI */
  66521. Longitude = Math.atan2(Y, X);
  66522. }
  66523. /* --------------------------------------------------------------
  66524. * Following iterative algorithm was developped by
  66525. * "Institut for Erdmessung", University of Hannover, July 1988.
  66526. * Internet: www.ife.uni-hannover.de
  66527. * Iterative computation of CPHI,SPHI and Height.
  66528. * Iteration of CPHI and SPHI to 10**-12 radian resp.
  66529. * 2*10**-7 arcsec.
  66530. * --------------------------------------------------------------
  66531. */
  66532. CT = Z / RR;
  66533. ST = P / RR;
  66534. RX = 1.0 / Math.sqrt(1.0 - es * (2.0 - es) * ST * ST);
  66535. CPHI0 = ST * (1.0 - es) * RX;
  66536. SPHI0 = CT * RX;
  66537. iter = 0;
  66538. /* loop to find sin(Latitude) resp. Latitude
  66539. * until |sin(Latitude(iter)-Latitude(iter-1))| < genau */
  66540. do {
  66541. iter++;
  66542. RN = a / Math.sqrt(1.0 - es * SPHI0 * SPHI0);
  66543. /* ellipsoidal (geodetic) height */
  66544. Height = P * CPHI0 + Z * SPHI0 - RN * (1.0 - es * SPHI0 * SPHI0);
  66545. RK = es * RN / (RN + Height);
  66546. RX = 1.0 / Math.sqrt(1.0 - RK * (2.0 - RK) * ST * ST);
  66547. CPHI = ST * (1.0 - RK) * RX;
  66548. SPHI = CT * RX;
  66549. SDPHI = SPHI * CPHI0 - CPHI * SPHI0;
  66550. CPHI0 = CPHI;
  66551. SPHI0 = SPHI;
  66552. }
  66553. while (SDPHI * SDPHI > genau2 && iter < maxiter);
  66554. /* ellipsoidal (geodetic) latitude */
  66555. Latitude = Math.atan(SPHI / Math.abs(CPHI));
  66556. return {
  66557. x: Longitude,
  66558. y: Latitude,
  66559. z: Height
  66560. };
  66561. } // cs_geocentric_to_geodetic()
  66562. /****************************************************************/
  66563. // pj_geocentic_to_wgs84( p )
  66564. // p = point to transform in geocentric coordinates (x,y,z)
  66565. /** point object, nothing fancy, just allows values to be
  66566. passed back and forth by reference rather than by value.
  66567. Other point classes may be used as long as they have
  66568. x and y properties, which will get modified in the transform method.
  66569. */
  66570. function geocentricToWgs84(p, datum_type, datum_params) {
  66571. if (datum_type === PJD_3PARAM) {
  66572. // if( x[io] === HUGE_VAL )
  66573. // continue;
  66574. return {
  66575. x: p.x + datum_params[0],
  66576. y: p.y + datum_params[1],
  66577. z: p.z + datum_params[2],
  66578. };
  66579. } else if (datum_type === PJD_7PARAM) {
  66580. var Dx_BF = datum_params[0];
  66581. var Dy_BF = datum_params[1];
  66582. var Dz_BF = datum_params[2];
  66583. var Rx_BF = datum_params[3];
  66584. var Ry_BF = datum_params[4];
  66585. var Rz_BF = datum_params[5];
  66586. var M_BF = datum_params[6];
  66587. // if( x[io] === HUGE_VAL )
  66588. // continue;
  66589. return {
  66590. x: M_BF * (p.x - Rz_BF * p.y + Ry_BF * p.z) + Dx_BF,
  66591. y: M_BF * (Rz_BF * p.x + p.y - Rx_BF * p.z) + Dy_BF,
  66592. z: M_BF * (-Ry_BF * p.x + Rx_BF * p.y + p.z) + Dz_BF
  66593. };
  66594. }
  66595. } // cs_geocentric_to_wgs84
  66596. /****************************************************************/
  66597. // pj_geocentic_from_wgs84()
  66598. // coordinate system definition,
  66599. // point to transform in geocentric coordinates (x,y,z)
  66600. function geocentricFromWgs84(p, datum_type, datum_params) {
  66601. if (datum_type === PJD_3PARAM) {
  66602. //if( x[io] === HUGE_VAL )
  66603. // continue;
  66604. return {
  66605. x: p.x - datum_params[0],
  66606. y: p.y - datum_params[1],
  66607. z: p.z - datum_params[2],
  66608. };
  66609. } else if (datum_type === PJD_7PARAM) {
  66610. var Dx_BF = datum_params[0];
  66611. var Dy_BF = datum_params[1];
  66612. var Dz_BF = datum_params[2];
  66613. var Rx_BF = datum_params[3];
  66614. var Ry_BF = datum_params[4];
  66615. var Rz_BF = datum_params[5];
  66616. var M_BF = datum_params[6];
  66617. var x_tmp = (p.x - Dx_BF) / M_BF;
  66618. var y_tmp = (p.y - Dy_BF) / M_BF;
  66619. var z_tmp = (p.z - Dz_BF) / M_BF;
  66620. //if( x[io] === HUGE_VAL )
  66621. // continue;
  66622. return {
  66623. x: x_tmp + Rz_BF * y_tmp - Ry_BF * z_tmp,
  66624. y: -Rz_BF * x_tmp + y_tmp + Rx_BF * z_tmp,
  66625. z: Ry_BF * x_tmp - Rx_BF * y_tmp + z_tmp
  66626. };
  66627. } //cs_geocentric_from_wgs84()
  66628. }
  66629. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/datum_transform.js
  66630. function checkParams(type) {
  66631. return (type === PJD_3PARAM || type === PJD_7PARAM);
  66632. }
  66633. /* harmony default export */ function datum_transform(source, dest, point) {
  66634. // Short cut if the datums are identical.
  66635. if (compareDatums(source, dest)) {
  66636. return point; // in this case, zero is sucess,
  66637. // whereas cs_compare_datums returns 1 to indicate TRUE
  66638. // confusing, should fix this
  66639. }
  66640. // Explicitly skip datum transform by setting 'datum=none' as parameter for either source or dest
  66641. if (source.datum_type === PJD_NODATUM || dest.datum_type === PJD_NODATUM) {
  66642. return point;
  66643. }
  66644. // If this datum requires grid shifts, then apply it to geodetic coordinates.
  66645. // Do we need to go through geocentric coordinates?
  66646. if (source.es === dest.es && source.a === dest.a && !checkParams(source.datum_type) && !checkParams(dest.datum_type)) {
  66647. return point;
  66648. }
  66649. // Convert to geocentric coordinates.
  66650. point = geodeticToGeocentric(point, source.es, source.a);
  66651. // Convert between datums
  66652. if (checkParams(source.datum_type)) {
  66653. point = geocentricToWgs84(point, source.datum_type, source.datum_params);
  66654. }
  66655. if (checkParams(dest.datum_type)) {
  66656. point = geocentricFromWgs84(point, dest.datum_type, dest.datum_params);
  66657. }
  66658. return geocentricToGeodetic(point, dest.es, dest.a, dest.b);
  66659. }
  66660. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/adjust_axis.js
  66661. /* harmony default export */ function adjust_axis(crs, denorm, point) {
  66662. var xin = point.x,
  66663. yin = point.y,
  66664. zin = point.z || 0.0;
  66665. var v, t, i;
  66666. var out = {};
  66667. for (i = 0; i < 3; i++) {
  66668. if (denorm && i === 2 && point.z === undefined) {
  66669. continue;
  66670. }
  66671. if (i === 0) {
  66672. v = xin;
  66673. if ("ew".indexOf(crs.axis[i]) !== -1) {
  66674. t = 'x';
  66675. } else {
  66676. t = 'y';
  66677. }
  66678. }
  66679. else if (i === 1) {
  66680. v = yin;
  66681. if ("ns".indexOf(crs.axis[i]) !== -1) {
  66682. t = 'y';
  66683. } else {
  66684. t = 'x';
  66685. }
  66686. }
  66687. else {
  66688. v = zin;
  66689. t = 'z';
  66690. }
  66691. switch (crs.axis[i]) {
  66692. case 'e':
  66693. case 'w':
  66694. case 'n':
  66695. case 's':
  66696. out[t] = v;
  66697. break;
  66698. case 'u':
  66699. if (point[t] !== undefined) {
  66700. out.z = v;
  66701. }
  66702. break;
  66703. case 'd':
  66704. if (point[t] !== undefined) {
  66705. out.z = -v;
  66706. }
  66707. break;
  66708. default:
  66709. //console.log("ERROR: unknow axis ("+crs.axis[i]+") - check definition of "+crs.projName);
  66710. return null;
  66711. }
  66712. }
  66713. return out;
  66714. }
  66715. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/toPoint.js
  66716. /* harmony default export */ function toPoint(array){
  66717. var out = {
  66718. x: array[0],
  66719. y: array[1]
  66720. };
  66721. if (array.length>2) {
  66722. out.z = array[2];
  66723. }
  66724. if (array.length>3) {
  66725. out.m = array[3];
  66726. }
  66727. return out;
  66728. }
  66729. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/checkSanity.js
  66730. /* harmony default export */ function checkSanity(point) {
  66731. checkCoord(point.x);
  66732. checkCoord(point.y);
  66733. }
  66734. function checkCoord(num) {
  66735. if (typeof Number.isFinite === 'function') {
  66736. if (Number.isFinite(num)) {
  66737. return;
  66738. }
  66739. throw new TypeError('coordinates must be finite numbers');
  66740. }
  66741. if (typeof num !== 'number' || num !== num || !isFinite(num)) {
  66742. throw new TypeError('coordinates must be finite numbers');
  66743. }
  66744. }
  66745. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/transform.js
  66746. function checkNotWGS(source, dest) {
  66747. 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');
  66748. }
  66749. function transform(source, dest, point) {
  66750. var wgs84;
  66751. if (Array.isArray(point)) {
  66752. point = toPoint(point);
  66753. }
  66754. checkSanity(point);
  66755. // Workaround for datum shifts towgs84, if either source or destination projection is not wgs84
  66756. if (source.datum && dest.datum && checkNotWGS(source, dest)) {
  66757. wgs84 = new Proj('WGS84');
  66758. point = transform(source, wgs84, point);
  66759. source = wgs84;
  66760. }
  66761. // DGR, 2010/11/12
  66762. if (source.axis !== 'enu') {
  66763. point = adjust_axis(source, false, point);
  66764. }
  66765. // Transform source points to long/lat, if they aren't already.
  66766. if (source.projName === 'longlat') {
  66767. point = {
  66768. x: point.x * D2R,
  66769. y: point.y * D2R,
  66770. z: point.z || 0
  66771. };
  66772. } else {
  66773. if (source.to_meter) {
  66774. point = {
  66775. x: point.x * source.to_meter,
  66776. y: point.y * source.to_meter,
  66777. z: point.z || 0
  66778. };
  66779. }
  66780. point = source.inverse(point); // Convert Cartesian to longlat
  66781. if (!point) {
  66782. return;
  66783. }
  66784. }
  66785. // Adjust for the prime meridian if necessary
  66786. if (source.from_greenwich) {
  66787. point.x += source.from_greenwich;
  66788. }
  66789. // Convert datums if needed, and if possible.
  66790. point = datum_transform(source.datum, dest.datum, point);
  66791. // Adjust for the prime meridian if necessary
  66792. if (dest.from_greenwich) {
  66793. point = {
  66794. x: point.x - dest.from_greenwich,
  66795. y: point.y,
  66796. z: point.z || 0
  66797. };
  66798. }
  66799. if (dest.projName === 'longlat') {
  66800. // convert radians to decimal degrees
  66801. point = {
  66802. x: point.x * R2D,
  66803. y: point.y * R2D,
  66804. z: point.z || 0
  66805. };
  66806. } else { // else project
  66807. point = dest.forward(point);
  66808. if (dest.to_meter) {
  66809. point = {
  66810. x: point.x / dest.to_meter,
  66811. y: point.y / dest.to_meter,
  66812. z: point.z || 0
  66813. };
  66814. }
  66815. }
  66816. // DGR, 2010/11/12
  66817. if (dest.axis !== 'enu') {
  66818. return adjust_axis(dest, true, point);
  66819. }
  66820. return point;
  66821. }
  66822. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/core.js
  66823. var wgs84 = Proj('WGS84');
  66824. function transformer(from, to, coords) {
  66825. var transformedArray, out, keys;
  66826. if (Array.isArray(coords)) {
  66827. transformedArray = transform(from, to, coords) || {x: NaN, y: NaN};
  66828. if (coords.length > 2) {
  66829. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  66830. if (typeof transformedArray.z === 'number') {
  66831. return [transformedArray.x, transformedArray.y, transformedArray.z].concat(coords.splice(3));
  66832. } else {
  66833. return [transformedArray.x, transformedArray.y, coords[2]].concat(coords.splice(3));
  66834. }
  66835. } else {
  66836. return [transformedArray.x, transformedArray.y].concat(coords.splice(2));
  66837. }
  66838. } else {
  66839. return [transformedArray.x, transformedArray.y];
  66840. }
  66841. } else {
  66842. out = transform(from, to, coords);
  66843. keys = Object.keys(coords);
  66844. if (keys.length === 2) {
  66845. return out;
  66846. }
  66847. keys.forEach(function (key) {
  66848. if ((typeof from.name !== 'undefined' && from.name === 'geocent') || (typeof to.name !== 'undefined' && to.name === 'geocent')) {
  66849. if (key === 'x' || key === 'y' || key === 'z') {
  66850. return;
  66851. }
  66852. } else {
  66853. if (key === 'x' || key === 'y') {
  66854. return;
  66855. }
  66856. }
  66857. out[key] = coords[key];
  66858. });
  66859. return out;
  66860. }
  66861. }
  66862. function checkProj(item) {
  66863. if (item instanceof Proj) {
  66864. return item;
  66865. }
  66866. if (item.oProj) {
  66867. return item.oProj;
  66868. }
  66869. return Proj(item);
  66870. }
  66871. function proj4(fromProj, toProj, coord) {
  66872. fromProj = checkProj(fromProj);
  66873. var single = false;
  66874. var obj;
  66875. if (typeof toProj === 'undefined') {
  66876. toProj = fromProj;
  66877. fromProj = wgs84;
  66878. single = true;
  66879. } else if (typeof toProj.x !== 'undefined' || Array.isArray(toProj)) {
  66880. coord = toProj;
  66881. toProj = fromProj;
  66882. fromProj = wgs84;
  66883. single = true;
  66884. }
  66885. toProj = checkProj(toProj);
  66886. if (coord) {
  66887. return transformer(fromProj, toProj, coord);
  66888. } else {
  66889. obj = {
  66890. forward: function (coords) {
  66891. return transformer(fromProj, toProj, coords);
  66892. },
  66893. inverse: function (coords) {
  66894. return transformer(toProj, fromProj, coords);
  66895. }
  66896. };
  66897. if (single) {
  66898. obj.oProj = toProj;
  66899. }
  66900. return obj;
  66901. }
  66902. }
  66903. /* harmony default export */ const core = (proj4);
  66904. ;// CONCATENATED MODULE: ./node_modules/mgrs/mgrs.js
  66905. /**
  66906. * UTM zones are grouped, and assigned to one of a group of 6
  66907. * sets.
  66908. *
  66909. * {int} @private
  66910. */
  66911. var NUM_100K_SETS = 6;
  66912. /**
  66913. * The column letters (for easting) of the lower left value, per
  66914. * set.
  66915. *
  66916. * {string} @private
  66917. */
  66918. var SET_ORIGIN_COLUMN_LETTERS = 'AJSAJS';
  66919. /**
  66920. * The row letters (for northing) of the lower left value, per
  66921. * set.
  66922. *
  66923. * {string} @private
  66924. */
  66925. var SET_ORIGIN_ROW_LETTERS = 'AFAFAF';
  66926. var A = 65; // A
  66927. var I = 73; // I
  66928. var O = 79; // O
  66929. var V = 86; // V
  66930. var Z = 90; // Z
  66931. /* harmony default export */ const mgrs = ({
  66932. forward: mgrs_forward,
  66933. inverse: mgrs_inverse,
  66934. toPoint: mgrs_toPoint
  66935. });
  66936. /**
  66937. * Conversion of lat/lon to MGRS.
  66938. *
  66939. * @param {object} ll Object literal with lat and lon properties on a
  66940. * WGS84 ellipsoid.
  66941. * @param {int} accuracy Accuracy in digits (5 for 1 m, 4 for 10 m, 3 for
  66942. * 100 m, 2 for 1000 m or 1 for 10000 m). Optional, default is 5.
  66943. * @return {string} the MGRS string for the given location and accuracy.
  66944. */
  66945. function mgrs_forward(ll, accuracy) {
  66946. accuracy = accuracy || 5; // default accuracy 1m
  66947. return encode(LLtoUTM({
  66948. lat: ll[1],
  66949. lon: ll[0]
  66950. }), accuracy);
  66951. };
  66952. /**
  66953. * Conversion of MGRS to lat/lon.
  66954. *
  66955. * @param {string} mgrs MGRS string.
  66956. * @return {array} An array with left (longitude), bottom (latitude), right
  66957. * (longitude) and top (latitude) values in WGS84, representing the
  66958. * bounding box for the provided MGRS reference.
  66959. */
  66960. function mgrs_inverse(mgrs) {
  66961. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  66962. if (bbox.lat && bbox.lon) {
  66963. return [bbox.lon, bbox.lat, bbox.lon, bbox.lat];
  66964. }
  66965. return [bbox.left, bbox.bottom, bbox.right, bbox.top];
  66966. };
  66967. function mgrs_toPoint(mgrs) {
  66968. var bbox = UTMtoLL(decode(mgrs.toUpperCase()));
  66969. if (bbox.lat && bbox.lon) {
  66970. return [bbox.lon, bbox.lat];
  66971. }
  66972. return [(bbox.left + bbox.right) / 2, (bbox.top + bbox.bottom) / 2];
  66973. };
  66974. /**
  66975. * Conversion from degrees to radians.
  66976. *
  66977. * @private
  66978. * @param {number} deg the angle in degrees.
  66979. * @return {number} the angle in radians.
  66980. */
  66981. function degToRad(deg) {
  66982. return (deg * (Math.PI / 180.0));
  66983. }
  66984. /**
  66985. * Conversion from radians to degrees.
  66986. *
  66987. * @private
  66988. * @param {number} rad the angle in radians.
  66989. * @return {number} the angle in degrees.
  66990. */
  66991. function radToDeg(rad) {
  66992. return (180.0 * (rad / Math.PI));
  66993. }
  66994. /**
  66995. * Converts a set of Longitude and Latitude co-ordinates to UTM
  66996. * using the WGS84 ellipsoid.
  66997. *
  66998. * @private
  66999. * @param {object} ll Object literal with lat and lon properties
  67000. * representing the WGS84 coordinate to be converted.
  67001. * @return {object} Object literal containing the UTM value with easting,
  67002. * northing, zoneNumber and zoneLetter properties, and an optional
  67003. * accuracy property in digits. Returns null if the conversion failed.
  67004. */
  67005. function LLtoUTM(ll) {
  67006. var Lat = ll.lat;
  67007. var Long = ll.lon;
  67008. var a = 6378137.0; //ellip.radius;
  67009. var eccSquared = 0.00669438; //ellip.eccsq;
  67010. var k0 = 0.9996;
  67011. var LongOrigin;
  67012. var eccPrimeSquared;
  67013. var N, T, C, A, M;
  67014. var LatRad = degToRad(Lat);
  67015. var LongRad = degToRad(Long);
  67016. var LongOriginRad;
  67017. var ZoneNumber;
  67018. // (int)
  67019. ZoneNumber = Math.floor((Long + 180) / 6) + 1;
  67020. //Make sure the longitude 180.00 is in Zone 60
  67021. if (Long === 180) {
  67022. ZoneNumber = 60;
  67023. }
  67024. // Special zone for Norway
  67025. if (Lat >= 56.0 && Lat < 64.0 && Long >= 3.0 && Long < 12.0) {
  67026. ZoneNumber = 32;
  67027. }
  67028. // Special zones for Svalbard
  67029. if (Lat >= 72.0 && Lat < 84.0) {
  67030. if (Long >= 0.0 && Long < 9.0) {
  67031. ZoneNumber = 31;
  67032. }
  67033. else if (Long >= 9.0 && Long < 21.0) {
  67034. ZoneNumber = 33;
  67035. }
  67036. else if (Long >= 21.0 && Long < 33.0) {
  67037. ZoneNumber = 35;
  67038. }
  67039. else if (Long >= 33.0 && Long < 42.0) {
  67040. ZoneNumber = 37;
  67041. }
  67042. }
  67043. LongOrigin = (ZoneNumber - 1) * 6 - 180 + 3; //+3 puts origin
  67044. // in middle of
  67045. // zone
  67046. LongOriginRad = degToRad(LongOrigin);
  67047. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  67048. N = a / Math.sqrt(1 - eccSquared * Math.sin(LatRad) * Math.sin(LatRad));
  67049. T = Math.tan(LatRad) * Math.tan(LatRad);
  67050. C = eccPrimeSquared * Math.cos(LatRad) * Math.cos(LatRad);
  67051. A = Math.cos(LatRad) * (LongRad - LongOriginRad);
  67052. 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));
  67053. 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);
  67054. 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)));
  67055. if (Lat < 0.0) {
  67056. UTMNorthing += 10000000.0; //10000000 meter offset for
  67057. // southern hemisphere
  67058. }
  67059. return {
  67060. northing: Math.round(UTMNorthing),
  67061. easting: Math.round(UTMEasting),
  67062. zoneNumber: ZoneNumber,
  67063. zoneLetter: getLetterDesignator(Lat)
  67064. };
  67065. }
  67066. /**
  67067. * Converts UTM coords to lat/long, using the WGS84 ellipsoid. This is a convenience
  67068. * class where the Zone can be specified as a single string eg."60N" which
  67069. * is then broken down into the ZoneNumber and ZoneLetter.
  67070. *
  67071. * @private
  67072. * @param {object} utm An object literal with northing, easting, zoneNumber
  67073. * and zoneLetter properties. If an optional accuracy property is
  67074. * provided (in meters), a bounding box will be returned instead of
  67075. * latitude and longitude.
  67076. * @return {object} An object literal containing either lat and lon values
  67077. * (if no accuracy was provided), or top, right, bottom and left values
  67078. * for the bounding box calculated according to the provided accuracy.
  67079. * Returns null if the conversion failed.
  67080. */
  67081. function UTMtoLL(utm) {
  67082. var UTMNorthing = utm.northing;
  67083. var UTMEasting = utm.easting;
  67084. var zoneLetter = utm.zoneLetter;
  67085. var zoneNumber = utm.zoneNumber;
  67086. // check the ZoneNummber is valid
  67087. if (zoneNumber < 0 || zoneNumber > 60) {
  67088. return null;
  67089. }
  67090. var k0 = 0.9996;
  67091. var a = 6378137.0; //ellip.radius;
  67092. var eccSquared = 0.00669438; //ellip.eccsq;
  67093. var eccPrimeSquared;
  67094. var e1 = (1 - Math.sqrt(1 - eccSquared)) / (1 + Math.sqrt(1 - eccSquared));
  67095. var N1, T1, C1, R1, D, M;
  67096. var LongOrigin;
  67097. var mu, phi1Rad;
  67098. // remove 500,000 meter offset for longitude
  67099. var x = UTMEasting - 500000.0;
  67100. var y = UTMNorthing;
  67101. // We must know somehow if we are in the Northern or Southern
  67102. // hemisphere, this is the only time we use the letter So even
  67103. // if the Zone letter isn't exactly correct it should indicate
  67104. // the hemisphere correctly
  67105. if (zoneLetter < 'N') {
  67106. y -= 10000000.0; // remove 10,000,000 meter offset used
  67107. // for southern hemisphere
  67108. }
  67109. // There are 60 zones with zone 1 being at West -180 to -174
  67110. LongOrigin = (zoneNumber - 1) * 6 - 180 + 3; // +3 puts origin
  67111. // in middle of
  67112. // zone
  67113. eccPrimeSquared = (eccSquared) / (1 - eccSquared);
  67114. M = y / k0;
  67115. mu = M / (a * (1 - eccSquared / 4 - 3 * eccSquared * eccSquared / 64 - 5 * eccSquared * eccSquared * eccSquared / 256));
  67116. 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);
  67117. // double phi1 = ProjMath.radToDeg(phi1Rad);
  67118. N1 = a / Math.sqrt(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad));
  67119. T1 = Math.tan(phi1Rad) * Math.tan(phi1Rad);
  67120. C1 = eccPrimeSquared * Math.cos(phi1Rad) * Math.cos(phi1Rad);
  67121. R1 = a * (1 - eccSquared) / Math.pow(1 - eccSquared * Math.sin(phi1Rad) * Math.sin(phi1Rad), 1.5);
  67122. D = x / (N1 * k0);
  67123. 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);
  67124. lat = radToDeg(lat);
  67125. 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);
  67126. lon = LongOrigin + radToDeg(lon);
  67127. var result;
  67128. if (utm.accuracy) {
  67129. var topRight = UTMtoLL({
  67130. northing: utm.northing + utm.accuracy,
  67131. easting: utm.easting + utm.accuracy,
  67132. zoneLetter: utm.zoneLetter,
  67133. zoneNumber: utm.zoneNumber
  67134. });
  67135. result = {
  67136. top: topRight.lat,
  67137. right: topRight.lon,
  67138. bottom: lat,
  67139. left: lon
  67140. };
  67141. }
  67142. else {
  67143. result = {
  67144. lat: lat,
  67145. lon: lon
  67146. };
  67147. }
  67148. return result;
  67149. }
  67150. /**
  67151. * Calculates the MGRS letter designator for the given latitude.
  67152. *
  67153. * @private
  67154. * @param {number} lat The latitude in WGS84 to get the letter designator
  67155. * for.
  67156. * @return {char} The letter designator.
  67157. */
  67158. function getLetterDesignator(lat) {
  67159. //This is here as an error flag to show that the Latitude is
  67160. //outside MGRS limits
  67161. var LetterDesignator = 'Z';
  67162. if ((84 >= lat) && (lat >= 72)) {
  67163. LetterDesignator = 'X';
  67164. }
  67165. else if ((72 > lat) && (lat >= 64)) {
  67166. LetterDesignator = 'W';
  67167. }
  67168. else if ((64 > lat) && (lat >= 56)) {
  67169. LetterDesignator = 'V';
  67170. }
  67171. else if ((56 > lat) && (lat >= 48)) {
  67172. LetterDesignator = 'U';
  67173. }
  67174. else if ((48 > lat) && (lat >= 40)) {
  67175. LetterDesignator = 'T';
  67176. }
  67177. else if ((40 > lat) && (lat >= 32)) {
  67178. LetterDesignator = 'S';
  67179. }
  67180. else if ((32 > lat) && (lat >= 24)) {
  67181. LetterDesignator = 'R';
  67182. }
  67183. else if ((24 > lat) && (lat >= 16)) {
  67184. LetterDesignator = 'Q';
  67185. }
  67186. else if ((16 > lat) && (lat >= 8)) {
  67187. LetterDesignator = 'P';
  67188. }
  67189. else if ((8 > lat) && (lat >= 0)) {
  67190. LetterDesignator = 'N';
  67191. }
  67192. else if ((0 > lat) && (lat >= -8)) {
  67193. LetterDesignator = 'M';
  67194. }
  67195. else if ((-8 > lat) && (lat >= -16)) {
  67196. LetterDesignator = 'L';
  67197. }
  67198. else if ((-16 > lat) && (lat >= -24)) {
  67199. LetterDesignator = 'K';
  67200. }
  67201. else if ((-24 > lat) && (lat >= -32)) {
  67202. LetterDesignator = 'J';
  67203. }
  67204. else if ((-32 > lat) && (lat >= -40)) {
  67205. LetterDesignator = 'H';
  67206. }
  67207. else if ((-40 > lat) && (lat >= -48)) {
  67208. LetterDesignator = 'G';
  67209. }
  67210. else if ((-48 > lat) && (lat >= -56)) {
  67211. LetterDesignator = 'F';
  67212. }
  67213. else if ((-56 > lat) && (lat >= -64)) {
  67214. LetterDesignator = 'E';
  67215. }
  67216. else if ((-64 > lat) && (lat >= -72)) {
  67217. LetterDesignator = 'D';
  67218. }
  67219. else if ((-72 > lat) && (lat >= -80)) {
  67220. LetterDesignator = 'C';
  67221. }
  67222. return LetterDesignator;
  67223. }
  67224. /**
  67225. * Encodes a UTM location as MGRS string.
  67226. *
  67227. * @private
  67228. * @param {object} utm An object literal with easting, northing,
  67229. * zoneLetter, zoneNumber
  67230. * @param {number} accuracy Accuracy in digits (1-5).
  67231. * @return {string} MGRS string for the given UTM location.
  67232. */
  67233. function encode(utm, accuracy) {
  67234. // prepend with leading zeroes
  67235. var seasting = "00000" + utm.easting,
  67236. snorthing = "00000" + utm.northing;
  67237. return utm.zoneNumber + utm.zoneLetter + get100kID(utm.easting, utm.northing, utm.zoneNumber) + seasting.substr(seasting.length - 5, accuracy) + snorthing.substr(snorthing.length - 5, accuracy);
  67238. }
  67239. /**
  67240. * Get the two letter 100k designator for a given UTM easting,
  67241. * northing and zone number value.
  67242. *
  67243. * @private
  67244. * @param {number} easting
  67245. * @param {number} northing
  67246. * @param {number} zoneNumber
  67247. * @return the two letter 100k designator for the given UTM location.
  67248. */
  67249. function get100kID(easting, northing, zoneNumber) {
  67250. var setParm = get100kSetForZone(zoneNumber);
  67251. var setColumn = Math.floor(easting / 100000);
  67252. var setRow = Math.floor(northing / 100000) % 20;
  67253. return getLetter100kID(setColumn, setRow, setParm);
  67254. }
  67255. /**
  67256. * Given a UTM zone number, figure out the MGRS 100K set it is in.
  67257. *
  67258. * @private
  67259. * @param {number} i An UTM zone number.
  67260. * @return {number} the 100k set the UTM zone is in.
  67261. */
  67262. function get100kSetForZone(i) {
  67263. var setParm = i % NUM_100K_SETS;
  67264. if (setParm === 0) {
  67265. setParm = NUM_100K_SETS;
  67266. }
  67267. return setParm;
  67268. }
  67269. /**
  67270. * Get the two-letter MGRS 100k designator given information
  67271. * translated from the UTM northing, easting and zone number.
  67272. *
  67273. * @private
  67274. * @param {number} column the column index as it relates to the MGRS
  67275. * 100k set spreadsheet, created from the UTM easting.
  67276. * Values are 1-8.
  67277. * @param {number} row the row index as it relates to the MGRS 100k set
  67278. * spreadsheet, created from the UTM northing value. Values
  67279. * are from 0-19.
  67280. * @param {number} parm the set block, as it relates to the MGRS 100k set
  67281. * spreadsheet, created from the UTM zone. Values are from
  67282. * 1-60.
  67283. * @return two letter MGRS 100k code.
  67284. */
  67285. function getLetter100kID(column, row, parm) {
  67286. // colOrigin and rowOrigin are the letters at the origin of the set
  67287. var index = parm - 1;
  67288. var colOrigin = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(index);
  67289. var rowOrigin = SET_ORIGIN_ROW_LETTERS.charCodeAt(index);
  67290. // colInt and rowInt are the letters to build to return
  67291. var colInt = colOrigin + column - 1;
  67292. var rowInt = rowOrigin + row;
  67293. var rollover = false;
  67294. if (colInt > Z) {
  67295. colInt = colInt - Z + A - 1;
  67296. rollover = true;
  67297. }
  67298. if (colInt === I || (colOrigin < I && colInt > I) || ((colInt > I || colOrigin < I) && rollover)) {
  67299. colInt++;
  67300. }
  67301. if (colInt === O || (colOrigin < O && colInt > O) || ((colInt > O || colOrigin < O) && rollover)) {
  67302. colInt++;
  67303. if (colInt === I) {
  67304. colInt++;
  67305. }
  67306. }
  67307. if (colInt > Z) {
  67308. colInt = colInt - Z + A - 1;
  67309. }
  67310. if (rowInt > V) {
  67311. rowInt = rowInt - V + A - 1;
  67312. rollover = true;
  67313. }
  67314. else {
  67315. rollover = false;
  67316. }
  67317. if (((rowInt === I) || ((rowOrigin < I) && (rowInt > I))) || (((rowInt > I) || (rowOrigin < I)) && rollover)) {
  67318. rowInt++;
  67319. }
  67320. if (((rowInt === O) || ((rowOrigin < O) && (rowInt > O))) || (((rowInt > O) || (rowOrigin < O)) && rollover)) {
  67321. rowInt++;
  67322. if (rowInt === I) {
  67323. rowInt++;
  67324. }
  67325. }
  67326. if (rowInt > V) {
  67327. rowInt = rowInt - V + A - 1;
  67328. }
  67329. var twoLetter = String.fromCharCode(colInt) + String.fromCharCode(rowInt);
  67330. return twoLetter;
  67331. }
  67332. /**
  67333. * Decode the UTM parameters from a MGRS string.
  67334. *
  67335. * @private
  67336. * @param {string} mgrsString an UPPERCASE coordinate string is expected.
  67337. * @return {object} An object literal with easting, northing, zoneLetter,
  67338. * zoneNumber and accuracy (in meters) properties.
  67339. */
  67340. function decode(mgrsString) {
  67341. if (mgrsString && mgrsString.length === 0) {
  67342. throw ("MGRSPoint coverting from nothing");
  67343. }
  67344. var length = mgrsString.length;
  67345. var hunK = null;
  67346. var sb = "";
  67347. var testChar;
  67348. var i = 0;
  67349. // get Zone number
  67350. while (!(/[A-Z]/).test(testChar = mgrsString.charAt(i))) {
  67351. if (i >= 2) {
  67352. throw ("MGRSPoint bad conversion from: " + mgrsString);
  67353. }
  67354. sb += testChar;
  67355. i++;
  67356. }
  67357. var zoneNumber = parseInt(sb, 10);
  67358. if (i === 0 || i + 3 > length) {
  67359. // A good MGRS string has to be 4-5 digits long,
  67360. // ##AAA/#AAA at least.
  67361. throw ("MGRSPoint bad conversion from: " + mgrsString);
  67362. }
  67363. var zoneLetter = mgrsString.charAt(i++);
  67364. // Should we check the zone letter here? Why not.
  67365. if (zoneLetter <= 'A' || zoneLetter === 'B' || zoneLetter === 'Y' || zoneLetter >= 'Z' || zoneLetter === 'I' || zoneLetter === 'O') {
  67366. throw ("MGRSPoint zone letter " + zoneLetter + " not handled: " + mgrsString);
  67367. }
  67368. hunK = mgrsString.substring(i, i += 2);
  67369. var set = get100kSetForZone(zoneNumber);
  67370. var east100k = getEastingFromChar(hunK.charAt(0), set);
  67371. var north100k = getNorthingFromChar(hunK.charAt(1), set);
  67372. // We have a bug where the northing may be 2000000 too low.
  67373. // How
  67374. // do we know when to roll over?
  67375. while (north100k < getMinNorthing(zoneLetter)) {
  67376. north100k += 2000000;
  67377. }
  67378. // calculate the char index for easting/northing separator
  67379. var remainder = length - i;
  67380. if (remainder % 2 !== 0) {
  67381. 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);
  67382. }
  67383. var sep = remainder / 2;
  67384. var sepEasting = 0.0;
  67385. var sepNorthing = 0.0;
  67386. var accuracyBonus, sepEastingString, sepNorthingString, easting, northing;
  67387. if (sep > 0) {
  67388. accuracyBonus = 100000.0 / Math.pow(10, sep);
  67389. sepEastingString = mgrsString.substring(i, i + sep);
  67390. sepEasting = parseFloat(sepEastingString) * accuracyBonus;
  67391. sepNorthingString = mgrsString.substring(i + sep);
  67392. sepNorthing = parseFloat(sepNorthingString) * accuracyBonus;
  67393. }
  67394. easting = sepEasting + east100k;
  67395. northing = sepNorthing + north100k;
  67396. return {
  67397. easting: easting,
  67398. northing: northing,
  67399. zoneLetter: zoneLetter,
  67400. zoneNumber: zoneNumber,
  67401. accuracy: accuracyBonus
  67402. };
  67403. }
  67404. /**
  67405. * Given the first letter from a two-letter MGRS 100k zone, and given the
  67406. * MGRS table set for the zone number, figure out the easting value that
  67407. * should be added to the other, secondary easting value.
  67408. *
  67409. * @private
  67410. * @param {char} e The first letter from a two-letter MGRS 100´k zone.
  67411. * @param {number} set The MGRS table set for the zone number.
  67412. * @return {number} The easting value for the given letter and set.
  67413. */
  67414. function getEastingFromChar(e, set) {
  67415. // colOrigin is the letter at the origin of the set for the
  67416. // column
  67417. var curCol = SET_ORIGIN_COLUMN_LETTERS.charCodeAt(set - 1);
  67418. var eastingValue = 100000.0;
  67419. var rewindMarker = false;
  67420. while (curCol !== e.charCodeAt(0)) {
  67421. curCol++;
  67422. if (curCol === I) {
  67423. curCol++;
  67424. }
  67425. if (curCol === O) {
  67426. curCol++;
  67427. }
  67428. if (curCol > Z) {
  67429. if (rewindMarker) {
  67430. throw ("Bad character: " + e);
  67431. }
  67432. curCol = A;
  67433. rewindMarker = true;
  67434. }
  67435. eastingValue += 100000.0;
  67436. }
  67437. return eastingValue;
  67438. }
  67439. /**
  67440. * Given the second letter from a two-letter MGRS 100k zone, and given the
  67441. * MGRS table set for the zone number, figure out the northing value that
  67442. * should be added to the other, secondary northing value. You have to
  67443. * remember that Northings are determined from the equator, and the vertical
  67444. * cycle of letters mean a 2000000 additional northing meters. This happens
  67445. * approx. every 18 degrees of latitude. This method does *NOT* count any
  67446. * additional northings. You have to figure out how many 2000000 meters need
  67447. * to be added for the zone letter of the MGRS coordinate.
  67448. *
  67449. * @private
  67450. * @param {char} n Second letter of the MGRS 100k zone
  67451. * @param {number} set The MGRS table set number, which is dependent on the
  67452. * UTM zone number.
  67453. * @return {number} The northing value for the given letter and set.
  67454. */
  67455. function getNorthingFromChar(n, set) {
  67456. if (n > 'V') {
  67457. throw ("MGRSPoint given invalid Northing " + n);
  67458. }
  67459. // rowOrigin is the letter at the origin of the set for the
  67460. // column
  67461. var curRow = SET_ORIGIN_ROW_LETTERS.charCodeAt(set - 1);
  67462. var northingValue = 0.0;
  67463. var rewindMarker = false;
  67464. while (curRow !== n.charCodeAt(0)) {
  67465. curRow++;
  67466. if (curRow === I) {
  67467. curRow++;
  67468. }
  67469. if (curRow === O) {
  67470. curRow++;
  67471. }
  67472. // fixing a bug making whole application hang in this loop
  67473. // when 'n' is a wrong character
  67474. if (curRow > V) {
  67475. if (rewindMarker) { // making sure that this loop ends
  67476. throw ("Bad character: " + n);
  67477. }
  67478. curRow = A;
  67479. rewindMarker = true;
  67480. }
  67481. northingValue += 100000.0;
  67482. }
  67483. return northingValue;
  67484. }
  67485. /**
  67486. * The function getMinNorthing returns the minimum northing value of a MGRS
  67487. * zone.
  67488. *
  67489. * Ported from Geotrans' c Lattitude_Band_Value structure table.
  67490. *
  67491. * @private
  67492. * @param {char} zoneLetter The MGRS zone to get the min northing for.
  67493. * @return {number}
  67494. */
  67495. function getMinNorthing(zoneLetter) {
  67496. var northing;
  67497. switch (zoneLetter) {
  67498. case 'C':
  67499. northing = 1100000.0;
  67500. break;
  67501. case 'D':
  67502. northing = 2000000.0;
  67503. break;
  67504. case 'E':
  67505. northing = 2800000.0;
  67506. break;
  67507. case 'F':
  67508. northing = 3700000.0;
  67509. break;
  67510. case 'G':
  67511. northing = 4600000.0;
  67512. break;
  67513. case 'H':
  67514. northing = 5500000.0;
  67515. break;
  67516. case 'J':
  67517. northing = 6400000.0;
  67518. break;
  67519. case 'K':
  67520. northing = 7300000.0;
  67521. break;
  67522. case 'L':
  67523. northing = 8200000.0;
  67524. break;
  67525. case 'M':
  67526. northing = 9100000.0;
  67527. break;
  67528. case 'N':
  67529. northing = 0.0;
  67530. break;
  67531. case 'P':
  67532. northing = 800000.0;
  67533. break;
  67534. case 'Q':
  67535. northing = 1700000.0;
  67536. break;
  67537. case 'R':
  67538. northing = 2600000.0;
  67539. break;
  67540. case 'S':
  67541. northing = 3500000.0;
  67542. break;
  67543. case 'T':
  67544. northing = 4400000.0;
  67545. break;
  67546. case 'U':
  67547. northing = 5300000.0;
  67548. break;
  67549. case 'V':
  67550. northing = 6200000.0;
  67551. break;
  67552. case 'W':
  67553. northing = 7000000.0;
  67554. break;
  67555. case 'X':
  67556. northing = 7900000.0;
  67557. break;
  67558. default:
  67559. northing = -1.0;
  67560. }
  67561. if (northing >= 0.0) {
  67562. return northing;
  67563. }
  67564. else {
  67565. throw ("Invalid zone letter: " + zoneLetter);
  67566. }
  67567. }
  67568. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/Point.js
  67569. function lib_Point_Point(x, y, z) {
  67570. if (!(this instanceof lib_Point_Point)) {
  67571. return new lib_Point_Point(x, y, z);
  67572. }
  67573. if (Array.isArray(x)) {
  67574. this.x = x[0];
  67575. this.y = x[1];
  67576. this.z = x[2] || 0.0;
  67577. } else if(typeof x === 'object') {
  67578. this.x = x.x;
  67579. this.y = x.y;
  67580. this.z = x.z || 0.0;
  67581. } else if (typeof x === 'string' && typeof y === 'undefined') {
  67582. var coords = x.split(',');
  67583. this.x = parseFloat(coords[0], 10);
  67584. this.y = parseFloat(coords[1], 10);
  67585. this.z = parseFloat(coords[2], 10) || 0.0;
  67586. } else {
  67587. this.x = x;
  67588. this.y = y;
  67589. this.z = z || 0.0;
  67590. }
  67591. console.warn('proj4.Point will be removed in version 3, use proj4.toPoint');
  67592. }
  67593. lib_Point_Point.fromMGRS = function(mgrsStr) {
  67594. return new lib_Point_Point(mgrs_toPoint(mgrsStr));
  67595. };
  67596. lib_Point_Point.prototype.toMGRS = function(accuracy) {
  67597. return mgrs_forward([this.x, this.y], accuracy);
  67598. };
  67599. /* harmony default export */ const lib_Point = (lib_Point_Point);
  67600. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_enfn.js
  67601. var C00 = 1;
  67602. var C02 = 0.25;
  67603. var C04 = 0.046875;
  67604. var C06 = 0.01953125;
  67605. var C08 = 0.01068115234375;
  67606. var C22 = 0.75;
  67607. var C44 = 0.46875;
  67608. var C46 = 0.01302083333333333333;
  67609. var C48 = 0.00712076822916666666;
  67610. var C66 = 0.36458333333333333333;
  67611. var C68 = 0.00569661458333333333;
  67612. var C88 = 0.3076171875;
  67613. /* harmony default export */ function pj_enfn(es) {
  67614. var en = [];
  67615. en[0] = C00 - es * (C02 + es * (C04 + es * (C06 + es * C08)));
  67616. en[1] = es * (C22 - es * (C04 + es * (C06 + es * C08)));
  67617. var t = es * es;
  67618. en[2] = t * (C44 - es * (C46 + es * C48));
  67619. t *= es;
  67620. en[3] = t * (C66 - es * C68);
  67621. en[4] = t * es * C88;
  67622. return en;
  67623. }
  67624. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_mlfn.js
  67625. /* harmony default export */ function pj_mlfn(phi, sphi, cphi, en) {
  67626. cphi *= sphi;
  67627. sphi *= sphi;
  67628. return (en[0] * phi - cphi * (en[1] + sphi * (en[2] + sphi * (en[3] + sphi * en[4]))));
  67629. }
  67630. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/pj_inv_mlfn.js
  67631. var MAX_ITER = 20;
  67632. /* harmony default export */ function pj_inv_mlfn(arg, es, en) {
  67633. var k = 1 / (1 - es);
  67634. var phi = arg;
  67635. for (var i = MAX_ITER; i; --i) { /* rarely goes over 2 iterations */
  67636. var s = Math.sin(phi);
  67637. var t = 1 - es * s * s;
  67638. //t = this.pj_mlfn(phi, s, Math.cos(phi), en) - arg;
  67639. //phi -= t * (t * Math.sqrt(t)) * k;
  67640. t = (pj_mlfn(phi, s, Math.cos(phi), en) - arg) * (t * Math.sqrt(t)) * k;
  67641. phi -= t;
  67642. if (Math.abs(t) < EPSLN) {
  67643. return phi;
  67644. }
  67645. }
  67646. //..reportError("cass:pj_inv_mlfn: Convergence error");
  67647. return phi;
  67648. }
  67649. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/tmerc.js
  67650. // Heavily based on this tmerc projection implementation
  67651. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/tmerc.js
  67652. function tmerc_init() {
  67653. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  67654. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  67655. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  67656. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  67657. if (this.es) {
  67658. this.en = pj_enfn(this.es);
  67659. this.ml0 = pj_mlfn(this.lat0, Math.sin(this.lat0), Math.cos(this.lat0), this.en);
  67660. }
  67661. }
  67662. /**
  67663. Transverse Mercator Forward - long/lat to x/y
  67664. long/lat in radians
  67665. */
  67666. function tmerc_forward(p) {
  67667. var lon = p.x;
  67668. var lat = p.y;
  67669. var delta_lon = adjust_lon(lon - this.long0);
  67670. var con;
  67671. var x, y;
  67672. var sin_phi = Math.sin(lat);
  67673. var cos_phi = Math.cos(lat);
  67674. if (!this.es) {
  67675. var b = cos_phi * Math.sin(delta_lon);
  67676. if ((Math.abs(Math.abs(b) - 1)) < EPSLN) {
  67677. return (93);
  67678. }
  67679. else {
  67680. x = 0.5 * this.a * this.k0 * Math.log((1 + b) / (1 - b)) + this.x0;
  67681. y = cos_phi * Math.cos(delta_lon) / Math.sqrt(1 - Math.pow(b, 2));
  67682. b = Math.abs(y);
  67683. if (b >= 1) {
  67684. if ((b - 1) > EPSLN) {
  67685. return (93);
  67686. }
  67687. else {
  67688. y = 0;
  67689. }
  67690. }
  67691. else {
  67692. y = Math.acos(y);
  67693. }
  67694. if (lat < 0) {
  67695. y = -y;
  67696. }
  67697. y = this.a * this.k0 * (y - this.lat0) + this.y0;
  67698. }
  67699. }
  67700. else {
  67701. var al = cos_phi * delta_lon;
  67702. var als = Math.pow(al, 2);
  67703. var c = this.ep2 * Math.pow(cos_phi, 2);
  67704. var cs = Math.pow(c, 2);
  67705. var tq = Math.abs(cos_phi) > EPSLN ? Math.tan(lat) : 0;
  67706. var t = Math.pow(tq, 2);
  67707. var ts = Math.pow(t, 2);
  67708. con = 1 - this.es * Math.pow(sin_phi, 2);
  67709. al = al / Math.sqrt(con);
  67710. var ml = pj_mlfn(lat, sin_phi, cos_phi, this.en);
  67711. x = this.a * (this.k0 * al * (1 +
  67712. als / 6 * (1 - t + c +
  67713. als / 20 * (5 - 18 * t + ts + 14 * c - 58 * t * c +
  67714. als / 42 * (61 + 179 * ts - ts * t - 479 * t))))) +
  67715. this.x0;
  67716. y = this.a * (this.k0 * (ml - this.ml0 +
  67717. sin_phi * delta_lon * al / 2 * (1 +
  67718. als / 12 * (5 - t + 9 * c + 4 * cs +
  67719. als / 30 * (61 + ts - 58 * t + 270 * c - 330 * t * c +
  67720. als / 56 * (1385 + 543 * ts - ts * t - 3111 * t)))))) +
  67721. this.y0;
  67722. }
  67723. p.x = x;
  67724. p.y = y;
  67725. return p;
  67726. }
  67727. /**
  67728. Transverse Mercator Inverse - x/y to long/lat
  67729. */
  67730. function tmerc_inverse(p) {
  67731. var con, phi;
  67732. var lat, lon;
  67733. var x = (p.x - this.x0) * (1 / this.a);
  67734. var y = (p.y - this.y0) * (1 / this.a);
  67735. if (!this.es) {
  67736. var f = Math.exp(x / this.k0);
  67737. var g = 0.5 * (f - 1 / f);
  67738. var temp = this.lat0 + y / this.k0;
  67739. var h = Math.cos(temp);
  67740. con = Math.sqrt((1 - Math.pow(h, 2)) / (1 + Math.pow(g, 2)));
  67741. lat = Math.asin(con);
  67742. if (y < 0) {
  67743. lat = -lat;
  67744. }
  67745. if ((g === 0) && (h === 0)) {
  67746. lon = 0;
  67747. }
  67748. else {
  67749. lon = adjust_lon(Math.atan2(g, h) + this.long0);
  67750. }
  67751. }
  67752. else { // ellipsoidal form
  67753. con = this.ml0 + y / this.k0;
  67754. phi = pj_inv_mlfn(con, this.es, this.en);
  67755. if (Math.abs(phi) < HALF_PI) {
  67756. var sin_phi = Math.sin(phi);
  67757. var cos_phi = Math.cos(phi);
  67758. var tan_phi = Math.abs(cos_phi) > EPSLN ? Math.tan(phi) : 0;
  67759. var c = this.ep2 * Math.pow(cos_phi, 2);
  67760. var cs = Math.pow(c, 2);
  67761. var t = Math.pow(tan_phi, 2);
  67762. var ts = Math.pow(t, 2);
  67763. con = 1 - this.es * Math.pow(sin_phi, 2);
  67764. var d = x * Math.sqrt(con) / this.k0;
  67765. var ds = Math.pow(d, 2);
  67766. con = con * tan_phi;
  67767. lat = phi - (con * ds / (1 - this.es)) * 0.5 * (1 -
  67768. ds / 12 * (5 + 3 * t - 9 * c * t + c - 4 * cs -
  67769. ds / 30 * (61 + 90 * t - 252 * c * t + 45 * ts + 46 * c -
  67770. ds / 56 * (1385 + 3633 * t + 4095 * ts + 1574 * ts * t))));
  67771. lon = adjust_lon(this.long0 + (d * (1 -
  67772. ds / 6 * (1 + 2 * t + c -
  67773. ds / 20 * (5 + 28 * t + 24 * ts + 8 * c * t + 6 * c -
  67774. ds / 42 * (61 + 662 * t + 1320 * ts + 720 * ts * t)))) / cos_phi));
  67775. }
  67776. else {
  67777. lat = HALF_PI * sign(y);
  67778. lon = 0;
  67779. }
  67780. }
  67781. p.x = lon;
  67782. p.y = lat;
  67783. return p;
  67784. }
  67785. var tmerc_names = ["Transverse_Mercator", "Transverse Mercator", "tmerc"];
  67786. /* harmony default export */ const tmerc = ({
  67787. init: tmerc_init,
  67788. forward: tmerc_forward,
  67789. inverse: tmerc_inverse,
  67790. names: tmerc_names
  67791. });
  67792. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/sinh.js
  67793. /* harmony default export */ function sinh(x) {
  67794. var r = Math.exp(x);
  67795. r = (r - 1 / r) / 2;
  67796. return r;
  67797. }
  67798. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/hypot.js
  67799. /* harmony default export */ function hypot(x, y) {
  67800. x = Math.abs(x);
  67801. y = Math.abs(y);
  67802. var a = Math.max(x, y);
  67803. var b = Math.min(x, y) / (a ? a : 1);
  67804. return a * Math.sqrt(1 + Math.pow(b, 2));
  67805. }
  67806. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/log1py.js
  67807. /* harmony default export */ function log1py(x) {
  67808. var y = 1 + x;
  67809. var z = y - 1;
  67810. return z === 0 ? x : x * Math.log(y) / z;
  67811. }
  67812. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinhy.js
  67813. /* harmony default export */ function asinhy(x) {
  67814. var y = Math.abs(x);
  67815. y = log1py(y * (1 + y / (hypot(1, y) + 1)));
  67816. return x < 0 ? -y : y;
  67817. }
  67818. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gatg.js
  67819. /* harmony default export */ function gatg(pp, B) {
  67820. var cos_2B = 2 * Math.cos(2 * B);
  67821. var i = pp.length - 1;
  67822. var h1 = pp[i];
  67823. var h2 = 0;
  67824. var h;
  67825. while (--i >= 0) {
  67826. h = -h2 + cos_2B * h1 + pp[i];
  67827. h2 = h1;
  67828. h1 = h;
  67829. }
  67830. return (B + h * Math.sin(2 * B));
  67831. }
  67832. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens.js
  67833. /* harmony default export */ function clens(pp, arg_r) {
  67834. var r = 2 * Math.cos(arg_r);
  67835. var i = pp.length - 1;
  67836. var hr1 = pp[i];
  67837. var hr2 = 0;
  67838. var hr;
  67839. while (--i >= 0) {
  67840. hr = -hr2 + r * hr1 + pp[i];
  67841. hr2 = hr1;
  67842. hr1 = hr;
  67843. }
  67844. return Math.sin(arg_r) * hr;
  67845. }
  67846. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/cosh.js
  67847. /* harmony default export */ function cosh(x) {
  67848. var r = Math.exp(x);
  67849. r = (r + 1 / r) / 2;
  67850. return r;
  67851. }
  67852. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/clens_cmplx.js
  67853. /* harmony default export */ function clens_cmplx(pp, arg_r, arg_i) {
  67854. var sin_arg_r = Math.sin(arg_r);
  67855. var cos_arg_r = Math.cos(arg_r);
  67856. var sinh_arg_i = sinh(arg_i);
  67857. var cosh_arg_i = cosh(arg_i);
  67858. var r = 2 * cos_arg_r * cosh_arg_i;
  67859. var i = -2 * sin_arg_r * sinh_arg_i;
  67860. var j = pp.length - 1;
  67861. var hr = pp[j];
  67862. var hi1 = 0;
  67863. var hr1 = 0;
  67864. var hi = 0;
  67865. var hr2;
  67866. var hi2;
  67867. while (--j >= 0) {
  67868. hr2 = hr1;
  67869. hi2 = hi1;
  67870. hr1 = hr;
  67871. hi1 = hi;
  67872. hr = -hr2 + r * hr1 - i * hi1 + pp[j];
  67873. hi = -hi2 + i * hr1 + r * hi1;
  67874. }
  67875. r = sin_arg_r * cosh_arg_i;
  67876. i = cos_arg_r * sinh_arg_i;
  67877. return [r * hr - i * hi, r * hi + i * hr];
  67878. }
  67879. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/etmerc.js
  67880. // Heavily based on this etmerc projection implementation
  67881. // https://github.com/mbloch/mapshaper-proj/blob/master/src/projections/etmerc.js
  67882. function etmerc_init() {
  67883. if (this.es === undefined || this.es <= 0) {
  67884. throw new Error('incorrect elliptical usage');
  67885. }
  67886. this.x0 = this.x0 !== undefined ? this.x0 : 0;
  67887. this.y0 = this.y0 !== undefined ? this.y0 : 0;
  67888. this.long0 = this.long0 !== undefined ? this.long0 : 0;
  67889. this.lat0 = this.lat0 !== undefined ? this.lat0 : 0;
  67890. this.cgb = [];
  67891. this.cbg = [];
  67892. this.utg = [];
  67893. this.gtu = [];
  67894. var f = this.es / (1 + Math.sqrt(1 - this.es));
  67895. var n = f / (2 - f);
  67896. var np = n;
  67897. this.cgb[0] = n * (2 + n * (-2 / 3 + n * (-2 + n * (116 / 45 + n * (26 / 45 + n * (-2854 / 675 ))))));
  67898. this.cbg[0] = n * (-2 + n * ( 2 / 3 + n * ( 4 / 3 + n * (-82 / 45 + n * (32 / 45 + n * (4642 / 4725))))));
  67899. np = np * n;
  67900. this.cgb[1] = np * (7 / 3 + n * (-8 / 5 + n * (-227 / 45 + n * (2704 / 315 + n * (2323 / 945)))));
  67901. this.cbg[1] = np * (5 / 3 + n * (-16 / 15 + n * ( -13 / 9 + n * (904 / 315 + n * (-1522 / 945)))));
  67902. np = np * n;
  67903. this.cgb[2] = np * (56 / 15 + n * (-136 / 35 + n * (-1262 / 105 + n * (73814 / 2835))));
  67904. this.cbg[2] = np * (-26 / 15 + n * (34 / 21 + n * (8 / 5 + n * (-12686 / 2835))));
  67905. np = np * n;
  67906. this.cgb[3] = np * (4279 / 630 + n * (-332 / 35 + n * (-399572 / 14175)));
  67907. this.cbg[3] = np * (1237 / 630 + n * (-12 / 5 + n * ( -24832 / 14175)));
  67908. np = np * n;
  67909. this.cgb[4] = np * (4174 / 315 + n * (-144838 / 6237));
  67910. this.cbg[4] = np * (-734 / 315 + n * (109598 / 31185));
  67911. np = np * n;
  67912. this.cgb[5] = np * (601676 / 22275);
  67913. this.cbg[5] = np * (444337 / 155925);
  67914. np = Math.pow(n, 2);
  67915. this.Qn = this.k0 / (1 + n) * (1 + np * (1 / 4 + np * (1 / 64 + np / 256)));
  67916. this.utg[0] = n * (-0.5 + n * ( 2 / 3 + n * (-37 / 96 + n * ( 1 / 360 + n * (81 / 512 + n * (-96199 / 604800))))));
  67917. this.gtu[0] = n * (0.5 + n * (-2 / 3 + n * (5 / 16 + n * (41 / 180 + n * (-127 / 288 + n * (7891 / 37800))))));
  67918. this.utg[1] = np * (-1 / 48 + n * (-1 / 15 + n * (437 / 1440 + n * (-46 / 105 + n * (1118711 / 3870720)))));
  67919. this.gtu[1] = np * (13 / 48 + n * (-3 / 5 + n * (557 / 1440 + n * (281 / 630 + n * (-1983433 / 1935360)))));
  67920. np = np * n;
  67921. this.utg[2] = np * (-17 / 480 + n * (37 / 840 + n * (209 / 4480 + n * (-5569 / 90720 ))));
  67922. this.gtu[2] = np * (61 / 240 + n * (-103 / 140 + n * (15061 / 26880 + n * (167603 / 181440))));
  67923. np = np * n;
  67924. this.utg[3] = np * (-4397 / 161280 + n * (11 / 504 + n * (830251 / 7257600)));
  67925. this.gtu[3] = np * (49561 / 161280 + n * (-179 / 168 + n * (6601661 / 7257600)));
  67926. np = np * n;
  67927. this.utg[4] = np * (-4583 / 161280 + n * (108847 / 3991680));
  67928. this.gtu[4] = np * (34729 / 80640 + n * (-3418889 / 1995840));
  67929. np = np * n;
  67930. this.utg[5] = np * (-20648693 / 638668800);
  67931. this.gtu[5] = np * (212378941 / 319334400);
  67932. var Z = gatg(this.cbg, this.lat0);
  67933. this.Zb = -this.Qn * (Z + clens(this.gtu, 2 * Z));
  67934. }
  67935. function etmerc_forward(p) {
  67936. var Ce = adjust_lon(p.x - this.long0);
  67937. var Cn = p.y;
  67938. Cn = gatg(this.cbg, Cn);
  67939. var sin_Cn = Math.sin(Cn);
  67940. var cos_Cn = Math.cos(Cn);
  67941. var sin_Ce = Math.sin(Ce);
  67942. var cos_Ce = Math.cos(Ce);
  67943. Cn = Math.atan2(sin_Cn, cos_Ce * cos_Cn);
  67944. Ce = Math.atan2(sin_Ce * cos_Cn, hypot(sin_Cn, cos_Cn * cos_Ce));
  67945. Ce = asinhy(Math.tan(Ce));
  67946. var tmp = clens_cmplx(this.gtu, 2 * Cn, 2 * Ce);
  67947. Cn = Cn + tmp[0];
  67948. Ce = Ce + tmp[1];
  67949. var x;
  67950. var y;
  67951. if (Math.abs(Ce) <= 2.623395162778) {
  67952. x = this.a * (this.Qn * Ce) + this.x0;
  67953. y = this.a * (this.Qn * Cn + this.Zb) + this.y0;
  67954. }
  67955. else {
  67956. x = Infinity;
  67957. y = Infinity;
  67958. }
  67959. p.x = x;
  67960. p.y = y;
  67961. return p;
  67962. }
  67963. function etmerc_inverse(p) {
  67964. var Ce = (p.x - this.x0) * (1 / this.a);
  67965. var Cn = (p.y - this.y0) * (1 / this.a);
  67966. Cn = (Cn - this.Zb) / this.Qn;
  67967. Ce = Ce / this.Qn;
  67968. var lon;
  67969. var lat;
  67970. if (Math.abs(Ce) <= 2.623395162778) {
  67971. var tmp = clens_cmplx(this.utg, 2 * Cn, 2 * Ce);
  67972. Cn = Cn + tmp[0];
  67973. Ce = Ce + tmp[1];
  67974. Ce = Math.atan(sinh(Ce));
  67975. var sin_Cn = Math.sin(Cn);
  67976. var cos_Cn = Math.cos(Cn);
  67977. var sin_Ce = Math.sin(Ce);
  67978. var cos_Ce = Math.cos(Ce);
  67979. Cn = Math.atan2(sin_Cn * cos_Ce, hypot(sin_Ce, cos_Ce * cos_Cn));
  67980. Ce = Math.atan2(sin_Ce, cos_Ce * cos_Cn);
  67981. lon = adjust_lon(Ce + this.long0);
  67982. lat = gatg(this.cgb, Cn);
  67983. }
  67984. else {
  67985. lon = Infinity;
  67986. lat = Infinity;
  67987. }
  67988. p.x = lon;
  67989. p.y = lat;
  67990. return p;
  67991. }
  67992. var etmerc_names = ["Extended_Transverse_Mercator", "Extended Transverse Mercator", "etmerc"];
  67993. /* harmony default export */ const etmerc = ({
  67994. init: etmerc_init,
  67995. forward: etmerc_forward,
  67996. inverse: etmerc_inverse,
  67997. names: etmerc_names
  67998. });
  67999. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_zone.js
  68000. /* harmony default export */ function adjust_zone(zone, lon) {
  68001. if (zone === undefined) {
  68002. zone = Math.floor((adjust_lon(lon) + Math.PI) * 30 / Math.PI) + 1;
  68003. if (zone < 0) {
  68004. return 0;
  68005. } else if (zone > 60) {
  68006. return 60;
  68007. }
  68008. }
  68009. return zone;
  68010. }
  68011. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/utm.js
  68012. var dependsOn = 'etmerc';
  68013. function utm_init() {
  68014. var zone = adjust_zone(this.zone, this.long0);
  68015. if (zone === undefined) {
  68016. throw new Error('unknown utm zone');
  68017. }
  68018. this.lat0 = 0;
  68019. this.long0 = ((6 * Math.abs(zone)) - 183) * D2R;
  68020. this.x0 = 500000;
  68021. this.y0 = this.utmSouth ? 10000000 : 0;
  68022. this.k0 = 0.9996;
  68023. etmerc.init.apply(this);
  68024. this.forward = etmerc.forward;
  68025. this.inverse = etmerc.inverse;
  68026. }
  68027. var utm_names = ["Universal Transverse Mercator System", "utm"];
  68028. /* harmony default export */ const utm = ({
  68029. init: utm_init,
  68030. names: utm_names,
  68031. dependsOn: dependsOn
  68032. });
  68033. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/srat.js
  68034. /* harmony default export */ function srat(esinp, exp) {
  68035. return (Math.pow((1 - esinp) / (1 + esinp), exp));
  68036. }
  68037. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gauss.js
  68038. var gauss_MAX_ITER = 20;
  68039. function gauss_init() {
  68040. var sphi = Math.sin(this.lat0);
  68041. var cphi = Math.cos(this.lat0);
  68042. cphi *= cphi;
  68043. this.rc = Math.sqrt(1 - this.es) / (1 - this.es * sphi * sphi);
  68044. this.C = Math.sqrt(1 + this.es * cphi * cphi / (1 - this.es));
  68045. this.phic0 = Math.asin(sphi / this.C);
  68046. this.ratexp = 0.5 * this.C * this.e;
  68047. 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));
  68048. }
  68049. function gauss_forward(p) {
  68050. var lon = p.x;
  68051. var lat = p.y;
  68052. 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;
  68053. p.x = this.C * lon;
  68054. return p;
  68055. }
  68056. function gauss_inverse(p) {
  68057. var DEL_TOL = 1e-14;
  68058. var lon = p.x / this.C;
  68059. var lat = p.y;
  68060. var num = Math.pow(Math.tan(0.5 * lat + FORTPI) / this.K, 1 / this.C);
  68061. for (var i = gauss_MAX_ITER; i > 0; --i) {
  68062. lat = 2 * Math.atan(num * srat(this.e * Math.sin(p.y), - 0.5 * this.e)) - HALF_PI;
  68063. if (Math.abs(lat - p.y) < DEL_TOL) {
  68064. break;
  68065. }
  68066. p.y = lat;
  68067. }
  68068. /* convergence failed */
  68069. if (!i) {
  68070. return null;
  68071. }
  68072. p.x = lon;
  68073. p.y = lat;
  68074. return p;
  68075. }
  68076. var gauss_names = ["gauss"];
  68077. /* harmony default export */ const gauss = ({
  68078. init: gauss_init,
  68079. forward: gauss_forward,
  68080. inverse: gauss_inverse,
  68081. names: gauss_names
  68082. });
  68083. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sterea.js
  68084. function sterea_init() {
  68085. gauss.init.apply(this);
  68086. if (!this.rc) {
  68087. return;
  68088. }
  68089. this.sinc0 = Math.sin(this.phic0);
  68090. this.cosc0 = Math.cos(this.phic0);
  68091. this.R2 = 2 * this.rc;
  68092. if (!this.title) {
  68093. this.title = "Oblique Stereographic Alternative";
  68094. }
  68095. }
  68096. function sterea_forward(p) {
  68097. var sinc, cosc, cosl, k;
  68098. p.x = adjust_lon(p.x - this.long0);
  68099. gauss.forward.apply(this, [p]);
  68100. sinc = Math.sin(p.y);
  68101. cosc = Math.cos(p.y);
  68102. cosl = Math.cos(p.x);
  68103. k = this.k0 * this.R2 / (1 + this.sinc0 * sinc + this.cosc0 * cosc * cosl);
  68104. p.x = k * cosc * Math.sin(p.x);
  68105. p.y = k * (this.cosc0 * sinc - this.sinc0 * cosc * cosl);
  68106. p.x = this.a * p.x + this.x0;
  68107. p.y = this.a * p.y + this.y0;
  68108. return p;
  68109. }
  68110. function sterea_inverse(p) {
  68111. var sinc, cosc, lon, lat, rho;
  68112. p.x = (p.x - this.x0) / this.a;
  68113. p.y = (p.y - this.y0) / this.a;
  68114. p.x /= this.k0;
  68115. p.y /= this.k0;
  68116. if ((rho = Math.sqrt(p.x * p.x + p.y * p.y))) {
  68117. var c = 2 * Math.atan2(rho, this.R2);
  68118. sinc = Math.sin(c);
  68119. cosc = Math.cos(c);
  68120. lat = Math.asin(cosc * this.sinc0 + p.y * sinc * this.cosc0 / rho);
  68121. lon = Math.atan2(p.x * sinc, rho * this.cosc0 * cosc - p.y * this.sinc0 * sinc);
  68122. }
  68123. else {
  68124. lat = this.phic0;
  68125. lon = 0;
  68126. }
  68127. p.x = lon;
  68128. p.y = lat;
  68129. gauss.inverse.apply(this, [p]);
  68130. p.x = adjust_lon(p.x + this.long0);
  68131. return p;
  68132. }
  68133. var sterea_names = ["Stereographic_North_Pole", "Oblique_Stereographic", "Polar_Stereographic", "sterea","Oblique Stereographic Alternative","Double_Stereographic"];
  68134. /* harmony default export */ const sterea = ({
  68135. init: sterea_init,
  68136. forward: sterea_forward,
  68137. inverse: sterea_inverse,
  68138. names: sterea_names
  68139. });
  68140. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/stere.js
  68141. function ssfn_(phit, sinphi, eccen) {
  68142. sinphi *= eccen;
  68143. return (Math.tan(0.5 * (HALF_PI + phit)) * Math.pow((1 - sinphi) / (1 + sinphi), 0.5 * eccen));
  68144. }
  68145. function stere_init() {
  68146. this.coslat0 = Math.cos(this.lat0);
  68147. this.sinlat0 = Math.sin(this.lat0);
  68148. if (this.sphere) {
  68149. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  68150. this.k0 = 0.5 * (1 + sign(this.lat0) * Math.sin(this.lat_ts));
  68151. }
  68152. }
  68153. else {
  68154. if (Math.abs(this.coslat0) <= EPSLN) {
  68155. if (this.lat0 > 0) {
  68156. //North pole
  68157. //trace('stere:north pole');
  68158. this.con = 1;
  68159. }
  68160. else {
  68161. //South pole
  68162. //trace('stere:south pole');
  68163. this.con = -1;
  68164. }
  68165. }
  68166. this.cons = Math.sqrt(Math.pow(1 + this.e, 1 + this.e) * Math.pow(1 - this.e, 1 - this.e));
  68167. if (this.k0 === 1 && !isNaN(this.lat_ts) && Math.abs(this.coslat0) <= EPSLN) {
  68168. 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));
  68169. }
  68170. this.ms1 = msfnz(this.e, this.sinlat0, this.coslat0);
  68171. this.X0 = 2 * Math.atan(this.ssfn_(this.lat0, this.sinlat0, this.e)) - HALF_PI;
  68172. this.cosX0 = Math.cos(this.X0);
  68173. this.sinX0 = Math.sin(this.X0);
  68174. }
  68175. }
  68176. // Stereographic forward equations--mapping lat,long to x,y
  68177. function stere_forward(p) {
  68178. var lon = p.x;
  68179. var lat = p.y;
  68180. var sinlat = Math.sin(lat);
  68181. var coslat = Math.cos(lat);
  68182. var A, X, sinX, cosX, ts, rh;
  68183. var dlon = adjust_lon(lon - this.long0);
  68184. if (Math.abs(Math.abs(lon - this.long0) - Math.PI) <= EPSLN && Math.abs(lat + this.lat0) <= EPSLN) {
  68185. //case of the origine point
  68186. //trace('stere:this is the origin point');
  68187. p.x = NaN;
  68188. p.y = NaN;
  68189. return p;
  68190. }
  68191. if (this.sphere) {
  68192. //trace('stere:sphere case');
  68193. A = 2 * this.k0 / (1 + this.sinlat0 * sinlat + this.coslat0 * coslat * Math.cos(dlon));
  68194. p.x = this.a * A * coslat * Math.sin(dlon) + this.x0;
  68195. p.y = this.a * A * (this.coslat0 * sinlat - this.sinlat0 * coslat * Math.cos(dlon)) + this.y0;
  68196. return p;
  68197. }
  68198. else {
  68199. X = 2 * Math.atan(this.ssfn_(lat, sinlat, this.e)) - HALF_PI;
  68200. cosX = Math.cos(X);
  68201. sinX = Math.sin(X);
  68202. if (Math.abs(this.coslat0) <= EPSLN) {
  68203. ts = tsfnz(this.e, lat * this.con, this.con * sinlat);
  68204. rh = 2 * this.a * this.k0 * ts / this.cons;
  68205. p.x = this.x0 + rh * Math.sin(lon - this.long0);
  68206. p.y = this.y0 - this.con * rh * Math.cos(lon - this.long0);
  68207. //trace(p.toString());
  68208. return p;
  68209. }
  68210. else if (Math.abs(this.sinlat0) < EPSLN) {
  68211. //Eq
  68212. //trace('stere:equateur');
  68213. A = 2 * this.a * this.k0 / (1 + cosX * Math.cos(dlon));
  68214. p.y = A * sinX;
  68215. }
  68216. else {
  68217. //other case
  68218. //trace('stere:normal case');
  68219. A = 2 * this.a * this.k0 * this.ms1 / (this.cosX0 * (1 + this.sinX0 * sinX + this.cosX0 * cosX * Math.cos(dlon)));
  68220. p.y = A * (this.cosX0 * sinX - this.sinX0 * cosX * Math.cos(dlon)) + this.y0;
  68221. }
  68222. p.x = A * cosX * Math.sin(dlon) + this.x0;
  68223. }
  68224. //trace(p.toString());
  68225. return p;
  68226. }
  68227. //* Stereographic inverse equations--mapping x,y to lat/long
  68228. function stere_inverse(p) {
  68229. p.x -= this.x0;
  68230. p.y -= this.y0;
  68231. var lon, lat, ts, ce, Chi;
  68232. var rh = Math.sqrt(p.x * p.x + p.y * p.y);
  68233. if (this.sphere) {
  68234. var c = 2 * Math.atan(rh / (2 * this.a * this.k0));
  68235. lon = this.long0;
  68236. lat = this.lat0;
  68237. if (rh <= EPSLN) {
  68238. p.x = lon;
  68239. p.y = lat;
  68240. return p;
  68241. }
  68242. lat = Math.asin(Math.cos(c) * this.sinlat0 + p.y * Math.sin(c) * this.coslat0 / rh);
  68243. if (Math.abs(this.coslat0) < EPSLN) {
  68244. if (this.lat0 > 0) {
  68245. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  68246. }
  68247. else {
  68248. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  68249. }
  68250. }
  68251. else {
  68252. 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)));
  68253. }
  68254. p.x = lon;
  68255. p.y = lat;
  68256. return p;
  68257. }
  68258. else {
  68259. if (Math.abs(this.coslat0) <= EPSLN) {
  68260. if (rh <= EPSLN) {
  68261. lat = this.lat0;
  68262. lon = this.long0;
  68263. p.x = lon;
  68264. p.y = lat;
  68265. //trace(p.toString());
  68266. return p;
  68267. }
  68268. p.x *= this.con;
  68269. p.y *= this.con;
  68270. ts = rh * this.cons / (2 * this.a * this.k0);
  68271. lat = this.con * phi2z(this.e, ts);
  68272. lon = this.con * adjust_lon(this.con * this.long0 + Math.atan2(p.x, - 1 * p.y));
  68273. }
  68274. else {
  68275. ce = 2 * Math.atan(rh * this.cosX0 / (2 * this.a * this.k0 * this.ms1));
  68276. lon = this.long0;
  68277. if (rh <= EPSLN) {
  68278. Chi = this.X0;
  68279. }
  68280. else {
  68281. Chi = Math.asin(Math.cos(ce) * this.sinX0 + p.y * Math.sin(ce) * this.cosX0 / rh);
  68282. 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)));
  68283. }
  68284. lat = -1 * phi2z(this.e, Math.tan(0.5 * (HALF_PI + Chi)));
  68285. }
  68286. }
  68287. p.x = lon;
  68288. p.y = lat;
  68289. //trace(p.toString());
  68290. return p;
  68291. }
  68292. var stere_names = ["stere", "Stereographic_South_Pole", "Polar Stereographic (variant B)"];
  68293. /* harmony default export */ const stere = ({
  68294. init: stere_init,
  68295. forward: stere_forward,
  68296. inverse: stere_inverse,
  68297. names: stere_names,
  68298. ssfn_: ssfn_
  68299. });
  68300. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/somerc.js
  68301. /*
  68302. references:
  68303. Formules et constantes pour le Calcul pour la
  68304. projection cylindrique conforme à axe oblique et pour la transformation entre
  68305. des systèmes de référence.
  68306. http://www.swisstopo.admin.ch/internet/swisstopo/fr/home/topics/survey/sys/refsys/switzerland.parsysrelated1.31216.downloadList.77004.DownloadFile.tmp/swissprojectionfr.pdf
  68307. */
  68308. function somerc_init() {
  68309. var phy0 = this.lat0;
  68310. this.lambda0 = this.long0;
  68311. var sinPhy0 = Math.sin(phy0);
  68312. var semiMajorAxis = this.a;
  68313. var invF = this.rf;
  68314. var flattening = 1 / invF;
  68315. var e2 = 2 * flattening - Math.pow(flattening, 2);
  68316. var e = this.e = Math.sqrt(e2);
  68317. this.R = this.k0 * semiMajorAxis * Math.sqrt(1 - e2) / (1 - e2 * Math.pow(sinPhy0, 2));
  68318. this.alpha = Math.sqrt(1 + e2 / (1 - e2) * Math.pow(Math.cos(phy0), 4));
  68319. this.b0 = Math.asin(sinPhy0 / this.alpha);
  68320. var k1 = Math.log(Math.tan(Math.PI / 4 + this.b0 / 2));
  68321. var k2 = Math.log(Math.tan(Math.PI / 4 + phy0 / 2));
  68322. var k3 = Math.log((1 + e * sinPhy0) / (1 - e * sinPhy0));
  68323. this.K = k1 - this.alpha * k2 + this.alpha * e / 2 * k3;
  68324. }
  68325. function somerc_forward(p) {
  68326. var Sa1 = Math.log(Math.tan(Math.PI / 4 - p.y / 2));
  68327. var Sa2 = this.e / 2 * Math.log((1 + this.e * Math.sin(p.y)) / (1 - this.e * Math.sin(p.y)));
  68328. var S = -this.alpha * (Sa1 + Sa2) + this.K;
  68329. // spheric latitude
  68330. var b = 2 * (Math.atan(Math.exp(S)) - Math.PI / 4);
  68331. // spheric longitude
  68332. var I = this.alpha * (p.x - this.lambda0);
  68333. // psoeudo equatorial rotation
  68334. var rotI = Math.atan(Math.sin(I) / (Math.sin(this.b0) * Math.tan(b) + Math.cos(this.b0) * Math.cos(I)));
  68335. var rotB = Math.asin(Math.cos(this.b0) * Math.sin(b) - Math.sin(this.b0) * Math.cos(b) * Math.cos(I));
  68336. p.y = this.R / 2 * Math.log((1 + Math.sin(rotB)) / (1 - Math.sin(rotB))) + this.y0;
  68337. p.x = this.R * rotI + this.x0;
  68338. return p;
  68339. }
  68340. function somerc_inverse(p) {
  68341. var Y = p.x - this.x0;
  68342. var X = p.y - this.y0;
  68343. var rotI = Y / this.R;
  68344. var rotB = 2 * (Math.atan(Math.exp(X / this.R)) - Math.PI / 4);
  68345. var b = Math.asin(Math.cos(this.b0) * Math.sin(rotB) + Math.sin(this.b0) * Math.cos(rotB) * Math.cos(rotI));
  68346. var I = Math.atan(Math.sin(rotI) / (Math.cos(this.b0) * Math.cos(rotI) - Math.sin(this.b0) * Math.tan(rotB)));
  68347. var lambda = this.lambda0 + I / this.alpha;
  68348. var S = 0;
  68349. var phy = b;
  68350. var prevPhy = -1000;
  68351. var iteration = 0;
  68352. while (Math.abs(phy - prevPhy) > 0.0000001) {
  68353. if (++iteration > 20) {
  68354. //...reportError("omercFwdInfinity");
  68355. return;
  68356. }
  68357. //S = Math.log(Math.tan(Math.PI / 4 + phy / 2));
  68358. 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));
  68359. prevPhy = phy;
  68360. phy = 2 * Math.atan(Math.exp(S)) - Math.PI / 2;
  68361. }
  68362. p.x = lambda;
  68363. p.y = phy;
  68364. return p;
  68365. }
  68366. var somerc_names = ["somerc"];
  68367. /* harmony default export */ const somerc = ({
  68368. init: somerc_init,
  68369. forward: somerc_forward,
  68370. inverse: somerc_inverse,
  68371. names: somerc_names
  68372. });
  68373. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/omerc.js
  68374. /* Initialize the Oblique Mercator projection
  68375. ------------------------------------------*/
  68376. function omerc_init() {
  68377. this.no_off = this.no_off || false;
  68378. this.no_rot = this.no_rot || false;
  68379. if (isNaN(this.k0)) {
  68380. this.k0 = 1;
  68381. }
  68382. var sinlat = Math.sin(this.lat0);
  68383. var coslat = Math.cos(this.lat0);
  68384. var con = this.e * sinlat;
  68385. this.bl = Math.sqrt(1 + this.es / (1 - this.es) * Math.pow(coslat, 4));
  68386. this.al = this.a * this.bl * this.k0 * Math.sqrt(1 - this.es) / (1 - con * con);
  68387. var t0 = tsfnz(this.e, this.lat0, sinlat);
  68388. var dl = this.bl / coslat * Math.sqrt((1 - this.es) / (1 - con * con));
  68389. if (dl * dl < 1) {
  68390. dl = 1;
  68391. }
  68392. var fl;
  68393. var gl;
  68394. if (!isNaN(this.longc)) {
  68395. //Central point and azimuth method
  68396. if (this.lat0 >= 0) {
  68397. fl = dl + Math.sqrt(dl * dl - 1);
  68398. }
  68399. else {
  68400. fl = dl - Math.sqrt(dl * dl - 1);
  68401. }
  68402. this.el = fl * Math.pow(t0, this.bl);
  68403. gl = 0.5 * (fl - 1 / fl);
  68404. this.gamma0 = Math.asin(Math.sin(this.alpha) / dl);
  68405. this.long0 = this.longc - Math.asin(gl * Math.tan(this.gamma0)) / this.bl;
  68406. }
  68407. else {
  68408. //2 points method
  68409. var t1 = tsfnz(this.e, this.lat1, Math.sin(this.lat1));
  68410. var t2 = tsfnz(this.e, this.lat2, Math.sin(this.lat2));
  68411. if (this.lat0 >= 0) {
  68412. this.el = (dl + Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
  68413. }
  68414. else {
  68415. this.el = (dl - Math.sqrt(dl * dl - 1)) * Math.pow(t0, this.bl);
  68416. }
  68417. var hl = Math.pow(t1, this.bl);
  68418. var ll = Math.pow(t2, this.bl);
  68419. fl = this.el / hl;
  68420. gl = 0.5 * (fl - 1 / fl);
  68421. var jl = (this.el * this.el - ll * hl) / (this.el * this.el + ll * hl);
  68422. var pl = (ll - hl) / (ll + hl);
  68423. var dlon12 = adjust_lon(this.long1 - this.long2);
  68424. this.long0 = 0.5 * (this.long1 + this.long2) - Math.atan(jl * Math.tan(0.5 * this.bl * (dlon12)) / pl) / this.bl;
  68425. this.long0 = adjust_lon(this.long0);
  68426. var dlon10 = adjust_lon(this.long1 - this.long0);
  68427. this.gamma0 = Math.atan(Math.sin(this.bl * (dlon10)) / gl);
  68428. this.alpha = Math.asin(dl * Math.sin(this.gamma0));
  68429. }
  68430. if (this.no_off) {
  68431. this.uc = 0;
  68432. }
  68433. else {
  68434. if (this.lat0 >= 0) {
  68435. this.uc = this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
  68436. }
  68437. else {
  68438. this.uc = -1 * this.al / this.bl * Math.atan2(Math.sqrt(dl * dl - 1), Math.cos(this.alpha));
  68439. }
  68440. }
  68441. }
  68442. /* Oblique Mercator forward equations--mapping lat,long to x,y
  68443. ----------------------------------------------------------*/
  68444. function omerc_forward(p) {
  68445. var lon = p.x;
  68446. var lat = p.y;
  68447. var dlon = adjust_lon(lon - this.long0);
  68448. var us, vs;
  68449. var con;
  68450. if (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN) {
  68451. if (lat > 0) {
  68452. con = -1;
  68453. }
  68454. else {
  68455. con = 1;
  68456. }
  68457. vs = this.al / this.bl * Math.log(Math.tan(FORTPI + con * this.gamma0 * 0.5));
  68458. us = -1 * con * HALF_PI * this.al / this.bl;
  68459. }
  68460. else {
  68461. var t = tsfnz(this.e, lat, Math.sin(lat));
  68462. var ql = this.el / Math.pow(t, this.bl);
  68463. var sl = 0.5 * (ql - 1 / ql);
  68464. var tl = 0.5 * (ql + 1 / ql);
  68465. var vl = Math.sin(this.bl * (dlon));
  68466. var ul = (sl * Math.sin(this.gamma0) - vl * Math.cos(this.gamma0)) / tl;
  68467. if (Math.abs(Math.abs(ul) - 1) <= EPSLN) {
  68468. vs = Number.POSITIVE_INFINITY;
  68469. }
  68470. else {
  68471. vs = 0.5 * this.al * Math.log((1 - ul) / (1 + ul)) / this.bl;
  68472. }
  68473. if (Math.abs(Math.cos(this.bl * (dlon))) <= EPSLN) {
  68474. us = this.al * this.bl * (dlon);
  68475. }
  68476. else {
  68477. us = this.al * Math.atan2(sl * Math.cos(this.gamma0) + vl * Math.sin(this.gamma0), Math.cos(this.bl * dlon)) / this.bl;
  68478. }
  68479. }
  68480. if (this.no_rot) {
  68481. p.x = this.x0 + us;
  68482. p.y = this.y0 + vs;
  68483. }
  68484. else {
  68485. us -= this.uc;
  68486. p.x = this.x0 + vs * Math.cos(this.alpha) + us * Math.sin(this.alpha);
  68487. p.y = this.y0 + us * Math.cos(this.alpha) - vs * Math.sin(this.alpha);
  68488. }
  68489. return p;
  68490. }
  68491. function omerc_inverse(p) {
  68492. var us, vs;
  68493. if (this.no_rot) {
  68494. vs = p.y - this.y0;
  68495. us = p.x - this.x0;
  68496. }
  68497. else {
  68498. vs = (p.x - this.x0) * Math.cos(this.alpha) - (p.y - this.y0) * Math.sin(this.alpha);
  68499. us = (p.y - this.y0) * Math.cos(this.alpha) + (p.x - this.x0) * Math.sin(this.alpha);
  68500. us += this.uc;
  68501. }
  68502. var qp = Math.exp(-1 * this.bl * vs / this.al);
  68503. var sp = 0.5 * (qp - 1 / qp);
  68504. var tp = 0.5 * (qp + 1 / qp);
  68505. var vp = Math.sin(this.bl * us / this.al);
  68506. var up = (vp * Math.cos(this.gamma0) + sp * Math.sin(this.gamma0)) / tp;
  68507. var ts = Math.pow(this.el / Math.sqrt((1 + up) / (1 - up)), 1 / this.bl);
  68508. if (Math.abs(up - 1) < EPSLN) {
  68509. p.x = this.long0;
  68510. p.y = HALF_PI;
  68511. }
  68512. else if (Math.abs(up + 1) < EPSLN) {
  68513. p.x = this.long0;
  68514. p.y = -1 * HALF_PI;
  68515. }
  68516. else {
  68517. p.y = phi2z(this.e, ts);
  68518. 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);
  68519. }
  68520. return p;
  68521. }
  68522. var omerc_names = ["Hotine_Oblique_Mercator", "Hotine Oblique Mercator", "Hotine_Oblique_Mercator_Azimuth_Natural_Origin", "Hotine_Oblique_Mercator_Azimuth_Center", "omerc"];
  68523. /* harmony default export */ const omerc = ({
  68524. init: omerc_init,
  68525. forward: omerc_forward,
  68526. inverse: omerc_inverse,
  68527. names: omerc_names
  68528. });
  68529. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/lcc.js
  68530. function lcc_init() {
  68531. // array of: r_maj,r_min,lat1,lat2,c_lon,c_lat,false_east,false_north
  68532. //double c_lat; /* center latitude */
  68533. //double c_lon; /* center longitude */
  68534. //double lat1; /* first standard parallel */
  68535. //double lat2; /* second standard parallel */
  68536. //double r_maj; /* major axis */
  68537. //double r_min; /* minor axis */
  68538. //double false_east; /* x offset in meters */
  68539. //double false_north; /* y offset in meters */
  68540. if (!this.lat2) {
  68541. this.lat2 = this.lat1;
  68542. } //if lat2 is not defined
  68543. if (!this.k0) {
  68544. this.k0 = 1;
  68545. }
  68546. this.x0 = this.x0 || 0;
  68547. this.y0 = this.y0 || 0;
  68548. // Standard Parallels cannot be equal and on opposite sides of the equator
  68549. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  68550. return;
  68551. }
  68552. var temp = this.b / this.a;
  68553. this.e = Math.sqrt(1 - temp * temp);
  68554. var sin1 = Math.sin(this.lat1);
  68555. var cos1 = Math.cos(this.lat1);
  68556. var ms1 = msfnz(this.e, sin1, cos1);
  68557. var ts1 = tsfnz(this.e, this.lat1, sin1);
  68558. var sin2 = Math.sin(this.lat2);
  68559. var cos2 = Math.cos(this.lat2);
  68560. var ms2 = msfnz(this.e, sin2, cos2);
  68561. var ts2 = tsfnz(this.e, this.lat2, sin2);
  68562. var ts0 = tsfnz(this.e, this.lat0, Math.sin(this.lat0));
  68563. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  68564. this.ns = Math.log(ms1 / ms2) / Math.log(ts1 / ts2);
  68565. }
  68566. else {
  68567. this.ns = sin1;
  68568. }
  68569. if (isNaN(this.ns)) {
  68570. this.ns = sin1;
  68571. }
  68572. this.f0 = ms1 / (this.ns * Math.pow(ts1, this.ns));
  68573. this.rh = this.a * this.f0 * Math.pow(ts0, this.ns);
  68574. if (!this.title) {
  68575. this.title = "Lambert Conformal Conic";
  68576. }
  68577. }
  68578. // Lambert Conformal conic forward equations--mapping lat,long to x,y
  68579. // -----------------------------------------------------------------
  68580. function lcc_forward(p) {
  68581. var lon = p.x;
  68582. var lat = p.y;
  68583. // singular cases :
  68584. if (Math.abs(2 * Math.abs(lat) - Math.PI) <= EPSLN) {
  68585. lat = sign(lat) * (HALF_PI - 2 * EPSLN);
  68586. }
  68587. var con = Math.abs(Math.abs(lat) - HALF_PI);
  68588. var ts, rh1;
  68589. if (con > EPSLN) {
  68590. ts = tsfnz(this.e, lat, Math.sin(lat));
  68591. rh1 = this.a * this.f0 * Math.pow(ts, this.ns);
  68592. }
  68593. else {
  68594. con = lat * this.ns;
  68595. if (con <= 0) {
  68596. return null;
  68597. }
  68598. rh1 = 0;
  68599. }
  68600. var theta = this.ns * adjust_lon(lon - this.long0);
  68601. p.x = this.k0 * (rh1 * Math.sin(theta)) + this.x0;
  68602. p.y = this.k0 * (this.rh - rh1 * Math.cos(theta)) + this.y0;
  68603. return p;
  68604. }
  68605. // Lambert Conformal Conic inverse equations--mapping x,y to lat/long
  68606. // -----------------------------------------------------------------
  68607. function lcc_inverse(p) {
  68608. var rh1, con, ts;
  68609. var lat, lon;
  68610. var x = (p.x - this.x0) / this.k0;
  68611. var y = (this.rh - (p.y - this.y0) / this.k0);
  68612. if (this.ns > 0) {
  68613. rh1 = Math.sqrt(x * x + y * y);
  68614. con = 1;
  68615. }
  68616. else {
  68617. rh1 = -Math.sqrt(x * x + y * y);
  68618. con = -1;
  68619. }
  68620. var theta = 0;
  68621. if (rh1 !== 0) {
  68622. theta = Math.atan2((con * x), (con * y));
  68623. }
  68624. if ((rh1 !== 0) || (this.ns > 0)) {
  68625. con = 1 / this.ns;
  68626. ts = Math.pow((rh1 / (this.a * this.f0)), con);
  68627. lat = phi2z(this.e, ts);
  68628. if (lat === -9999) {
  68629. return null;
  68630. }
  68631. }
  68632. else {
  68633. lat = -HALF_PI;
  68634. }
  68635. lon = adjust_lon(theta / this.ns + this.long0);
  68636. p.x = lon;
  68637. p.y = lat;
  68638. return p;
  68639. }
  68640. var lcc_names = ["Lambert Tangential Conformal Conic Projection", "Lambert_Conformal_Conic", "Lambert_Conformal_Conic_2SP", "lcc"];
  68641. /* harmony default export */ const lcc = ({
  68642. init: lcc_init,
  68643. forward: lcc_forward,
  68644. inverse: lcc_inverse,
  68645. names: lcc_names
  68646. });
  68647. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/krovak.js
  68648. function krovak_init() {
  68649. this.a = 6377397.155;
  68650. this.es = 0.006674372230614;
  68651. this.e = Math.sqrt(this.es);
  68652. if (!this.lat0) {
  68653. this.lat0 = 0.863937979737193;
  68654. }
  68655. if (!this.long0) {
  68656. this.long0 = 0.7417649320975901 - 0.308341501185665;
  68657. }
  68658. /* if scale not set default to 0.9999 */
  68659. if (!this.k0) {
  68660. this.k0 = 0.9999;
  68661. }
  68662. this.s45 = 0.785398163397448; /* 45 */
  68663. this.s90 = 2 * this.s45;
  68664. this.fi0 = this.lat0;
  68665. this.e2 = this.es;
  68666. this.e = Math.sqrt(this.e2);
  68667. this.alfa = Math.sqrt(1 + (this.e2 * Math.pow(Math.cos(this.fi0), 4)) / (1 - this.e2));
  68668. this.uq = 1.04216856380474;
  68669. this.u0 = Math.asin(Math.sin(this.fi0) / this.alfa);
  68670. this.g = Math.pow((1 + this.e * Math.sin(this.fi0)) / (1 - this.e * Math.sin(this.fi0)), this.alfa * this.e / 2);
  68671. this.k = Math.tan(this.u0 / 2 + this.s45) / Math.pow(Math.tan(this.fi0 / 2 + this.s45), this.alfa) * this.g;
  68672. this.k1 = this.k0;
  68673. this.n0 = this.a * Math.sqrt(1 - this.e2) / (1 - this.e2 * Math.pow(Math.sin(this.fi0), 2));
  68674. this.s0 = 1.37008346281555;
  68675. this.n = Math.sin(this.s0);
  68676. this.ro0 = this.k1 * this.n0 / Math.tan(this.s0);
  68677. this.ad = this.s90 - this.uq;
  68678. }
  68679. /* ellipsoid */
  68680. /* calculate xy from lat/lon */
  68681. /* Constants, identical to inverse transform function */
  68682. function krovak_forward(p) {
  68683. var gfi, u, deltav, s, d, eps, ro;
  68684. var lon = p.x;
  68685. var lat = p.y;
  68686. var delta_lon = adjust_lon(lon - this.long0);
  68687. /* Transformation */
  68688. gfi = Math.pow(((1 + this.e * Math.sin(lat)) / (1 - this.e * Math.sin(lat))), (this.alfa * this.e / 2));
  68689. u = 2 * (Math.atan(this.k * Math.pow(Math.tan(lat / 2 + this.s45), this.alfa) / gfi) - this.s45);
  68690. deltav = -delta_lon * this.alfa;
  68691. s = Math.asin(Math.cos(this.ad) * Math.sin(u) + Math.sin(this.ad) * Math.cos(u) * Math.cos(deltav));
  68692. d = Math.asin(Math.cos(u) * Math.sin(deltav) / Math.cos(s));
  68693. eps = this.n * d;
  68694. ro = this.ro0 * Math.pow(Math.tan(this.s0 / 2 + this.s45), this.n) / Math.pow(Math.tan(s / 2 + this.s45), this.n);
  68695. p.y = ro * Math.cos(eps) / 1;
  68696. p.x = ro * Math.sin(eps) / 1;
  68697. if (!this.czech) {
  68698. p.y *= -1;
  68699. p.x *= -1;
  68700. }
  68701. return (p);
  68702. }
  68703. /* calculate lat/lon from xy */
  68704. function krovak_inverse(p) {
  68705. var u, deltav, s, d, eps, ro, fi1;
  68706. var ok;
  68707. /* Transformation */
  68708. /* revert y, x*/
  68709. var tmp = p.x;
  68710. p.x = p.y;
  68711. p.y = tmp;
  68712. if (!this.czech) {
  68713. p.y *= -1;
  68714. p.x *= -1;
  68715. }
  68716. ro = Math.sqrt(p.x * p.x + p.y * p.y);
  68717. eps = Math.atan2(p.y, p.x);
  68718. d = eps / Math.sin(this.s0);
  68719. s = 2 * (Math.atan(Math.pow(this.ro0 / ro, 1 / this.n) * Math.tan(this.s0 / 2 + this.s45)) - this.s45);
  68720. u = Math.asin(Math.cos(this.ad) * Math.sin(s) - Math.sin(this.ad) * Math.cos(s) * Math.cos(d));
  68721. deltav = Math.asin(Math.cos(s) * Math.sin(d) / Math.cos(u));
  68722. p.x = this.long0 - deltav / this.alfa;
  68723. fi1 = u;
  68724. ok = 0;
  68725. var iter = 0;
  68726. do {
  68727. 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);
  68728. if (Math.abs(fi1 - p.y) < 0.0000000001) {
  68729. ok = 1;
  68730. }
  68731. fi1 = p.y;
  68732. iter += 1;
  68733. } while (ok === 0 && iter < 15);
  68734. if (iter >= 15) {
  68735. return null;
  68736. }
  68737. return (p);
  68738. }
  68739. var krovak_names = ["Krovak", "krovak"];
  68740. /* harmony default export */ const krovak = ({
  68741. init: krovak_init,
  68742. forward: krovak_forward,
  68743. inverse: krovak_inverse,
  68744. names: krovak_names
  68745. });
  68746. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/mlfn.js
  68747. /* harmony default export */ function mlfn(e0, e1, e2, e3, phi) {
  68748. return (e0 * phi - e1 * Math.sin(2 * phi) + e2 * Math.sin(4 * phi) - e3 * Math.sin(6 * phi));
  68749. }
  68750. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e0fn.js
  68751. /* harmony default export */ function e0fn(x) {
  68752. return (1 - 0.25 * x * (1 + x / 16 * (3 + 1.25 * x)));
  68753. }
  68754. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e1fn.js
  68755. /* harmony default export */ function e1fn(x) {
  68756. return (0.375 * x * (1 + 0.25 * x * (1 + 0.46875 * x)));
  68757. }
  68758. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e2fn.js
  68759. /* harmony default export */ function e2fn(x) {
  68760. return (0.05859375 * x * x * (1 + 0.75 * x));
  68761. }
  68762. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/e3fn.js
  68763. /* harmony default export */ function e3fn(x) {
  68764. return (x * x * x * (35 / 3072));
  68765. }
  68766. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/gN.js
  68767. /* harmony default export */ function gN(a, e, sinphi) {
  68768. var temp = e * sinphi;
  68769. return a / Math.sqrt(1 - temp * temp);
  68770. }
  68771. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/adjust_lat.js
  68772. /* harmony default export */ function adjust_lat(x) {
  68773. return (Math.abs(x) < HALF_PI) ? x : (x - (sign(x) * Math.PI));
  68774. }
  68775. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/imlfn.js
  68776. /* harmony default export */ function imlfn(ml, e0, e1, e2, e3) {
  68777. var phi;
  68778. var dphi;
  68779. phi = ml / e0;
  68780. for (var i = 0; i < 15; i++) {
  68781. 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));
  68782. phi += dphi;
  68783. if (Math.abs(dphi) <= 0.0000000001) {
  68784. return phi;
  68785. }
  68786. }
  68787. //..reportError("IMLFN-CONV:Latitude failed to converge after 15 iterations");
  68788. return NaN;
  68789. }
  68790. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cass.js
  68791. function cass_init() {
  68792. if (!this.sphere) {
  68793. this.e0 = e0fn(this.es);
  68794. this.e1 = e1fn(this.es);
  68795. this.e2 = e2fn(this.es);
  68796. this.e3 = e3fn(this.es);
  68797. this.ml0 = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  68798. }
  68799. }
  68800. /* Cassini forward equations--mapping lat,long to x,y
  68801. -----------------------------------------------------------------------*/
  68802. function cass_forward(p) {
  68803. /* Forward equations
  68804. -----------------*/
  68805. var x, y;
  68806. var lam = p.x;
  68807. var phi = p.y;
  68808. lam = adjust_lon(lam - this.long0);
  68809. if (this.sphere) {
  68810. x = this.a * Math.asin(Math.cos(phi) * Math.sin(lam));
  68811. y = this.a * (Math.atan2(Math.tan(phi), Math.cos(lam)) - this.lat0);
  68812. }
  68813. else {
  68814. //ellipsoid
  68815. var sinphi = Math.sin(phi);
  68816. var cosphi = Math.cos(phi);
  68817. var nl = gN(this.a, this.e, sinphi);
  68818. var tl = Math.tan(phi) * Math.tan(phi);
  68819. var al = lam * Math.cos(phi);
  68820. var asq = al * al;
  68821. var cl = this.es * cosphi * cosphi / (1 - this.es);
  68822. var ml = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  68823. x = nl * al * (1 - asq * tl * (1 / 6 - (8 - tl + 8 * cl) * asq / 120));
  68824. y = ml - this.ml0 + nl * sinphi / cosphi * asq * (0.5 + (5 - tl + 6 * cl) * asq / 24);
  68825. }
  68826. p.x = x + this.x0;
  68827. p.y = y + this.y0;
  68828. return p;
  68829. }
  68830. /* Inverse equations
  68831. -----------------*/
  68832. function cass_inverse(p) {
  68833. p.x -= this.x0;
  68834. p.y -= this.y0;
  68835. var x = p.x / this.a;
  68836. var y = p.y / this.a;
  68837. var phi, lam;
  68838. if (this.sphere) {
  68839. var dd = y + this.lat0;
  68840. phi = Math.asin(Math.sin(dd) * Math.cos(x));
  68841. lam = Math.atan2(Math.tan(x), Math.cos(dd));
  68842. }
  68843. else {
  68844. /* ellipsoid */
  68845. var ml1 = this.ml0 / this.a + y;
  68846. var phi1 = imlfn(ml1, this.e0, this.e1, this.e2, this.e3);
  68847. if (Math.abs(Math.abs(phi1) - HALF_PI) <= EPSLN) {
  68848. p.x = this.long0;
  68849. p.y = HALF_PI;
  68850. if (y < 0) {
  68851. p.y *= -1;
  68852. }
  68853. return p;
  68854. }
  68855. var nl1 = gN(this.a, this.e, Math.sin(phi1));
  68856. var rl1 = nl1 * nl1 * nl1 / this.a / this.a * (1 - this.es);
  68857. var tl1 = Math.pow(Math.tan(phi1), 2);
  68858. var dl = x * this.a / nl1;
  68859. var dsq = dl * dl;
  68860. phi = phi1 - nl1 * Math.tan(phi1) / rl1 * dl * dl * (0.5 - (1 + 3 * tl1) * dl * dl / 24);
  68861. lam = dl * (1 - dsq * (tl1 / 3 + (1 + 3 * tl1) * tl1 * dsq / 15)) / Math.cos(phi1);
  68862. }
  68863. p.x = adjust_lon(lam + this.long0);
  68864. p.y = adjust_lat(phi);
  68865. return p;
  68866. }
  68867. var cass_names = ["Cassini", "Cassini_Soldner", "cass"];
  68868. /* harmony default export */ const cass = ({
  68869. init: cass_init,
  68870. forward: cass_forward,
  68871. inverse: cass_inverse,
  68872. names: cass_names
  68873. });
  68874. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/qsfnz.js
  68875. /* harmony default export */ function qsfnz(eccent, sinphi) {
  68876. var con;
  68877. if (eccent > 1.0e-7) {
  68878. con = eccent * sinphi;
  68879. return ((1 - eccent * eccent) * (sinphi / (1 - con * con) - (0.5 / eccent) * Math.log((1 - con) / (1 + con))));
  68880. }
  68881. else {
  68882. return (2 * sinphi);
  68883. }
  68884. }
  68885. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/laea.js
  68886. /*
  68887. reference
  68888. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  68889. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  68890. */
  68891. var S_POLE = 1;
  68892. var N_POLE = 2;
  68893. var EQUIT = 3;
  68894. var OBLIQ = 4;
  68895. /* Initialize the Lambert Azimuthal Equal Area projection
  68896. ------------------------------------------------------*/
  68897. function laea_init() {
  68898. var t = Math.abs(this.lat0);
  68899. if (Math.abs(t - HALF_PI) < EPSLN) {
  68900. this.mode = this.lat0 < 0 ? this.S_POLE : this.N_POLE;
  68901. }
  68902. else if (Math.abs(t) < EPSLN) {
  68903. this.mode = this.EQUIT;
  68904. }
  68905. else {
  68906. this.mode = this.OBLIQ;
  68907. }
  68908. if (this.es > 0) {
  68909. var sinphi;
  68910. this.qp = qsfnz(this.e, 1);
  68911. this.mmf = 0.5 / (1 - this.es);
  68912. this.apa = authset(this.es);
  68913. switch (this.mode) {
  68914. case this.N_POLE:
  68915. this.dd = 1;
  68916. break;
  68917. case this.S_POLE:
  68918. this.dd = 1;
  68919. break;
  68920. case this.EQUIT:
  68921. this.rq = Math.sqrt(0.5 * this.qp);
  68922. this.dd = 1 / this.rq;
  68923. this.xmf = 1;
  68924. this.ymf = 0.5 * this.qp;
  68925. break;
  68926. case this.OBLIQ:
  68927. this.rq = Math.sqrt(0.5 * this.qp);
  68928. sinphi = Math.sin(this.lat0);
  68929. this.sinb1 = qsfnz(this.e, sinphi) / this.qp;
  68930. this.cosb1 = Math.sqrt(1 - this.sinb1 * this.sinb1);
  68931. this.dd = Math.cos(this.lat0) / (Math.sqrt(1 - this.es * sinphi * sinphi) * this.rq * this.cosb1);
  68932. this.ymf = (this.xmf = this.rq) / this.dd;
  68933. this.xmf *= this.dd;
  68934. break;
  68935. }
  68936. }
  68937. else {
  68938. if (this.mode === this.OBLIQ) {
  68939. this.sinph0 = Math.sin(this.lat0);
  68940. this.cosph0 = Math.cos(this.lat0);
  68941. }
  68942. }
  68943. }
  68944. /* Lambert Azimuthal Equal Area forward equations--mapping lat,long to x,y
  68945. -----------------------------------------------------------------------*/
  68946. function laea_forward(p) {
  68947. /* Forward equations
  68948. -----------------*/
  68949. var x, y, coslam, sinlam, sinphi, q, sinb, cosb, b, cosphi;
  68950. var lam = p.x;
  68951. var phi = p.y;
  68952. lam = adjust_lon(lam - this.long0);
  68953. if (this.sphere) {
  68954. sinphi = Math.sin(phi);
  68955. cosphi = Math.cos(phi);
  68956. coslam = Math.cos(lam);
  68957. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  68958. y = (this.mode === this.EQUIT) ? 1 + cosphi * coslam : 1 + this.sinph0 * sinphi + this.cosph0 * cosphi * coslam;
  68959. if (y <= EPSLN) {
  68960. return null;
  68961. }
  68962. y = Math.sqrt(2 / y);
  68963. x = y * cosphi * Math.sin(lam);
  68964. y *= (this.mode === this.EQUIT) ? sinphi : this.cosph0 * sinphi - this.sinph0 * cosphi * coslam;
  68965. }
  68966. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  68967. if (this.mode === this.N_POLE) {
  68968. coslam = -coslam;
  68969. }
  68970. if (Math.abs(phi + this.lat0) < EPSLN) {
  68971. return null;
  68972. }
  68973. y = FORTPI - phi * 0.5;
  68974. y = 2 * ((this.mode === this.S_POLE) ? Math.cos(y) : Math.sin(y));
  68975. x = y * Math.sin(lam);
  68976. y *= coslam;
  68977. }
  68978. }
  68979. else {
  68980. sinb = 0;
  68981. cosb = 0;
  68982. b = 0;
  68983. coslam = Math.cos(lam);
  68984. sinlam = Math.sin(lam);
  68985. sinphi = Math.sin(phi);
  68986. q = qsfnz(this.e, sinphi);
  68987. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  68988. sinb = q / this.qp;
  68989. cosb = Math.sqrt(1 - sinb * sinb);
  68990. }
  68991. switch (this.mode) {
  68992. case this.OBLIQ:
  68993. b = 1 + this.sinb1 * sinb + this.cosb1 * cosb * coslam;
  68994. break;
  68995. case this.EQUIT:
  68996. b = 1 + cosb * coslam;
  68997. break;
  68998. case this.N_POLE:
  68999. b = HALF_PI + phi;
  69000. q = this.qp - q;
  69001. break;
  69002. case this.S_POLE:
  69003. b = phi - HALF_PI;
  69004. q = this.qp + q;
  69005. break;
  69006. }
  69007. if (Math.abs(b) < EPSLN) {
  69008. return null;
  69009. }
  69010. switch (this.mode) {
  69011. case this.OBLIQ:
  69012. case this.EQUIT:
  69013. b = Math.sqrt(2 / b);
  69014. if (this.mode === this.OBLIQ) {
  69015. y = this.ymf * b * (this.cosb1 * sinb - this.sinb1 * cosb * coslam);
  69016. }
  69017. else {
  69018. y = (b = Math.sqrt(2 / (1 + cosb * coslam))) * sinb * this.ymf;
  69019. }
  69020. x = this.xmf * b * cosb * sinlam;
  69021. break;
  69022. case this.N_POLE:
  69023. case this.S_POLE:
  69024. if (q >= 0) {
  69025. x = (b = Math.sqrt(q)) * sinlam;
  69026. y = coslam * ((this.mode === this.S_POLE) ? b : -b);
  69027. }
  69028. else {
  69029. x = y = 0;
  69030. }
  69031. break;
  69032. }
  69033. }
  69034. p.x = this.a * x + this.x0;
  69035. p.y = this.a * y + this.y0;
  69036. return p;
  69037. }
  69038. /* Inverse equations
  69039. -----------------*/
  69040. function laea_inverse(p) {
  69041. p.x -= this.x0;
  69042. p.y -= this.y0;
  69043. var x = p.x / this.a;
  69044. var y = p.y / this.a;
  69045. var lam, phi, cCe, sCe, q, rho, ab;
  69046. if (this.sphere) {
  69047. var cosz = 0,
  69048. rh, sinz = 0;
  69049. rh = Math.sqrt(x * x + y * y);
  69050. phi = rh * 0.5;
  69051. if (phi > 1) {
  69052. return null;
  69053. }
  69054. phi = 2 * Math.asin(phi);
  69055. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  69056. sinz = Math.sin(phi);
  69057. cosz = Math.cos(phi);
  69058. }
  69059. switch (this.mode) {
  69060. case this.EQUIT:
  69061. phi = (Math.abs(rh) <= EPSLN) ? 0 : Math.asin(y * sinz / rh);
  69062. x *= sinz;
  69063. y = cosz * rh;
  69064. break;
  69065. case this.OBLIQ:
  69066. phi = (Math.abs(rh) <= EPSLN) ? this.lat0 : Math.asin(cosz * this.sinph0 + y * sinz * this.cosph0 / rh);
  69067. x *= sinz * this.cosph0;
  69068. y = (cosz - Math.sin(phi) * this.sinph0) * rh;
  69069. break;
  69070. case this.N_POLE:
  69071. y = -y;
  69072. phi = HALF_PI - phi;
  69073. break;
  69074. case this.S_POLE:
  69075. phi -= HALF_PI;
  69076. break;
  69077. }
  69078. lam = (y === 0 && (this.mode === this.EQUIT || this.mode === this.OBLIQ)) ? 0 : Math.atan2(x, y);
  69079. }
  69080. else {
  69081. ab = 0;
  69082. if (this.mode === this.OBLIQ || this.mode === this.EQUIT) {
  69083. x /= this.dd;
  69084. y *= this.dd;
  69085. rho = Math.sqrt(x * x + y * y);
  69086. if (rho < EPSLN) {
  69087. p.x = this.long0;
  69088. p.y = this.lat0;
  69089. return p;
  69090. }
  69091. sCe = 2 * Math.asin(0.5 * rho / this.rq);
  69092. cCe = Math.cos(sCe);
  69093. x *= (sCe = Math.sin(sCe));
  69094. if (this.mode === this.OBLIQ) {
  69095. ab = cCe * this.sinb1 + y * sCe * this.cosb1 / rho;
  69096. q = this.qp * ab;
  69097. y = rho * this.cosb1 * cCe - y * this.sinb1 * sCe;
  69098. }
  69099. else {
  69100. ab = y * sCe / rho;
  69101. q = this.qp * ab;
  69102. y = rho * cCe;
  69103. }
  69104. }
  69105. else if (this.mode === this.N_POLE || this.mode === this.S_POLE) {
  69106. if (this.mode === this.N_POLE) {
  69107. y = -y;
  69108. }
  69109. q = (x * x + y * y);
  69110. if (!q) {
  69111. p.x = this.long0;
  69112. p.y = this.lat0;
  69113. return p;
  69114. }
  69115. ab = 1 - q / this.qp;
  69116. if (this.mode === this.S_POLE) {
  69117. ab = -ab;
  69118. }
  69119. }
  69120. lam = Math.atan2(x, y);
  69121. phi = authlat(Math.asin(ab), this.apa);
  69122. }
  69123. p.x = adjust_lon(this.long0 + lam);
  69124. p.y = phi;
  69125. return p;
  69126. }
  69127. /* determine latitude from authalic latitude */
  69128. var P00 = 0.33333333333333333333;
  69129. var P01 = 0.17222222222222222222;
  69130. var P02 = 0.10257936507936507936;
  69131. var P10 = 0.06388888888888888888;
  69132. var P11 = 0.06640211640211640211;
  69133. var P20 = 0.01641501294219154443;
  69134. function authset(es) {
  69135. var t;
  69136. var APA = [];
  69137. APA[0] = es * P00;
  69138. t = es * es;
  69139. APA[0] += t * P01;
  69140. APA[1] = t * P10;
  69141. t *= es;
  69142. APA[0] += t * P02;
  69143. APA[1] += t * P11;
  69144. APA[2] = t * P20;
  69145. return APA;
  69146. }
  69147. function authlat(beta, APA) {
  69148. var t = beta + beta;
  69149. return (beta + APA[0] * Math.sin(t) + APA[1] * Math.sin(t + t) + APA[2] * Math.sin(t + t + t));
  69150. }
  69151. var laea_names = ["Lambert Azimuthal Equal Area", "Lambert_Azimuthal_Equal_Area", "laea"];
  69152. /* harmony default export */ const laea = ({
  69153. init: laea_init,
  69154. forward: laea_forward,
  69155. inverse: laea_inverse,
  69156. names: laea_names,
  69157. S_POLE: S_POLE,
  69158. N_POLE: N_POLE,
  69159. EQUIT: EQUIT,
  69160. OBLIQ: OBLIQ
  69161. });
  69162. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/asinz.js
  69163. /* harmony default export */ function asinz(x) {
  69164. if (Math.abs(x) > 1) {
  69165. x = (x > 1) ? 1 : -1;
  69166. }
  69167. return Math.asin(x);
  69168. }
  69169. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aea.js
  69170. function aea_init() {
  69171. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  69172. return;
  69173. }
  69174. this.temp = this.b / this.a;
  69175. this.es = 1 - Math.pow(this.temp, 2);
  69176. this.e3 = Math.sqrt(this.es);
  69177. this.sin_po = Math.sin(this.lat1);
  69178. this.cos_po = Math.cos(this.lat1);
  69179. this.t1 = this.sin_po;
  69180. this.con = this.sin_po;
  69181. this.ms1 = msfnz(this.e3, this.sin_po, this.cos_po);
  69182. this.qs1 = qsfnz(this.e3, this.sin_po, this.cos_po);
  69183. this.sin_po = Math.sin(this.lat2);
  69184. this.cos_po = Math.cos(this.lat2);
  69185. this.t2 = this.sin_po;
  69186. this.ms2 = msfnz(this.e3, this.sin_po, this.cos_po);
  69187. this.qs2 = qsfnz(this.e3, this.sin_po, this.cos_po);
  69188. this.sin_po = Math.sin(this.lat0);
  69189. this.cos_po = Math.cos(this.lat0);
  69190. this.t3 = this.sin_po;
  69191. this.qs0 = qsfnz(this.e3, this.sin_po, this.cos_po);
  69192. if (Math.abs(this.lat1 - this.lat2) > EPSLN) {
  69193. this.ns0 = (this.ms1 * this.ms1 - this.ms2 * this.ms2) / (this.qs2 - this.qs1);
  69194. }
  69195. else {
  69196. this.ns0 = this.con;
  69197. }
  69198. this.c = this.ms1 * this.ms1 + this.ns0 * this.qs1;
  69199. this.rh = this.a * Math.sqrt(this.c - this.ns0 * this.qs0) / this.ns0;
  69200. }
  69201. /* Albers Conical Equal Area forward equations--mapping lat,long to x,y
  69202. -------------------------------------------------------------------*/
  69203. function aea_forward(p) {
  69204. var lon = p.x;
  69205. var lat = p.y;
  69206. this.sin_phi = Math.sin(lat);
  69207. this.cos_phi = Math.cos(lat);
  69208. var qs = qsfnz(this.e3, this.sin_phi, this.cos_phi);
  69209. var rh1 = this.a * Math.sqrt(this.c - this.ns0 * qs) / this.ns0;
  69210. var theta = this.ns0 * adjust_lon(lon - this.long0);
  69211. var x = rh1 * Math.sin(theta) + this.x0;
  69212. var y = this.rh - rh1 * Math.cos(theta) + this.y0;
  69213. p.x = x;
  69214. p.y = y;
  69215. return p;
  69216. }
  69217. function aea_inverse(p) {
  69218. var rh1, qs, con, theta, lon, lat;
  69219. p.x -= this.x0;
  69220. p.y = this.rh - p.y + this.y0;
  69221. if (this.ns0 >= 0) {
  69222. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  69223. con = 1;
  69224. }
  69225. else {
  69226. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  69227. con = -1;
  69228. }
  69229. theta = 0;
  69230. if (rh1 !== 0) {
  69231. theta = Math.atan2(con * p.x, con * p.y);
  69232. }
  69233. con = rh1 * this.ns0 / this.a;
  69234. if (this.sphere) {
  69235. lat = Math.asin((this.c - con * con) / (2 * this.ns0));
  69236. }
  69237. else {
  69238. qs = (this.c - con * con) / this.ns0;
  69239. lat = this.phi1z(this.e3, qs);
  69240. }
  69241. lon = adjust_lon(theta / this.ns0 + this.long0);
  69242. p.x = lon;
  69243. p.y = lat;
  69244. return p;
  69245. }
  69246. /* Function to compute phi1, the latitude for the inverse of the
  69247. Albers Conical Equal-Area projection.
  69248. -------------------------------------------*/
  69249. function phi1z(eccent, qs) {
  69250. var sinphi, cosphi, con, com, dphi;
  69251. var phi = asinz(0.5 * qs);
  69252. if (eccent < EPSLN) {
  69253. return phi;
  69254. }
  69255. var eccnts = eccent * eccent;
  69256. for (var i = 1; i <= 25; i++) {
  69257. sinphi = Math.sin(phi);
  69258. cosphi = Math.cos(phi);
  69259. con = eccent * sinphi;
  69260. com = 1 - con * con;
  69261. dphi = 0.5 * com * com / cosphi * (qs / (1 - eccnts) - sinphi / com + 0.5 / eccent * Math.log((1 - con) / (1 + con)));
  69262. phi = phi + dphi;
  69263. if (Math.abs(dphi) <= 1e-7) {
  69264. return phi;
  69265. }
  69266. }
  69267. return null;
  69268. }
  69269. var aea_names = ["Albers_Conic_Equal_Area", "Albers", "aea"];
  69270. /* harmony default export */ const aea = ({
  69271. init: aea_init,
  69272. forward: aea_forward,
  69273. inverse: aea_inverse,
  69274. names: aea_names,
  69275. phi1z: phi1z
  69276. });
  69277. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/gnom.js
  69278. /*
  69279. reference:
  69280. Wolfram Mathworld "Gnomonic Projection"
  69281. http://mathworld.wolfram.com/GnomonicProjection.html
  69282. Accessed: 12th November 2009
  69283. */
  69284. function gnom_init() {
  69285. /* Place parameters in static storage for common use
  69286. -------------------------------------------------*/
  69287. this.sin_p14 = Math.sin(this.lat0);
  69288. this.cos_p14 = Math.cos(this.lat0);
  69289. // Approximation for projecting points to the horizon (infinity)
  69290. this.infinity_dist = 1000 * this.a;
  69291. this.rc = 1;
  69292. }
  69293. /* Gnomonic forward equations--mapping lat,long to x,y
  69294. ---------------------------------------------------*/
  69295. function gnom_forward(p) {
  69296. var sinphi, cosphi; /* sin and cos value */
  69297. var dlon; /* delta longitude value */
  69298. var coslon; /* cos of longitude */
  69299. var ksp; /* scale factor */
  69300. var g;
  69301. var x, y;
  69302. var lon = p.x;
  69303. var lat = p.y;
  69304. /* Forward equations
  69305. -----------------*/
  69306. dlon = adjust_lon(lon - this.long0);
  69307. sinphi = Math.sin(lat);
  69308. cosphi = Math.cos(lat);
  69309. coslon = Math.cos(dlon);
  69310. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  69311. ksp = 1;
  69312. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  69313. x = this.x0 + this.a * ksp * cosphi * Math.sin(dlon) / g;
  69314. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon) / g;
  69315. }
  69316. else {
  69317. // Point is in the opposing hemisphere and is unprojectable
  69318. // We still need to return a reasonable point, so we project
  69319. // to infinity, on a bearing
  69320. // equivalent to the northern hemisphere equivalent
  69321. // This is a reasonable approximation for short shapes and lines that
  69322. // straddle the horizon.
  69323. x = this.x0 + this.infinity_dist * cosphi * Math.sin(dlon);
  69324. y = this.y0 + this.infinity_dist * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  69325. }
  69326. p.x = x;
  69327. p.y = y;
  69328. return p;
  69329. }
  69330. function gnom_inverse(p) {
  69331. var rh; /* Rho */
  69332. var sinc, cosc;
  69333. var c;
  69334. var lon, lat;
  69335. /* Inverse equations
  69336. -----------------*/
  69337. p.x = (p.x - this.x0) / this.a;
  69338. p.y = (p.y - this.y0) / this.a;
  69339. p.x /= this.k0;
  69340. p.y /= this.k0;
  69341. if ((rh = Math.sqrt(p.x * p.x + p.y * p.y))) {
  69342. c = Math.atan2(rh, this.rc);
  69343. sinc = Math.sin(c);
  69344. cosc = Math.cos(c);
  69345. lat = asinz(cosc * this.sin_p14 + (p.y * sinc * this.cos_p14) / rh);
  69346. lon = Math.atan2(p.x * sinc, rh * this.cos_p14 * cosc - p.y * this.sin_p14 * sinc);
  69347. lon = adjust_lon(this.long0 + lon);
  69348. }
  69349. else {
  69350. lat = this.phic0;
  69351. lon = 0;
  69352. }
  69353. p.x = lon;
  69354. p.y = lat;
  69355. return p;
  69356. }
  69357. var gnom_names = ["gnom"];
  69358. /* harmony default export */ const gnom = ({
  69359. init: gnom_init,
  69360. forward: gnom_forward,
  69361. inverse: gnom_inverse,
  69362. names: gnom_names
  69363. });
  69364. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/common/iqsfnz.js
  69365. /* harmony default export */ function iqsfnz(eccent, q) {
  69366. var temp = 1 - (1 - eccent * eccent) / (2 * eccent) * Math.log((1 - eccent) / (1 + eccent));
  69367. if (Math.abs(Math.abs(q) - temp) < 1.0E-6) {
  69368. if (q < 0) {
  69369. return (-1 * HALF_PI);
  69370. }
  69371. else {
  69372. return HALF_PI;
  69373. }
  69374. }
  69375. //var phi = 0.5* q/(1-eccent*eccent);
  69376. var phi = Math.asin(0.5 * q);
  69377. var dphi;
  69378. var sin_phi;
  69379. var cos_phi;
  69380. var con;
  69381. for (var i = 0; i < 30; i++) {
  69382. sin_phi = Math.sin(phi);
  69383. cos_phi = Math.cos(phi);
  69384. con = eccent * sin_phi;
  69385. 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)));
  69386. phi += dphi;
  69387. if (Math.abs(dphi) <= 0.0000000001) {
  69388. return phi;
  69389. }
  69390. }
  69391. //console.log("IQSFN-CONV:Latitude failed to converge after 30 iterations");
  69392. return NaN;
  69393. }
  69394. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/cea.js
  69395. /*
  69396. reference:
  69397. "Cartographic Projection Procedures for the UNIX Environment-
  69398. A User's Manual" by Gerald I. Evenden,
  69399. USGS Open File Report 90-284and Release 4 Interim Reports (2003)
  69400. */
  69401. function cea_init() {
  69402. //no-op
  69403. if (!this.sphere) {
  69404. this.k0 = msfnz(this.e, Math.sin(this.lat_ts), Math.cos(this.lat_ts));
  69405. }
  69406. }
  69407. /* Cylindrical Equal Area forward equations--mapping lat,long to x,y
  69408. ------------------------------------------------------------*/
  69409. function cea_forward(p) {
  69410. var lon = p.x;
  69411. var lat = p.y;
  69412. var x, y;
  69413. /* Forward equations
  69414. -----------------*/
  69415. var dlon = adjust_lon(lon - this.long0);
  69416. if (this.sphere) {
  69417. x = this.x0 + this.a * dlon * Math.cos(this.lat_ts);
  69418. y = this.y0 + this.a * Math.sin(lat) / Math.cos(this.lat_ts);
  69419. }
  69420. else {
  69421. var qs = qsfnz(this.e, Math.sin(lat));
  69422. x = this.x0 + this.a * this.k0 * dlon;
  69423. y = this.y0 + this.a * qs * 0.5 / this.k0;
  69424. }
  69425. p.x = x;
  69426. p.y = y;
  69427. return p;
  69428. }
  69429. /* Cylindrical Equal Area inverse equations--mapping x,y to lat/long
  69430. ------------------------------------------------------------*/
  69431. function cea_inverse(p) {
  69432. p.x -= this.x0;
  69433. p.y -= this.y0;
  69434. var lon, lat;
  69435. if (this.sphere) {
  69436. lon = adjust_lon(this.long0 + (p.x / this.a) / Math.cos(this.lat_ts));
  69437. lat = Math.asin((p.y / this.a) * Math.cos(this.lat_ts));
  69438. }
  69439. else {
  69440. lat = iqsfnz(this.e, 2 * p.y * this.k0 / this.a);
  69441. lon = adjust_lon(this.long0 + p.x / (this.a * this.k0));
  69442. }
  69443. p.x = lon;
  69444. p.y = lat;
  69445. return p;
  69446. }
  69447. var cea_names = ["cea"];
  69448. /* harmony default export */ const cea = ({
  69449. init: cea_init,
  69450. forward: cea_forward,
  69451. inverse: cea_inverse,
  69452. names: cea_names
  69453. });
  69454. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqc.js
  69455. function eqc_init() {
  69456. this.x0 = this.x0 || 0;
  69457. this.y0 = this.y0 || 0;
  69458. this.lat0 = this.lat0 || 0;
  69459. this.long0 = this.long0 || 0;
  69460. this.lat_ts = this.lat_ts || 0;
  69461. this.title = this.title || "Equidistant Cylindrical (Plate Carre)";
  69462. this.rc = Math.cos(this.lat_ts);
  69463. }
  69464. // forward equations--mapping lat,long to x,y
  69465. // -----------------------------------------------------------------
  69466. function eqc_forward(p) {
  69467. var lon = p.x;
  69468. var lat = p.y;
  69469. var dlon = adjust_lon(lon - this.long0);
  69470. var dlat = adjust_lat(lat - this.lat0);
  69471. p.x = this.x0 + (this.a * dlon * this.rc);
  69472. p.y = this.y0 + (this.a * dlat);
  69473. return p;
  69474. }
  69475. // inverse equations--mapping x,y to lat/long
  69476. // -----------------------------------------------------------------
  69477. function eqc_inverse(p) {
  69478. var x = p.x;
  69479. var y = p.y;
  69480. p.x = adjust_lon(this.long0 + ((x - this.x0) / (this.a * this.rc)));
  69481. p.y = adjust_lat(this.lat0 + ((y - this.y0) / (this.a)));
  69482. return p;
  69483. }
  69484. var eqc_names = ["Equirectangular", "Equidistant_Cylindrical", "eqc"];
  69485. /* harmony default export */ const eqc = ({
  69486. init: eqc_init,
  69487. forward: eqc_forward,
  69488. inverse: eqc_inverse,
  69489. names: eqc_names
  69490. });
  69491. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/poly.js
  69492. var poly_MAX_ITER = 20;
  69493. function poly_init() {
  69494. /* Place parameters in static storage for common use
  69495. -------------------------------------------------*/
  69496. this.temp = this.b / this.a;
  69497. 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
  69498. this.e = Math.sqrt(this.es);
  69499. this.e0 = e0fn(this.es);
  69500. this.e1 = e1fn(this.es);
  69501. this.e2 = e2fn(this.es);
  69502. this.e3 = e3fn(this.es);
  69503. 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
  69504. }
  69505. /* Polyconic forward equations--mapping lat,long to x,y
  69506. ---------------------------------------------------*/
  69507. function poly_forward(p) {
  69508. var lon = p.x;
  69509. var lat = p.y;
  69510. var x, y, el;
  69511. var dlon = adjust_lon(lon - this.long0);
  69512. el = dlon * Math.sin(lat);
  69513. if (this.sphere) {
  69514. if (Math.abs(lat) <= EPSLN) {
  69515. x = this.a * dlon;
  69516. y = -1 * this.a * this.lat0;
  69517. }
  69518. else {
  69519. x = this.a * Math.sin(el) / Math.tan(lat);
  69520. y = this.a * (adjust_lat(lat - this.lat0) + (1 - Math.cos(el)) / Math.tan(lat));
  69521. }
  69522. }
  69523. else {
  69524. if (Math.abs(lat) <= EPSLN) {
  69525. x = this.a * dlon;
  69526. y = -1 * this.ml0;
  69527. }
  69528. else {
  69529. var nl = gN(this.a, this.e, Math.sin(lat)) / Math.tan(lat);
  69530. x = nl * Math.sin(el);
  69531. y = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, lat) - this.ml0 + nl * (1 - Math.cos(el));
  69532. }
  69533. }
  69534. p.x = x + this.x0;
  69535. p.y = y + this.y0;
  69536. return p;
  69537. }
  69538. /* Inverse equations
  69539. -----------------*/
  69540. function poly_inverse(p) {
  69541. var lon, lat, x, y, i;
  69542. var al, bl;
  69543. var phi, dphi;
  69544. x = p.x - this.x0;
  69545. y = p.y - this.y0;
  69546. if (this.sphere) {
  69547. if (Math.abs(y + this.a * this.lat0) <= EPSLN) {
  69548. lon = adjust_lon(x / this.a + this.long0);
  69549. lat = 0;
  69550. }
  69551. else {
  69552. al = this.lat0 + y / this.a;
  69553. bl = x * x / this.a / this.a + al * al;
  69554. phi = al;
  69555. var tanphi;
  69556. for (i = poly_MAX_ITER; i; --i) {
  69557. tanphi = Math.tan(phi);
  69558. dphi = -1 * (al * (phi * tanphi + 1) - phi - 0.5 * (phi * phi + bl) * tanphi) / ((phi - al) / tanphi - 1);
  69559. phi += dphi;
  69560. if (Math.abs(dphi) <= EPSLN) {
  69561. lat = phi;
  69562. break;
  69563. }
  69564. }
  69565. lon = adjust_lon(this.long0 + (Math.asin(x * Math.tan(phi) / this.a)) / Math.sin(lat));
  69566. }
  69567. }
  69568. else {
  69569. if (Math.abs(y + this.ml0) <= EPSLN) {
  69570. lat = 0;
  69571. lon = adjust_lon(this.long0 + x / this.a);
  69572. }
  69573. else {
  69574. al = (this.ml0 + y) / this.a;
  69575. bl = x * x / this.a / this.a + al * al;
  69576. phi = al;
  69577. var cl, mln, mlnp, ma;
  69578. var con;
  69579. for (i = poly_MAX_ITER; i; --i) {
  69580. con = this.e * Math.sin(phi);
  69581. cl = Math.sqrt(1 - con * con) * Math.tan(phi);
  69582. mln = this.a * mlfn(this.e0, this.e1, this.e2, this.e3, phi);
  69583. mlnp = this.e0 - 2 * this.e1 * Math.cos(2 * phi) + 4 * this.e2 * Math.cos(4 * phi) - 6 * this.e3 * Math.cos(6 * phi);
  69584. ma = mln / this.a;
  69585. 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);
  69586. phi -= dphi;
  69587. if (Math.abs(dphi) <= EPSLN) {
  69588. lat = phi;
  69589. break;
  69590. }
  69591. }
  69592. //lat=phi4z(this.e,this.e0,this.e1,this.e2,this.e3,al,bl,0,0);
  69593. cl = Math.sqrt(1 - this.es * Math.pow(Math.sin(lat), 2)) * Math.tan(lat);
  69594. lon = adjust_lon(this.long0 + Math.asin(x * cl / this.a) / Math.sin(lat));
  69595. }
  69596. }
  69597. p.x = lon;
  69598. p.y = lat;
  69599. return p;
  69600. }
  69601. var poly_names = ["Polyconic", "poly"];
  69602. /* harmony default export */ const poly = ({
  69603. init: poly_init,
  69604. forward: poly_forward,
  69605. inverse: poly_inverse,
  69606. names: poly_names
  69607. });
  69608. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/nzmg.js
  69609. /*
  69610. reference
  69611. Department of Land and Survey Technical Circular 1973/32
  69612. http://www.linz.govt.nz/docs/miscellaneous/nz-map-definition.pdf
  69613. OSG Technical Report 4.1
  69614. http://www.linz.govt.nz/docs/miscellaneous/nzmg.pdf
  69615. */
  69616. /**
  69617. * iterations: Number of iterations to refine inverse transform.
  69618. * 0 -> km accuracy
  69619. * 1 -> m accuracy -- suitable for most mapping applications
  69620. * 2 -> mm accuracy
  69621. */
  69622. var iterations = 1;
  69623. function nzmg_init() {
  69624. this.A = [];
  69625. this.A[1] = 0.6399175073;
  69626. this.A[2] = -0.1358797613;
  69627. this.A[3] = 0.063294409;
  69628. this.A[4] = -0.02526853;
  69629. this.A[5] = 0.0117879;
  69630. this.A[6] = -0.0055161;
  69631. this.A[7] = 0.0026906;
  69632. this.A[8] = -0.001333;
  69633. this.A[9] = 0.00067;
  69634. this.A[10] = -0.00034;
  69635. this.B_re = [];
  69636. this.B_im = [];
  69637. this.B_re[1] = 0.7557853228;
  69638. this.B_im[1] = 0;
  69639. this.B_re[2] = 0.249204646;
  69640. this.B_im[2] = 0.003371507;
  69641. this.B_re[3] = -0.001541739;
  69642. this.B_im[3] = 0.041058560;
  69643. this.B_re[4] = -0.10162907;
  69644. this.B_im[4] = 0.01727609;
  69645. this.B_re[5] = -0.26623489;
  69646. this.B_im[5] = -0.36249218;
  69647. this.B_re[6] = -0.6870983;
  69648. this.B_im[6] = -1.1651967;
  69649. this.C_re = [];
  69650. this.C_im = [];
  69651. this.C_re[1] = 1.3231270439;
  69652. this.C_im[1] = 0;
  69653. this.C_re[2] = -0.577245789;
  69654. this.C_im[2] = -0.007809598;
  69655. this.C_re[3] = 0.508307513;
  69656. this.C_im[3] = -0.112208952;
  69657. this.C_re[4] = -0.15094762;
  69658. this.C_im[4] = 0.18200602;
  69659. this.C_re[5] = 1.01418179;
  69660. this.C_im[5] = 1.64497696;
  69661. this.C_re[6] = 1.9660549;
  69662. this.C_im[6] = 2.5127645;
  69663. this.D = [];
  69664. this.D[1] = 1.5627014243;
  69665. this.D[2] = 0.5185406398;
  69666. this.D[3] = -0.03333098;
  69667. this.D[4] = -0.1052906;
  69668. this.D[5] = -0.0368594;
  69669. this.D[6] = 0.007317;
  69670. this.D[7] = 0.01220;
  69671. this.D[8] = 0.00394;
  69672. this.D[9] = -0.0013;
  69673. }
  69674. /**
  69675. New Zealand Map Grid Forward - long/lat to x/y
  69676. long/lat in radians
  69677. */
  69678. function nzmg_forward(p) {
  69679. var n;
  69680. var lon = p.x;
  69681. var lat = p.y;
  69682. var delta_lat = lat - this.lat0;
  69683. var delta_lon = lon - this.long0;
  69684. // 1. Calculate d_phi and d_psi ... // and d_lambda
  69685. // For this algorithm, delta_latitude is in seconds of arc x 10-5, so we need to scale to those units. Longitude is radians.
  69686. var d_phi = delta_lat / SEC_TO_RAD * 1E-5;
  69687. var d_lambda = delta_lon;
  69688. var d_phi_n = 1; // d_phi^0
  69689. var d_psi = 0;
  69690. for (n = 1; n <= 10; n++) {
  69691. d_phi_n = d_phi_n * d_phi;
  69692. d_psi = d_psi + this.A[n] * d_phi_n;
  69693. }
  69694. // 2. Calculate theta
  69695. var th_re = d_psi;
  69696. var th_im = d_lambda;
  69697. // 3. Calculate z
  69698. var th_n_re = 1;
  69699. var th_n_im = 0; // theta^0
  69700. var th_n_re1;
  69701. var th_n_im1;
  69702. var z_re = 0;
  69703. var z_im = 0;
  69704. for (n = 1; n <= 6; n++) {
  69705. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  69706. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  69707. th_n_re = th_n_re1;
  69708. th_n_im = th_n_im1;
  69709. z_re = z_re + this.B_re[n] * th_n_re - this.B_im[n] * th_n_im;
  69710. z_im = z_im + this.B_im[n] * th_n_re + this.B_re[n] * th_n_im;
  69711. }
  69712. // 4. Calculate easting and northing
  69713. p.x = (z_im * this.a) + this.x0;
  69714. p.y = (z_re * this.a) + this.y0;
  69715. return p;
  69716. }
  69717. /**
  69718. New Zealand Map Grid Inverse - x/y to long/lat
  69719. */
  69720. function nzmg_inverse(p) {
  69721. var n;
  69722. var x = p.x;
  69723. var y = p.y;
  69724. var delta_x = x - this.x0;
  69725. var delta_y = y - this.y0;
  69726. // 1. Calculate z
  69727. var z_re = delta_y / this.a;
  69728. var z_im = delta_x / this.a;
  69729. // 2a. Calculate theta - first approximation gives km accuracy
  69730. var z_n_re = 1;
  69731. var z_n_im = 0; // z^0
  69732. var z_n_re1;
  69733. var z_n_im1;
  69734. var th_re = 0;
  69735. var th_im = 0;
  69736. for (n = 1; n <= 6; n++) {
  69737. z_n_re1 = z_n_re * z_re - z_n_im * z_im;
  69738. z_n_im1 = z_n_im * z_re + z_n_re * z_im;
  69739. z_n_re = z_n_re1;
  69740. z_n_im = z_n_im1;
  69741. th_re = th_re + this.C_re[n] * z_n_re - this.C_im[n] * z_n_im;
  69742. th_im = th_im + this.C_im[n] * z_n_re + this.C_re[n] * z_n_im;
  69743. }
  69744. // 2b. Iterate to refine the accuracy of the calculation
  69745. // 0 iterations gives km accuracy
  69746. // 1 iteration gives m accuracy -- good enough for most mapping applications
  69747. // 2 iterations bives mm accuracy
  69748. for (var i = 0; i < this.iterations; i++) {
  69749. var th_n_re = th_re;
  69750. var th_n_im = th_im;
  69751. var th_n_re1;
  69752. var th_n_im1;
  69753. var num_re = z_re;
  69754. var num_im = z_im;
  69755. for (n = 2; n <= 6; n++) {
  69756. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  69757. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  69758. th_n_re = th_n_re1;
  69759. th_n_im = th_n_im1;
  69760. num_re = num_re + (n - 1) * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  69761. num_im = num_im + (n - 1) * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  69762. }
  69763. th_n_re = 1;
  69764. th_n_im = 0;
  69765. var den_re = this.B_re[1];
  69766. var den_im = this.B_im[1];
  69767. for (n = 2; n <= 6; n++) {
  69768. th_n_re1 = th_n_re * th_re - th_n_im * th_im;
  69769. th_n_im1 = th_n_im * th_re + th_n_re * th_im;
  69770. th_n_re = th_n_re1;
  69771. th_n_im = th_n_im1;
  69772. den_re = den_re + n * (this.B_re[n] * th_n_re - this.B_im[n] * th_n_im);
  69773. den_im = den_im + n * (this.B_im[n] * th_n_re + this.B_re[n] * th_n_im);
  69774. }
  69775. // Complex division
  69776. var den2 = den_re * den_re + den_im * den_im;
  69777. th_re = (num_re * den_re + num_im * den_im) / den2;
  69778. th_im = (num_im * den_re - num_re * den_im) / den2;
  69779. }
  69780. // 3. Calculate d_phi ... // and d_lambda
  69781. var d_psi = th_re;
  69782. var d_lambda = th_im;
  69783. var d_psi_n = 1; // d_psi^0
  69784. var d_phi = 0;
  69785. for (n = 1; n <= 9; n++) {
  69786. d_psi_n = d_psi_n * d_psi;
  69787. d_phi = d_phi + this.D[n] * d_psi_n;
  69788. }
  69789. // 4. Calculate latitude and longitude
  69790. // d_phi is calcuated in second of arc * 10^-5, so we need to scale back to radians. d_lambda is in radians.
  69791. var lat = this.lat0 + (d_phi * SEC_TO_RAD * 1E5);
  69792. var lon = this.long0 + d_lambda;
  69793. p.x = lon;
  69794. p.y = lat;
  69795. return p;
  69796. }
  69797. var nzmg_names = ["New_Zealand_Map_Grid", "nzmg"];
  69798. /* harmony default export */ const nzmg = ({
  69799. init: nzmg_init,
  69800. forward: nzmg_forward,
  69801. inverse: nzmg_inverse,
  69802. names: nzmg_names
  69803. });
  69804. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/mill.js
  69805. /*
  69806. reference
  69807. "New Equal-Area Map Projections for Noncircular Regions", John P. Snyder,
  69808. The American Cartographer, Vol 15, No. 4, October 1988, pp. 341-355.
  69809. */
  69810. /* Initialize the Miller Cylindrical projection
  69811. -------------------------------------------*/
  69812. function mill_init() {
  69813. //no-op
  69814. }
  69815. /* Miller Cylindrical forward equations--mapping lat,long to x,y
  69816. ------------------------------------------------------------*/
  69817. function mill_forward(p) {
  69818. var lon = p.x;
  69819. var lat = p.y;
  69820. /* Forward equations
  69821. -----------------*/
  69822. var dlon = adjust_lon(lon - this.long0);
  69823. var x = this.x0 + this.a * dlon;
  69824. var y = this.y0 + this.a * Math.log(Math.tan((Math.PI / 4) + (lat / 2.5))) * 1.25;
  69825. p.x = x;
  69826. p.y = y;
  69827. return p;
  69828. }
  69829. /* Miller Cylindrical inverse equations--mapping x,y to lat/long
  69830. ------------------------------------------------------------*/
  69831. function mill_inverse(p) {
  69832. p.x -= this.x0;
  69833. p.y -= this.y0;
  69834. var lon = adjust_lon(this.long0 + p.x / this.a);
  69835. var lat = 2.5 * (Math.atan(Math.exp(0.8 * p.y / this.a)) - Math.PI / 4);
  69836. p.x = lon;
  69837. p.y = lat;
  69838. return p;
  69839. }
  69840. var mill_names = ["Miller_Cylindrical", "mill"];
  69841. /* harmony default export */ const mill = ({
  69842. init: mill_init,
  69843. forward: mill_forward,
  69844. inverse: mill_inverse,
  69845. names: mill_names
  69846. });
  69847. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/sinu.js
  69848. var sinu_MAX_ITER = 20;
  69849. function sinu_init() {
  69850. /* Place parameters in static storage for common use
  69851. -------------------------------------------------*/
  69852. if (!this.sphere) {
  69853. this.en = pj_enfn(this.es);
  69854. }
  69855. else {
  69856. this.n = 1;
  69857. this.m = 0;
  69858. this.es = 0;
  69859. this.C_y = Math.sqrt((this.m + 1) / this.n);
  69860. this.C_x = this.C_y / (this.m + 1);
  69861. }
  69862. }
  69863. /* Sinusoidal forward equations--mapping lat,long to x,y
  69864. -----------------------------------------------------*/
  69865. function sinu_forward(p) {
  69866. var x, y;
  69867. var lon = p.x;
  69868. var lat = p.y;
  69869. /* Forward equations
  69870. -----------------*/
  69871. lon = adjust_lon(lon - this.long0);
  69872. if (this.sphere) {
  69873. if (!this.m) {
  69874. lat = this.n !== 1 ? Math.asin(this.n * Math.sin(lat)) : lat;
  69875. }
  69876. else {
  69877. var k = this.n * Math.sin(lat);
  69878. for (var i = sinu_MAX_ITER; i; --i) {
  69879. var V = (this.m * lat + Math.sin(lat) - k) / (this.m + Math.cos(lat));
  69880. lat -= V;
  69881. if (Math.abs(V) < EPSLN) {
  69882. break;
  69883. }
  69884. }
  69885. }
  69886. x = this.a * this.C_x * lon * (this.m + Math.cos(lat));
  69887. y = this.a * this.C_y * lat;
  69888. }
  69889. else {
  69890. var s = Math.sin(lat);
  69891. var c = Math.cos(lat);
  69892. y = this.a * pj_mlfn(lat, s, c, this.en);
  69893. x = this.a * lon * c / Math.sqrt(1 - this.es * s * s);
  69894. }
  69895. p.x = x;
  69896. p.y = y;
  69897. return p;
  69898. }
  69899. function sinu_inverse(p) {
  69900. var lat, temp, lon, s;
  69901. p.x -= this.x0;
  69902. lon = p.x / this.a;
  69903. p.y -= this.y0;
  69904. lat = p.y / this.a;
  69905. if (this.sphere) {
  69906. lat /= this.C_y;
  69907. lon = lon / (this.C_x * (this.m + Math.cos(lat)));
  69908. if (this.m) {
  69909. lat = asinz((this.m * lat + Math.sin(lat)) / this.n);
  69910. }
  69911. else if (this.n !== 1) {
  69912. lat = asinz(Math.sin(lat) / this.n);
  69913. }
  69914. lon = adjust_lon(lon + this.long0);
  69915. lat = adjust_lat(lat);
  69916. }
  69917. else {
  69918. lat = pj_inv_mlfn(p.y / this.a, this.es, this.en);
  69919. s = Math.abs(lat);
  69920. if (s < HALF_PI) {
  69921. s = Math.sin(lat);
  69922. temp = this.long0 + p.x * Math.sqrt(1 - this.es * s * s) / (this.a * Math.cos(lat));
  69923. //temp = this.long0 + p.x / (this.a * Math.cos(lat));
  69924. lon = adjust_lon(temp);
  69925. }
  69926. else if ((s - EPSLN) < HALF_PI) {
  69927. lon = this.long0;
  69928. }
  69929. }
  69930. p.x = lon;
  69931. p.y = lat;
  69932. return p;
  69933. }
  69934. var sinu_names = ["Sinusoidal", "sinu"];
  69935. /* harmony default export */ const sinu = ({
  69936. init: sinu_init,
  69937. forward: sinu_forward,
  69938. inverse: sinu_inverse,
  69939. names: sinu_names
  69940. });
  69941. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/moll.js
  69942. function moll_init() {}
  69943. /* Mollweide forward equations--mapping lat,long to x,y
  69944. ----------------------------------------------------*/
  69945. function moll_forward(p) {
  69946. /* Forward equations
  69947. -----------------*/
  69948. var lon = p.x;
  69949. var lat = p.y;
  69950. var delta_lon = adjust_lon(lon - this.long0);
  69951. var theta = lat;
  69952. var con = Math.PI * Math.sin(lat);
  69953. /* Iterate using the Newton-Raphson method to find theta
  69954. -----------------------------------------------------*/
  69955. while (true) {
  69956. var delta_theta = -(theta + Math.sin(theta) - con) / (1 + Math.cos(theta));
  69957. theta += delta_theta;
  69958. if (Math.abs(delta_theta) < EPSLN) {
  69959. break;
  69960. }
  69961. }
  69962. theta /= 2;
  69963. /* If the latitude is 90 deg, force the x coordinate to be "0 + false easting"
  69964. this is done here because of precision problems with "cos(theta)"
  69965. --------------------------------------------------------------------------*/
  69966. if (Math.PI / 2 - Math.abs(lat) < EPSLN) {
  69967. delta_lon = 0;
  69968. }
  69969. var x = 0.900316316158 * this.a * delta_lon * Math.cos(theta) + this.x0;
  69970. var y = 1.4142135623731 * this.a * Math.sin(theta) + this.y0;
  69971. p.x = x;
  69972. p.y = y;
  69973. return p;
  69974. }
  69975. function moll_inverse(p) {
  69976. var theta;
  69977. var arg;
  69978. /* Inverse equations
  69979. -----------------*/
  69980. p.x -= this.x0;
  69981. p.y -= this.y0;
  69982. arg = p.y / (1.4142135623731 * this.a);
  69983. /* Because of division by zero problems, 'arg' can not be 1. Therefore
  69984. a number very close to one is used instead.
  69985. -------------------------------------------------------------------*/
  69986. if (Math.abs(arg) > 0.999999999999) {
  69987. arg = 0.999999999999;
  69988. }
  69989. theta = Math.asin(arg);
  69990. var lon = adjust_lon(this.long0 + (p.x / (0.900316316158 * this.a * Math.cos(theta))));
  69991. if (lon < (-Math.PI)) {
  69992. lon = -Math.PI;
  69993. }
  69994. if (lon > Math.PI) {
  69995. lon = Math.PI;
  69996. }
  69997. arg = (2 * theta + Math.sin(2 * theta)) / Math.PI;
  69998. if (Math.abs(arg) > 1) {
  69999. arg = 1;
  70000. }
  70001. var lat = Math.asin(arg);
  70002. p.x = lon;
  70003. p.y = lat;
  70004. return p;
  70005. }
  70006. var moll_names = ["Mollweide", "moll"];
  70007. /* harmony default export */ const moll = ({
  70008. init: moll_init,
  70009. forward: moll_forward,
  70010. inverse: moll_inverse,
  70011. names: moll_names
  70012. });
  70013. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/eqdc.js
  70014. function eqdc_init() {
  70015. /* Place parameters in static storage for common use
  70016. -------------------------------------------------*/
  70017. // Standard Parallels cannot be equal and on opposite sides of the equator
  70018. if (Math.abs(this.lat1 + this.lat2) < EPSLN) {
  70019. return;
  70020. }
  70021. this.lat2 = this.lat2 || this.lat1;
  70022. this.temp = this.b / this.a;
  70023. this.es = 1 - Math.pow(this.temp, 2);
  70024. this.e = Math.sqrt(this.es);
  70025. this.e0 = e0fn(this.es);
  70026. this.e1 = e1fn(this.es);
  70027. this.e2 = e2fn(this.es);
  70028. this.e3 = e3fn(this.es);
  70029. this.sinphi = Math.sin(this.lat1);
  70030. this.cosphi = Math.cos(this.lat1);
  70031. this.ms1 = msfnz(this.e, this.sinphi, this.cosphi);
  70032. this.ml1 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat1);
  70033. if (Math.abs(this.lat1 - this.lat2) < EPSLN) {
  70034. this.ns = this.sinphi;
  70035. }
  70036. else {
  70037. this.sinphi = Math.sin(this.lat2);
  70038. this.cosphi = Math.cos(this.lat2);
  70039. this.ms2 = msfnz(this.e, this.sinphi, this.cosphi);
  70040. this.ml2 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat2);
  70041. this.ns = (this.ms1 - this.ms2) / (this.ml2 - this.ml1);
  70042. }
  70043. this.g = this.ml1 + this.ms1 / this.ns;
  70044. this.ml0 = mlfn(this.e0, this.e1, this.e2, this.e3, this.lat0);
  70045. this.rh = this.a * (this.g - this.ml0);
  70046. }
  70047. /* Equidistant Conic forward equations--mapping lat,long to x,y
  70048. -----------------------------------------------------------*/
  70049. function eqdc_forward(p) {
  70050. var lon = p.x;
  70051. var lat = p.y;
  70052. var rh1;
  70053. /* Forward equations
  70054. -----------------*/
  70055. if (this.sphere) {
  70056. rh1 = this.a * (this.g - lat);
  70057. }
  70058. else {
  70059. var ml = mlfn(this.e0, this.e1, this.e2, this.e3, lat);
  70060. rh1 = this.a * (this.g - ml);
  70061. }
  70062. var theta = this.ns * adjust_lon(lon - this.long0);
  70063. var x = this.x0 + rh1 * Math.sin(theta);
  70064. var y = this.y0 + this.rh - rh1 * Math.cos(theta);
  70065. p.x = x;
  70066. p.y = y;
  70067. return p;
  70068. }
  70069. /* Inverse equations
  70070. -----------------*/
  70071. function eqdc_inverse(p) {
  70072. p.x -= this.x0;
  70073. p.y = this.rh - p.y + this.y0;
  70074. var con, rh1, lat, lon;
  70075. if (this.ns >= 0) {
  70076. rh1 = Math.sqrt(p.x * p.x + p.y * p.y);
  70077. con = 1;
  70078. }
  70079. else {
  70080. rh1 = -Math.sqrt(p.x * p.x + p.y * p.y);
  70081. con = -1;
  70082. }
  70083. var theta = 0;
  70084. if (rh1 !== 0) {
  70085. theta = Math.atan2(con * p.x, con * p.y);
  70086. }
  70087. if (this.sphere) {
  70088. lon = adjust_lon(this.long0 + theta / this.ns);
  70089. lat = adjust_lat(this.g - rh1 / this.a);
  70090. p.x = lon;
  70091. p.y = lat;
  70092. return p;
  70093. }
  70094. else {
  70095. var ml = this.g - rh1 / this.a;
  70096. lat = imlfn(ml, this.e0, this.e1, this.e2, this.e3);
  70097. lon = adjust_lon(this.long0 + theta / this.ns);
  70098. p.x = lon;
  70099. p.y = lat;
  70100. return p;
  70101. }
  70102. }
  70103. var eqdc_names = ["Equidistant_Conic", "eqdc"];
  70104. /* harmony default export */ const eqdc = ({
  70105. init: eqdc_init,
  70106. forward: eqdc_forward,
  70107. inverse: eqdc_inverse,
  70108. names: eqdc_names
  70109. });
  70110. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/vandg.js
  70111. /* Initialize the Van Der Grinten projection
  70112. ----------------------------------------*/
  70113. function vandg_init() {
  70114. //this.R = 6370997; //Radius of earth
  70115. this.R = this.a;
  70116. }
  70117. function vandg_forward(p) {
  70118. var lon = p.x;
  70119. var lat = p.y;
  70120. /* Forward equations
  70121. -----------------*/
  70122. var dlon = adjust_lon(lon - this.long0);
  70123. var x, y;
  70124. if (Math.abs(lat) <= EPSLN) {
  70125. x = this.x0 + this.R * dlon;
  70126. y = this.y0;
  70127. }
  70128. var theta = asinz(2 * Math.abs(lat / Math.PI));
  70129. if ((Math.abs(dlon) <= EPSLN) || (Math.abs(Math.abs(lat) - HALF_PI) <= EPSLN)) {
  70130. x = this.x0;
  70131. if (lat >= 0) {
  70132. y = this.y0 + Math.PI * this.R * Math.tan(0.5 * theta);
  70133. }
  70134. else {
  70135. y = this.y0 + Math.PI * this.R * -Math.tan(0.5 * theta);
  70136. }
  70137. // return(OK);
  70138. }
  70139. var al = 0.5 * Math.abs((Math.PI / dlon) - (dlon / Math.PI));
  70140. var asq = al * al;
  70141. var sinth = Math.sin(theta);
  70142. var costh = Math.cos(theta);
  70143. var g = costh / (sinth + costh - 1);
  70144. var gsq = g * g;
  70145. var m = g * (2 / sinth - 1);
  70146. var msq = m * m;
  70147. var con = Math.PI * this.R * (al * (g - msq) + Math.sqrt(asq * (g - msq) * (g - msq) - (msq + asq) * (gsq - msq))) / (msq + asq);
  70148. if (dlon < 0) {
  70149. con = -con;
  70150. }
  70151. x = this.x0 + con;
  70152. //con = Math.abs(con / (Math.PI * this.R));
  70153. var q = asq + g;
  70154. con = Math.PI * this.R * (m * q - al * Math.sqrt((msq + asq) * (asq + 1) - q * q)) / (msq + asq);
  70155. if (lat >= 0) {
  70156. //y = this.y0 + Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  70157. y = this.y0 + con;
  70158. }
  70159. else {
  70160. //y = this.y0 - Math.PI * this.R * Math.sqrt(1 - con * con - 2 * al * con);
  70161. y = this.y0 - con;
  70162. }
  70163. p.x = x;
  70164. p.y = y;
  70165. return p;
  70166. }
  70167. /* Van Der Grinten inverse equations--mapping x,y to lat/long
  70168. ---------------------------------------------------------*/
  70169. function vandg_inverse(p) {
  70170. var lon, lat;
  70171. var xx, yy, xys, c1, c2, c3;
  70172. var a1;
  70173. var m1;
  70174. var con;
  70175. var th1;
  70176. var d;
  70177. /* inverse equations
  70178. -----------------*/
  70179. p.x -= this.x0;
  70180. p.y -= this.y0;
  70181. con = Math.PI * this.R;
  70182. xx = p.x / con;
  70183. yy = p.y / con;
  70184. xys = xx * xx + yy * yy;
  70185. c1 = -Math.abs(yy) * (1 + xys);
  70186. c2 = c1 - 2 * yy * yy + xx * xx;
  70187. c3 = -2 * c1 + 1 + 2 * yy * yy + xys * xys;
  70188. d = yy * yy / c3 + (2 * c2 * c2 * c2 / c3 / c3 / c3 - 9 * c1 * c2 / c3 / c3) / 27;
  70189. a1 = (c1 - c2 * c2 / 3 / c3) / c3;
  70190. m1 = 2 * Math.sqrt(-a1 / 3);
  70191. con = ((3 * d) / a1) / m1;
  70192. if (Math.abs(con) > 1) {
  70193. if (con >= 0) {
  70194. con = 1;
  70195. }
  70196. else {
  70197. con = -1;
  70198. }
  70199. }
  70200. th1 = Math.acos(con) / 3;
  70201. if (p.y >= 0) {
  70202. lat = (-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  70203. }
  70204. else {
  70205. lat = -(-m1 * Math.cos(th1 + Math.PI / 3) - c2 / 3 / c3) * Math.PI;
  70206. }
  70207. if (Math.abs(xx) < EPSLN) {
  70208. lon = this.long0;
  70209. }
  70210. else {
  70211. lon = adjust_lon(this.long0 + Math.PI * (xys - 1 + Math.sqrt(1 + 2 * (xx * xx - yy * yy) + xys * xys)) / 2 / xx);
  70212. }
  70213. p.x = lon;
  70214. p.y = lat;
  70215. return p;
  70216. }
  70217. var vandg_names = ["Van_der_Grinten_I", "VanDerGrinten", "vandg"];
  70218. /* harmony default export */ const vandg = ({
  70219. init: vandg_init,
  70220. forward: vandg_forward,
  70221. inverse: vandg_inverse,
  70222. names: vandg_names
  70223. });
  70224. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/aeqd.js
  70225. function aeqd_init() {
  70226. this.sin_p12 = Math.sin(this.lat0);
  70227. this.cos_p12 = Math.cos(this.lat0);
  70228. }
  70229. function aeqd_forward(p) {
  70230. var lon = p.x;
  70231. var lat = p.y;
  70232. var sinphi = Math.sin(p.y);
  70233. var cosphi = Math.cos(p.y);
  70234. var dlon = adjust_lon(lon - this.long0);
  70235. 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;
  70236. if (this.sphere) {
  70237. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  70238. //North Pole case
  70239. p.x = this.x0 + this.a * (HALF_PI - lat) * Math.sin(dlon);
  70240. p.y = this.y0 - this.a * (HALF_PI - lat) * Math.cos(dlon);
  70241. return p;
  70242. }
  70243. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  70244. //South Pole case
  70245. p.x = this.x0 + this.a * (HALF_PI + lat) * Math.sin(dlon);
  70246. p.y = this.y0 + this.a * (HALF_PI + lat) * Math.cos(dlon);
  70247. return p;
  70248. }
  70249. else {
  70250. //default case
  70251. cos_c = this.sin_p12 * sinphi + this.cos_p12 * cosphi * Math.cos(dlon);
  70252. c = Math.acos(cos_c);
  70253. kp = c ? c / Math.sin(c) : 1;
  70254. p.x = this.x0 + this.a * kp * cosphi * Math.sin(dlon);
  70255. p.y = this.y0 + this.a * kp * (this.cos_p12 * sinphi - this.sin_p12 * cosphi * Math.cos(dlon));
  70256. return p;
  70257. }
  70258. }
  70259. else {
  70260. e0 = e0fn(this.es);
  70261. e1 = e1fn(this.es);
  70262. e2 = e2fn(this.es);
  70263. e3 = e3fn(this.es);
  70264. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  70265. //North Pole case
  70266. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  70267. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  70268. p.x = this.x0 + (Mlp - Ml) * Math.sin(dlon);
  70269. p.y = this.y0 - (Mlp - Ml) * Math.cos(dlon);
  70270. return p;
  70271. }
  70272. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  70273. //South Pole case
  70274. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  70275. Ml = this.a * mlfn(e0, e1, e2, e3, lat);
  70276. p.x = this.x0 + (Mlp + Ml) * Math.sin(dlon);
  70277. p.y = this.y0 + (Mlp + Ml) * Math.cos(dlon);
  70278. return p;
  70279. }
  70280. else {
  70281. //Default case
  70282. tanphi = sinphi / cosphi;
  70283. Nl1 = gN(this.a, this.e, this.sin_p12);
  70284. Nl = gN(this.a, this.e, sinphi);
  70285. psi = Math.atan((1 - this.es) * tanphi + this.es * Nl1 * this.sin_p12 / (Nl * cosphi));
  70286. Az = Math.atan2(Math.sin(dlon), this.cos_p12 * Math.tan(psi) - this.sin_p12 * Math.cos(dlon));
  70287. if (Az === 0) {
  70288. s = Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  70289. }
  70290. else if (Math.abs(Math.abs(Az) - Math.PI) <= EPSLN) {
  70291. s = -Math.asin(this.cos_p12 * Math.sin(psi) - this.sin_p12 * Math.cos(psi));
  70292. }
  70293. else {
  70294. s = Math.asin(Math.sin(dlon) * Math.cos(psi) / Math.sin(Az));
  70295. }
  70296. G = this.e * this.sin_p12 / Math.sqrt(1 - this.es);
  70297. H = this.e * this.cos_p12 * Math.cos(Az) / Math.sqrt(1 - this.es);
  70298. GH = G * H;
  70299. Hs = H * H;
  70300. s2 = s * s;
  70301. s3 = s2 * s;
  70302. s4 = s3 * s;
  70303. s5 = s4 * s;
  70304. 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);
  70305. p.x = this.x0 + c * Math.sin(Az);
  70306. p.y = this.y0 + c * Math.cos(Az);
  70307. return p;
  70308. }
  70309. }
  70310. }
  70311. function aeqd_inverse(p) {
  70312. p.x -= this.x0;
  70313. p.y -= this.y0;
  70314. 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;
  70315. if (this.sphere) {
  70316. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  70317. if (rh > (2 * HALF_PI * this.a)) {
  70318. return;
  70319. }
  70320. z = rh / this.a;
  70321. sinz = Math.sin(z);
  70322. cosz = Math.cos(z);
  70323. lon = this.long0;
  70324. if (Math.abs(rh) <= EPSLN) {
  70325. lat = this.lat0;
  70326. }
  70327. else {
  70328. lat = asinz(cosz * this.sin_p12 + (p.y * sinz * this.cos_p12) / rh);
  70329. con = Math.abs(this.lat0) - HALF_PI;
  70330. if (Math.abs(con) <= EPSLN) {
  70331. if (this.lat0 >= 0) {
  70332. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  70333. }
  70334. else {
  70335. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  70336. }
  70337. }
  70338. else {
  70339. /*con = cosz - this.sin_p12 * Math.sin(lat);
  70340. if ((Math.abs(con) < EPSLN) && (Math.abs(p.x) < EPSLN)) {
  70341. //no-op, just keep the lon value as is
  70342. } else {
  70343. var temp = Math.atan2((p.x * sinz * this.cos_p12), (con * rh));
  70344. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz * this.cos_p12), (con * rh)));
  70345. }*/
  70346. lon = adjust_lon(this.long0 + Math.atan2(p.x * sinz, rh * this.cos_p12 * cosz - p.y * this.sin_p12 * sinz));
  70347. }
  70348. }
  70349. p.x = lon;
  70350. p.y = lat;
  70351. return p;
  70352. }
  70353. else {
  70354. e0 = e0fn(this.es);
  70355. e1 = e1fn(this.es);
  70356. e2 = e2fn(this.es);
  70357. e3 = e3fn(this.es);
  70358. if (Math.abs(this.sin_p12 - 1) <= EPSLN) {
  70359. //North pole case
  70360. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  70361. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  70362. M = Mlp - rh;
  70363. lat = imlfn(M / this.a, e0, e1, e2, e3);
  70364. lon = adjust_lon(this.long0 + Math.atan2(p.x, - 1 * p.y));
  70365. p.x = lon;
  70366. p.y = lat;
  70367. return p;
  70368. }
  70369. else if (Math.abs(this.sin_p12 + 1) <= EPSLN) {
  70370. //South pole case
  70371. Mlp = this.a * mlfn(e0, e1, e2, e3, HALF_PI);
  70372. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  70373. M = rh - Mlp;
  70374. lat = imlfn(M / this.a, e0, e1, e2, e3);
  70375. lon = adjust_lon(this.long0 + Math.atan2(p.x, p.y));
  70376. p.x = lon;
  70377. p.y = lat;
  70378. return p;
  70379. }
  70380. else {
  70381. //default case
  70382. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  70383. Az = Math.atan2(p.x, p.y);
  70384. N1 = gN(this.a, this.e, this.sin_p12);
  70385. cosAz = Math.cos(Az);
  70386. tmp = this.e * this.cos_p12 * cosAz;
  70387. A = -tmp * tmp / (1 - this.es);
  70388. B = 3 * this.es * (1 - A) * this.sin_p12 * this.cos_p12 * cosAz / (1 - this.es);
  70389. D = rh / N1;
  70390. Ee = D - A * (1 + A) * Math.pow(D, 3) / 6 - B * (1 + 3 * A) * Math.pow(D, 4) / 24;
  70391. F = 1 - A * Ee * Ee / 2 - D * Ee * Ee * Ee / 6;
  70392. psi = Math.asin(this.sin_p12 * Math.cos(Ee) + this.cos_p12 * Math.sin(Ee) * cosAz);
  70393. lon = adjust_lon(this.long0 + Math.asin(Math.sin(Az) * Math.sin(Ee) / Math.cos(psi)));
  70394. sinpsi = Math.sin(psi);
  70395. lat = Math.atan2((sinpsi - this.es * F * this.sin_p12) * Math.tan(psi), sinpsi * (1 - this.es));
  70396. p.x = lon;
  70397. p.y = lat;
  70398. return p;
  70399. }
  70400. }
  70401. }
  70402. var aeqd_names = ["Azimuthal_Equidistant", "aeqd"];
  70403. /* harmony default export */ const aeqd = ({
  70404. init: aeqd_init,
  70405. forward: aeqd_forward,
  70406. inverse: aeqd_inverse,
  70407. names: aeqd_names
  70408. });
  70409. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/ortho.js
  70410. function ortho_init() {
  70411. //double temp; /* temporary variable */
  70412. /* Place parameters in static storage for common use
  70413. -------------------------------------------------*/
  70414. this.sin_p14 = Math.sin(this.lat0);
  70415. this.cos_p14 = Math.cos(this.lat0);
  70416. }
  70417. /* Orthographic forward equations--mapping lat,long to x,y
  70418. ---------------------------------------------------*/
  70419. function ortho_forward(p) {
  70420. var sinphi, cosphi; /* sin and cos value */
  70421. var dlon; /* delta longitude value */
  70422. var coslon; /* cos of longitude */
  70423. var ksp; /* scale factor */
  70424. var g, x, y;
  70425. var lon = p.x;
  70426. var lat = p.y;
  70427. /* Forward equations
  70428. -----------------*/
  70429. dlon = adjust_lon(lon - this.long0);
  70430. sinphi = Math.sin(lat);
  70431. cosphi = Math.cos(lat);
  70432. coslon = Math.cos(dlon);
  70433. g = this.sin_p14 * sinphi + this.cos_p14 * cosphi * coslon;
  70434. ksp = 1;
  70435. if ((g > 0) || (Math.abs(g) <= EPSLN)) {
  70436. x = this.a * ksp * cosphi * Math.sin(dlon);
  70437. y = this.y0 + this.a * ksp * (this.cos_p14 * sinphi - this.sin_p14 * cosphi * coslon);
  70438. }
  70439. p.x = x;
  70440. p.y = y;
  70441. return p;
  70442. }
  70443. function ortho_inverse(p) {
  70444. var rh; /* height above ellipsoid */
  70445. var z; /* angle */
  70446. var sinz, cosz; /* sin of z and cos of z */
  70447. var con;
  70448. var lon, lat;
  70449. /* Inverse equations
  70450. -----------------*/
  70451. p.x -= this.x0;
  70452. p.y -= this.y0;
  70453. rh = Math.sqrt(p.x * p.x + p.y * p.y);
  70454. z = asinz(rh / this.a);
  70455. sinz = Math.sin(z);
  70456. cosz = Math.cos(z);
  70457. lon = this.long0;
  70458. if (Math.abs(rh) <= EPSLN) {
  70459. lat = this.lat0;
  70460. p.x = lon;
  70461. p.y = lat;
  70462. return p;
  70463. }
  70464. lat = asinz(cosz * this.sin_p14 + (p.y * sinz * this.cos_p14) / rh);
  70465. con = Math.abs(this.lat0) - HALF_PI;
  70466. if (Math.abs(con) <= EPSLN) {
  70467. if (this.lat0 >= 0) {
  70468. lon = adjust_lon(this.long0 + Math.atan2(p.x, - p.y));
  70469. }
  70470. else {
  70471. lon = adjust_lon(this.long0 - Math.atan2(-p.x, p.y));
  70472. }
  70473. p.x = lon;
  70474. p.y = lat;
  70475. return p;
  70476. }
  70477. lon = adjust_lon(this.long0 + Math.atan2((p.x * sinz), rh * this.cos_p14 * cosz - p.y * this.sin_p14 * sinz));
  70478. p.x = lon;
  70479. p.y = lat;
  70480. return p;
  70481. }
  70482. var ortho_names = ["ortho"];
  70483. /* harmony default export */ const ortho = ({
  70484. init: ortho_init,
  70485. forward: ortho_forward,
  70486. inverse: ortho_inverse,
  70487. names: ortho_names
  70488. });
  70489. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/qsc.js
  70490. // QSC projection rewritten from the original PROJ4
  70491. // https://github.com/OSGeo/proj.4/blob/master/src/PJ_qsc.c
  70492. /* constants */
  70493. var FACE_ENUM = {
  70494. FRONT: 1,
  70495. RIGHT: 2,
  70496. BACK: 3,
  70497. LEFT: 4,
  70498. TOP: 5,
  70499. BOTTOM: 6
  70500. };
  70501. var AREA_ENUM = {
  70502. AREA_0: 1,
  70503. AREA_1: 2,
  70504. AREA_2: 3,
  70505. AREA_3: 4
  70506. };
  70507. function qsc_init() {
  70508. this.x0 = this.x0 || 0;
  70509. this.y0 = this.y0 || 0;
  70510. this.lat0 = this.lat0 || 0;
  70511. this.long0 = this.long0 || 0;
  70512. this.lat_ts = this.lat_ts || 0;
  70513. this.title = this.title || "Quadrilateralized Spherical Cube";
  70514. /* Determine the cube face from the center of projection. */
  70515. if (this.lat0 >= HALF_PI - FORTPI / 2.0) {
  70516. this.face = FACE_ENUM.TOP;
  70517. } else if (this.lat0 <= -(HALF_PI - FORTPI / 2.0)) {
  70518. this.face = FACE_ENUM.BOTTOM;
  70519. } else if (Math.abs(this.long0) <= FORTPI) {
  70520. this.face = FACE_ENUM.FRONT;
  70521. } else if (Math.abs(this.long0) <= HALF_PI + FORTPI) {
  70522. this.face = this.long0 > 0.0 ? FACE_ENUM.RIGHT : FACE_ENUM.LEFT;
  70523. } else {
  70524. this.face = FACE_ENUM.BACK;
  70525. }
  70526. /* Fill in useful values for the ellipsoid <-> sphere shift
  70527. * described in [LK12]. */
  70528. if (this.es !== 0) {
  70529. this.one_minus_f = 1 - (this.a - this.b) / this.a;
  70530. this.one_minus_f_squared = this.one_minus_f * this.one_minus_f;
  70531. }
  70532. }
  70533. // QSC forward equations--mapping lat,long to x,y
  70534. // -----------------------------------------------------------------
  70535. function qsc_forward(p) {
  70536. var xy = {x: 0, y: 0};
  70537. var lat, lon;
  70538. var theta, phi;
  70539. var t, mu;
  70540. /* nu; */
  70541. var area = {value: 0};
  70542. // move lon according to projection's lon
  70543. p.x -= this.long0;
  70544. /* Convert the geodetic latitude to a geocentric latitude.
  70545. * This corresponds to the shift from the ellipsoid to the sphere
  70546. * described in [LK12]. */
  70547. if (this.es !== 0) {//if (P->es != 0) {
  70548. lat = Math.atan(this.one_minus_f_squared * Math.tan(p.y));
  70549. } else {
  70550. lat = p.y;
  70551. }
  70552. /* Convert the input lat, lon into theta, phi as used by QSC.
  70553. * This depends on the cube face and the area on it.
  70554. * For the top and bottom face, we can compute theta and phi
  70555. * directly from phi, lam. For the other faces, we must use
  70556. * unit sphere cartesian coordinates as an intermediate step. */
  70557. lon = p.x; //lon = lp.lam;
  70558. if (this.face === FACE_ENUM.TOP) {
  70559. phi = HALF_PI - lat;
  70560. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  70561. area.value = AREA_ENUM.AREA_0;
  70562. theta = lon - HALF_PI;
  70563. } else if (lon > HALF_PI + FORTPI || lon <= -(HALF_PI + FORTPI)) {
  70564. area.value = AREA_ENUM.AREA_1;
  70565. theta = (lon > 0.0 ? lon - SPI : lon + SPI);
  70566. } else if (lon > -(HALF_PI + FORTPI) && lon <= -FORTPI) {
  70567. area.value = AREA_ENUM.AREA_2;
  70568. theta = lon + HALF_PI;
  70569. } else {
  70570. area.value = AREA_ENUM.AREA_3;
  70571. theta = lon;
  70572. }
  70573. } else if (this.face === FACE_ENUM.BOTTOM) {
  70574. phi = HALF_PI + lat;
  70575. if (lon >= FORTPI && lon <= HALF_PI + FORTPI) {
  70576. area.value = AREA_ENUM.AREA_0;
  70577. theta = -lon + HALF_PI;
  70578. } else if (lon < FORTPI && lon >= -FORTPI) {
  70579. area.value = AREA_ENUM.AREA_1;
  70580. theta = -lon;
  70581. } else if (lon < -FORTPI && lon >= -(HALF_PI + FORTPI)) {
  70582. area.value = AREA_ENUM.AREA_2;
  70583. theta = -lon - HALF_PI;
  70584. } else {
  70585. area.value = AREA_ENUM.AREA_3;
  70586. theta = (lon > 0.0 ? -lon + SPI : -lon - SPI);
  70587. }
  70588. } else {
  70589. var q, r, s;
  70590. var sinlat, coslat;
  70591. var sinlon, coslon;
  70592. if (this.face === FACE_ENUM.RIGHT) {
  70593. lon = qsc_shift_lon_origin(lon, +HALF_PI);
  70594. } else if (this.face === FACE_ENUM.BACK) {
  70595. lon = qsc_shift_lon_origin(lon, +SPI);
  70596. } else if (this.face === FACE_ENUM.LEFT) {
  70597. lon = qsc_shift_lon_origin(lon, -HALF_PI);
  70598. }
  70599. sinlat = Math.sin(lat);
  70600. coslat = Math.cos(lat);
  70601. sinlon = Math.sin(lon);
  70602. coslon = Math.cos(lon);
  70603. q = coslat * coslon;
  70604. r = coslat * sinlon;
  70605. s = sinlat;
  70606. if (this.face === FACE_ENUM.FRONT) {
  70607. phi = Math.acos(q);
  70608. theta = qsc_fwd_equat_face_theta(phi, s, r, area);
  70609. } else if (this.face === FACE_ENUM.RIGHT) {
  70610. phi = Math.acos(r);
  70611. theta = qsc_fwd_equat_face_theta(phi, s, -q, area);
  70612. } else if (this.face === FACE_ENUM.BACK) {
  70613. phi = Math.acos(-q);
  70614. theta = qsc_fwd_equat_face_theta(phi, s, -r, area);
  70615. } else if (this.face === FACE_ENUM.LEFT) {
  70616. phi = Math.acos(-r);
  70617. theta = qsc_fwd_equat_face_theta(phi, s, q, area);
  70618. } else {
  70619. /* Impossible */
  70620. phi = theta = 0;
  70621. area.value = AREA_ENUM.AREA_0;
  70622. }
  70623. }
  70624. /* Compute mu and nu for the area of definition.
  70625. * For mu, see Eq. (3-21) in [OL76], but note the typos:
  70626. * compare with Eq. (3-14). For nu, see Eq. (3-38). */
  70627. mu = Math.atan((12 / SPI) * (theta + Math.acos(Math.sin(theta) * Math.cos(FORTPI)) - HALF_PI));
  70628. t = Math.sqrt((1 - Math.cos(phi)) / (Math.cos(mu) * Math.cos(mu)) / (1 - Math.cos(Math.atan(1 / Math.cos(theta)))));
  70629. /* Apply the result to the real area. */
  70630. if (area.value === AREA_ENUM.AREA_1) {
  70631. mu += HALF_PI;
  70632. } else if (area.value === AREA_ENUM.AREA_2) {
  70633. mu += SPI;
  70634. } else if (area.value === AREA_ENUM.AREA_3) {
  70635. mu += 1.5 * SPI;
  70636. }
  70637. /* Now compute x, y from mu and nu */
  70638. xy.x = t * Math.cos(mu);
  70639. xy.y = t * Math.sin(mu);
  70640. xy.x = xy.x * this.a + this.x0;
  70641. xy.y = xy.y * this.a + this.y0;
  70642. p.x = xy.x;
  70643. p.y = xy.y;
  70644. return p;
  70645. }
  70646. // QSC inverse equations--mapping x,y to lat/long
  70647. // -----------------------------------------------------------------
  70648. function qsc_inverse(p) {
  70649. var lp = {lam: 0, phi: 0};
  70650. var mu, nu, cosmu, tannu;
  70651. var tantheta, theta, cosphi, phi;
  70652. var t;
  70653. var area = {value: 0};
  70654. /* de-offset */
  70655. p.x = (p.x - this.x0) / this.a;
  70656. p.y = (p.y - this.y0) / this.a;
  70657. /* Convert the input x, y to the mu and nu angles as used by QSC.
  70658. * This depends on the area of the cube face. */
  70659. nu = Math.atan(Math.sqrt(p.x * p.x + p.y * p.y));
  70660. mu = Math.atan2(p.y, p.x);
  70661. if (p.x >= 0.0 && p.x >= Math.abs(p.y)) {
  70662. area.value = AREA_ENUM.AREA_0;
  70663. } else if (p.y >= 0.0 && p.y >= Math.abs(p.x)) {
  70664. area.value = AREA_ENUM.AREA_1;
  70665. mu -= HALF_PI;
  70666. } else if (p.x < 0.0 && -p.x >= Math.abs(p.y)) {
  70667. area.value = AREA_ENUM.AREA_2;
  70668. mu = (mu < 0.0 ? mu + SPI : mu - SPI);
  70669. } else {
  70670. area.value = AREA_ENUM.AREA_3;
  70671. mu += HALF_PI;
  70672. }
  70673. /* Compute phi and theta for the area of definition.
  70674. * The inverse projection is not described in the original paper, but some
  70675. * good hints can be found here (as of 2011-12-14):
  70676. * http://fits.gsfc.nasa.gov/fitsbits/saf.93/saf.9302
  70677. * (search for "Message-Id: <9302181759.AA25477 at fits.cv.nrao.edu>") */
  70678. t = (SPI / 12) * Math.tan(mu);
  70679. tantheta = Math.sin(t) / (Math.cos(t) - (1 / Math.sqrt(2)));
  70680. theta = Math.atan(tantheta);
  70681. cosmu = Math.cos(mu);
  70682. tannu = Math.tan(nu);
  70683. cosphi = 1 - cosmu * cosmu * tannu * tannu * (1 - Math.cos(Math.atan(1 / Math.cos(theta))));
  70684. if (cosphi < -1) {
  70685. cosphi = -1;
  70686. } else if (cosphi > +1) {
  70687. cosphi = +1;
  70688. }
  70689. /* Apply the result to the real area on the cube face.
  70690. * For the top and bottom face, we can compute phi and lam directly.
  70691. * For the other faces, we must use unit sphere cartesian coordinates
  70692. * as an intermediate step. */
  70693. if (this.face === FACE_ENUM.TOP) {
  70694. phi = Math.acos(cosphi);
  70695. lp.phi = HALF_PI - phi;
  70696. if (area.value === AREA_ENUM.AREA_0) {
  70697. lp.lam = theta + HALF_PI;
  70698. } else if (area.value === AREA_ENUM.AREA_1) {
  70699. lp.lam = (theta < 0.0 ? theta + SPI : theta - SPI);
  70700. } else if (area.value === AREA_ENUM.AREA_2) {
  70701. lp.lam = theta - HALF_PI;
  70702. } else /* area.value == AREA_ENUM.AREA_3 */ {
  70703. lp.lam = theta;
  70704. }
  70705. } else if (this.face === FACE_ENUM.BOTTOM) {
  70706. phi = Math.acos(cosphi);
  70707. lp.phi = phi - HALF_PI;
  70708. if (area.value === AREA_ENUM.AREA_0) {
  70709. lp.lam = -theta + HALF_PI;
  70710. } else if (area.value === AREA_ENUM.AREA_1) {
  70711. lp.lam = -theta;
  70712. } else if (area.value === AREA_ENUM.AREA_2) {
  70713. lp.lam = -theta - HALF_PI;
  70714. } else /* area.value == AREA_ENUM.AREA_3 */ {
  70715. lp.lam = (theta < 0.0 ? -theta - SPI : -theta + SPI);
  70716. }
  70717. } else {
  70718. /* Compute phi and lam via cartesian unit sphere coordinates. */
  70719. var q, r, s;
  70720. q = cosphi;
  70721. t = q * q;
  70722. if (t >= 1) {
  70723. s = 0;
  70724. } else {
  70725. s = Math.sqrt(1 - t) * Math.sin(theta);
  70726. }
  70727. t += s * s;
  70728. if (t >= 1) {
  70729. r = 0;
  70730. } else {
  70731. r = Math.sqrt(1 - t);
  70732. }
  70733. /* Rotate q,r,s into the correct area. */
  70734. if (area.value === AREA_ENUM.AREA_1) {
  70735. t = r;
  70736. r = -s;
  70737. s = t;
  70738. } else if (area.value === AREA_ENUM.AREA_2) {
  70739. r = -r;
  70740. s = -s;
  70741. } else if (area.value === AREA_ENUM.AREA_3) {
  70742. t = r;
  70743. r = s;
  70744. s = -t;
  70745. }
  70746. /* Rotate q,r,s into the correct cube face. */
  70747. if (this.face === FACE_ENUM.RIGHT) {
  70748. t = q;
  70749. q = -r;
  70750. r = t;
  70751. } else if (this.face === FACE_ENUM.BACK) {
  70752. q = -q;
  70753. r = -r;
  70754. } else if (this.face === FACE_ENUM.LEFT) {
  70755. t = q;
  70756. q = r;
  70757. r = -t;
  70758. }
  70759. /* Now compute phi and lam from the unit sphere coordinates. */
  70760. lp.phi = Math.acos(-s) - HALF_PI;
  70761. lp.lam = Math.atan2(r, q);
  70762. if (this.face === FACE_ENUM.RIGHT) {
  70763. lp.lam = qsc_shift_lon_origin(lp.lam, -HALF_PI);
  70764. } else if (this.face === FACE_ENUM.BACK) {
  70765. lp.lam = qsc_shift_lon_origin(lp.lam, -SPI);
  70766. } else if (this.face === FACE_ENUM.LEFT) {
  70767. lp.lam = qsc_shift_lon_origin(lp.lam, +HALF_PI);
  70768. }
  70769. }
  70770. /* Apply the shift from the sphere to the ellipsoid as described
  70771. * in [LK12]. */
  70772. if (this.es !== 0) {
  70773. var invert_sign;
  70774. var tanphi, xa;
  70775. invert_sign = (lp.phi < 0 ? 1 : 0);
  70776. tanphi = Math.tan(lp.phi);
  70777. xa = this.b / Math.sqrt(tanphi * tanphi + this.one_minus_f_squared);
  70778. lp.phi = Math.atan(Math.sqrt(this.a * this.a - xa * xa) / (this.one_minus_f * xa));
  70779. if (invert_sign) {
  70780. lp.phi = -lp.phi;
  70781. }
  70782. }
  70783. lp.lam += this.long0;
  70784. p.x = lp.lam;
  70785. p.y = lp.phi;
  70786. return p;
  70787. }
  70788. /* Helper function for forward projection: compute the theta angle
  70789. * and determine the area number. */
  70790. function qsc_fwd_equat_face_theta(phi, y, x, area) {
  70791. var theta;
  70792. if (phi < EPSLN) {
  70793. area.value = AREA_ENUM.AREA_0;
  70794. theta = 0.0;
  70795. } else {
  70796. theta = Math.atan2(y, x);
  70797. if (Math.abs(theta) <= FORTPI) {
  70798. area.value = AREA_ENUM.AREA_0;
  70799. } else if (theta > FORTPI && theta <= HALF_PI + FORTPI) {
  70800. area.value = AREA_ENUM.AREA_1;
  70801. theta -= HALF_PI;
  70802. } else if (theta > HALF_PI + FORTPI || theta <= -(HALF_PI + FORTPI)) {
  70803. area.value = AREA_ENUM.AREA_2;
  70804. theta = (theta >= 0.0 ? theta - SPI : theta + SPI);
  70805. } else {
  70806. area.value = AREA_ENUM.AREA_3;
  70807. theta += HALF_PI;
  70808. }
  70809. }
  70810. return theta;
  70811. }
  70812. /* Helper function: shift the longitude. */
  70813. function qsc_shift_lon_origin(lon, offset) {
  70814. var slon = lon + offset;
  70815. if (slon < -SPI) {
  70816. slon += TWO_PI;
  70817. } else if (slon > +SPI) {
  70818. slon -= TWO_PI;
  70819. }
  70820. return slon;
  70821. }
  70822. var qsc_names = ["Quadrilateralized Spherical Cube", "Quadrilateralized_Spherical_Cube", "qsc"];
  70823. /* harmony default export */ const qsc = ({
  70824. init: qsc_init,
  70825. forward: qsc_forward,
  70826. inverse: qsc_inverse,
  70827. names: qsc_names
  70828. });
  70829. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/robin.js
  70830. // Robinson projection
  70831. // Based on https://github.com/OSGeo/proj.4/blob/master/src/PJ_robin.c
  70832. // Polynomial coeficients from http://article.gmane.org/gmane.comp.gis.proj-4.devel/6039
  70833. var COEFS_X = [
  70834. [1.0000, 2.2199e-17, -7.15515e-05, 3.1103e-06],
  70835. [0.9986, -0.000482243, -2.4897e-05, -1.3309e-06],
  70836. [0.9954, -0.00083103, -4.48605e-05, -9.86701e-07],
  70837. [0.9900, -0.00135364, -5.9661e-05, 3.6777e-06],
  70838. [0.9822, -0.00167442, -4.49547e-06, -5.72411e-06],
  70839. [0.9730, -0.00214868, -9.03571e-05, 1.8736e-08],
  70840. [0.9600, -0.00305085, -9.00761e-05, 1.64917e-06],
  70841. [0.9427, -0.00382792, -6.53386e-05, -2.6154e-06],
  70842. [0.9216, -0.00467746, -0.00010457, 4.81243e-06],
  70843. [0.8962, -0.00536223, -3.23831e-05, -5.43432e-06],
  70844. [0.8679, -0.00609363, -0.000113898, 3.32484e-06],
  70845. [0.8350, -0.00698325, -6.40253e-05, 9.34959e-07],
  70846. [0.7986, -0.00755338, -5.00009e-05, 9.35324e-07],
  70847. [0.7597, -0.00798324, -3.5971e-05, -2.27626e-06],
  70848. [0.7186, -0.00851367, -7.01149e-05, -8.6303e-06],
  70849. [0.6732, -0.00986209, -0.000199569, 1.91974e-05],
  70850. [0.6213, -0.010418, 8.83923e-05, 6.24051e-06],
  70851. [0.5722, -0.00906601, 0.000182, 6.24051e-06],
  70852. [0.5322, -0.00677797, 0.000275608, 6.24051e-06]
  70853. ];
  70854. var COEFS_Y = [
  70855. [-5.20417e-18, 0.0124, 1.21431e-18, -8.45284e-11],
  70856. [0.0620, 0.0124, -1.26793e-09, 4.22642e-10],
  70857. [0.1240, 0.0124, 5.07171e-09, -1.60604e-09],
  70858. [0.1860, 0.0123999, -1.90189e-08, 6.00152e-09],
  70859. [0.2480, 0.0124002, 7.10039e-08, -2.24e-08],
  70860. [0.3100, 0.0123992, -2.64997e-07, 8.35986e-08],
  70861. [0.3720, 0.0124029, 9.88983e-07, -3.11994e-07],
  70862. [0.4340, 0.0123893, -3.69093e-06, -4.35621e-07],
  70863. [0.4958, 0.0123198, -1.02252e-05, -3.45523e-07],
  70864. [0.5571, 0.0121916, -1.54081e-05, -5.82288e-07],
  70865. [0.6176, 0.0119938, -2.41424e-05, -5.25327e-07],
  70866. [0.6769, 0.011713, -3.20223e-05, -5.16405e-07],
  70867. [0.7346, 0.0113541, -3.97684e-05, -6.09052e-07],
  70868. [0.7903, 0.0109107, -4.89042e-05, -1.04739e-06],
  70869. [0.8435, 0.0103431, -6.4615e-05, -1.40374e-09],
  70870. [0.8936, 0.00969686, -6.4636e-05, -8.547e-06],
  70871. [0.9394, 0.00840947, -0.000192841, -4.2106e-06],
  70872. [0.9761, 0.00616527, -0.000256, -4.2106e-06],
  70873. [1.0000, 0.00328947, -0.000319159, -4.2106e-06]
  70874. ];
  70875. var FXC = 0.8487;
  70876. var FYC = 1.3523;
  70877. var C1 = R2D/5; // rad to 5-degree interval
  70878. var RC1 = 1/C1;
  70879. var NODES = 18;
  70880. var poly3_val = function(coefs, x) {
  70881. return coefs[0] + x * (coefs[1] + x * (coefs[2] + x * coefs[3]));
  70882. };
  70883. var poly3_der = function(coefs, x) {
  70884. return coefs[1] + x * (2 * coefs[2] + x * 3 * coefs[3]);
  70885. };
  70886. function newton_rapshon(f_df, start, max_err, iters) {
  70887. var x = start;
  70888. for (; iters; --iters) {
  70889. var upd = f_df(x);
  70890. x -= upd;
  70891. if (Math.abs(upd) < max_err) {
  70892. break;
  70893. }
  70894. }
  70895. return x;
  70896. }
  70897. function robin_init() {
  70898. this.x0 = this.x0 || 0;
  70899. this.y0 = this.y0 || 0;
  70900. this.long0 = this.long0 || 0;
  70901. this.es = 0;
  70902. this.title = this.title || "Robinson";
  70903. }
  70904. function robin_forward(ll) {
  70905. var lon = adjust_lon(ll.x - this.long0);
  70906. var dphi = Math.abs(ll.y);
  70907. var i = Math.floor(dphi * C1);
  70908. if (i < 0) {
  70909. i = 0;
  70910. } else if (i >= NODES) {
  70911. i = NODES - 1;
  70912. }
  70913. dphi = R2D * (dphi - RC1 * i);
  70914. var xy = {
  70915. x: poly3_val(COEFS_X[i], dphi) * lon,
  70916. y: poly3_val(COEFS_Y[i], dphi)
  70917. };
  70918. if (ll.y < 0) {
  70919. xy.y = -xy.y;
  70920. }
  70921. xy.x = xy.x * this.a * FXC + this.x0;
  70922. xy.y = xy.y * this.a * FYC + this.y0;
  70923. return xy;
  70924. }
  70925. function robin_inverse(xy) {
  70926. var ll = {
  70927. x: (xy.x - this.x0) / (this.a * FXC),
  70928. y: Math.abs(xy.y - this.y0) / (this.a * FYC)
  70929. };
  70930. if (ll.y >= 1) { // pathologic case
  70931. ll.x /= COEFS_X[NODES][0];
  70932. ll.y = xy.y < 0 ? -HALF_PI : HALF_PI;
  70933. } else {
  70934. // find table interval
  70935. var i = Math.floor(ll.y * NODES);
  70936. if (i < 0) {
  70937. i = 0;
  70938. } else if (i >= NODES) {
  70939. i = NODES - 1;
  70940. }
  70941. for (;;) {
  70942. if (COEFS_Y[i][0] > ll.y) {
  70943. --i;
  70944. } else if (COEFS_Y[i+1][0] <= ll.y) {
  70945. ++i;
  70946. } else {
  70947. break;
  70948. }
  70949. }
  70950. // linear interpolation in 5 degree interval
  70951. var coefs = COEFS_Y[i];
  70952. var t = 5 * (ll.y - coefs[0]) / (COEFS_Y[i+1][0] - coefs[0]);
  70953. // find t so that poly3_val(coefs, t) = ll.y
  70954. t = newton_rapshon(function(x) {
  70955. return (poly3_val(coefs, x) - ll.y) / poly3_der(coefs, x);
  70956. }, t, EPSLN, 100);
  70957. ll.x /= poly3_val(COEFS_X[i], t);
  70958. ll.y = (5 * i + t) * D2R;
  70959. if (xy.y < 0) {
  70960. ll.y = -ll.y;
  70961. }
  70962. }
  70963. ll.x = adjust_lon(ll.x + this.long0);
  70964. return ll;
  70965. }
  70966. var robin_names = ["Robinson", "robin"];
  70967. /* harmony default export */ const robin = ({
  70968. init: robin_init,
  70969. forward: robin_forward,
  70970. inverse: robin_inverse,
  70971. names: robin_names
  70972. });
  70973. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/projections/geocent.js
  70974. function geocent_init() {
  70975. this.name = 'geocent';
  70976. }
  70977. function geocent_forward(p) {
  70978. var point = geodeticToGeocentric(p, this.es, this.a);
  70979. return point;
  70980. }
  70981. function geocent_inverse(p) {
  70982. var point = geocentricToGeodetic(p, this.es, this.a, this.b);
  70983. return point;
  70984. }
  70985. var geocent_names = ["Geocentric", 'geocentric', "geocent", "Geocent"];
  70986. /* harmony default export */ const geocent = ({
  70987. init: geocent_init,
  70988. forward: geocent_forward,
  70989. inverse: geocent_inverse,
  70990. names: geocent_names
  70991. });
  70992. ;// CONCATENATED MODULE: ./node_modules/proj4/projs.js
  70993. /* harmony default export */ function proj4_projs(proj4){
  70994. proj4.Proj.projections.add(tmerc);
  70995. proj4.Proj.projections.add(etmerc);
  70996. proj4.Proj.projections.add(utm);
  70997. proj4.Proj.projections.add(sterea);
  70998. proj4.Proj.projections.add(stere);
  70999. proj4.Proj.projections.add(somerc);
  71000. proj4.Proj.projections.add(omerc);
  71001. proj4.Proj.projections.add(lcc);
  71002. proj4.Proj.projections.add(krovak);
  71003. proj4.Proj.projections.add(cass);
  71004. proj4.Proj.projections.add(laea);
  71005. proj4.Proj.projections.add(aea);
  71006. proj4.Proj.projections.add(gnom);
  71007. proj4.Proj.projections.add(cea);
  71008. proj4.Proj.projections.add(eqc);
  71009. proj4.Proj.projections.add(poly);
  71010. proj4.Proj.projections.add(nzmg);
  71011. proj4.Proj.projections.add(mill);
  71012. proj4.Proj.projections.add(sinu);
  71013. proj4.Proj.projections.add(moll);
  71014. proj4.Proj.projections.add(eqdc);
  71015. proj4.Proj.projections.add(vandg);
  71016. proj4.Proj.projections.add(aeqd);
  71017. proj4.Proj.projections.add(ortho);
  71018. proj4.Proj.projections.add(qsc);
  71019. proj4.Proj.projections.add(robin);
  71020. proj4.Proj.projections.add(geocent);
  71021. }
  71022. ;// CONCATENATED MODULE: ./node_modules/proj4/lib/index.js
  71023. core.defaultDatum = 'WGS84'; //default datum
  71024. core.Proj = Proj;
  71025. core.WGS84 = new core.Proj('WGS84');
  71026. core.Point = lib_Point;
  71027. core.toPoint = toPoint;
  71028. core.defs = lib_defs;
  71029. core.transform = transform;
  71030. core.mgrs = mgrs;
  71031. core.version = '__VERSION__';
  71032. proj4_projs(core);
  71033. /* harmony default export */ const lib = (core);
  71034. ;// CONCATENATED MODULE: ./src/openlayers/services/DataFlowService.js
  71035. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71036. * This program are made available under the terms of the Apache License, Version 2.0
  71037. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71038. /**
  71039. * @class ol.supermap.DataFlowService
  71040. * @category iServer DataFlow
  71041. * @classdesc 数据流服务。
  71042. * @extends {ol.supermap.ServiceBase}
  71043. * @example
  71044. * new ol.supermap.DataFlowService(url)
  71045. * .queryChart(param,function(result){
  71046. * //doSomething
  71047. * })
  71048. * @param {string} url - 与客户端交互的数据流服务地址。
  71049. * @param {Object} options - 参数。
  71050. * @param {string} [options.proxy] - 服务代理地址。
  71051. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  71052. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  71053. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  71054. * @param {Object} [options.headers] - 请求头。
  71055. * @param {GeoJSONObject} [options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  71056. * @param {Object} [options.excludeField] - 排除字段。
  71057. */
  71058. class DataFlowService extends ServiceBase {
  71059. constructor(url, options) {
  71060. options = options || {};
  71061. if (options.projection) {
  71062. options.prjCoordSys = options.projection;
  71063. }
  71064. super(url, options);
  71065. this.dataFlow = new DataFlowService_DataFlowService(url, options);
  71066. this.dataFlow.events.on({
  71067. "broadcastSocketConnected": this._defaultEvent,
  71068. "broadcastSocketError": this._defaultEvent,
  71069. "broadcastFailed": this._defaultEvent,
  71070. "broadcastSucceeded": this._defaultEvent,
  71071. "subscribeSocketConnected": this._defaultEvent,
  71072. "subscribeSocketError": this._defaultEvent,
  71073. "messageSucceeded": this._defaultEvent,
  71074. "setFilterParamSucceeded": this._defaultEvent,
  71075. scope: this
  71076. });
  71077. }
  71078. /**
  71079. * @function ol.supermap.DataFlowService.prototype.initBroadcast
  71080. * @description 初始化广播。
  71081. * @returns {ol.supermap.DataFlowService}
  71082. */
  71083. initBroadcast() {
  71084. this.dataFlow.initBroadcast();
  71085. return this;
  71086. }
  71087. /**
  71088. * @function ol.supermap.DataFlowService.prototype.broadcast
  71089. * @description 加载广播数据。
  71090. * @param {JSON} obj - JSON 格式的要素数据。
  71091. */
  71092. broadcast(obj) {
  71093. this.dataFlow.broadcast(obj);
  71094. }
  71095. /**
  71096. * @function ol.supermap.DataFlowService.prototype.initSubscribe
  71097. * @description 初始化订阅数据。
  71098. */
  71099. initSubscribe() {
  71100. this.dataFlow.initSubscribe();
  71101. return this;
  71102. }
  71103. /**
  71104. * @function ol.supermap.DataFlowService.prototype.setExcludeField
  71105. * @description 设置排除字段。
  71106. * @param {Object} excludeField - 排除字段。
  71107. */
  71108. setExcludeField(excludeField) {
  71109. this.dataFlow.setExcludeField(excludeField);
  71110. this.options.excludeField = excludeField;
  71111. return this;
  71112. }
  71113. /**
  71114. * @function ol.supermap.DataFlowService.prototype.setGeometry
  71115. * @description 设置添加的几何要素数据。
  71116. * @param {GeoJSONObject} geometry - 指定几何范围,该范围内的要素才能被订阅。
  71117. */
  71118. setGeometry(geometry) {
  71119. this.dataFlow.setGeometry(geometry);
  71120. this.options.geometry = geometry;
  71121. return this;
  71122. }
  71123. /**
  71124. * @function ol.supermap.DataFlowService.prototype.unSubscribe
  71125. * @description 结束订阅数据。
  71126. */
  71127. unSubscribe() {
  71128. this.dataFlow.unSubscribe();
  71129. }
  71130. /**
  71131. * @function ol.supermap.DataFlowService.prototype.unBroadcast
  71132. * @description 结束加载广播。
  71133. */
  71134. unBroadcast() {
  71135. this.dataFlow.unBroadcast();
  71136. }
  71137. _defaultEvent(e) {
  71138. this.dispatchEvent({type: e.eventType || e.type, value: e});
  71139. }
  71140. }
  71141. ;// CONCATENATED MODULE: ./src/openlayers/overlay/DataFlow.js
  71142. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71143. * This program are made available under the terms of the Apache License, Version 2.0
  71144. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71145. /**
  71146. * @class ol.source.DataFlow
  71147. * @category iServer DataFlow
  71148. * @classdesc 数据流图层源。订阅SuperMap iServer 数据流服务,并将订阅得到的数据根据 `options.idField` 自动更新。与 {@link ol/layer/Vector} 结合使用可以实现SuperMap iServer 数据流上图、根据`options.idField`自动更新。
  71149. * @param {Object} opt_options - 参数。
  71150. * @param {string} opt_options.ws - SuperMap iServer 数据流服务地址,例如:http://localhost:8090/iserver/services/dataflowTest/dataflow。
  71151. * @param {string} [opt_options.idField = 'id'] - 要素属性中表示唯一标识的字段。
  71152. * @param {GeoJSONObject} [opt_options.geometry] - 指定几何范围,该范围内的要素才能被订阅。
  71153. * @param {Object} [opt_options.prjCoordSys] - 请求的地图的坐标参考系统。当此参数设置的坐标系统不同于地图的原有坐标系统时, 系统会进行动态投影,并返回动态投影后的地图瓦片。例如:{"epsgCode":3857}。
  71154. * @param {Object} [opt_options.excludeField] - 排除字段
  71155. * @extends {ol/source/Vector}
  71156. * @example
  71157. * var source = new ol.source.DataFlow({
  71158. * ws: urlDataFlow,
  71159. * idField:"objectId"
  71160. * });
  71161. * var layer = new ol.layer.Vector({
  71162. * source: source,
  71163. * });
  71164. *
  71165. */
  71166. class DataFlow extends (external_ol_source_Vector_default()) {
  71167. constructor(opt_options) {
  71168. var options = opt_options ? opt_options : {};
  71169. super(options);
  71170. this.idField = options.idField || "id";
  71171. this.dataService = new DataFlowService(options.ws, {
  71172. geometry: options.geometry,
  71173. prjCoordSys: options.prjCoordSys,
  71174. excludeField: options.excludeField
  71175. }).initSubscribe();
  71176. var me = this;
  71177. me.dataService.on("subscribeSocketConnected", function(e) {
  71178. me.dispatchEvent({
  71179. type: "subscribeSucceeded",
  71180. value: e
  71181. });
  71182. });
  71183. me.dataService.on("messageSucceeded", function(msg) {
  71184. me._onMessageSuccessed(msg);
  71185. });
  71186. me.dataService.on("setFilterParamSucceeded", function(msg) {
  71187. me.dispatchEvent({
  71188. type: "setFilterParamSucceeded",
  71189. value: msg
  71190. });
  71191. });
  71192. this.featureCache = {};
  71193. }
  71194. // /**
  71195. // * @function ol.source.DataFlow.prototype.setPrjCoordSys
  71196. // * @description 设置坐标参考系。
  71197. // * @param {Object} prjCoordSys - 参考系。
  71198. // */
  71199. // setPrjCoordSys(prjCoordSys) {
  71200. // this.dataService.setPrjCoordSys(prjCoordSys);
  71201. // this.prjCoordSys = prjCoordSys;
  71202. // return this;
  71203. // }
  71204. /**
  71205. * @function ol.source.DataFlow.prototype.setExcludeField
  71206. * @description 设置唯一字段。
  71207. * @param {Object} excludeField - 排除字段。
  71208. */
  71209. setExcludeField(excludeField) {
  71210. this.dataService.setExcludeField(excludeField);
  71211. this.excludeField = excludeField;
  71212. return this;
  71213. }
  71214. /**
  71215. * @function ol.source.DataFlow.prototype.setGeometry
  71216. * @description 设置几何图形。
  71217. * @param {Object} geometry - 要素图形。
  71218. */
  71219. setGeometry(geometry) {
  71220. this.dataService.setGeometry(geometry);
  71221. this.geometry = geometry;
  71222. return this;
  71223. }
  71224. _onMessageSuccessed(msg) {
  71225. //this.clear();
  71226. var feature = new (external_ol_format_GeoJSON_default())().readFeature(msg.value.featureResult);
  71227. var geoID = feature.get(this.idField);
  71228. if (geoID !== undefined && this.featureCache[geoID]) {
  71229. this.featureCache[geoID].setGeometry(feature.getGeometry());
  71230. this.featureCache[geoID].setProperties(feature.getProperties());
  71231. this.changed();
  71232. } else {
  71233. this.addFeature(feature);
  71234. this.featureCache[geoID] = feature;
  71235. }
  71236. this.dispatchEvent({
  71237. type: "dataupdated",
  71238. value: {
  71239. source: this,
  71240. data: feature
  71241. }
  71242. });
  71243. }
  71244. }
  71245. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/ThemeFeature.js
  71246. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71247. * This program are made available under the terms of the Apache License, Version 2.0
  71248. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71249. /**
  71250. * @class ol.supermap.ThemeFeature
  71251. * @category Visualization Theme
  71252. * @classdesc 专题图要素类。
  71253. * @param {Object} geometry - 要量算的几何对象,支持 {@link ol/geom/Geometry} 和 GeoText 标签数组类型 geometry = [x,y,text]。
  71254. * @param {Object} [attributes] - 属性。
  71255. */
  71256. class ThemeFeature {
  71257. constructor(geometry, attributes) {
  71258. this.geometry = geometry;
  71259. this.attributes = attributes;
  71260. }
  71261. /**
  71262. * @function ol.supermap.ThemeFeature.prototype.toFeature
  71263. * @description 转为矢量要素。
  71264. */
  71265. toFeature() {
  71266. var geometry = this.geometry;
  71267. if (geometry instanceof (external_ol_geom_Geometry_default())) {
  71268. //先把数据属性与要素合并
  71269. let featureOption = this.attributes;
  71270. featureOption.geometry = geometry;
  71271. let olFeature = new (external_ol_Feature_default())(featureOption);
  71272. return new GeoJSON().read((new (external_ol_format_GeoJSON_default())()).writeFeature(olFeature), "Feature");
  71273. } else if (geometry.length === 3) {
  71274. geometry = new GeoText(geometry[0], geometry[1], geometry[2]);
  71275. return new Vector(geometry, this.attributes);
  71276. }
  71277. }
  71278. }
  71279. ;// CONCATENATED MODULE: external "ol.source.ImageCanvas"
  71280. const external_ol_source_ImageCanvas_namespaceObject = ol.source.ImageCanvas;
  71281. var external_ol_source_ImageCanvas_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_ImageCanvas_namespaceObject);
  71282. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/Theme.js
  71283. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71284. * This program are made available under the terms of the Apache License, Version 2.0
  71285. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71286. /**
  71287. * @class ol.source.Theme
  71288. * @category Visualization Theme
  71289. * @classdesc 专题图基类。
  71290. * @param {string} name - 专题图图层名称。
  71291. * @param {Object} opt_option - 参数。
  71292. * @param {ol/Map} opt_option.map - 当前 openlayers 的 Map 对象。
  71293. * @param {string} [opt_option.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  71294. * @param {number} [opt_option.opacity=1] - 图层透明度。
  71295. * @param {string} [opt_option.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  71296. * @param {ol/proj/Projection} [opt_option.projection] - 投影信息。
  71297. * @param {number} [opt_option.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。 必须是 1 或更高。
  71298. * @param {Array} [opt_option.resolutions] - 分辨率数组。
  71299. * @param {ol/source/State} [opt_option.state] - 资源状态。
  71300. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  71301. * @extends {ol/source/ImageCanvas}
  71302. */
  71303. class theme_Theme_Theme extends (external_ol_source_ImageCanvas_default()) {
  71304. constructor(name, opt_options) {
  71305. var options = opt_options ? opt_options : {};
  71306. super({
  71307. attributions: options.attributions || "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>",
  71308. canvasFunction: canvasFunctionInternal_,
  71309. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  71310. projection: options.projection,
  71311. ratio: options.ratio,
  71312. resolutions: options.resolutions,
  71313. state: options.state
  71314. });
  71315. this.id = options.id ? options.id : Util.createUniqueID("themeLayer_");
  71316. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  71317. var mapWidth = size[0] * pixelRatio;
  71318. var mapHeight = size[1] * pixelRatio;
  71319. if (!this.context) {
  71320. this.context = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  71321. }
  71322. if (!this.features) {
  71323. return this.context.canvas;
  71324. }
  71325. this.pixelRatio = pixelRatio;
  71326. var width = this.map.getSize()[0] * pixelRatio;
  71327. var height = this.map.getSize()[1] * pixelRatio;
  71328. this.offset = [(mapWidth - width) / 2 / pixelRatio, (mapHeight - height) / 2 / pixelRatio];
  71329. if (!this.notFirst) {
  71330. this.redrawThematicFeatures(extent);
  71331. this.notFirst = true;
  71332. }
  71333. this.div.id = this.id;
  71334. this.div.className = "themeLayer";
  71335. this.div.style.width = mapWidth + "px";
  71336. this.div.style.height = mapHeight + "px";
  71337. this.map.getViewport().appendChild(this.div);
  71338. this.renderer.resize();
  71339. this.map.getViewport().removeChild(this.div);
  71340. this.themeCanvas = this.renderer.painter.root.getElementsByTagName('canvas')[0];
  71341. this.themeCanvas.width = mapWidth;
  71342. this.themeCanvas.height = mapHeight;
  71343. this.themeCanvas.style.width = mapWidth + "px";
  71344. this.themeCanvas.style.height = mapHeight + "px";
  71345. this.themeCanvas.getContext('2d').clearRect(0, 0, mapWidth, mapHeight);
  71346. var highLightContext = this.renderer.painter._layers.hover.ctx;
  71347. var highlightCanvas = highLightContext.canvas;
  71348. var copyHighLightContext = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  71349. copyHighLightContext.drawImage(highlightCanvas, 0, 0, highlightCanvas.width, highlightCanvas.height, 0, 0, mapWidth, mapHeight);
  71350. this.redrawThematicFeatures(extent);
  71351. var canvas = this.context.canvas;
  71352. this.context.clearRect(0, 0, canvas.width, canvas.height);
  71353. canvas.width = mapWidth;
  71354. canvas.height = mapHeight;
  71355. canvas.style.width = mapWidth + "px";
  71356. canvas.style.height = mapHeight + "px";
  71357. this.context.drawImage(this.themeCanvas, 0, 0);
  71358. this.context.drawImage(copyHighLightContext.canvas, 0, 0);
  71359. return this.context.canvas;
  71360. }
  71361. this.canvasFunctionInternal_ = canvasFunctionInternal_;
  71362. this.EVENT_TYPES = ["loadstart", "loadend", "loadcancel",
  71363. "visibilitychanged", "move", "moveend", "added", "removed",
  71364. "tileloaded", "beforefeaturesadded", "featuresadded", "featuresremoved"];
  71365. this.features = [];
  71366. this.TFEvents = options.TFEvents || [];
  71367. this.map = options.map;
  71368. var size = this.map.getSize();
  71369. this.div = document.createElement('div');
  71370. this.map.getViewport().appendChild(this.div);
  71371. this.div.style.width = size[0] + "px";
  71372. this.div.style.height = size[1] + "px";
  71373. this.setOpacity(options.opacity);
  71374. this.levelRenderer = new LevelRenderer();
  71375. this.movingOffset = [0, 0];
  71376. this.renderer = this.levelRenderer.init(this.div);
  71377. this.map.getViewport().removeChild(this.div);
  71378. this.renderer.clear();
  71379. //处理用户预先(在图层添加到 map 前)监听的事件
  71380. this.addTFEvents();
  71381. }
  71382. /**
  71383. * @function ol.source.Theme.prototype.destroy
  71384. * @description 释放资源,将引用资源的属性置空。
  71385. */
  71386. destroy() {
  71387. this.EVENT_TYPES = null;
  71388. this.isBaseLayer = null;
  71389. this.TFEvents = null;
  71390. this.destroyFeatures();
  71391. this.features = null;
  71392. if (this.renderer) {
  71393. this.renderer.dispose();
  71394. }
  71395. this.renderer = null;
  71396. this.levelRenderer = null;
  71397. this.movingOffset = null;
  71398. this.currentMousePosition = null;
  71399. }
  71400. /**
  71401. * @function ol.source.Theme.prototype.destroyFeatures
  71402. * @description 销毁某个要素。
  71403. * @param {SuperMap.Feature.Vector} features - 将被销毁的要素。
  71404. */
  71405. destroyFeatures(features) {
  71406. var all = (features == undefined);
  71407. if (all) {
  71408. features = this.features;
  71409. }
  71410. if (features) {
  71411. this.removeFeatures(features);
  71412. for (var i = features.length - 1; i >= 0; i--) {
  71413. features[i].destroy();
  71414. }
  71415. }
  71416. }
  71417. /**
  71418. * @function ol.source.Theme.prototype.setOpacity
  71419. * @description 设置图层的不透明度,取值[0-1]之间。
  71420. * @param {number} opacity - 不透明度。
  71421. */
  71422. setOpacity(opacity) {
  71423. if (opacity !== this.opacity) {
  71424. this.opacity = opacity;
  71425. var element = this.div;
  71426. Util.modifyDOMElement(element, null, null, null,
  71427. null, null, null, opacity);
  71428. if (this.map !== null) {
  71429. this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
  71430. }
  71431. }
  71432. }
  71433. /**
  71434. * @function ol.source.Theme.prototype.addFeatures
  71435. * @param {(ol.supermap.ThemeFeature|GeoJSONObject|ol/Feature)} features - 待转要素。
  71436. * @description 抽象方法,可实例化子类必须实现此方法。向专题图图层中添加数据,
  71437. * 专题图仅接收 SuperMap.Feature.Vector 类型数据,
  71438. * feature 将储存于 features 属性中,其存储形式为数组。
  71439. */
  71440. addFeatures(features) { // eslint-disable-line no-unused-vars
  71441. }
  71442. /**
  71443. * @function ol.source.Theme.prototype.removeFeatures
  71444. * @param {Array.<SuperMap.Feature.Vector>} features - 要删除 feature 的数组。
  71445. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  71446. * 参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature,
  71447. * 如果无法确定 feature 数组,则可以调用 removeAllFeatures 来删除所有 feature。
  71448. * 如果要删除的 feature 数组中的元素特别多,推荐使用 removeAllFeatures,
  71449. * 删除所有 feature 后再重新添加。这样效率会更高。
  71450. */
  71451. removeFeatures(features) {
  71452. if (!features || features.length === 0) {
  71453. return;
  71454. }
  71455. if (features === this.features) {
  71456. return this.removeAllFeatures();
  71457. }
  71458. if (!(Util.isArray(features))) {
  71459. features = [features];
  71460. }
  71461. var featuresFailRemoved = [];
  71462. for (var i = features.length - 1; i >= 0; i--) {
  71463. var feature = features[i];
  71464. //如果我们传入的feature在features数组中没有的话,则不进行删除,
  71465. //并将其放入未删除的数组中。
  71466. var findex = Util.indexOf(this.features, feature);
  71467. if (findex === -1) {
  71468. featuresFailRemoved.push(feature);
  71469. continue;
  71470. }
  71471. this.features.splice(findex, 1);
  71472. }
  71473. var drawFeatures = [];
  71474. for (var hex = 0, len = this.features.length; hex < len; hex++) {
  71475. feature = this.features[hex];
  71476. drawFeatures.push(feature);
  71477. }
  71478. this.features = [];
  71479. this.addFeatures(drawFeatures);
  71480. //绘制专题要素
  71481. if (this.renderer) {
  71482. this.redrawThematicFeatures(this.map.getView().calculateExtent());
  71483. }
  71484. var succeed = featuresFailRemoved.length == 0 ? true : false;
  71485. this.dispatchEvent({type: "featuresremoved", value: {features: featuresFailRemoved, succeed: succeed}});
  71486. }
  71487. /**
  71488. * @function ol.source.Theme.prototype.removeAllFeatures
  71489. * @description 清除当前图层所有的矢量要素。
  71490. */
  71491. removeAllFeatures() {
  71492. if (this.renderer) {
  71493. this.renderer.clear();
  71494. }
  71495. this.features = [];
  71496. this.dispatchEvent({type: 'featuresremoved', value: {features: [], succeed: true}});
  71497. }
  71498. /**
  71499. * @function ol.source.Theme.prototype.getFeatures
  71500. * @description 查看当前图层中的有效数据。
  71501. * @returns {SuperMap.Feature.Vector} 用户加入图层的有效数据。
  71502. */
  71503. getFeatures() {
  71504. var len = this.features.length;
  71505. var clonedFeatures = new Array(len);
  71506. for (var i = 0; i < len; ++i) {
  71507. clonedFeatures[i] = this.features[i];
  71508. //clonedFeatures[i] = this.features[i].clone();
  71509. }
  71510. return clonedFeatures;
  71511. }
  71512. /**
  71513. * @function ol.source.Theme.prototype.getFeatureBy
  71514. * @description 在专题图的要素数组 features 里面遍历每一个 feature,当 feature[property] === value 时,
  71515. * 返回此 feature(并且只返回第一个)。
  71516. * @param {string} property - feature 的某个属性名称。
  71517. * @param {string} value - property 所对应的值。
  71518. * @returns {SuperMap.Feature.Vector} 第一个匹配属性和值的矢量要素。
  71519. */
  71520. getFeatureBy(property, value) {
  71521. var feature = null;
  71522. for (var id in this.features) {
  71523. if (this.features[id][property] === value) {
  71524. feature = this.features[id];
  71525. //feature = this.features[id].clone();
  71526. break;
  71527. }
  71528. }
  71529. return feature;
  71530. }
  71531. /**
  71532. * @function ol.source.Theme.prototype.getFeatureById
  71533. * @description 通过给定一个 ID,返回对应的矢量要素。
  71534. * @param {string} featureId - 矢量要素的属性 ID。
  71535. * @returns {SuperMap.Feature.Vector} 对应 ID 的 feature,如果不存在则返回 null。
  71536. */
  71537. getFeatureById(featureId) {
  71538. return this.getFeatureBy('id', featureId);
  71539. }
  71540. /**
  71541. * @function ol.source.Theme.prototype.getFeaturesByAttribute
  71542. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  71543. * @param {string} attrName - 属性的 key。
  71544. * @param {string} attrValue - 矢量要素的属性 ID。
  71545. * @returns {Array.<SuperMap.Feature.Vector>} 一个匹配的 feature 数组。
  71546. */
  71547. getFeaturesByAttribute(attrName, attrValue) {
  71548. var feature,
  71549. foundFeatures = [];
  71550. for (var id in this.features) {
  71551. feature = this.features[id];
  71552. //feature = this.features[id].clone();
  71553. if (feature && feature.attributes) {
  71554. if (feature.attributes[attrName] === attrValue) {
  71555. foundFeatures.push(feature);
  71556. }
  71557. }
  71558. }
  71559. return foundFeatures;
  71560. }
  71561. /**
  71562. * @function ol.source.Theme.prototype.redrawThematicFeatures
  71563. * @description 抽象方法,可实例化子类必须实现此方法。重绘专题要素。
  71564. * @param {Array} extent - 当前级别下计算出的地图范围。
  71565. */
  71566. redrawThematicFeatures(extent) { //eslint-disable-line no-unused-vars
  71567. }
  71568. /**
  71569. * @function ol.source.Theme.prototype.on
  71570. * @description 添加专题要素事件监听。支持的事件包括: click、mousedown、mousemove、mouseout、mouseover、mouseup。
  71571. * @param {string} event - 事件名称。
  71572. * @param {RequestCallback} callback - 事件回调函数。
  71573. */
  71574. on(event, callback) {
  71575. var cb = callback;
  71576. if (!this.renderer) {
  71577. var evn = [];
  71578. evn.push(event);
  71579. evn.push(cb);
  71580. this.TFEvents.push(evn);
  71581. } else {
  71582. this.renderer.on(event, cb);
  71583. }
  71584. }
  71585. /**
  71586. * @function ol.source.Theme.prototype.fire
  71587. * @description 添加专题要素事件监听。
  71588. * @param {string} type - 事件类型。
  71589. * @param {string} event - 事件名称。
  71590. */
  71591. fire(type, event) {
  71592. if (!this.offset) {
  71593. return;
  71594. }
  71595. event = event.originalEvent;
  71596. var x = this.getX(event);
  71597. var y = this.getY(event);
  71598. var rotation = -this.map.getView().getRotation();
  71599. var center = this.map.getPixelFromCoordinate(this.map.getView().getCenter());
  71600. var scaledP = this.scale([x, y], center, this.pixelRatio);
  71601. var rotatedP = this.rotate(scaledP, rotation, center);
  71602. var resultP = [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  71603. var offsetEvent = document.createEvent('Event');
  71604. offsetEvent.initEvent('pointermove', true, true);
  71605. offsetEvent.offsetX = resultP[0];
  71606. offsetEvent.offsetY = resultP[1];
  71607. offsetEvent.layerX = resultP[0];
  71608. offsetEvent.layerY = resultP[1];
  71609. offsetEvent.clientX = resultP[0];
  71610. offsetEvent.clientY = resultP[1];
  71611. offsetEvent.x = x;
  71612. offsetEvent.y = y;
  71613. if (type === 'click') {
  71614. this.renderer.handler._clickHandler(offsetEvent);
  71615. }
  71616. if (type === 'dblclick') {
  71617. this.renderer.handler._dblclickHandler(offsetEvent);
  71618. }
  71619. if (type === 'onmousewheel') {
  71620. this.renderer.handler._mousewheelHandler(offsetEvent);
  71621. }
  71622. if (type === 'mousemove') {
  71623. this.renderer.handler._mousemoveHandler(offsetEvent);
  71624. this.changed();
  71625. }
  71626. if (type === 'onmouseout') {
  71627. this.renderer.handler._mouseoutHandler(offsetEvent);
  71628. }
  71629. if (type === 'onmousedown') {
  71630. this.renderer.handler._mousedownHandler(offsetEvent);
  71631. }
  71632. if (type === 'onmouseup') {
  71633. this.renderer.handler._mouseupHandler(offsetEvent);
  71634. }
  71635. }
  71636. getX(e) {
  71637. return typeof e.zrenderX != 'undefined' && e.zrenderX
  71638. || typeof e.offsetX != 'undefined' && e.offsetX
  71639. || typeof e.layerX != 'undefined' && e.layerX
  71640. || typeof e.clientX != 'undefined' && e.clientX;
  71641. }
  71642. getY(e) {
  71643. return typeof e.zrenderY != 'undefined' && e.zrenderY
  71644. || typeof e.offsetY != 'undefined' && e.offsetY
  71645. || typeof e.layerY != 'undefined' && e.layerY
  71646. || typeof e.clientY != 'undefined' && e.clientY;
  71647. }
  71648. /**
  71649. * @function ol.source.Theme.prototype.un
  71650. * @description 移除专题要素事件监听。
  71651. * @param {string} event - 事件名称。
  71652. * @param {RequestCallback} callback - 事件回调函数。
  71653. */
  71654. un(event, callback) {
  71655. var cb = callback;
  71656. if (!this.renderer) {
  71657. var tfEs = this.TFEvents;
  71658. var len = tfEs.length;
  71659. var newtfEs = [];
  71660. for (var i = 0; i < len; i++) {
  71661. var tfEs_i = tfEs[i];
  71662. if (!(tfEs_i[0] === event && tfEs_i[1] === cb)) {
  71663. newtfEs.push(tfEs_i)
  71664. }
  71665. }
  71666. this.TFEvents = newtfEs;
  71667. } else {
  71668. this.renderer.un(event, cb);
  71669. }
  71670. }
  71671. /**
  71672. * @function ol.source.Theme.prototype.addTFEvents
  71673. * @description 将图层添加到地图上之前用户要求添加的事件监听添加到图层。
  71674. * @private
  71675. */
  71676. addTFEvents() {
  71677. var tfEs = this.TFEvents;
  71678. var len = tfEs.length;
  71679. for (var i = 0; i < len; i++) {
  71680. this.renderer.on(tfEs[i][0], tfEs[i][1]);
  71681. }
  71682. }
  71683. /**
  71684. * @function ol.source.Theme.prototype.getLocalXY
  71685. * @description 获取坐标系统。
  71686. * @param {Object} coordinate - 坐标位置。
  71687. */
  71688. getLocalXY(coordinate) {
  71689. var pixelP, map = this.map;
  71690. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  71691. pixelP = map.getPixelFromCoordinate([coordinate.x, coordinate.y]);
  71692. }
  71693. if (coordinate instanceof LonLat) {
  71694. pixelP = map.getPixelFromCoordinate([coordinate.lon, coordinate.lat]);
  71695. }
  71696. var rotation = -map.getView().getRotation();
  71697. var center = map.getPixelFromCoordinate(map.getView().getCenter());
  71698. var rotatedP = pixelP;
  71699. if (this.pixelRatio) {
  71700. rotatedP = this.scale(pixelP, center, this.pixelRatio);
  71701. }
  71702. if (pixelP && center) {
  71703. rotatedP = this.rotate(rotatedP, rotation, center);
  71704. }
  71705. if (this.offset && rotatedP) {
  71706. return [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  71707. }
  71708. return rotatedP;
  71709. }
  71710. /**
  71711. * @function ol.source.Theme.prototype.rotate
  71712. * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。
  71713. * @param {number} pixelP - 像素坐标点位置。
  71714. * @param {number} rotation - 旋转角度。
  71715. * @param {number} center - 中心位置。
  71716. */
  71717. rotate(pixelP, rotation, center) {
  71718. var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  71719. var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  71720. return [x, y];
  71721. }
  71722. /**
  71723. * @function ol.source.Theme.prototype.scale
  71724. * @description 获取某像素坐标点 pixelP 相对于中心 center 进行缩放 scaleRatio 倍后的像素点坐标。
  71725. * @param {Object} pixelP - 像素点。
  71726. * @param {Object} center - 中心点。
  71727. * @param {number} scaleRatio - 缩放倍数。
  71728. * @returns {Array.<number>} 返回数组形比例
  71729. */
  71730. scale(pixelP, center, scaleRatio) {
  71731. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  71732. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  71733. return [x, y];
  71734. }
  71735. /**
  71736. * @function ol.source.Theme.prototype.toiClientFeature
  71737. * @description 转为 iClient 要素。
  71738. * @param {(ol.supermap.ThemeFeature|GeoJSONObject|ol/Feature)} features - 待转要素。
  71739. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素
  71740. */
  71741. toiClientFeature(features) {
  71742. if (!Util.isArray(features)) {
  71743. features = [features];
  71744. }
  71745. let featuresTemp = [];
  71746. for (let i = 0; i < features.length; i++) {
  71747. if (features[i] instanceof ThemeFeature) {
  71748. //ol.supermap.ThemeFeature 类型
  71749. featuresTemp.push(features[i].toFeature());
  71750. continue;
  71751. } else if (features[i] instanceof (external_ol_Feature_default())) {
  71752. //ol/Feature 数据类型
  71753. //_toFeature 统一处理 ol/Feature 所有 geometry 类型
  71754. featuresTemp.push(this._toFeature(features[i]));
  71755. continue;
  71756. } else if (features[i] instanceof Vector) {
  71757. // 若是 GeometryVector 直接返回
  71758. featuresTemp.push(features[i]);
  71759. continue;
  71760. } else if (features[i].geometry && features[i].geometry.parts) {
  71761. //iServer服务器返回数据格式
  71762. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  71763. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  71764. //GeoJSON 规范数据类型
  71765. const format = new GeoJSON();
  71766. featuresTemp = featuresTemp.concat(format.read(features[i]));
  71767. } else {
  71768. throw new Error(`features[${i}]'s type is not be supported.`);
  71769. }
  71770. }
  71771. return featuresTemp;
  71772. }
  71773. /**
  71774. * @function ol.source.Theme.prototype.toFeature
  71775. * @deprecated
  71776. * @description 转为 iClient 要素,该方法将被弃用,由 {@link ol.source.Theme#toiClientFeature} 代替。
  71777. * @param {(ol.supermap.ThemeFeature|GeoJSONObject|ol/Feature)} features - 待转要素。
  71778. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素
  71779. */
  71780. toFeature(features) {
  71781. return this.toiClientFeature(features);
  71782. }
  71783. //统一处理 ol/feature所有 geometry 类型
  71784. _toFeature(feature) {
  71785. let geoFeature = (new (external_ol_format_GeoJSON_default())()).writeFeature(feature);
  71786. return new GeoJSON().read(geoFeature, "Feature");
  71787. }
  71788. }
  71789. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Graph.js
  71790. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  71791. * This program are made available under the terms of the Apache License, Version 2.0
  71792. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  71793. /**
  71794. * @class ol.source.Graph
  71795. * @category Visualization Theme
  71796. * @classdesc 统计专题图图层基类。
  71797. * @param {string} chartsType - 图表类别。
  71798. * @param {string} name - 图层名称。
  71799. * @param {Object} opt_options - 参数。
  71800. * @param {ol/Map} opt_options.map - 当前 Map 对象。
  71801. * @param {string} opt_options.chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  71802. * @param {Object} opt_options.chartsSetting - 各类型图表的 chartsSetting 对象可设属性请参考具体图表模型类的注释中对 chartsSetting 对象可设属性的描述。chartsSetting 对象通常都具有以下几个基础可设属性。
  71803. * @param {number} opt_options.chartsSetting.width - 专题要素(图表)宽度。
  71804. * @param {number} opt_options.chartsSetting.height - 专题要素(图表)高度。
  71805. * @param {Array.<number>} opt_options.chartsSetting.codomain - 值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  71806. * @param {number} [opt_options.chartsSetting.XOffset] - 专题要素(图表)在 X 方向上的偏移值,单位像素。
  71807. * @param {number} [opt_options.chartsSetting.YOffset] - 专题要素(图表)在 Y 方向上的偏移值,单位像素。
  71808. * @param {Array.<number>} [opt_options.chartsSetting.dataViewBoxParameter] - 数据视图框 dataViewBox 参数,它是指图表框 chartBox(由图表位置、图表宽度、图表高度构成的图表范围框)在左、下,右,上四个方向上的内偏距值,长度为 4 的一维数组。
  71809. * @param {number} [opt_options.chartsSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  71810. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  71811. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  71812. * @param {number} [opt_options.opacity = 1] - 图层透明度。
  71813. * @param {string} [opt_option.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  71814. * @param {ol/proj/Projection} [opt_options.projection] - {@link ol/proj/Projection} 投影信息。
  71815. * @param {number} [opt_options.ratio=1.5] - 视图比, 1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  71816. * @param {Array.<number>} [opt_options.resolutions] - 分辨率数组。
  71817. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  71818. * @param {ol/source/State} [opt_options.state] - 资源状态。
  71819. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  71820. * @extends {ol.source.Theme}
  71821. */
  71822. class Graph_Graph extends theme_Theme_Theme {
  71823. constructor(name, chartsType, opt_options) {
  71824. super(name, opt_options);
  71825. this.chartsSetting = opt_options.chartsSetting || {};
  71826. this.themeFields = opt_options.themeFields || null;
  71827. this.overlayWeightField = opt_options.overlayWeightField || null;
  71828. this.isOverLay = opt_options.isOverLay === undefined ? true : opt_options.isOverLay;
  71829. this.charts = opt_options.charts || [];
  71830. this.cache = opt_options.cache || {};
  71831. this.chartsType = chartsType;
  71832. }
  71833. /**
  71834. * @function ol.source.Graph.prototype.destroy
  71835. * @description 释放资源,将引用资源的属性置空。
  71836. */
  71837. destroy() {
  71838. this.chartsType = null;
  71839. this.chartsSetting = null;
  71840. this.themeFields = null;
  71841. this.overlayWeightField = null;
  71842. this.isOverLay = null;
  71843. theme_Theme_Theme.prototype.destroy.apply(this, arguments);
  71844. // charts cache 为缓存,需要在父类destory后置为null(父类destory中有方法会初始化缓存参数)
  71845. this.charts = null;
  71846. this.cache = null;
  71847. }
  71848. /**
  71849. * @function ol.source.Graph.prototype.setChartsType
  71850. * @description 设置图表类型,此函数可动态改变图表类型。在调用此函数前请通过 chartsSetting 为新类型的图表做相关配置。
  71851. * @param {string} chartsType - 图表类型。目前可用:"Bar","Bar3D","Line","Point","Pie","Ring"。
  71852. */
  71853. setChartsType(chartsType) {
  71854. this.chartsType = chartsType;
  71855. this.redraw();
  71856. }
  71857. /**
  71858. * @function ol.source.Graph.prototype.addFeatures
  71859. * @description 向专题图图层中添加数据。
  71860. * @param {(SuperMap.ServerFeature|L.supermap.themeFeature)} features - 待添加的要素。
  71861. */
  71862. addFeatures(features) {
  71863. var ret = this.dispatchEvent({
  71864. type: 'beforefeaturesadded',
  71865. value: {
  71866. features: features
  71867. }
  71868. });
  71869. if (ret === false) {
  71870. return;
  71871. }
  71872. //转换 features 形式
  71873. this.features = this.toiClientFeature(features);
  71874. //绘制专题要素
  71875. if (this.renderer) {
  71876. this.changed();
  71877. }
  71878. }
  71879. /**
  71880. * @function ol.source.Graph.prototype.redrawThematicFeatures
  71881. * @description 重绘所有专题要素。
  71882. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  71883. * 地图漫游时调用此方法进行图层刷新。
  71884. * @param {Object} extent - 重绘的范围。
  71885. *
  71886. */
  71887. redrawThematicFeatures(extent) {
  71888. //清除当前所有可视元素
  71889. this.renderer.clearAll();
  71890. var features = this.features;
  71891. for (var i = 0, len = features.length; i < len; i++) {
  71892. var feature = features[i];
  71893. // 要素范围判断
  71894. var feaBounds = feature.geometry.getBounds();
  71895. //剔除当前视图(地理)范围以外的数据
  71896. if (extent) {
  71897. var bounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  71898. if (!bounds.intersectsBounds(feaBounds)) {
  71899. continue;
  71900. }
  71901. }
  71902. var cache = this.cache;
  71903. // 用 feature id 做缓存标识
  71904. var cacheField = feature.id;
  71905. // 数据对应的图表是否已缓存,没缓存则重新创建图表
  71906. if (cache[cacheField]) {
  71907. continue;
  71908. }
  71909. cache[cacheField] = cacheField;
  71910. var chart = this.createThematicFeature(feature);
  71911. // 压盖处理权重值
  71912. if (chart && this.overlayWeightField) {
  71913. if (feature.attributes[this.overlayWeightField] && !isNaN(feature.attributes[this.overlayWeightField])) {
  71914. chart["__overlayWeight"] = feature.attributes[this.overlayWeightField];
  71915. }
  71916. }
  71917. if (chart) {
  71918. this.charts.push(chart);
  71919. }
  71920. }
  71921. this.drawCharts();
  71922. }
  71923. /**
  71924. * @function ol.source.Graph.prototype.createThematicFeature
  71925. * @description 向专题图图层中添加数据, 支持的 feature 类型为:iServer 返回的 feature JSON 对象。
  71926. * @param {SuperMap.ServerFeature} feature - 待添加的要素。
  71927. *
  71928. */
  71929. createThematicFeature(feature) {
  71930. var thematicFeature;
  71931. // 检查图表创建条件并创建图形
  71932. if (Theme_Theme[this.chartsType] && this.themeFields && this.chartsSetting) {
  71933. thematicFeature = new Theme_Theme[this.chartsType](feature, this, this.themeFields, this.chartsSetting);
  71934. }
  71935. // thematicFeature 是否创建成功
  71936. if (!thematicFeature) {
  71937. return false;
  71938. }
  71939. // 对专题要素执行图形装载
  71940. thematicFeature.assembleShapes();
  71941. return thematicFeature;
  71942. }
  71943. /**
  71944. * @function ol.source.Graph.prototype.drawCharts
  71945. * @description 绘制图表。包含压盖处理。
  71946. *
  71947. */
  71948. drawCharts() {
  71949. // 判断 rendere r就绪
  71950. if (!this.renderer) {
  71951. return;
  71952. }
  71953. var charts = this.charts;
  71954. // 图表权重值处理
  71955. if (this.overlayWeightField) {
  71956. charts.sort(function (cs, ce) {
  71957. if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  71958. return 0;
  71959. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) == "undefined") {
  71960. return -1;
  71961. } else if (typeof (cs["__overlayWeight"]) == "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  71962. return 1;
  71963. } else if (typeof (cs["__overlayWeight"]) != "undefined" && typeof (ce["__overlayWeight"]) != "undefined") {
  71964. if (parseFloat(cs["__overlayWeight"]) < parseFloat(ce["__overlayWeight"])) {
  71965. return 1;
  71966. } else {
  71967. return -1;
  71968. }
  71969. }
  71970. return 0;
  71971. });
  71972. }
  71973. // 不进行避让
  71974. if (!this.isOverLay) {
  71975. for (var m = 0, len_m = charts.length; m < len_m; m++) {
  71976. var chart_m = charts[m];
  71977. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  71978. var shapeROP_m = chart_m.resetLocation();
  71979. // 添加图形
  71980. var shapes_m = chart_m.shapes;
  71981. for (var n = 0, slen_n = shapes_m.length; n < slen_n; n++) {
  71982. shapes_m[n].refOriginalPosition = shapeROP_m;
  71983. this.renderer.addShape(shapes_m[n]);
  71984. }
  71985. }
  71986. } else {
  71987. // 压盖判断所需 chartsBounds 集合
  71988. var chartsBounds = [];
  71989. var extent = this.map.getView().calculateExtent();
  71990. var mapBounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  71991. // 获取地图像素 bounds
  71992. var mapPxLT = this.getLocalXY(new LonLat(mapBounds.left, mapBounds.top));
  71993. var mapPxRB = this.getLocalXY(new LonLat(mapBounds.right, mapBounds.bottom));
  71994. var mBounds = new Bounds(mapPxLT[0], mapPxRB[1], mapPxRB[0], mapPxLT[1]);
  71995. // 压盖处理 & 添加图形
  71996. for (var i = 0, len = charts.length; i < len; i++) {
  71997. var chart = charts[i];
  71998. // 图形参考位置 (reSetLocation 会更新 chartBounds)
  71999. var shapeROP = chart.resetLocation();
  72000. // 图表框
  72001. var cbs = chart.chartBounds;
  72002. var cBounds = [{
  72003. "x": cbs.left,
  72004. "y": cbs.top
  72005. }, {
  72006. "x": cbs.left,
  72007. "y": cbs.bottom
  72008. }, {
  72009. "x": cbs.right,
  72010. "y": cbs.bottom
  72011. }, {
  72012. "x": cbs.right,
  72013. "y": cbs.top
  72014. }, {
  72015. "x": cbs.left,
  72016. "y": cbs.top
  72017. }];
  72018. // 地图范围外不绘制
  72019. if (mBounds) {
  72020. if (!this.isChartInMap(mBounds, cBounds)) {
  72021. continue;
  72022. }
  72023. }
  72024. // 是否压盖
  72025. var isOL = false;
  72026. if (i !== 0) {
  72027. for (let j = 0; j < chartsBounds.length; j++) {
  72028. //压盖判断
  72029. if (this.isQuadrilateralOverLap(cBounds, chartsBounds[j])) {
  72030. isOL = true;
  72031. break;
  72032. }
  72033. }
  72034. }
  72035. if (isOL) {
  72036. continue;
  72037. } else {
  72038. chartsBounds.push(cBounds);
  72039. }
  72040. // 添加图形
  72041. var shapes = chart.shapes;
  72042. for (let j = 0, slen = shapes.length; j < slen; j++) {
  72043. shapes[j].refOriginalPosition = shapeROP;
  72044. this.renderer.addShape(shapes[j]);
  72045. }
  72046. }
  72047. }
  72048. // 绘制图形
  72049. this.renderer.render();
  72050. }
  72051. /**
  72052. * @function ol.source.Graph.prototype.getShapesByFeatureID
  72053. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  72054. * @param {number} featureID - 要素 ID。
  72055. */
  72056. getShapesByFeatureID(featureID) {
  72057. var list = [];
  72058. var shapeList = this.renderer.getAllShapes();
  72059. if (!featureID) {
  72060. return shapeList
  72061. }
  72062. for (var i = 0, len = shapeList.length; i < len; i++) {
  72063. var si = shapeList[i];
  72064. if (si.refDataID && featureID === si.refDataID) {
  72065. list.push(si);
  72066. }
  72067. }
  72068. return list;
  72069. }
  72070. /**
  72071. * @function ol.source.Graph.prototype.isQuadrilateralOverLap
  72072. * @description 判断两个四边形是否有压盖。
  72073. * @param {Array.<Object>} quadrilateral - 四边形节点数组。
  72074. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  72075. */
  72076. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  72077. var quadLen = quadrilateral.length,
  72078. quad2Len = quadrilateral2.length;
  72079. if (quadLen !== 5 || quad2Len !== 5) {
  72080. return null;
  72081. } //不是四边形
  72082. var OverLap = false;
  72083. //如果两四边形互不包含对方的节点,则两个四边形不相交
  72084. for (let i = 0; i < quadLen; i++) {
  72085. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  72086. OverLap = true;
  72087. break;
  72088. }
  72089. }
  72090. for (let i = 0; i < quad2Len; i++) {
  72091. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  72092. OverLap = true;
  72093. break;
  72094. }
  72095. }
  72096. //加上两矩形十字相交的情况
  72097. for (let i = 0; i < quadLen - 1; i++) {
  72098. if (OverLap) {
  72099. break;
  72100. }
  72101. for (let j = 0; j < quad2Len - 1; j++) {
  72102. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  72103. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  72104. OverLap = true;
  72105. break;
  72106. }
  72107. }
  72108. }
  72109. return OverLap;
  72110. }
  72111. /**
  72112. * @function ol.source.Graph.prototype.isPointInPoly
  72113. * @description 判断一个点是否在多边形里面。(射线法)。
  72114. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  72115. * @param {Array.<Object>} poly - 多边形节点数组。
  72116. */
  72117. isPointInPoly(pt, poly) {
  72118. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  72119. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  72120. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  72121. (isIn = !isIn);
  72122. }
  72123. return isIn;
  72124. }
  72125. /**
  72126. * @function ol.source.Graph.prototype.isChartInMap
  72127. * @description 判断图表是否在地图里。
  72128. * @param {SuperMap.Bounds} mapPxBounds - 地图像素范围。
  72129. * @param {Array.<Object>} chartPxBounds - 图表范围的四边形节点数组。
  72130. */
  72131. isChartInMap(mapPxBounds, chartPxBounds) {
  72132. var mb = mapPxBounds;
  72133. var isIn = false;
  72134. for (var i = 0, len = chartPxBounds.length; i < len; i++) {
  72135. var cb = chartPxBounds[i];
  72136. if (cb.x >= mb.left && cb.x <= mb.right && cb.y >= mb.top && cb.y <= mb.bottom) {
  72137. isIn = true;
  72138. break;
  72139. }
  72140. }
  72141. return isIn;
  72142. }
  72143. /**
  72144. * @function ol.source.Graph.prototype.clearCache
  72145. * @description 清除缓存。
  72146. */
  72147. clearCache() {
  72148. this.cache = {};
  72149. this.charts = [];
  72150. }
  72151. /**
  72152. * @function ol.source.Graph.prototype.removeFeatures
  72153. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。参数中的 features 数组中的每一项,必须是已经添加到当前图层中的 feature。
  72154. * @param {SuperMap.Feature.Vector} features - 要删除的要素。
  72155. */
  72156. removeFeatures(features) {
  72157. this.clearCache();
  72158. super.removeFeatures(features);
  72159. }
  72160. /**
  72161. * @function ol.source.Graph.prototype.removeAllFeatures
  72162. * @description 移除所有的要素
  72163. */
  72164. removeAllFeatures() {
  72165. this.clearCache();
  72166. super.removeAllFeatures();
  72167. }
  72168. /**
  72169. * @function ol.source.Graph.prototype.redraw
  72170. * @description 重绘该图层
  72171. */
  72172. redraw() {
  72173. this.clearCache();
  72174. if (this.renderer) {
  72175. this.redrawThematicFeatures(this.map.getView().calculateExtent());
  72176. return true;
  72177. }
  72178. return false
  72179. }
  72180. /**
  72181. * @function ol.source.Graph.prototype.clear
  72182. * @description 清除的内容包括数据(features) 、专题要素、缓存。
  72183. */
  72184. clear() {
  72185. if (this.renderer) {
  72186. this.renderer.clearAll();
  72187. this.renderer.refresh();
  72188. }
  72189. this.removeAllFeatures();
  72190. this.clearCache();
  72191. }
  72192. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  72193. return theme_Theme_Theme.prototype.canvasFunctionInternal_.apply(this, arguments);
  72194. }
  72195. }
  72196. ;// CONCATENATED MODULE: external "ol.style.RegularShape"
  72197. const external_ol_style_RegularShape_namespaceObject = ol.style.RegularShape;
  72198. var external_ol_style_RegularShape_default = /*#__PURE__*/__webpack_require__.n(external_ol_style_RegularShape_namespaceObject);
  72199. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/CloverShape.js
  72200. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72201. * This program are made available under the terms of the Apache License, Version 2.0
  72202. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72203. /**
  72204. * @class ol.style.CloverShape
  72205. * @category Visualization Graphic
  72206. * @classdesc 三叶草要素风格。
  72207. * @extends {ol/style/RegularShape}
  72208. * @param {Object} options - 三叶草形要素风格参数。
  72209. * @param {number} [options.angle=30] - 三叶草每个扇叶的圆心角,单位弧度。
  72210. * @param {number} [options.count=3] - 扇叶数量。
  72211. * @param {ol/style/Fill} [options.fill] - 填充样式。
  72212. * @param {number} [options.strokeOpacity] - 透明度。
  72213. * @param {number} [options.fillOpacity] - 填充透明度。
  72214. * @param {number} [options.radius] - 半径。
  72215. * @param {ol/style/Stroke} [options.stroke] - 边框样式。
  72216. * @param {string} [options.stroke.color='#3388ff'] - 边框颜色。
  72217. * @param {number} [options.stroke.width=1] - 边框宽度。
  72218. */
  72219. class CloverShape extends (external_ol_style_RegularShape_default()) {
  72220. constructor(options) {
  72221. if (options.stroke) {
  72222. options.stroke.color = options.stroke.getColor() || "#3388ff";
  72223. options.stroke.width = options.stroke.getWidth() || 1;
  72224. } else {
  72225. options.stroke = new (external_ol_style_Stroke_default())({
  72226. color: "#3388ff",
  72227. width: 1
  72228. })
  72229. }
  72230. if (options.fill) {
  72231. options.fill.color = options.fill.getColor() || "#66ccff";
  72232. } else {
  72233. options.fill = new (external_ol_style_Fill_default())({
  72234. color: "#66ccff"
  72235. })
  72236. }
  72237. super({
  72238. angle: options.angle || 60,
  72239. stroke: options.stroke,
  72240. fill: options.fill,
  72241. radius: options.radius || 10,
  72242. rotation: options.rotation || 0
  72243. });
  72244. this.count_ = options.count || 3;
  72245. this.strokeOpacity = options.strokeOpacity || 1;
  72246. this.fillOpacity = options.fillOpacity || 1;
  72247. this._canvas = this.getImage();
  72248. this._ctx = this._canvas.getContext('2d');
  72249. this._render();
  72250. }
  72251. _render() {
  72252. //起始角度
  72253. var sAngle = 0;
  72254. var eAngle = this.getAngle();
  72255. this.spaceAngle = 360 / this.count_ - this.getAngle();
  72256. if (this.spaceAngle < 0) {
  72257. return;
  72258. }
  72259. this._ctx.translate(0, 0);
  72260. this._ctx.beginPath();
  72261. for (var i = 0; i < this.count_; i++) {
  72262. this._drawSector(this._ctx, this.getAnchor()[0], this.getAnchor()[1], this.getRadius(), sAngle, eAngle);
  72263. sAngle = eAngle + this.spaceAngle;
  72264. eAngle = sAngle + this.getAngle();
  72265. }
  72266. this._fillStroke();
  72267. this._ctx.closePath();
  72268. }
  72269. /**
  72270. * @function ol.style.CloverShape.prototype.drawSector
  72271. * @description 绘制扇形。
  72272. * @param {CanvasRenderingContext2D} ctx - context 对象
  72273. * @param {number} x - 中心点 x。
  72274. * @param {number} y - 中心点 y。
  72275. * @param {number} r - 中心点 r。
  72276. * @param {number} sAngle - 扇叶起始角度。
  72277. * @param {number} eAngle - 扇叶终止角度。
  72278. */
  72279. _drawSector(ctx, x, y, r, sAngle, eAngle) {
  72280. //角度转换
  72281. sAngle = sAngle / 180 * Math.PI;
  72282. eAngle = eAngle / 180 * Math.PI;
  72283. ctx.moveTo(x, y);
  72284. ctx.lineTo(x + r * Math.cos(sAngle), y + r * Math.sin(sAngle));
  72285. ctx.arc(x, y, r, sAngle, eAngle);
  72286. ctx.lineTo(x, y);
  72287. }
  72288. _fillStroke() {
  72289. if (this.getFill()) {
  72290. this._ctx.globalAlpha = this.fillOpacity;
  72291. this._ctx.fillStyle = this.getFill().color;
  72292. this._ctx.fill();
  72293. }
  72294. if (this.getStroke() && this.weight !== 0) {
  72295. this._ctx.globalAlpha = this.strokeOpacity;
  72296. this._ctx.lineWidth = this.getStroke().width;
  72297. this._ctx.strokeStyle = this.getStroke().color;
  72298. this._ctx.lineCap = this.getStroke().lineCap;
  72299. this._ctx.lineJoin = this.getStroke().lineJoin;
  72300. this._ctx.stroke();
  72301. }
  72302. }
  72303. /**
  72304. * @function ol.style.CloverShape.prototype.getCount
  72305. * @description 获取扇叶数量。
  72306. */
  72307. getCount() {
  72308. return this.count_;
  72309. }
  72310. /**
  72311. * @function ol.style.CloverShape.prototype.getSpaceAngle
  72312. * @description 获取扇叶间隔角度。
  72313. */
  72314. getSpaceAngle() {
  72315. return this.spaceAngle;
  72316. }
  72317. }
  72318. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/HitCloverShape.js
  72319. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72320. * This program are made available under the terms of the Apache License, Version 2.0
  72321. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72322. /**
  72323. * @class ol.style.HitCloverShape
  72324. * @category Visualization Graphic
  72325. * @classdesc 三叶草要素高亮风格。
  72326. * @extends {ol.style.CloverShape}
  72327. * @param {Object} options - 三叶草形要素风格参数。
  72328. * @param {number} options.sAngle - 扇叶起始角度。
  72329. * @param {number} options.eAngle - 扇叶终止角度。
  72330. * @param {number} [options.angle = 30] - 三叶草每个扇叶的圆心角,单位弧度。
  72331. * @param {ol/style/Fill} [options.fill] - 填充样式。
  72332. * @param {ol/style/Stroke} [options.stroke] - 边框样式。
  72333. * @param {number} [options.strokeOpacity] - 透明度。
  72334. * @param {number} [options.fillOpacity] - 填充透明度。
  72335. * @param {number} [options.radius] - 半径。
  72336. */
  72337. class HitCloverShape extends CloverShape {
  72338. constructor(options) {
  72339. super(options);
  72340. this.sAngle = options.sAngle;
  72341. this.eAngle = options.eAngle;
  72342. this._render();
  72343. }
  72344. _render() {
  72345. // draw the circle on the canvas
  72346. this._ctx.clearRect(0, 0, this.getImage().width, this.getImage().height);
  72347. // reset transform
  72348. this._ctx.setTransform(1, 0, 0, 1, 0, 0);
  72349. this._ctx.translate(0, 0);
  72350. this._ctx.beginPath();
  72351. this._drawSector(this._ctx, this.getAnchor()[0], this.getAnchor()[1], this.getRadius(), this.sAngle, this.eAngle);
  72352. this._fillStroke();
  72353. this._ctx.closePath();
  72354. }
  72355. /**
  72356. * @function ol.style.HitCloverShape.prototype.getSAngle
  72357. * @description 获取扇叶起始角度。
  72358. */
  72359. getSAngle() {
  72360. return this.sAngle;
  72361. }
  72362. /**
  72363. * @function ol.style.HitCloverShape.prototype.getEAngle
  72364. * @description 获取扇叶终止角度。
  72365. */
  72366. getEAngle() {
  72367. return this.eAngle;
  72368. }
  72369. }
  72370. ;// CONCATENATED MODULE: external "ol.Object"
  72371. const external_ol_Object_namespaceObject = ol.Object;
  72372. var external_ol_Object_default = /*#__PURE__*/__webpack_require__.n(external_ol_Object_namespaceObject);
  72373. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/WebGLRenderer.js
  72374. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72375. * This program are made available under the terms of the Apache License, Version 2.0
  72376. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72377. const emptyFunc = () => false;
  72378. const CSS_TRANSFORM = (function () {
  72379. let div = document.createElement('div');
  72380. let props = [
  72381. 'transform',
  72382. 'WebkitTransform',
  72383. 'MozTransform',
  72384. 'OTransform',
  72385. 'msTransform'
  72386. ];
  72387. for (let i = 0; i < props.length; i++) {
  72388. let prop = props[i];
  72389. if (div.style[prop] !== undefined) {
  72390. return prop;
  72391. }
  72392. }
  72393. return props[0];
  72394. })();
  72395. /**
  72396. * @private
  72397. * @class GraphicWebGLRenderer
  72398. * @classdesc 高效率点图层 webgl 渲染器。
  72399. * @category Visualization Graphic
  72400. * @extends {ol/Object}
  72401. * @param {ol.source.Graphic} layer - 高效率点图层。
  72402. * @param {Object} options - 图层参数。
  72403. * @param {number} options.width - 地图宽度。
  72404. * @param {number} options.height - 地图高度。
  72405. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  72406. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 颜色,目前只支持 rgba 数组。
  72407. * @param {number} [options.radius=10] - 半径。
  72408. * @param {number} [options.opacity=0.8] - 不透明度。
  72409. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  72410. * @param {number} [options.radiusScale = 1] - 点放大倍数。
  72411. * @param {number} [options.radiusMinPixels = 0] - 半径最小值(像素)。
  72412. * @param {number} [options.radiusMaxPixels = Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  72413. * @param {number} [options.strokeWidth = 1] - 边框大小。
  72414. * @param {boolean} [options.outline = false] - 是否显示边框。
  72415. * @param {function} [options.onClick] - 点击事件。
  72416. * @param {function} [options.onHover] - 悬停事件。
  72417. */
  72418. class GraphicWebGLRenderer extends (external_ol_Object_default()) {
  72419. constructor(layer, options) {
  72420. super();
  72421. this.layer = layer;
  72422. this.map = layer.map;
  72423. let opt = options || {};
  72424. Util.extend(this, opt);
  72425. let pixelRatio = this.pixelRatio = window ? window.devicePixelRatio : 1;
  72426. this.width = this.map.getSize()[0] * pixelRatio;
  72427. this.height = this.map.getSize()[1] * pixelRatio;
  72428. this.center = this.map.getView().getCenter();
  72429. this._initContainer();
  72430. this._registerEvents();
  72431. }
  72432. _registerEvents() {
  72433. let map = this.map;
  72434. let view = map.getView();
  72435. map.on('change:size', this._resizeEvent.bind(this), this);
  72436. view.on('change:resolution', this._moveEndEvent.bind(this), this);
  72437. view.on('change:center', this._moveEvent.bind(this), this);
  72438. view.on('change:rotation', this._moveEndEvent.bind(this), this);
  72439. map.on('moveend', this._moveEndEvent.bind(this), this)
  72440. }
  72441. _resizeEvent() {
  72442. this._resize();
  72443. this._clearAndRedraw();
  72444. }
  72445. _moveEvent() {
  72446. let oldCenterPixel = this.map.getPixelFromCoordinate(this.center);
  72447. let newCenterPixel = this.map.getPixelFromCoordinate(this.map.getView().getCenter());
  72448. let offset = [oldCenterPixel[0] - newCenterPixel[0], oldCenterPixel[1] - newCenterPixel[1]];
  72449. this._canvas.style[CSS_TRANSFORM] = 'translate(' + Math.round(offset[0]) + 'px,' + Math.round(offset[1]) + 'px)';
  72450. }
  72451. _moveEndEvent() {
  72452. this._canvas.style[CSS_TRANSFORM] = 'translate(0,0)';
  72453. this.center = this.map.getView().getCenter();
  72454. this._clearAndRedraw();
  72455. }
  72456. _clearAndRedraw() {
  72457. this._clearBuffer();
  72458. this.layer.changed();
  72459. }
  72460. _resize() {
  72461. const size = this.map.getSize();
  72462. const width = size[0] * this.pixelRatio;
  72463. const height = size[1] * this.pixelRatio;
  72464. this._canvas.width = width;
  72465. this._canvas.height = height;
  72466. this._canvas.style.width = width + 'px';
  72467. this._canvas.style.height = height + 'px';
  72468. }
  72469. _clearBuffer() {
  72470. if (!this.deckGL) {
  72471. return;
  72472. }
  72473. let lm = this.deckGL.layerManager;
  72474. lm && lm.context.gl.clear(lm.context.gl.COLOR_BUFFER_BIT);
  72475. return this;
  72476. }
  72477. /**
  72478. * @private
  72479. * @function GraphicWebGLRenderer.prototype.getCanvas
  72480. * @description 返回画布。
  72481. * @returns {HTMLCanvasElement} canvas 对象。
  72482. */
  72483. getCanvas() {
  72484. return this._canvas;
  72485. }
  72486. /**
  72487. * @private
  72488. * @function GraphicWebGLRenderer.prototype.update
  72489. * @description 更新图层,数据或者样式改变后调用。
  72490. */
  72491. update(graphics) {
  72492. if (graphics && graphics.length > -1) {
  72493. this._data = graphics;
  72494. }
  72495. if (!this._renderLayer) {
  72496. return;
  72497. }
  72498. this._renderLayer.setChangeFlags({
  72499. dataChanged: true,
  72500. propsChanged: true,
  72501. viewportChanged: true,
  72502. updateTriggersChanged: true
  72503. });
  72504. this._refreshData();
  72505. let state = this._getLayerState();
  72506. state.data = this._data || [];
  72507. this._renderLayer.setNeedsRedraw(true);
  72508. this._renderLayer.setState(state);
  72509. }
  72510. /**
  72511. * @private
  72512. * @function GraphicWebGLRenderer.prototype.drawGraphics
  72513. * @description 绘制点要素。
  72514. */
  72515. drawGraphics(graphics) {
  72516. this._data = graphics ? graphics : this._data ? this._data : [];
  72517. if (!this._renderLayer) {
  72518. this._createInnerRender();
  72519. }
  72520. this._clearBuffer();
  72521. this._draw();
  72522. }
  72523. _initContainer() {
  72524. this._canvas = this._createCanvas(this.width, this.height);
  72525. this._layerContainer = this.container;
  72526. this._wrapper = document.createElement('div');
  72527. this._wrapper.className = "deck-wrapper";
  72528. this._wrapper.style.position = "absolute";
  72529. this._wrapper.style.top = "0";
  72530. this._wrapper.style.left = "0";
  72531. this._wrapper.appendChild(this._canvas);
  72532. this._layerContainer && this._layerContainer.appendChild(this._wrapper);
  72533. }
  72534. _createCanvas(width, height) {
  72535. let canvas = document.createElement('canvas');
  72536. canvas.oncontextmenu = emptyFunc;
  72537. canvas.width = width;
  72538. canvas.height = height;
  72539. canvas.style.width = width + "px";
  72540. canvas.style.height = height + "px";
  72541. return canvas;
  72542. }
  72543. _createInnerRender() {
  72544. let me = this;
  72545. let state = this._getLayerState();
  72546. let {
  72547. color,
  72548. radius,
  72549. opacity,
  72550. highlightColor,
  72551. radiusScale,
  72552. radiusMinPixels,
  72553. radiusMaxPixels,
  72554. strokeWidth,
  72555. outline
  72556. } = state;
  72557. radius = this._pixelToMeter(radius);
  72558. let innerLayerOptions = {
  72559. id: 'scatter-plot',
  72560. data: [],
  72561. pickable: Boolean(this.onClick) || Boolean(this.onHover),
  72562. autoHighlight: true,
  72563. color: color,
  72564. opacity: opacity,
  72565. radius: radius,
  72566. radiusScale: radiusScale,
  72567. highlightColor: highlightColor,
  72568. radiusMinPixels: radiusMinPixels,
  72569. radiusMaxPixels: radiusMaxPixels,
  72570. strokeWidth: strokeWidth,
  72571. outline: outline,
  72572. getPosition(point) {
  72573. if (!point) {
  72574. return [0, 0, 0];
  72575. }
  72576. let geometry = point.getGeometry();
  72577. let coordinates = geometry && geometry.getCoordinates();
  72578. coordinates = me._project(coordinates);
  72579. return coordinates && [coordinates[0], coordinates[1], 0];
  72580. },
  72581. getColor(point) {
  72582. let defaultStyle = me._getLayerDefaultStyle();
  72583. let style = point && point.getStyle();
  72584. return style && style.getColor() || defaultStyle.color
  72585. },
  72586. getRadius(point) {
  72587. let defaultStyle = me._getLayerDefaultStyle();
  72588. let style = point && point.getStyle();
  72589. return style && style.getRadius() || defaultStyle.radius
  72590. },
  72591. updateTriggers: {
  72592. getColor: [color],
  72593. getRadius: [radius]
  72594. }
  72595. };
  72596. let _self = this;
  72597. if (this.onClick) {
  72598. innerLayerOptions.onClick = function () {
  72599. _self._canvas.style.cursor = "pointer";
  72600. _self.onClick.apply(_self, arguments)
  72601. };
  72602. }
  72603. if (this.onHover) {
  72604. innerLayerOptions.onHover = function () {
  72605. _self._canvas.style.cursor = "pointer";
  72606. _self.onHover.apply(_self, arguments)
  72607. };
  72608. }
  72609. me._renderLayer = new window.DeckGL.ScatterplotLayer(innerLayerOptions);
  72610. }
  72611. _getLayerDefaultStyle() {
  72612. let {
  72613. color,
  72614. opacity,
  72615. radius,
  72616. radiusScale,
  72617. radiusMinPixels,
  72618. radiusMaxPixels,
  72619. strokeWidth,
  72620. outline
  72621. } = this._getLayerState();
  72622. radius = this._pixelToMeter(radius);
  72623. return {
  72624. color,
  72625. opacity,
  72626. radius,
  72627. radiusScale,
  72628. radiusMinPixels,
  72629. radiusMaxPixels,
  72630. strokeWidth,
  72631. outline
  72632. }
  72633. }
  72634. _getLayerState() {
  72635. let state = this.layer.getLayerState();
  72636. let view = this.map.getView();
  72637. let projection = view.getProjection().getCode();
  72638. let center = external_ol_proj_namespaceObject.transform([state.longitude, state.latitude], projection, 'EPSG:4326')
  72639. state.longitude = center[0];
  72640. state.latitude = center[1];
  72641. state.zoom = state.zoom - 1;
  72642. return state;
  72643. }
  72644. _draw() {
  72645. this._refreshData();
  72646. let state = this._getLayerState();
  72647. state.data = this._data || [];
  72648. let deckOptions = {};
  72649. for (let key in state) {
  72650. deckOptions[key] = state[key];
  72651. }
  72652. this._renderLayer.setNeedsRedraw(true);
  72653. deckOptions.layers = [this._renderLayer];
  72654. deckOptions.canvas = this._canvas;
  72655. if (this.onBeforeRender) {
  72656. deckOptions.onBeforeRender = this.onBeforeRender.bind(this);
  72657. }
  72658. if (this.onAfterRender) {
  72659. deckOptions.onAfterRender = this.onAfterRender.bind(this);
  72660. }
  72661. if (!this.deckGL) {
  72662. this.deckGL = new window.DeckGL.experimental.DeckGLJS(deckOptions);
  72663. } else {
  72664. this.deckGL.setProps(deckOptions);
  72665. }
  72666. }
  72667. _refreshData() {
  72668. let graphics = this._data || [];
  72669. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  72670. //this.layer.props.data不能被重新赋值,只能在原数组上进行操作
  72671. if (!this._renderLayer.props.data) {
  72672. this._renderLayer.props.data = [];
  72673. }
  72674. this._renderLayer.props.data.length = 0;
  72675. for (let j = 0; j < sGraphics.length; j++) {
  72676. this._renderLayer.props.data.push(sGraphics[j]);
  72677. }
  72678. this._data = this._renderLayer.props.data;
  72679. }
  72680. _project(coordinates) {
  72681. let view = this.map.getView();
  72682. let projection = view.getProjection().getCode();
  72683. if ("EPSG:4326" === projection) {
  72684. return coordinates;
  72685. }
  72686. return external_ol_proj_namespaceObject.transform(coordinates, projection, 'EPSG:4326');
  72687. }
  72688. _pixelToMeter(pixel) {
  72689. let view = this.map.getView();
  72690. let projection = view.getProjection();
  72691. let unit = projection.getUnits() || 'degrees';
  72692. if (unit === 'degrees') {
  72693. unit = REST_Unit.DEGREE;
  72694. }
  72695. if (unit === 'm') {
  72696. unit = REST_Unit.METER;
  72697. }
  72698. const res = view.getResolution();
  72699. if (unit === REST_Unit.DEGREE) {
  72700. let meterRes= res*(Math.PI * 6378137 / 180);
  72701. return pixel * meterRes;
  72702. }else{
  72703. return pixel * res;
  72704. }
  72705. }
  72706. }
  72707. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/CanvasRenderer.js
  72708. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72709. * This program are made available under the terms of the Apache License, Version 2.0
  72710. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72711. //获取某像素坐标点pixelP相对于中心center进行缩放scaleRatio倍后的像素点坐标。
  72712. function scale(pixelP, center, scaleRatio) {
  72713. let x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  72714. let y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  72715. return [x, y];
  72716. }
  72717. /**
  72718. * @private
  72719. * @class GraphicCanvasRenderer
  72720. * @classdesc 高效率点图层 canvas 渲染器。
  72721. * @category Visualization Graphic
  72722. * @extends {ol/Object}
  72723. * @param {ol.source.Graphic} layer - 高效率点图层。
  72724. * @param {Object} options - 图层参数。
  72725. * @param {number} options.width - 地图宽度。
  72726. * @param {number} options.height - 地图高度。
  72727. * @param {HTMLElement} options.container - 放置渲染器的父元素。
  72728. * @param {Array.<number>} [options.colo=[0, 0, 0, 255]] - 颜色,目前只支持rgba数组。默认[0, 0, 0, 255],
  72729. * @param {number} [options.radius=10] - 半径。
  72730. * @param {number} [options.opacity=0.8] - 不透明度。
  72731. * @param {Array} [options.highlightColor] - 高亮颜色,目前只支持rgba数组。
  72732. * @param {number} [options.radiusScale] - 点放大倍数。
  72733. * @param {number} [options.radiusMinPixels] - 半径最小值(像素)。
  72734. * @param {number} [options.radiusMaxPixels] - 半径最大值(像素)。
  72735. * @param {number} [options.strokeWidth] - 边框大小。
  72736. * @param {boolean} [options.outline] - 是否显示边框。
  72737. * @param {function} [options.onClick] - 点击事件。
  72738. * @param {function} [options.onHover] - 悬停事件。
  72739. */
  72740. class GraphicCanvasRenderer extends (external_ol_Object_default()) {
  72741. constructor(layer, options) {
  72742. super();
  72743. this.layer = layer;
  72744. this.map = layer.map;
  72745. let opt = options || {};
  72746. Util.extend(this, opt);
  72747. this.highLightStyle = this.layer.highLightStyle;
  72748. this.mapWidth = this.size[0];
  72749. this.mapHeight = this.size[1];
  72750. this.width = this.map.getSize()[0];
  72751. this.height = this.map.getSize()[1];
  72752. this.context = core_Util_Util.createCanvasContext2D(this.mapWidth, this.mapHeight);
  72753. this.context.scale(this.pixelRatio, this.pixelRatio);
  72754. this.canvas = this.context.canvas;
  72755. this.canvas.style.width = this.width + 'px';
  72756. this.canvas.style.height = this.height + 'px';
  72757. this._registerEvents();
  72758. }
  72759. _registerEvents() {
  72760. this.map.on('change:size', this._resizeEvent.bind(this), this);
  72761. }
  72762. _resizeEvent() {
  72763. this._resize();
  72764. this._clearAndRedraw();
  72765. }
  72766. _resize() {
  72767. let size = this.map.getSize();
  72768. let width = size[0];
  72769. let height = size[1];
  72770. let xRatio = width / this.width;
  72771. let yRatio = height / this.height;
  72772. this.width = width;
  72773. this.height = height;
  72774. this.mapWidth = this.mapWidth * xRatio;
  72775. this.mapHeight = this.mapHeight * yRatio;
  72776. this.canvas.width = this.mapWidth;
  72777. this.canvas.height = this.mapHeight;
  72778. this.canvas.style.width = this.width + 'px';
  72779. this.canvas.style.height = this.height + 'px';
  72780. }
  72781. _clearAndRedraw() {
  72782. this._clearBuffer();
  72783. this.layer.changed();
  72784. }
  72785. update() {
  72786. this.layer.changed();
  72787. }
  72788. _clearBuffer() {}
  72789. /**
  72790. * @private
  72791. * @function GraphicCanvasRenderer.prototype.getCanvas
  72792. * @description 返回画布。
  72793. * @returns {HTMLCanvasElement} canvas 对象。
  72794. */
  72795. getCanvas() {
  72796. return this.canvas;
  72797. }
  72798. /**
  72799. * @private
  72800. * @function GraphicCanvasRenderer.prototype.drawGraphics
  72801. * @description 绘制点要素。
  72802. */
  72803. drawGraphics(graphics) {
  72804. this.graphics_ = graphics || [];
  72805. let mapWidth = this.mapWidth / this.pixelRatio;
  72806. let mapHeight = this.mapHeight / this.pixelRatio;
  72807. let vectorContext = external_ol_render_namespaceObject.toContext(this.context, {
  72808. size: [mapWidth, mapHeight],
  72809. pixelRatio: this.pixelRatio
  72810. });
  72811. var defaultStyle = this.layer._getDefaultStyle();
  72812. let me = this,
  72813. layer = me.layer,
  72814. map = layer.map;
  72815. graphics.map(function(graphic) {
  72816. let style = graphic.getStyle() || defaultStyle;
  72817. if (me.selected === graphic) {
  72818. let defaultHighLightStyle = style;
  72819. if (style instanceof external_ol_style_namespaceObject.Circle) {
  72820. defaultHighLightStyle = new external_ol_style_namespaceObject.Circle({
  72821. radius: style.getRadius(),
  72822. fill: new external_ol_style_namespaceObject.Fill({
  72823. color: 'rgba(0, 153, 255, 1)'
  72824. }),
  72825. stroke: style.getStroke(),
  72826. snapToPixel: core_Util_Util.getOlVersion() === '4' ? style.getSnapToPixel() : null
  72827. });
  72828. } else if (style instanceof external_ol_style_namespaceObject.RegularShape) {
  72829. defaultHighLightStyle = new external_ol_style_namespaceObject.RegularShape({
  72830. radius: style.getRadius(),
  72831. radius2: style.getRadius2(),
  72832. points: style.getPoints(),
  72833. angle: style.getAngle(),
  72834. snapToPixel: core_Util_Util.getOlVersion() === '4' ? style.getSnapToPixel() : null,
  72835. rotation: style.getRotation(),
  72836. rotateWithView: style.getRotateWithView(),
  72837. fill: new external_ol_style_namespaceObject.Fill({
  72838. color: 'rgba(0, 153, 255, 1)'
  72839. }),
  72840. stroke: style.getStroke()
  72841. });
  72842. }
  72843. style = me.highLightStyle || defaultHighLightStyle;
  72844. }
  72845. vectorContext.setStyle(
  72846. new external_ol_style_namespaceObject.Style({
  72847. image: style
  72848. })
  72849. );
  72850. let geometry = graphic.getGeometry();
  72851. let coordinate = geometry.getCoordinates();
  72852. let center = map.getView().getCenter();
  72853. let mapCenterPx = map.getPixelFromCoordinate(center);
  72854. let resolution = map.getView().getResolution();
  72855. let x = (coordinate[0] - center[0]) / resolution;
  72856. let y = (center[1] - coordinate[1]) / resolution;
  72857. let scaledP = [x + mapCenterPx[0], y + mapCenterPx[1]];
  72858. scaledP = scale(scaledP, mapCenterPx, 1);
  72859. //处理放大或缩小级别*/
  72860. let result = [scaledP[0] + me.offset[0], scaledP[1] + me.offset[1]];
  72861. let pixelGeometry = new (external_ol_geom_Point_default())(result);
  72862. vectorContext.drawGeometry(pixelGeometry);
  72863. return graphic;
  72864. });
  72865. }
  72866. }
  72867. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/Graphic.js
  72868. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  72869. * This program are made available under the terms of the Apache License, Version 2.0
  72870. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  72871. /**
  72872. * @class ol.Graphic
  72873. * @category Visualization Graphic
  72874. * @classdesc 高效率点图层点要素类。
  72875. * @param {ol/geom/Point} geometry - 几何对象。
  72876. * @param {Object} [attributes] - 要素属性。
  72877. * @extends {ol/Object}
  72878. */
  72879. class Graphic_Graphic extends (external_ol_Object_default()) {
  72880. constructor(geometry, attributes) {
  72881. super();
  72882. if (geometry instanceof (external_ol_geom_Geometry_default())) {
  72883. this.geometry_ = geometry;
  72884. }
  72885. this.attributes = attributes;
  72886. this.setStyle();
  72887. }
  72888. /**
  72889. * @function ol.Graphic.prototype.clone
  72890. * @description 克隆当前要素。
  72891. * @returns {ol.Graphic} 克隆后的要素。
  72892. */
  72893. clone() {
  72894. var clone = new Graphic_Graphic();
  72895. clone.setId(this.id);
  72896. clone.setGeometry(this.geometry_);
  72897. clone.setAttributes(this.attributes);
  72898. clone.setStyle(this.style_);
  72899. return clone;
  72900. }
  72901. /**
  72902. * @function ol.Graphic.prototype.getId
  72903. * @description 获取当前 ID。
  72904. * @returns {string} id
  72905. */
  72906. getId() {
  72907. return this.id;
  72908. }
  72909. /**
  72910. * @function ol.Graphic.prototype.setId
  72911. * @description 设置当前要素 ID。
  72912. * @param {string} id - 要素 ID。
  72913. */
  72914. setId(id) {
  72915. this.id = id;
  72916. }
  72917. /**
  72918. * @function ol.Graphic.prototype.getGeometry
  72919. * @description 获取当前要素几何信息。
  72920. * @returns {ol/geom/Point} 要素几何信息。
  72921. */
  72922. getGeometry() {
  72923. return this.geometry_;
  72924. }
  72925. /**
  72926. * @function ol.Graphic.prototype.setGeometry
  72927. * @description 设置当前要素几何信息。
  72928. * @param {ol/geom/Point} geometry - 要素几何信息。
  72929. */
  72930. setGeometry(geometry) {
  72931. this.geometry_ = geometry;
  72932. }
  72933. /**
  72934. * @function ol.Graphic.prototype.setAttributes
  72935. * @description 设置要素属性。
  72936. * @param {Object} attributes - 属性对象。
  72937. */
  72938. setAttributes(attributes) {
  72939. this.attributes = attributes;
  72940. }
  72941. /**
  72942. * @function ol.Graphic.prototype.getAttributes
  72943. * @description 获取要素属性。
  72944. * @returns {Object} 要素属性。
  72945. */
  72946. getAttributes() {
  72947. return this.attributes;
  72948. }
  72949. /**
  72950. * @function ol.Graphic.prototype.getStyle
  72951. * @description 获取样式。
  72952. * @returns {ol/style/Image} ol/style/Image 子类样式对象。
  72953. */
  72954. getStyle() {
  72955. return this.style_;
  72956. }
  72957. /**
  72958. * @function ol.Graphic.prototype.setStyle
  72959. * @description 设置样式。
  72960. * @param {ol/style/Image} style - 样式,ol/style/Image 子类样式对象。
  72961. */
  72962. setStyle(style) {
  72963. if (!this.style && !style) {
  72964. return;
  72965. }
  72966. this.style_ = style;
  72967. this.styleFunction_ = !style ?
  72968. undefined : Graphic_Graphic.createStyleFunction(new (external_ol_style_Style_default())({
  72969. image: style
  72970. }));
  72971. this.changed();
  72972. }
  72973. /**
  72974. * @function ol.Graphic.prototype.getStyleFunction
  72975. * @description 获取样式函数。
  72976. * @returns {Function} 样式函数。
  72977. */
  72978. getStyleFunction() {
  72979. return this.styleFunction_;
  72980. }
  72981. /**
  72982. * @function ol.Graphic.createStyleFunction
  72983. * @description 新建样式函数。
  72984. * @param {Object} obj - 对象参数。
  72985. */
  72986. static createStyleFunction(obj) {
  72987. var styleFunction;
  72988. if (typeof obj === 'function') {
  72989. if (obj.length == 2) {
  72990. styleFunction = function (resolution) {
  72991. return (obj)(this, resolution);
  72992. };
  72993. } else {
  72994. styleFunction = obj;
  72995. }
  72996. } else {
  72997. var styles;
  72998. if (Array.isArray(obj)) {
  72999. styles = obj;
  73000. } else {
  73001. styles = [obj];
  73002. }
  73003. styleFunction = function () {
  73004. return styles;
  73005. };
  73006. }
  73007. return styleFunction;
  73008. }
  73009. /**
  73010. * @function ol.Graphic.prototype.destroy
  73011. * @description 清除参数值。
  73012. */
  73013. destroy() {
  73014. this.id = null;
  73015. this.geometry_ = null;
  73016. this.attributes = null;
  73017. this.style_ = null;
  73018. }
  73019. }
  73020. ;// CONCATENATED MODULE: external "ol.extent"
  73021. const external_ol_extent_namespaceObject = ol.extent;
  73022. ;// CONCATENATED MODULE: external "ol.geom.Polygon"
  73023. const external_ol_geom_Polygon_namespaceObject = ol.geom.Polygon;
  73024. var external_ol_geom_Polygon_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_Polygon_namespaceObject);
  73025. ;// CONCATENATED MODULE: external "ol.layer.Image"
  73026. const external_ol_layer_Image_namespaceObject = ol.layer.Image;
  73027. var external_ol_layer_Image_default = /*#__PURE__*/__webpack_require__.n(external_ol_layer_Image_namespaceObject);
  73028. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Graphic.js
  73029. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73030. * This program are made available under the terms of the Apache License, Version 2.0
  73031. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73032. const defaultProps = {
  73033. color: [0, 0, 0, 255],
  73034. opacity: 0.8,
  73035. radius: 10,
  73036. radiusScale: 1,
  73037. radiusMinPixels: 0,
  73038. radiusMaxPixels: Number.MAX_SAFE_INTEGER,
  73039. strokeWidth: 1,
  73040. outline: false
  73041. };
  73042. const Renderer = ['canvas', 'webgl'];
  73043. /**
  73044. * @class ol.source.Graphic
  73045. * @category Visualization Graphic
  73046. * @classdesc 高效率点图层源。
  73047. * @param {Object} options - 图形参数。
  73048. * @param {ol/map} options.map - openlayers 地图对象。
  73049. * @param {ol/Graphic} options.graphics - 高效率点图层点要素。
  73050. * @param {string} [options.render ='canvas'] - 指定使用的渲染器。可选值:"webgl","canvas"(webgl 渲染目前只支持散点)。
  73051. * @param {boolean} [options.isHighLight=true] - 事件响应是否支持要素高亮。
  73052. * @param {ol/style} [options.highLightStyle=defaultHighLightStyle] - 高亮风格。
  73053. * @param {Array.<number>} [options.color=[0, 0, 0, 255]] - 要素颜色。
  73054. * @param {Array.<number>} [options.highlightColor] - webgl 渲染时要素高亮颜色。
  73055. * @param {number} [options.opacity=0.8] - 要素透明度。
  73056. * @param {number} [options.radius=10] - 要素半径,单位像素。
  73057. * @param {number} [options.radiusScale=1] - webgl 渲染时的要素放大倍数。
  73058. * @param {number} [options.radiusMinPixels=0] - webgl 渲染时的要素半径最小值(像素)。
  73059. * @param {number} [options.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - webgl 渲染时的要素半径最大值(像素)。
  73060. * @param {number} [options.strokeWidth=1] - 边框大小。
  73061. * @param {boolean} [options.outline=false] - 是否显示边框。
  73062. * @param {function} [options.onHover] - 图层鼠标悬停响应事件(只有 webgl 渲染时有用)。
  73063. * @param {function} [options.onClick] - 图层鼠标点击响应事件(webgl、canvas 渲染时都有用)。
  73064. * @extends {ol/source/ImageCanvas}
  73065. */
  73066. class Graphic extends (external_ol_source_ImageCanvas_default()) {
  73067. constructor(options) {
  73068. super({
  73069. attributions: options.attributions,
  73070. canvasFunction: canvasFunctionInternal_,
  73071. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  73072. projection: options.projection,
  73073. ratio: options.ratio,
  73074. resolutions: options.resolutions,
  73075. state: options.state
  73076. });
  73077. this.graphics = [].concat(options.graphics);
  73078. this.map = options.map;
  73079. Util.extend(this, options);
  73080. this.render = options.render || Renderer[0];
  73081. if (!core_Util_Util.supportWebGL2()) {
  73082. this.render = Renderer[0];
  73083. }
  73084. this.highLightStyle = options.highLightStyle;
  73085. //是否支持高亮,默认支持
  73086. this.isHighLight = typeof options.isHighLight === 'undefined' ? true : options.isHighLight;
  73087. this.hitGraphicLayer = null;
  73088. this._forEachFeatureAtCoordinate = _forEachFeatureAtCoordinate;
  73089. const me = this;
  73090. if (options.onClick) {
  73091. me.map.on('click', function(e) {
  73092. if (me.renderer instanceof GraphicWebGLRenderer) {
  73093. return;
  73094. }
  73095. const features = me.map.getFeaturesAtPixel(e.pixel) || [];
  73096. for (let index = 0; index < features.length; index++) {
  73097. const graphic = features[index];
  73098. if (me.graphics.indexOf(graphic) > -1) {
  73099. options.onClick(graphic, e);
  73100. if (me.isHighLight) {
  73101. me._highLight(
  73102. graphic.getGeometry().getCoordinates(),
  73103. new (external_ol_style_Style_default())({
  73104. image: graphic.getStyle()
  73105. }).getImage(),
  73106. graphic,
  73107. e.pixel
  73108. );
  73109. }
  73110. break;
  73111. }
  73112. }
  73113. });
  73114. }
  73115. //eslint-disable-next-line no-unused-vars
  73116. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) {
  73117. var mapWidth = size[0] / pixelRatio;
  73118. var mapHeight = size[1] / pixelRatio;
  73119. var width = me.map.getSize()[0];
  73120. var height = me.map.getSize()[1];
  73121. if (!me.renderer) {
  73122. me.renderer = createRenderer(size, pixelRatio);
  73123. }
  73124. me.renderer.mapWidth = mapWidth;
  73125. me.renderer.mapHeight = mapHeight;
  73126. me.renderer.pixelRatio = pixelRatio;
  73127. me.renderer.offset = [(mapWidth - width) / 2, (mapHeight - height) / 2];
  73128. let graphics = this.getGraphicsInExtent(extent);
  73129. me.renderer._clearBuffer();
  73130. me.renderer.selected = this.selected;
  73131. me.renderer.drawGraphics(graphics);
  73132. return me.renderer.getCanvas();
  73133. }
  73134. function createRenderer(size, pixelRatio) {
  73135. let renderer;
  73136. if (me.render === Renderer[0]) {
  73137. renderer = new GraphicCanvasRenderer(me, {
  73138. size,
  73139. pixelRatio
  73140. });
  73141. } else {
  73142. let optDefault = Util.extend({}, defaultProps);
  73143. let opt = Util.extend(optDefault, {
  73144. color: me.color,
  73145. opacity: me.opacity,
  73146. radius: me.radius,
  73147. radiusScale: me.radiusScale,
  73148. radiusMinPixels: me.radiusMinPixels,
  73149. radiusMaxPixels: me.radiusMaxPixels,
  73150. strokeWidth: me.strokeWidth,
  73151. outline: me.outline,
  73152. onClick: me.onClick,
  73153. onHover: me.onHover
  73154. });
  73155. opt = Util.extend(me, opt);
  73156. opt.pixelRatio = pixelRatio;
  73157. opt.container = me.map.getViewport().getElementsByClassName('ol-overlaycontainer')[0];
  73158. opt.onBeforeRender = function() {
  73159. return false;
  73160. };
  73161. opt.onAfterRender = function() {
  73162. return false;
  73163. };
  73164. renderer = new GraphicWebGLRenderer(me, opt);
  73165. }
  73166. return renderer;
  73167. }
  73168. /**
  73169. * @private
  73170. * @function ol.source.Graphic.prototype._forEachFeatureAtCoordinate
  73171. * @description 获取在视图上的要素。
  73172. * @param {string} coordinate -坐标。
  73173. * @param {number} resolution -分辨率。
  73174. * @param {RequestCallback} callback -回调函数。
  73175. * @param {ol/Pixel} evtPixel - 当前选中的屏幕像素坐标。
  73176. */
  73177. function _forEachFeatureAtCoordinate(coordinate, resolution, callback, evtPixel, e) {
  73178. let graphics = me.getGraphicsInExtent();
  73179. // FIX 无法高亮元素
  73180. me._highLightClose();
  73181. for (let i = graphics.length - 1; i >= 0; i--) {
  73182. let style = graphics[i].getStyle();
  73183. if (!style) {
  73184. return;
  73185. }
  73186. //已经被高亮的graphics 不被选选中
  73187. if (style instanceof HitCloverShape) {
  73188. continue;
  73189. }
  73190. let center = graphics[i].getGeometry().getCoordinates();
  73191. let image = new (external_ol_style_Style_default())({
  73192. image: style
  73193. }).getImage();
  73194. let contain = false;
  73195. //icl-1047 当只有一个叶片的时候,判断是否选中的逻辑处理的更准确一点
  73196. if (image instanceof CloverShape && image.getCount() === 1) {
  73197. const ratation = (image.getRotation() * 180) / Math.PI;
  73198. const angle = Number.parseFloat(image.getAngle());
  73199. const r = image.getRadius() * resolution;
  73200. //if(image.getAngle() )
  73201. let geo = null;
  73202. if (angle > 355) {
  73203. geo = new (external_ol_style_Circle_default())(center, r);
  73204. } else {
  73205. const coors = [];
  73206. coors.push(center);
  73207. const perAngle = angle / 8;
  73208. for (let index = 0; index < 8; index++) {
  73209. const radian = ((ratation + index * perAngle) / 180) * Math.PI;
  73210. coors.push([center[0] + r * Math.cos(radian), center[1] - r * Math.sin(radian)]);
  73211. }
  73212. coors.push(center);
  73213. geo = new (external_ol_geom_Polygon_default())([coors]);
  73214. }
  73215. if (geo.intersectsCoordinate(this.map.getCoordinateFromPixel(evtPixel))) {
  73216. contain = true;
  73217. }
  73218. } else {
  73219. let extent = [];
  73220. extent[0] = center[0] - image.getAnchor()[0] * resolution;
  73221. extent[2] = center[0] + image.getAnchor()[0] * resolution;
  73222. extent[1] = center[1] - image.getAnchor()[1] * resolution;
  73223. extent[3] = center[1] + image.getAnchor()[1] * resolution;
  73224. if (external_ol_extent_namespaceObject.containsCoordinate(extent, coordinate)) {
  73225. contain = true;
  73226. }
  73227. }
  73228. if (contain === true) {
  73229. if (callback) {
  73230. callback(graphics[i], e);
  73231. }
  73232. continue;
  73233. }
  73234. // if (me.isHighLight) {
  73235. // // me._highLightClose();
  73236. // }
  73237. }
  73238. return undefined;
  73239. }
  73240. }
  73241. /**
  73242. * @function ol.source.Graphic.prototype.setGraphics
  73243. * @description 设置绘制的点要素,会覆盖之前的所有要素。
  73244. * @param {Array.<ol.Graphic>} graphics - 点要素对象数组。
  73245. */
  73246. setGraphics(graphics) {
  73247. this.graphics = this.graphics || [];
  73248. this.graphics.length = 0;
  73249. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  73250. this.graphics = [].concat(sGraphics);
  73251. this.update();
  73252. }
  73253. /**
  73254. * @function ol.source.Graphic.prototype.addGraphics
  73255. * @description 追加点要素,不会覆盖之前的要素。
  73256. * @param {Array.<ol.Graphic>} graphics - 点要素对象数组。
  73257. */
  73258. addGraphics(graphics) {
  73259. this.graphics = this.graphics || [];
  73260. let sGraphics = !core_Util_Util.isArray(graphics) ? [graphics] : [].concat(graphics);
  73261. this.graphics = this.graphics.concat(sGraphics);
  73262. this.update();
  73263. }
  73264. /**
  73265. * @function ol.source.Graphic.prototype.getGraphicBy
  73266. * @description 在 Vector 的要素数组 graphics 里面遍历每一个 graphic,当 graphic[property]===value 时,返回此 graphic(并且只返回第一个)。
  73267. * @param {string} property - graphic 的某个属性名称。
  73268. * @param {string} value - property 所对应的值。
  73269. * @returns {ol.Graphic} 一个匹配的 graphic。
  73270. */
  73271. getGraphicBy(property, value) {
  73272. let graphic = null;
  73273. for (let index in this.graphics) {
  73274. if (this.graphics[index][property] === value) {
  73275. graphic = this.graphics[index];
  73276. break;
  73277. }
  73278. }
  73279. return graphic;
  73280. }
  73281. /**
  73282. * @function ol.source.Graphic.prototype.getGraphicById
  73283. * @description 通过给定一个 id,返回对应的矢量要素。
  73284. * @param {string} graphicId - 矢量要素的属性 id
  73285. * @returns {ol.Graphic} 一个匹配的 graphic。
  73286. */
  73287. getGraphicById(graphicId) {
  73288. return this.getGraphicBy('id', graphicId);
  73289. }
  73290. /**
  73291. * @function ol.source.Graphic.prototype.getGraphicsByAttribute
  73292. * @description 通过给定一个属性的 key 值和 value 值,返回所有匹配的要素数组。
  73293. * @param {string} attrName - graphic 的某个属性名称。
  73294. * @param {string} attrValue - property 所对应的值。
  73295. * @returns {Array.<ol.Graphic>} 一个匹配的 graphic 数组。
  73296. */
  73297. getGraphicsByAttribute(attrName, attrValue) {
  73298. var graphic,
  73299. foundgraphics = [];
  73300. for (let index in this.graphics) {
  73301. graphic = this.graphics[index];
  73302. if (graphic && graphic.attributes) {
  73303. if (graphic.attributes[attrName] === attrValue) {
  73304. foundgraphics.push(graphic);
  73305. }
  73306. }
  73307. }
  73308. return foundgraphics;
  73309. }
  73310. /**
  73311. * @function ol.source.Graphic.prototype.removeGraphics
  73312. * @description 删除要素数组,默认将删除所有要素。
  73313. * @param {Array.<ol.Graphic>} [graphics] - 删除的 graphics 数组。
  73314. */
  73315. removeGraphics(graphics = null) {
  73316. //当 graphics 为 null 、为空数组,或 === this.graphics,则清除所有要素
  73317. if (!graphics || graphics.length === 0 || graphics === this.graphics) {
  73318. this.graphics.length = 0;
  73319. this.update();
  73320. return;
  73321. }
  73322. if (!Util.isArray(graphics)) {
  73323. graphics = [graphics];
  73324. }
  73325. for (let i = graphics.length - 1; i >= 0; i--) {
  73326. let graphic = graphics[i];
  73327. //如果我们传入的grapchic在graphics数组中没有的话,则不进行删除,
  73328. //并将其放入未删除的数组中。
  73329. let findex = Util.indexOf(this.graphics, graphic);
  73330. if (findex === -1) {
  73331. continue;
  73332. }
  73333. this.graphics.splice(findex, 1);
  73334. }
  73335. //删除完成后重新设置 setGraphics,以更新
  73336. this.update();
  73337. }
  73338. /**
  73339. * @function ol.source.Graphic.prototype.clear
  73340. * @description 释放图层资源。
  73341. */
  73342. clear() {
  73343. this.removeGraphics();
  73344. }
  73345. /**
  73346. * @function ol.source.Graphic.prototype.update
  73347. * @description 更新图层。
  73348. */
  73349. update() {
  73350. this.renderer.update(this.graphics, this._getDefaultStyle());
  73351. }
  73352. _getDefaultStyle() {
  73353. const target = {};
  73354. if (this.color) {
  73355. target.fill = new (external_ol_style_Fill_default())({
  73356. color: this.toRGBA(this.color)
  73357. });
  73358. }
  73359. if (this.radius) {
  73360. target.radius = this.radius;
  73361. }
  73362. if (this.outline) {
  73363. target.stroke = new (external_ol_style_Fill_default())({
  73364. color: this.toRGBA(this.color),
  73365. width: this.strokeWidth
  73366. });
  73367. }
  73368. return new (external_ol_style_Circle_default())(target);
  73369. }
  73370. toRGBA(colorArray) {
  73371. return `rgba(${colorArray[0]},${colorArray[1]},${colorArray[2]},${(colorArray[3] || 255) / 255})`;
  73372. }
  73373. /**
  73374. * @function ol.source.Graphic.prototype.setStyle
  73375. * @description 设置图层要素整体样式(接口仅在 webgl 渲染时有用)。
  73376. * @param {Object} styleOptions - 样式对象。
  73377. * @param {Array.<number>} [styleOptions.color=[0, 0, 0, 255]] - 点颜色。
  73378. * @param {number} [styleOptions.radius=10] - 点半径。
  73379. * @param {number} [styleOptions.opacity=0.8] - 不透明度。
  73380. * @param {Array} [styleOptions.highlightColor] - 高亮颜色,目前只支持 rgba 数组。
  73381. * @param {number} [styleOptions.radiusScale=1] - 点放大倍数。
  73382. * @param {number} [styleOptions.radiusMinPixels=0] - 半径最小值(像素)。
  73383. * @param {number} [styleOptions.radiusMaxPixels=Number.MAX_SAFE_INTEGER] - 半径最大值(像素)。
  73384. * @param {number} [styleOptions.strokeWidth=1] - 边框大小。
  73385. * @param {boolean} [styleOptions.outline=false] - 是否显示边框。
  73386. */
  73387. setStyle(styleOptions) {
  73388. let self = this;
  73389. let styleOpt = {
  73390. color: self.color,
  73391. radius: self.radius,
  73392. opacity: self.opacity,
  73393. highlightColor: self.highlightColor,
  73394. radiusScale: self.radiusScale,
  73395. radiusMinPixels: self.radiusMinPixels,
  73396. radiusMaxPixels: self.radiusMaxPixels,
  73397. strokeWidth: self.strokeWidth,
  73398. outline: self.outline
  73399. };
  73400. Util.extend(self, Util.extend(styleOpt, styleOptions));
  73401. self.update();
  73402. }
  73403. /**
  73404. * @function ol.source.Graphic.prototype.getLayerState
  73405. * @description 获取当前地图及图层状态。
  73406. * @returns {Object} 地图及图层状态,包含地图状态信息和本图层相关状态。
  73407. */
  73408. getLayerState() {
  73409. let map = this.map;
  73410. let width = map.getSize()[0];
  73411. let height = map.getSize()[1];
  73412. let view = map.getView();
  73413. let center = view.getCenter();
  73414. let longitude = center[0];
  73415. let latitude = center[1];
  73416. let zoom = view.getZoom();
  73417. let maxZoom = view.getMaxZoom();
  73418. let rotationRadians = view.getRotation();
  73419. let rotation = (-rotationRadians * 180) / Math.PI;
  73420. let mapViewport = {
  73421. longitude: longitude,
  73422. latitude: latitude,
  73423. zoom: zoom,
  73424. maxZoom: maxZoom,
  73425. pitch: 0,
  73426. bearing: rotation
  73427. };
  73428. let state = {};
  73429. for (let key in mapViewport) {
  73430. state[key] = mapViewport[key];
  73431. }
  73432. state.width = width;
  73433. state.height = height;
  73434. state.color = this.color;
  73435. state.radius = this.radius;
  73436. state.opacity = this.opacity;
  73437. state.highlightColor = this.highlightColor;
  73438. state.radiusScale = this.radiusScale;
  73439. state.radiusMinPixels = this.radiusMinPixels;
  73440. state.radiusMaxPixels = this.radiusMaxPixels;
  73441. state.strokeWidth = this.strokeWidth;
  73442. state.outline = this.outline;
  73443. return state;
  73444. }
  73445. /**
  73446. * @function ol.source.Graphic.prototype._highLightClose
  73447. * @description 关闭高亮要素显示。
  73448. * @private
  73449. */
  73450. _highLightClose() {
  73451. this.selected = null;
  73452. if (this.hitGraphicLayer) {
  73453. this.map.removeLayer(this.hitGraphicLayer);
  73454. this.hitGraphicLayer = null;
  73455. }
  73456. this.changed();
  73457. }
  73458. /**
  73459. * @function ol.source.Graphic.prototype._highLight
  73460. * @description 高亮显示选中要素。
  73461. * @param {Array.<number>} center - 中心点。
  73462. * @param {ol/style/Style} image - 点样式。
  73463. * @param {ol.Graphic} selectGraphic - 高效率点图层点要素。
  73464. * @param {ol/Pixel} evtPixel - 当前选中的屏幕像素坐标。
  73465. * @private
  73466. */
  73467. _highLight(center, image, selectGraphic, evtPixel) {
  73468. if (selectGraphic.getStyle() instanceof CloverShape) {
  73469. if (this.hitGraphicLayer) {
  73470. this.map.removeLayer(this.hitGraphicLayer);
  73471. this.hitGraphicLayer = null;
  73472. }
  73473. var pixel = this.map.getPixelFromCoordinate([center[0], center[1]]);
  73474. //点击点与中心点的角度
  73475. evtPixel = evtPixel || [0, 0];
  73476. var angle = (Math.atan2(evtPixel[1] - pixel[1], evtPixel[0] - pixel[0]) / Math.PI) * 180;
  73477. angle = angle > 0 ? angle : 360 + angle;
  73478. //确定扇叶
  73479. var index = Math.ceil(angle / (image.getAngle() + image.getSpaceAngle()));
  73480. //扇叶的起始角度
  73481. var sAngle = (index - 1) * (image.getAngle() + image.getSpaceAngle());
  73482. //渲染参数
  73483. var opts = {
  73484. stroke: new (external_ol_style_Stroke_default())({
  73485. color: '#ff0000',
  73486. width: 1
  73487. }),
  73488. fill: new (external_ol_style_Fill_default())({
  73489. color: '#0099ff'
  73490. }),
  73491. radius: image.getRadius(),
  73492. angle: image.getAngle(),
  73493. eAngle: sAngle + image.getAngle(),
  73494. sAngle: sAngle,
  73495. rotation: image.getRotation()
  73496. };
  73497. if (this.highLightStyle && this.highLightStyle instanceof HitCloverShape) {
  73498. opts.stroke = this.highLightStyle.getStroke();
  73499. opts.fill = this.highLightStyle.getFill();
  73500. opts.radius = this.highLightStyle.getRadius();
  73501. opts.angle = this.highLightStyle.getAngle();
  73502. }
  73503. var hitGraphic = new Graphic_Graphic(new (external_ol_geom_Point_default())(center));
  73504. hitGraphic.setStyle(new HitCloverShape(opts));
  73505. this.hitGraphicLayer = new (external_ol_layer_Image_default())({
  73506. source: new Graphic({
  73507. map: this.map,
  73508. graphics: [hitGraphic]
  73509. })
  73510. });
  73511. this.map.addLayer(this.hitGraphicLayer);
  73512. } else {
  73513. this.selected = selectGraphic;
  73514. this.changed();
  73515. }
  73516. }
  73517. /**
  73518. * @function ol.source.Graphic.prototype.getGraphicsInExtent
  73519. * @description 在指定范围中获取几何要素面积。
  73520. * @param {Object} extent - 长度范围。
  73521. */
  73522. getGraphicsInExtent(extent) {
  73523. var graphics = [];
  73524. if (!extent) {
  73525. this.graphics.map(function(graphic) {
  73526. graphics.push(graphic);
  73527. return graphic;
  73528. });
  73529. return graphics;
  73530. }
  73531. this.graphics.map(function(graphic) {
  73532. if (external_ol_extent_namespaceObject.containsExtent(extent, graphic.getGeometry().getExtent())) {
  73533. graphics.push(graphic);
  73534. }
  73535. return graphic;
  73536. });
  73537. return graphics;
  73538. }
  73539. }
  73540. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/GeoFeature.js
  73541. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73542. * This program are made available under the terms of the Apache License, Version 2.0
  73543. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73544. /**
  73545. * @class ol.source.GeoFeature
  73546. * @category Visualization Theme
  73547. * @classdesc 地理几何专题要素型专题图层基类。
  73548. * @param {string} name - 图层名称。
  73549. * @param {Object} opt_options - 参数。
  73550. * @param {ol/Map} opt_options.map - 当前 OpenLayers Map 对象。
  73551. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  73552. * @param {number} [opt_options.opacity=1] - 图层透明度。
  73553. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  73554. * @param {ol/proj/Projection} [opt_options.projection] - 投影信息。
  73555. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。 必须是 1 或更高。
  73556. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  73557. * @param {ol/source/State} [opt_option.state] - 资源状态。
  73558. * @param {Object} [opt_options.style] - 专题图样式。
  73559. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  73560. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  73561. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  73562. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  73563. * @extends {Theme}
  73564. */
  73565. class GeoFeature extends theme_Theme_Theme {
  73566. constructor(name, opt_options) {
  73567. super(name, opt_options);
  73568. this.cache = opt_options.cache || {};
  73569. this.cacheFields = opt_options.cacheFields || [];
  73570. this.style = opt_options.style || {};
  73571. this.maxCacheCount = opt_options.maxCacheCount || 0;
  73572. this.isCustomSetMaxCacheCount = opt_options.isCustomSetMaxCacheCount === undefined ? false : opt_options.isCustomSetMaxCacheCount;
  73573. this.nodesClipPixel = opt_options.nodesClipPixel || 2;
  73574. this.isHoverAble = opt_options.isHoverAble === undefined ? false : opt_options.isHoverAble;
  73575. this.isMultiHover = opt_options.isMultiHover === undefined ? false : opt_options.isMultiHover;
  73576. this.isClickAble = opt_options.isClickAble === undefined ? true : opt_options.isClickAble;
  73577. this.highlightStyle = opt_options.highlightStyle || null;
  73578. this.isAllowFeatureStyle = opt_options.isAllowFeatureStyle === undefined ? false : opt_options.isAllowFeatureStyle;
  73579. }
  73580. /**
  73581. * @function ol.source.GeoFeature.prototype.destroy
  73582. * @description 释放资源,将引用资源的属性置空。
  73583. */
  73584. destroy() {
  73585. this.maxCacheCount = null;
  73586. this.isCustomSetMaxCacheCount = null;
  73587. this.nodesClipPixel = null;
  73588. this.isHoverAble = null;
  73589. this.isMultiHover = null;
  73590. this.isClickAble = null;
  73591. this.cache = null;
  73592. this.cacheFields = null;
  73593. this.style = null;
  73594. this.highlightStyle = null;
  73595. this.isAllowFeatureStyle = null;
  73596. }
  73597. /**
  73598. * @function ol.source.GeoFeature.prototype.addFeatures
  73599. * @description 添加要素。
  73600. * @param {SuperMap.ServerFeature|GeoJSONObject|ol/Feature} features - 要素对象。
  73601. */
  73602. addFeatures(features) {
  73603. this.dispatchEvent({type: 'beforefeaturesadded', value: {features: features}});
  73604. //转换 features 形式
  73605. this.features = this.toiClientFeature(features);
  73606. if (!this.isCustomSetMaxCacheCount) {
  73607. this.maxCacheCount = this.features.length * 5;
  73608. }
  73609. //绘制专题要素
  73610. if (this.renderer) {
  73611. this.changed();
  73612. }
  73613. }
  73614. /**
  73615. * @function ol.source.GeoFeature.prototype.removeFeatures
  73616. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  73617. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  73618. */
  73619. removeFeatures(features) { // eslint-disable-line no-unused-vars
  73620. this.clearCache();
  73621. theme_Theme_Theme.prototype.removeFeatures.apply(this, arguments);
  73622. }
  73623. /**
  73624. * @function ol.source.GeoFeature.prototype.removeAllFeatures
  73625. * @description 清除当前图层所有的矢量要素。
  73626. */
  73627. removeAllFeatures() {
  73628. this.clearCache();
  73629. theme_Theme_Theme.prototype.removeAllFeatures.apply(this, arguments);
  73630. }
  73631. /**
  73632. * @function ol.source.GeoFeature.prototype.redrawThematicFeatures
  73633. * @description 重绘所有专题要素。
  73634. * @param {Object} extent - 视图范围数据。
  73635. */
  73636. redrawThematicFeatures(extent) {
  73637. //获取高亮专题要素对应的用户 id
  73638. var hoverone = this.renderer.getHoverOne();
  73639. var hoverFid = null;
  73640. if (hoverone && hoverone.refDataID) {
  73641. hoverFid = hoverone.refDataID;
  73642. }
  73643. //清除当前所有可视元素
  73644. this.renderer.clearAll();
  73645. var features = this.features;
  73646. var cache = this.cache;
  73647. var cacheFields = this.cacheFields;
  73648. var cmZoom = this.map.getView().getZoom();
  73649. var maxCC = this.maxCacheCount;
  73650. for (var i = 0, len = features.length; i < len; i++) {
  73651. var feature = features[i];
  73652. if (!feature.geometry) {
  73653. continue;
  73654. }
  73655. var feaBounds = feature.geometry.getBounds();
  73656. //剔除当前视图(地理)范围以外的数据
  73657. if (extent) {
  73658. var bounds = new Bounds(extent[0], extent[1], extent[2], extent[3]);
  73659. if (!bounds.intersectsBounds(feaBounds)) {
  73660. continue;
  73661. }
  73662. }
  73663. //缓存字段
  73664. var fields = feature.id + "_zoom_" + cmZoom.toString();
  73665. var thematicFeature;
  73666. //判断专题要素缓存是否存在
  73667. if (cache[fields]) {
  73668. cache[fields].updateAndAddShapes();
  73669. } else {
  73670. //如果专题要素缓存不存在,创建专题要素
  73671. thematicFeature = this.createThematicFeature(features[i]);
  73672. //检查 thematicFeature 是否有可视化图形
  73673. if (thematicFeature.getShapesCount() < 1) {
  73674. continue;
  73675. }
  73676. //加入缓存
  73677. cache[fields] = thematicFeature;
  73678. cacheFields.push(fields);
  73679. //缓存数量限制
  73680. if (cacheFields.length > maxCC) {
  73681. var fieldsTemp = cacheFields[0];
  73682. cacheFields.splice(0, 1);
  73683. delete cache[fieldsTemp];
  73684. }
  73685. }
  73686. }
  73687. this.renderer.render();
  73688. //地图漫游后,重新高亮图形
  73689. if (hoverFid && this.isHoverAble && this.isMultiHover) {
  73690. var hShapes = this.getShapesByFeatureID(hoverFid);
  73691. this.renderer.updateHoverShapes(hShapes);
  73692. }
  73693. }
  73694. /**
  73695. * @function ol.source.GeoFeature.prototype.createThematicFeature
  73696. * @description 创建专题要素。
  73697. * @param {Object} feature - 要素对象。
  73698. */
  73699. createThematicFeature(feature) {
  73700. var style = Util.copyAttributesWithClip(this.style);
  73701. if (feature.style && this.isAllowFeatureStyle === true) {
  73702. style = Util.copyAttributesWithClip(feature.style);
  73703. }
  73704. //创建专题要素时的可选参数
  73705. var options = {};
  73706. options.nodesClipPixel = this.nodesClipPixel;
  73707. options.isHoverAble = this.isHoverAble;
  73708. options.isMultiHover = this.isMultiHover;
  73709. options.isClickAble = this.isClickAble;
  73710. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  73711. //将数据转为专题要素(Vector)
  73712. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  73713. //直接添加图形到渲染器
  73714. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  73715. this.renderer.addShape(thematicFeature.shapes[m]);
  73716. }
  73717. return thematicFeature;
  73718. }
  73719. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  73720. return theme_Theme_Theme.prototype.canvasFunctionInternal_.apply(this, arguments);
  73721. }
  73722. /**
  73723. * @function ol.source.GeoFeature.prototype.clearCache
  73724. * @description 清除缓存。
  73725. */
  73726. clearCache() {
  73727. this.cache = {};
  73728. this.cacheFields = [];
  73729. }
  73730. /**
  73731. * @function ol.source.GeoFeature.prototype.clear
  73732. * @description 清除的内容包括数据(features)、专题要素、缓存。
  73733. */
  73734. clear() {
  73735. this.renderer.clearAll();
  73736. this.renderer.refresh();
  73737. this.removeAllFeatures();
  73738. this.clearCache();
  73739. }
  73740. /**
  73741. * @function ol.source.GeoFeature.prototype.getCacheCount
  73742. * @description 获取当前缓存数量。
  73743. * @returns {number} 返回当前缓存数量。
  73744. */
  73745. getCacheCount() {
  73746. return this.cacheFields.length;
  73747. }
  73748. /**
  73749. * @function ol.source.GeoFeature.prototype.setMaxCacheCount
  73750. * @param {number} cacheCount - 缓存总数。
  73751. * @description 设置最大缓存条数。
  73752. */
  73753. setMaxCacheCount(cacheCount) {
  73754. if (!isNaN(cacheCount)) {
  73755. this.maxCacheCount = cacheCount;
  73756. this.isCustomSetMaxCacheCount = true;
  73757. }
  73758. }
  73759. /**
  73760. * @function ol.source.GeoFeature.prototype.setMaxCacheCount
  73761. * @param {number} featureID - 要素 ID。
  73762. * @description 通过 FeatureID 获取 feature 关联的所有图形。如果不传入此参数,函数将返回所有图形。
  73763. */
  73764. getShapesByFeatureID(featureID) {
  73765. var list = [];
  73766. var shapeList = this.renderer.getAllShapes();
  73767. if (!featureID) {
  73768. return shapeList
  73769. }
  73770. for (var i = 0, len = shapeList.length; i < len; i++) {
  73771. var si = shapeList[i];
  73772. if (si.refDataID && featureID === si.refDataID) {
  73773. list.push(si);
  73774. }
  73775. }
  73776. return list;
  73777. }
  73778. }
  73779. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Label.js
  73780. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  73781. * This program are made available under the terms of the Apache License, Version 2.0
  73782. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  73783. /**
  73784. * @class ol.source.Label
  73785. * @category Visualization Theme
  73786. * @classdesc 标签专题图图层源。
  73787. * @param {string} name - 名称。
  73788. * @param {Object} opt_options - 参数。
  73789. * @param {ol/Map} opt_options.map - 当前 Map 对象。
  73790. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  73791. * @param {number} [opt_options.opacity=1] - 图层透明度。
  73792. * @param {string|Object} [opt_options.attributions] - 版权信息。
  73793. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  73794. * @param {ol/proj/Projection} [opt_options.projection] - 投影信息。
  73795. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是1或更高。
  73796. * @param {Array.<number>} [opt_options.resolutions] - 分辨率数组。
  73797. * @param {ol/source/State} [opt_options.state] - 资源状态。
  73798. * @param {string} [opt_options.themeField] - 指定创建专题图字段。
  73799. * @param {Object} [opt_options.style] - 专题图样式。
  73800. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  73801. * @param {boolean} [opt_options.isHoverAble = false] - 是否开启 hover 事件。
  73802. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  73803. * @extends {GeoFeature}
  73804. */
  73805. class Label_Label extends GeoFeature {
  73806. constructor(name, opt_options) {
  73807. super(name, opt_options);
  73808. this.isOverLay = opt_options.isOverLay != null ? opt_options.isOverLay : true;
  73809. this.isAvoid = opt_options.isAvoid != null ? opt_options.isAvoid : true;
  73810. this.style = opt_options.style;
  73811. this.themeField = opt_options.themeField;
  73812. this.styleGroups = opt_options.styleGroups;
  73813. this.defaultStyle = {
  73814. //默认文本样式
  73815. fontColor: "#000000",
  73816. fontOpacity: 1,
  73817. fontSize: "12px",
  73818. fontStyle: "normal",
  73819. fontWeight: "normal",
  73820. labelAlign: "cm",
  73821. labelXOffset: 0,
  73822. labelYOffset: 0,
  73823. labelRotation: 0,
  73824. //默认背景框样式
  73825. fill: false,
  73826. fillColor: "#ee9900",
  73827. fillOpacity: 0.4,
  73828. stroke: false,
  73829. strokeColor: "#ee9900",
  73830. strokeOpacity: 1,
  73831. strokeWidth: 1,
  73832. strokeLinecap: "round",
  73833. strokeDashstyle: "solid",
  73834. //对用户隐藏但必须保持此值的属性
  73835. //cursor: "pointer",
  73836. labelSelect: true,
  73837. //用 _isGeoTextStrategyStyle 标记此style,携带此类style的要素特指GeoText策略中的标签要素
  73838. _isGeoTextStrategyStyle: true
  73839. };
  73840. //获取标签像素 bounds 的方式。0 - 表示通过文本类容和文本风格计算获取像素范围,现在支持中文、英文; 1 - 表示通过绘制的文本标签获取像素范围,支持各个语种的文字范围获取,但性能消耗较大(尤其是采用SVG渲染)。默认值为0。
  73841. this.getPxBoundsMode = 0;
  73842. this.labelFeatures = [];
  73843. }
  73844. /**
  73845. * @function ol.source.Label.prototype.destroy
  73846. * @description 释放资源,将引用资源的属性置空。
  73847. */
  73848. destroy() {
  73849. this.style = null;
  73850. this.themeField = null;
  73851. this.styleGroups = null;
  73852. super.destroy();
  73853. }
  73854. /**
  73855. * @function ol.source.Label.prototype.createThematicFeature
  73856. * @description 创建专题要素。
  73857. * @param {SuperMap.Feature.Vector} feature - 矢量要素。
  73858. * @returns {SuperMap.Feature.Theme.Vector} 专题图矢量要素。
  73859. */
  73860. createThematicFeature(feature) {
  73861. //赋 style
  73862. var style = this.getStyleByData(feature);
  73863. //创建专题要素时的可选参数
  73864. var options = {};
  73865. options.nodesClipPixel = this.nodesClipPixel;
  73866. options.isHoverAble = this.isHoverAble;
  73867. options.isMultiHover = this.isMultiHover;
  73868. options.isClickAble = this.isClickAble;
  73869. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  73870. //将数据转为专题要素(Vector)
  73871. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  73872. //直接添加图形到渲染器
  73873. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  73874. this.renderer.addShape(thematicFeature.shapes[m]);
  73875. }
  73876. return thematicFeature;
  73877. }
  73878. /**
  73879. * @function ol.source.Label.prototype.redrawThematicFeatures
  73880. * @description 重绘所有专题要素。
  73881. * 此方法包含绘制专题要素的所有步骤,包含用户数据到专题要素的转换,抽稀,缓存等步骤。
  73882. * 地图漫游时调用此方法进行图层刷新。
  73883. * @param {Array.<number>} bounds - 重绘范围。
  73884. */
  73885. redrawThematicFeatures(bounds) {
  73886. if (this.features.length > 0 && this.labelFeatures.length === 0) {
  73887. var feats = this.setLabelsStyle(this.features);
  73888. for (var i = 0, len = feats.length; i < len; i++) {
  73889. this.labelFeatures.push(feats[i]);
  73890. }
  73891. }
  73892. this.features = this.getDrawnLabels(this.labelFeatures);
  73893. super.redrawThematicFeatures.call(this, bounds);
  73894. }
  73895. /**
  73896. * @function ol.source.Label.prototype.removeFeatures
  73897. * @description 从专题图中删除 feature。这个函数删除所有传递进来的矢量要素。
  73898. * @param {SuperMap.Feature.Vector} features - 要删除的要素对象。
  73899. */
  73900. removeFeatures(features) { // eslint-disable-line no-unused-vars
  73901. this.labelFeatures = [];
  73902. super.removeFeatures.call(this, arguments);
  73903. }
  73904. /**
  73905. * @function ol.source.Label.prototype.removeAllFeatures
  73906. * @description 清除当前图层所有的矢量要素。
  73907. */
  73908. removeAllFeatures() {
  73909. this.labelFeatures = [];
  73910. super.removeAllFeatures.call(this, arguments);
  73911. }
  73912. /**
  73913. * @function ol.source.Label.prototype.getDrawnLabels
  73914. * @description 获取经(压盖)处理后将要绘制在图层上的标签要素。
  73915. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 所有标签要素的数组。
  73916. * @returns {Array.<SuperMap.Feature.Vector>} 最终要绘制的标签要素数组。
  73917. */
  73918. getDrawnLabels(labelFeatures) {
  73919. var feas = [], //最终要绘制的标签要素集
  73920. fea, //最终要绘制的标签要素
  73921. fi, //临时标签要素,用户的第i个标签
  73922. labelsB = [], //不产生压盖的标签要素范围集
  73923. styTmp, //用于临时存储要素style的变量
  73924. feaSty, //标签要素最终的style
  73925. // styleTemp用于屏蔽文本style中带有偏移性质style属性,偏移已经在计算bounds的过程中参与了运算,
  73926. // 所以在最终按照bounds来绘制标签时,需屏蔽style中带有偏移性质属性,否则文本的偏移量将扩大一倍。
  73927. styleTemp = {
  73928. labelAlign: "cm",
  73929. labelXOffset: 0,
  73930. labelYOffset: 0
  73931. };
  73932. var map = this.map;
  73933. var mapSize = map.getSize();
  73934. mapSize = {
  73935. x: mapSize[0],
  73936. y: mapSize[1]
  73937. };
  73938. var zoom = map.getView().getZoom();
  73939. //对用户的每个标签要素进行处理与判断
  73940. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  73941. fi = labelFeatures[i];
  73942. //检查fi的style在避让中是否被改变,如果改变,重新设置要素的style
  73943. if (fi.isStyleChange) {
  73944. fi = this.setStyle(fi);
  73945. }
  73946. //标签最终的中心点像素位置 (偏移后)
  73947. var loc = this.getLabelPxLocation(fi);
  73948. //过滤掉地图范围外的标签 (偏移后)
  73949. if ((loc.x >= 0 && loc.x <= mapSize.x) && (loc.y >= 0 && loc.y <= mapSize.y)) {
  73950. //根据当前地图缩放级别过滤标签
  73951. if (fi.style.minZoomLevel > -1) {
  73952. if (zoom <= fi.style.minZoomLevel) {
  73953. continue;
  73954. }
  73955. }
  73956. if (fi.style.maxZoomLevel > -1) {
  73957. if (zoom > fi.style.maxZoomLevel) {
  73958. continue;
  73959. }
  73960. }
  73961. //计算标签bounds
  73962. var boundsQuad = null;
  73963. if (fi.isStyleChange) {
  73964. fi.isStyleChange = null;
  73965. boundsQuad = this.calculateLabelBounds(fi, loc);
  73966. } else {
  73967. if (fi.geometry.bsInfo.w && fi.geometry.bsInfo.h) {
  73968. //使用calculateLabelBounds2可以提高bounds的计算效率,尤其是在getPxBoundsMode = 1时
  73969. boundsQuad = this.calculateLabelBounds2(fi, loc);
  73970. } else {
  73971. boundsQuad = this.calculateLabelBounds(fi, loc);
  73972. }
  73973. }
  73974. //避让处理 -start
  73975. var mapViewBounds = new Bounds(0, mapSize.y, mapSize.x, 0), //地图像素范围
  73976. quadlen = boundsQuad.length;
  73977. if (this.isAvoid) {
  73978. var avoidInfo = this.getAvoidInfo(mapViewBounds, boundsQuad); //避让信息
  73979. if (avoidInfo) {
  73980. //横向(x方向)上的避让
  73981. if (avoidInfo.aspectW === "left") {
  73982. fi.style.labelXOffset += avoidInfo.offsetX;
  73983. for (let j = 0; j < quadlen; j++) {
  73984. boundsQuad[j].x += avoidInfo.offsetX;
  73985. }
  73986. } else if (avoidInfo.aspectW === "right") {
  73987. fi.style.labelXOffset += (-avoidInfo.offsetX);
  73988. for (let j = 0; j < quadlen; j++) {
  73989. boundsQuad[j].x += (-avoidInfo.offsetX);
  73990. }
  73991. }
  73992. //纵向(y方向)上的避让
  73993. if (avoidInfo.aspectH === "top") {
  73994. fi.style.labelYOffset += avoidInfo.offsetY;
  73995. for (let j = 0; j < quadlen; j++) {
  73996. boundsQuad[j].y += avoidInfo.offsetY;
  73997. }
  73998. } else if (avoidInfo.aspectH === "bottom") {
  73999. fi.style.labelYOffset += (-avoidInfo.offsetY);
  74000. for (let j = 0; j < quadlen; j++) {
  74001. boundsQuad[j].y += (-avoidInfo.offsetY);
  74002. }
  74003. }
  74004. //如果style发生变化,记录下来
  74005. fi.isStyleChange = true;
  74006. }
  74007. }
  74008. //避让处理 -end
  74009. //压盖处理 -start
  74010. if (this.isOverLay) {
  74011. //是否压盖
  74012. var isOL = false;
  74013. if (i != 0) {
  74014. for (let j = 0; j < labelsB.length; j++) {
  74015. //压盖判断
  74016. if (this.isQuadrilateralOverLap(boundsQuad, labelsB[j])) {
  74017. isOL = true;
  74018. break;
  74019. }
  74020. }
  74021. }
  74022. if (isOL) {
  74023. continue;
  74024. } else {
  74025. labelsB.push(boundsQuad);
  74026. }
  74027. }
  74028. //压盖处理 -end
  74029. //将标签像素范围转为地理范围
  74030. var geoBs = [];
  74031. for (let j = 0; j < quadlen - 1; j++) {
  74032. geoBs.push(map.getCoordinateFromPixel([boundsQuad[j].x, boundsQuad[j].y]));
  74033. }
  74034. //屏蔽有偏移性质的style属性,偏移量在算bounds时已经加入计算
  74035. var bounds = new Bounds(geoBs[3][0], geoBs[3][1], geoBs[1][0], [geoBs[1][1]]);
  74036. var center = bounds.getCenterLonLat();
  74037. var label = new GeoText(center.lon, center.lat, fi.attributes[this.themeField]);
  74038. label.calculateBounds();
  74039. styTmp = Util.cloneObject(fi.style);
  74040. feaSty = Util.cloneObject(Util.copyAttributes(styTmp, styleTemp));
  74041. fea = new Vector(label, fi.attributes, feaSty);
  74042. //赋予id
  74043. fea.id = fi.id;
  74044. fea.fid = fi.fid;
  74045. feas.push(fea);
  74046. }
  74047. }
  74048. //返回最终要绘制的标签要素
  74049. return feas;
  74050. }
  74051. /**
  74052. * @function ol.source.Label.prototype.getStyleByData
  74053. * @description 根据用户数据(feature)设置专题要素的 Style。
  74054. * @param {SuperMap.Feature.Vector} feat - 矢量要素对象。
  74055. * @returns {Array.<SuperMap.ThemeStyle>} 专题要素的 Style。
  74056. */
  74057. getStyleByData(feat) {
  74058. var feature = feat;
  74059. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  74060. //将style赋给标签
  74061. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  74062. this.style.fontSize = "12px";
  74063. }
  74064. feature.style = Util.copyAttributes(feature.style, this.style);
  74065. if (this.themeField && this.styleGroups && feature.attributes) {
  74066. var Sf = this.themeField;
  74067. var attributes = feature.attributes;
  74068. var groups = this.styleGroups;
  74069. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  74070. var attr = null; //属性值
  74071. for (var property in attributes) {
  74072. if (Sf === property) {
  74073. isSfInAttrs = true;
  74074. attr = attributes[property];
  74075. break;
  74076. }
  74077. }
  74078. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  74079. if (isSfInAttrs) {
  74080. for (var i = 0, len = groups.length; i < len; i++) {
  74081. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  74082. var sty1 = groups[i].style;
  74083. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  74084. sty1.fontSize = "12px";
  74085. }
  74086. feature.style = Util.copyAttributes(feature.style, sty1);
  74087. }
  74088. }
  74089. }
  74090. feature.style.label = feature.attributes[this.themeField]
  74091. }
  74092. return feature.style;
  74093. }
  74094. /**
  74095. * @function ol.source.Label.prototype.setLabelsStyle
  74096. * @description 设置标签要素的 Style。
  74097. * @param {Array.<SuperMap.Feature.Vector>} labelFeatures - 需要设置 Style 的标签要素数组。
  74098. * @returns {Array.<SuperMap.Feature.Vector>} 赋予 Style 后的标签要素数组。
  74099. */
  74100. setLabelsStyle(labelFeatures) {
  74101. var fea, labelFeas = [];
  74102. for (var i = 0, len = labelFeatures.length; i < len; i++) {
  74103. var feature = labelFeatures[i];
  74104. if (feature.geometry.CLASS_NAME === "SuperMap.Geometry.GeoText") {
  74105. //设置标签的Style
  74106. if (feature.geometry.bsInfo.w || feature.geometry.bsInfo.h) {
  74107. feature.geometry.bsInfo.w = null;
  74108. feature.geometry.bsInfo.h = null;
  74109. feature.geometry.labelWTmp = null;
  74110. }
  74111. fea = this.setStyle(feature);
  74112. //为标签要素指定图层
  74113. fea.layer = this.layer;
  74114. labelFeas.push(fea);
  74115. } else {
  74116. return labelFeatures;
  74117. }
  74118. }
  74119. return labelFeas;
  74120. }
  74121. /**
  74122. * @function ol.source.Label.prototype.setStyle
  74123. * @description 设置标签要素的 Style。
  74124. * @param {SuperMap.Feature.Vector} feat - 需要赋予 style 的要素。
  74125. */
  74126. setStyle(feat) {
  74127. var feature = feat;
  74128. feature.style = Util.copyAttributes(feature.style, this.defaultStyle);
  74129. //将style赋给标签
  74130. if (this.style && this.style.fontSize && parseFloat(this.style.fontSize) < 12) {
  74131. this.style.fontSize = "12px";
  74132. }
  74133. feature.style = Util.copyAttributes(feature.style, this.style);
  74134. if (this.groupField && this.styleGroups && feature.attributes) {
  74135. var Sf = this.groupField;
  74136. var attributes = feature.attributes;
  74137. var groups = this.styleGroups;
  74138. var isSfInAttrs = false; //指定的 groupField 是否是geotext的属性字段之一
  74139. var attr = null; //属性值
  74140. for (var property in attributes) {
  74141. if (Sf === property) {
  74142. isSfInAttrs = true;
  74143. attr = attributes[property];
  74144. break;
  74145. }
  74146. }
  74147. //判断属性值是否属于styleGroups的某一个范围,以便对标签分组
  74148. if (isSfInAttrs) {
  74149. for (var i = 0, len = groups.length; i < len; i++) {
  74150. if ((attr >= groups[i].start) && (attr < groups[i].end)) {
  74151. var sty1 = groups[i].style;
  74152. if (sty1 && sty1.fontSize && parseFloat(sty1.fontSize) < 12) {
  74153. sty1.fontSize = "12px";
  74154. }
  74155. feature.style = Util.copyAttributes(feature.style, sty1);
  74156. }
  74157. }
  74158. }
  74159. }
  74160. //将文本内容赋到标签要素的style上
  74161. feature.style.label = feature.geometry.text;
  74162. return feature;
  74163. }
  74164. /**
  74165. * @function ol.source.Label.prototype.getLabelPxLocation
  74166. * @description 获取标签要素的像素坐标。
  74167. * @param {SuperMap.Feature.Vector} feature - 标签要素。
  74168. * @returns {Object} 标签位置,例如:{"x":1,"y":1}。
  74169. */
  74170. getLabelPxLocation(feature) {
  74171. var geoText = feature.geometry;
  74172. var styleTmp = feature.style;
  74173. //将标签的地理位置转为像素位置
  74174. var locationTmp = geoText.getCentroid();
  74175. var locTmp = this.map.getPixelFromCoordinate([locationTmp.x, locationTmp.y]);
  74176. var loc = new (external_ol_geom_Point_default())([locTmp[0], locTmp[1]]);
  74177. //偏移处理
  74178. if (styleTmp.labelXOffset || styleTmp.labelYOffset) {
  74179. var xOffset = isNaN(styleTmp.labelXOffset) ? 0 : styleTmp.labelXOffset;
  74180. var yOffset = isNaN(styleTmp.labelYOffset) ? 0 : styleTmp.labelYOffset;
  74181. loc.translate(xOffset, -yOffset);
  74182. }
  74183. return {
  74184. x: loc.getCoordinates()[0],
  74185. y: loc.getCoordinates()[1]
  74186. };
  74187. }
  74188. /**
  74189. * @function ol.source.Label.prototype.calculateLabelBounds
  74190. * @description 获得标签要素的最终范围。
  74191. * @param {SuperMap.Feature.Vector} feature - 需要计算bounds的标签要素数。
  74192. * @param {Object} loc - 标签位置,例如:{"x":1,"y":1}。
  74193. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74194. */
  74195. calculateLabelBounds(feature, loc) {
  74196. var geoText = feature.geometry;
  74197. //标签范围(未旋转前)
  74198. var labB = null;
  74199. var labelInfo = null;
  74200. //获取bounds的方式
  74201. if (this.getPxBoundsMode == 0) {
  74202. labB = geoText.getLabelPxBoundsByText(loc, feature.style);
  74203. } else if (this.getPxBoundsMode === 1) {
  74204. //canvas
  74205. labelInfo = this.getLabelInfo(feature.geometry.getCentroid(), feature.style);
  74206. labB = geoText.getLabelPxBoundsByLabel(loc, labelInfo.w, labelInfo.h, feature.style);
  74207. } else {
  74208. return null;
  74209. }
  74210. //旋转Bounds
  74211. var boundsQuad = [];
  74212. if ((feature.style.labelRotation % 180) == 0) {
  74213. boundsQuad = [{
  74214. "x": labB.left,
  74215. "y": labB.top
  74216. },
  74217. {
  74218. "x": labB.right,
  74219. "y": labB.top
  74220. },
  74221. {
  74222. "x": labB.right,
  74223. "y": labB.bottom
  74224. },
  74225. {
  74226. "x": labB.left,
  74227. "y": labB.bottom
  74228. },
  74229. {
  74230. "x": labB.left,
  74231. "y": labB.top
  74232. }
  74233. ];
  74234. } else {
  74235. boundsQuad = this.rotationBounds(labB, loc, feature.style.labelRotation);
  74236. }
  74237. //重置GeoText的bounds
  74238. geoText.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  74239. return boundsQuad;
  74240. }
  74241. /**
  74242. * @function ol.source.Label.prototype.calculateLabelBounds2
  74243. * @description 获得标签要素的最终范围的另一种算法(通过记录下的标签宽高),提高计算 bounds 的效率。
  74244. * @param {SuperMap.Feature.Vector} feature - 需要计算 bounds 的标签要素数。
  74245. * @param {Object} loc - 标签位置,例如:{"x":1,"y":1}。
  74246. * @returns {Array.<Object>} 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74247. */
  74248. calculateLabelBounds2(feature, loc) {
  74249. var labB, left, bottom, top, right;
  74250. var labelSize = feature.geometry.bsInfo;
  74251. var style = feature.style;
  74252. var locationPx = Util.cloneObject(loc);
  74253. //处理文字对齐
  74254. if (style.labelAlign && style.labelAlign !== "cm") {
  74255. switch (style.labelAlign) {
  74256. case "lt":
  74257. locationPx.x += labelSize.w / 2;
  74258. locationPx.y += labelSize.h / 2;
  74259. break;
  74260. case "lm":
  74261. locationPx.x += labelSize.w / 2;
  74262. break;
  74263. case "lb":
  74264. locationPx.x += labelSize.w / 2;
  74265. locationPx.y -= labelSize.h / 2;
  74266. break;
  74267. case "ct":
  74268. locationPx.y += labelSize.h / 2;
  74269. break;
  74270. case "cb":
  74271. locationPx.y -= labelSize.h / 2;
  74272. break;
  74273. case "rt":
  74274. locationPx.x -= labelSize.w / 2;
  74275. locationPx.y += labelSize.h / 2;
  74276. break;
  74277. case "rm":
  74278. locationPx.x -= labelSize.w / 2;
  74279. break;
  74280. case "rb":
  74281. locationPx.x -= labelSize.w / 2;
  74282. locationPx.y -= labelSize.h / 2;
  74283. break;
  74284. default:
  74285. break;
  74286. }
  74287. }
  74288. left = locationPx.x - labelSize.w / 2;
  74289. bottom = locationPx.y + labelSize.h / 2;
  74290. //处理斜体字
  74291. if (style.fontStyle && style.fontStyle === "italic") {
  74292. right = locationPx.x + labelSize.w / 2 + parseInt(parseFloat(style.fontSize) / 2);
  74293. } else {
  74294. right = locationPx.x + labelSize.w / 2;
  74295. }
  74296. top = locationPx.y - labelSize.h / 2;
  74297. labB = new Bounds(left, bottom, right, top);
  74298. //旋转Bounds
  74299. var boundsQuad = [];
  74300. if ((style.labelRotation % 180) == 0) {
  74301. boundsQuad = [{
  74302. "x": labB.left,
  74303. "y": labB.top
  74304. },
  74305. {
  74306. "x": labB.right,
  74307. "y": labB.top
  74308. },
  74309. {
  74310. "x": labB.right,
  74311. "y": labB.bottom
  74312. },
  74313. {
  74314. "x": labB.left,
  74315. "y": labB.bottom
  74316. },
  74317. {
  74318. "x": labB.left,
  74319. "y": labB.top
  74320. }
  74321. ];
  74322. } else {
  74323. boundsQuad = this.rotationBounds(labB, loc, style.labelRotation);
  74324. }
  74325. //重置GeoText的bounds
  74326. feature.geometry.bounds = new Bounds(boundsQuad[1].x, boundsQuad[3].y, boundsQuad[2].x, boundsQuad[4].y);
  74327. return boundsQuad;
  74328. }
  74329. /**
  74330. * @function ol.source.Label.prototype.getLabelInfo
  74331. * @description 根据当前位置获取绘制后的标签信息,包括标签的宽,高和行数等。
  74332. * @returns {Object} 绘制后的标签信息。
  74333. */
  74334. getLabelInfo(location, style) {
  74335. var LABEL_ALIGN = {
  74336. "l": "left",
  74337. "r": "right",
  74338. "t": "top",
  74339. "b": "bottom"
  74340. },
  74341. LABEL_FACTOR = {
  74342. "l": 0,
  74343. "r": -1,
  74344. "t": 0,
  74345. "b": -1
  74346. };
  74347. style = Util.extend({
  74348. fontColor: "#000000",
  74349. labelAlign: "cm"
  74350. }, style);
  74351. var pt = this.getLocalXY(location);
  74352. var labelWidth = 0;
  74353. if (style.labelXOffset || style.labelYOffset) {
  74354. var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
  74355. var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
  74356. pt[0] += xOffset;
  74357. pt[1] -= yOffset;
  74358. }
  74359. var canvas = document.createElement('canvas');
  74360. canvas.globalAlpha = 0;
  74361. canvas.lineWidth = 1;
  74362. var ctx = canvas.getContext("2d");
  74363. ctx.fillStyle = style.fontColor;
  74364. ctx.globalAlpha = style.fontOpacity || 1.0;
  74365. var fontStyle = [style.fontStyle ? style.fontStyle : "normal",
  74366. "normal",
  74367. style.fontWeight ? style.fontWeight : "normal",
  74368. style.fontSize ? style.fontSize : "1em",
  74369. style.fontFamily ? style.fontFamily : "sans-serif"
  74370. ].join(" ");
  74371. var labelRows = style.label.split('\n');
  74372. var numRows = labelRows.length;
  74373. var vfactor, lineHeight, labelWidthTmp;
  74374. if (ctx.fillText) {
  74375. // HTML5
  74376. ctx.font = fontStyle;
  74377. ctx.textAlign = LABEL_ALIGN[style.labelAlign[0]] ||
  74378. "center";
  74379. ctx.textBaseline = LABEL_ALIGN[style.labelAlign[1]] ||
  74380. "middle";
  74381. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  74382. if (vfactor == null) {
  74383. vfactor = -.5;
  74384. }
  74385. lineHeight = ctx.measureText('Mg').height ||
  74386. ctx.measureText('xx').width;
  74387. pt[1] += lineHeight * vfactor * (numRows - 1);
  74388. for (let i = 0; i < numRows; i++) {
  74389. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  74390. if (labelWidth < labelWidthTmp) {
  74391. labelWidth = labelWidthTmp;
  74392. }
  74393. }
  74394. } else if (ctx.mozDrawText) {
  74395. // Mozilla pre-Gecko1.9.1 (<FF3.1)
  74396. ctx.mozTextStyle = fontStyle;
  74397. vfactor = LABEL_FACTOR[style.labelAlign[1]];
  74398. if (vfactor == null) {
  74399. vfactor = -.5;
  74400. }
  74401. lineHeight = ctx.mozMeasureText('xx');
  74402. pt[1] += lineHeight * (1 + (vfactor * numRows));
  74403. for (let i = 0; i < numRows; i++) {
  74404. labelWidthTmp = ctx.measureText(labelRows[i]).width;
  74405. if (labelWidth < labelWidthTmp) {
  74406. labelWidth = labelWidthTmp;
  74407. }
  74408. }
  74409. }
  74410. var labelInfo = {}; //标签信息
  74411. if (labelWidth) {
  74412. labelInfo.w = labelWidth; //标签的宽
  74413. } else {
  74414. return null;
  74415. }
  74416. labelInfo.h = style.fontSize; //一行标签的高
  74417. labelInfo.rows = labelRows.length; //标签的行数
  74418. return labelInfo;
  74419. }
  74420. /**
  74421. * @function ol.source.Label.prototype.rotationBounds
  74422. * @description 旋转 bounds。
  74423. * @param {SuperMap.Bounds} bounds - 要旋转的 bounds。
  74424. * @param {Object} rotationCenterPoi - 旋转中心点对象,此对象含有属性 x(横坐标),属性 y(纵坐标)。
  74425. * @param {number} angle - 旋转角度(顺时针)。
  74426. * @returns {Array.<Object>} bounds 旋转后形成的多边形节点数组。是一个四边形,形如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74427. */
  74428. rotationBounds(bounds, rotationCenterPoi, angle) {
  74429. var ltPoi = new (external_ol_geom_Point_default())([bounds.left, bounds.top]);
  74430. var rtPoi = new (external_ol_geom_Point_default())([bounds.right, bounds.top]);
  74431. var rbPoi = new (external_ol_geom_Point_default())([bounds.right, bounds.bottom]);
  74432. var lbPoi = new (external_ol_geom_Point_default())([bounds.left, bounds.bottom]);
  74433. var ver = [];
  74434. ver.push(this.getRotatedLocation(ltPoi.getCoordinates()[0], ltPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  74435. ver.push(this.getRotatedLocation(rtPoi.getCoordinates()[0], rtPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  74436. ver.push(this.getRotatedLocation(rbPoi.getCoordinates()[0], rbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  74437. ver.push(this.getRotatedLocation(lbPoi.getCoordinates()[0], lbPoi.getCoordinates()[1], rotationCenterPoi.x, rotationCenterPoi.y, angle));
  74438. //bounds旋转后形成的多边形节点数组
  74439. var quad = [];
  74440. for (var i = 0; i < ver.length; i++) {
  74441. quad.push({
  74442. "x": ver[i].x,
  74443. "y": ver[i].y
  74444. });
  74445. }
  74446. quad.push({
  74447. "x": ver[0].x,
  74448. "y": ver[0].y
  74449. });
  74450. return quad;
  74451. }
  74452. /**
  74453. * @function ol.source.Label.prototype.getRotatedLocation
  74454. * @description 获取一个点绕旋转中心顺时针旋转后的位置。(此方法用于屏幕坐标)。
  74455. * @param {number} x - 旋转点横坐标。
  74456. * @param {number} y - 旋转点纵坐标。
  74457. * @param {number} rx - 旋转中心点横坐标。
  74458. * @param {number} ry - 旋转中心点纵坐标。
  74459. * @param {number} angle - 旋转角度
  74460. * @returns {Object} 旋转后的坐标位置对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  74461. */
  74462. getRotatedLocation(x, y, rx, ry, angle) {
  74463. var loc = {},
  74464. x0, y0;
  74465. y = -y;
  74466. ry = -ry;
  74467. angle = -angle; //顺时针旋转
  74468. x0 = (x - rx) * Math.cos((angle / 180) * Math.PI) - (y - ry) * Math.sin((angle / 180) * Math.PI) + rx;
  74469. y0 = (x - rx) * Math.sin((angle / 180) * Math.PI) + (y - ry) * Math.cos((angle / 180) * Math.PI) + ry;
  74470. loc.x = x0;
  74471. loc.y = -y0;
  74472. return loc;
  74473. }
  74474. /**
  74475. * @function ol.source.Label.prototype.getAvoidInfo
  74476. * @description 获取避让的信息。
  74477. * @param {SuperMap.Bounds} bounds - 地图像素范围。
  74478. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74479. * @returns {Object} 避让的信息。
  74480. */
  74481. getAvoidInfo(bounds, quadrilateral) {
  74482. if (quadrilateral.length !== 5) {
  74483. return null;
  74484. } //不是四边形
  74485. //将bound序列化为点数组形式
  74486. var bounddQuad = [{
  74487. "x": bounds.left,
  74488. "y": bounds.top
  74489. },
  74490. {
  74491. "x": bounds.right,
  74492. "y": bounds.top
  74493. },
  74494. {
  74495. "x": bounds.right,
  74496. "y": bounds.bottom
  74497. },
  74498. {
  74499. "x": bounds.left,
  74500. "y": bounds.bottom
  74501. },
  74502. {
  74503. "x": bounds.left,
  74504. "y": bounds.top
  74505. }
  74506. ];
  74507. var isIntersection = false,
  74508. bqLen = bounddQuad.length,
  74509. quadLen = quadrilateral.length;
  74510. var offsetX = 0,
  74511. offsetY = 0,
  74512. aspectH = "",
  74513. aspectW = "";
  74514. for (var i = 0; i < bqLen - 1; i++) {
  74515. for (var j = 0; j < quadLen - 1; j++) {
  74516. var isLineIn = Util.lineIntersection(bounddQuad[i], bounddQuad[i + 1], quadrilateral[j], quadrilateral[j + 1]);
  74517. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  74518. //设置避让信息
  74519. setInfo(quadrilateral[j]);
  74520. setInfo(quadrilateral[j + 1]);
  74521. isIntersection = true;
  74522. }
  74523. }
  74524. }
  74525. if (isIntersection) {
  74526. //组织避让操作所需的信息
  74527. return {
  74528. "aspectW": aspectW,
  74529. "aspectH": aspectH,
  74530. "offsetX": offsetX,
  74531. "offsetY": offsetY
  74532. };
  74533. } else {
  74534. return null;
  74535. }
  74536. //内部函数:设置避让信息
  74537. //参数:vec-{Object} quadrilateral四边形单个节点。如:{"x":1,"y":1}。
  74538. function setInfo(vec) {
  74539. //四边形不在bounds内的节点
  74540. if (!bounds.contains(vec.x, vec.y)) {
  74541. //bounds的Top边
  74542. if (vec.y < bounds.top) {
  74543. let oY = Math.abs(bounds.top - vec.y);
  74544. if (oY > offsetY) {
  74545. offsetY = oY;
  74546. aspectH = "top";
  74547. }
  74548. }
  74549. //bounds的Bottom边
  74550. if (vec.y > bounds.bottom) {
  74551. let oY = Math.abs(vec.y - bounds.bottom);
  74552. if (oY > offsetY) {
  74553. offsetY = oY;
  74554. aspectH = "bottom";
  74555. }
  74556. }
  74557. //bounds的left边
  74558. if (vec.x < bounds.left) {
  74559. let oX = Math.abs(bounds.left - vec.x);
  74560. if (oX > offsetX) {
  74561. offsetX = oX;
  74562. aspectW = "left";
  74563. }
  74564. }
  74565. //bounds的right边
  74566. if (vec.x > bounds.right) {
  74567. let oX = Math.abs(vec.x - bounds.right);
  74568. if (oX > offsetX) {
  74569. offsetX = oX;
  74570. aspectW = "right";
  74571. }
  74572. }
  74573. }
  74574. }
  74575. }
  74576. /**
  74577. * @function ol.source.Label.prototype.isQuadrilateralOverLap
  74578. * @description 判断两个四边形是否有压盖。
  74579. * @param {Array.<Object>} quadrilateral - 四边形节点数组。例如:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74580. * @param {Array.<Object>} quadrilateral2 - 第二个四边形节点数组。
  74581. * @returns {boolean} 是否压盖,true 表示压盖。
  74582. */
  74583. isQuadrilateralOverLap(quadrilateral, quadrilateral2) {
  74584. var quadLen = quadrilateral.length,
  74585. quad2Len = quadrilateral2.length;
  74586. if (quadLen !== 5 || quad2Len !== 5) {
  74587. return null;
  74588. } //不是四边形
  74589. var OverLap = false;
  74590. //如果两四边形互不包含对方的节点,则两个四边形不相交
  74591. for (let i = 0; i < quadLen; i++) {
  74592. if (this.isPointInPoly(quadrilateral[i], quadrilateral2)) {
  74593. OverLap = true;
  74594. break;
  74595. }
  74596. }
  74597. for (let i = 0; i < quad2Len; i++) {
  74598. if (this.isPointInPoly(quadrilateral2[i], quadrilateral)) {
  74599. OverLap = true;
  74600. break;
  74601. }
  74602. }
  74603. //加上两矩形十字相交的情况
  74604. for (let i = 0; i < quadLen - 1; i++) {
  74605. if (OverLap) {
  74606. break;
  74607. }
  74608. for (var j = 0; j < quad2Len - 1; j++) {
  74609. var isLineIn = Util.lineIntersection(quadrilateral[i], quadrilateral[i + 1], quadrilateral2[j], quadrilateral2[j + 1]);
  74610. if (isLineIn.CLASS_NAME === "SuperMap.Geometry.Point") {
  74611. OverLap = true;
  74612. break;
  74613. }
  74614. }
  74615. }
  74616. return OverLap;
  74617. }
  74618. /**
  74619. * @function ol.source.Label.prototype.isPointInPoly
  74620. * @description 判断一个点是否在多边形里面(射线法)。
  74621. * @param {Object} pt - 需要判定的点对象,该对象含有属性 x(横坐标),属性 y(纵坐标)。
  74622. * @param {Array.<Object>} poly - 多边形节点数组。例如一个四边形:[{"x":1,"y":1},{"x":3,"y":1},{"x":6,"y":4},{"x":2,"y":10},{"x":1,"y":1}]。
  74623. * @returns {boolean} 点是否在多边形内。
  74624. */
  74625. isPointInPoly(pt, poly) {
  74626. for (var isIn = false, i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
  74627. ((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) &&
  74628. (pt.x < (poly[j].x - poly[i].x) * (pt.y - poly[i].y) / (poly[j].y - poly[i].y) + poly[i].x) &&
  74629. (isIn = !isIn);
  74630. }
  74631. return isIn;
  74632. }
  74633. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  74634. return super.canvasFunctionInternal_.apply(this, arguments);
  74635. }
  74636. }
  74637. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/MapvCanvasLayer.js
  74638. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74639. * This program are made available under the terms of the Apache License, Version 2.0
  74640. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74641. /**
  74642. * @class ol.supermap.MapvCanvasLayer
  74643. * @classdesc Mapv 渲染器。
  74644. * @private
  74645. * @param {Object} options - 参数。
  74646. * @param {number} options.width - 画布宽。
  74647. * @param {number} options.height - 画布高。
  74648. * @param {string} [options.paneName='mapPane'] - 窗口名。
  74649. * @param {string} [options.context='2d'] - 内容。
  74650. * @param {number} [options.zIndex=2] - 层级。
  74651. * @param {string} [options.mixBlendMode] - 最小混合模式。
  74652. */
  74653. class MapvCanvasLayer {
  74654. constructor(options) {
  74655. this.options = options || {};
  74656. this.enableMassClear = this.options.enableMassClear;
  74657. this._map = options.map;
  74658. this.paneName = this.options.paneName || 'mapPane';
  74659. this.context = this.options.context || '2d';
  74660. this.zIndex = this.options.zIndex || 2;
  74661. this.mixBlendMode = this.options.mixBlendMode || null;
  74662. this.width = options.width;
  74663. this.height = options.height;
  74664. this.initialize();
  74665. }
  74666. initialize() {
  74667. var canvas = this.canvas = document.createElement("canvas");
  74668. canvas.style.cssText = "position:absolute;" + "left:0;" + "top:0;" + "z-index:" + this.zIndex + ";user-select:none;";
  74669. canvas.style.mixBlendMode = this.mixBlendMode;
  74670. canvas.className = "mapvClass";
  74671. var global$2 = typeof window === 'undefined' ? {} : window;
  74672. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  74673. canvas.width = parseInt(this.width) * devicePixelRatio;
  74674. canvas.height = parseInt(this.height) * devicePixelRatio;
  74675. if (this.context === '2d') {
  74676. canvas.getContext(this.context).scale(devicePixelRatio, devicePixelRatio);
  74677. }
  74678. canvas.style.width = this.width + "px";
  74679. canvas.style.height = this.height + "px";
  74680. if (this.context === 'webgl') {
  74681. this.canvas.getContext(this.context).viewport(0, 0, canvas.width, canvas.height)
  74682. }
  74683. }
  74684. /**
  74685. * @function ol.supermap.MapvCanvasLayer.prototype.draw
  74686. * @description 生成地图。
  74687. */
  74688. draw() {
  74689. this.options.update && this.options.update.call(this);
  74690. }
  74691. /**
  74692. * @function ol.supermap.MapvCanvasLayer.prototype.resize
  74693. * @param {number} mapWidth - 地图宽度。
  74694. * @param {number} mapHeight - 地图高度。
  74695. * @description 调整地图大小。
  74696. */
  74697. resize(mapWidth, mapHeight) {
  74698. var global$2 = typeof window === 'undefined' ? {} : window;
  74699. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  74700. this.canvas.width = mapWidth * devicePixelRatio;
  74701. this.canvas.height = mapHeight * devicePixelRatio;
  74702. if (this.context === '2d') {
  74703. this.canvas.getContext('2d').scale(devicePixelRatio, devicePixelRatio);
  74704. }
  74705. this.canvas.style.width = mapWidth + "px";
  74706. this.canvas.style.height = mapHeight + "px";
  74707. if (this.context === 'webgl') {
  74708. this.canvas.getContext(this.context).viewport(0, 0, this.canvas.width, this.canvas.height)
  74709. }
  74710. }
  74711. /**
  74712. * @function ol.supermap.MapvCanvasLayer.prototype.getContainer
  74713. * @description 获取容器。
  74714. * @returns {Element} 包含 Mapv 图层的 DOM 对象。
  74715. */
  74716. getContainer() {
  74717. return this.canvas;
  74718. }
  74719. /**
  74720. * @function ol.supermap.MapvCanvasLayer.prototype.setZIndex
  74721. * @param {number} zIndex - 层级参数。
  74722. * @description 设置图层层级。
  74723. */
  74724. setZIndex(zIndex) {
  74725. this.canvas.style.zIndex = zIndex;
  74726. }
  74727. /**
  74728. * @function ol.supermap.MapvCanvasLayer.prototype.getZIndex
  74729. * @description 获取图层层级。
  74730. */
  74731. getZIndex() {
  74732. return this.zIndex;
  74733. }
  74734. }
  74735. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  74736. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  74737. ;// CONCATENATED MODULE: external "ol.interaction.Pointer"
  74738. const external_ol_interaction_Pointer_namespaceObject = ol.interaction.Pointer;
  74739. var external_ol_interaction_Pointer_default = /*#__PURE__*/__webpack_require__.n(external_ol_interaction_Pointer_namespaceObject);
  74740. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/MapvLayer.js
  74741. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  74742. * This program are made available under the terms of the Apache License, Version 2.0
  74743. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  74744. var BaiduMapLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  74745. /**
  74746. * @class MapvLayer
  74747. * @classdesc MapV 图层类。
  74748. * @private
  74749. * @param {Object} map - 地图。
  74750. * @param {Mapv.DataSet} [dataSet] - 数据集。
  74751. * @param {Object} options - 参数。
  74752. * @param {number} mapWidth - 地图宽度。
  74753. * @param {number} mapHeight - 地图高度。
  74754. * @param {Object} source - 资源。
  74755. * @param {number} options.width - 画布宽。
  74756. * @param {number} options.height - 画布高。
  74757. * @param {string} [options.paneName='mapPane'] - 窗口名。
  74758. * @param {string} [options.context] - 内容。
  74759. * @param {number} [options.zIndex] - 层级。
  74760. * @param {string} [options.mixBlendMode] - 最小混合模式。
  74761. * @extends {Mapv.BaiduMapLayer}
  74762. */
  74763. class MapvLayer extends BaiduMapLayer {
  74764. constructor(map, dataSet, options, mapWidth, mapHeight, source) {
  74765. super(map, dataSet, options);
  74766. this.dataSet = dataSet;
  74767. this.mapWidth = mapWidth;
  74768. this.mapHeight = mapHeight;
  74769. var self = this;
  74770. options = options || {};
  74771. this.source = source;
  74772. self.animator = null;
  74773. self.map = map;
  74774. self.init(options);
  74775. self.argCheck(options);
  74776. this.canvasLayer = new MapvCanvasLayer({
  74777. map: map,
  74778. context: this.context,
  74779. paneName: options.paneName,
  74780. mixBlendMode: options.mixBlendMode,
  74781. enableMassClear: options.enableMassClear,
  74782. zIndex: options.zIndex,
  74783. width: mapWidth,
  74784. height: mapHeight,
  74785. update: function update() {
  74786. self._canvasUpdate();
  74787. }
  74788. });
  74789. this.clickEvent = this.clickEvent.bind(this);
  74790. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  74791. map.on('movestart', this.moveStartEvent.bind(this));
  74792. map.on('moveend', this.moveEndEvent.bind(this));
  74793. map.getView().on('change:center', this.zoomEvent.bind(this));
  74794. map.getView().on('change:size', this.sizeEvent.bind(this));
  74795. map.on('pointerdrag', this.dragEvent.bind(this));
  74796. this.bindEvent();
  74797. }
  74798. /**
  74799. * @function MapvLayer.prototype.init
  74800. * @param {Object} options - 参数。
  74801. * @description 初始化参数。
  74802. */
  74803. init(options) {
  74804. var self = this;
  74805. self.options = options;
  74806. this.initDataRange(options);
  74807. this.context = self.options.context || '2d';
  74808. if (self.options.zIndex) {
  74809. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  74810. }
  74811. this.initAnimator();
  74812. }
  74813. /**
  74814. * @function MapvLayer.prototype.clickEvent
  74815. * @param {Object} e - 事件参数。
  74816. * @description 点击事件。
  74817. */
  74818. clickEvent(e) {
  74819. var pixel = e.pixel;
  74820. super.clickEvent({
  74821. x: pixel[0] + this.offset[0],
  74822. y: pixel[1] + this.offset[1]
  74823. }, e);
  74824. }
  74825. /**
  74826. * @function MapvLayer.prototype.mousemoveEvent
  74827. * @param {Object} e - 事件参数。
  74828. * @description 鼠标移动事件。
  74829. */
  74830. mousemoveEvent(e) {
  74831. var pixel = e.pixel;
  74832. super.mousemoveEvent({
  74833. x: pixel[0],
  74834. y: pixel[1]
  74835. }, e);
  74836. }
  74837. /**
  74838. * @function MapvLayer.prototype.dragEvent
  74839. * @description 鼠标拖动事件。
  74840. */
  74841. dragEvent() {
  74842. this.clear(this.getContext());
  74843. }
  74844. /**
  74845. * @function MapvLayer.prototype.zoomEvent
  74846. * @description 缩放事件。
  74847. */
  74848. zoomEvent() {
  74849. this.clear(this.getContext());
  74850. }
  74851. /**
  74852. * @function MapvLayer.prototype.sizeEvent
  74853. * @description 地图窗口大小发生变化时触发。
  74854. */
  74855. sizeEvent() {
  74856. this.canvasLayer.resize();
  74857. }
  74858. /**
  74859. * @function MapvLayer.prototype.moveStartEvent
  74860. * @description 开始移动事件。
  74861. */
  74862. moveStartEvent() {
  74863. var animationOptions = this.options.animation;
  74864. if (this.isEnabledTime() && this.animator) {
  74865. this.steps.step = animationOptions.stepsRange.start;
  74866. }
  74867. }
  74868. /**
  74869. * @function MapvLayer.prototype.moveEndEvent
  74870. * @description 结束移动事件。
  74871. */
  74872. moveEndEvent() {
  74873. this.canvasLayer.draw();
  74874. }
  74875. /**
  74876. * @function MapvLayer.prototype.bindEvent
  74877. * @description 绑定事件。
  74878. */
  74879. bindEvent() {
  74880. var me = this;
  74881. var map = me.map;
  74882. if (me.options.methods) {
  74883. if (me.options.methods.click) {
  74884. map.on('click', me.clickEvent);
  74885. }
  74886. if (me.options.methods.mousemove) {
  74887. me.pointerInteraction = new (external_ol_interaction_Pointer_default())();
  74888. me.pointerInteraction.handleMoveEvent_ = function (event) {
  74889. me.mousemoveEvent(event);
  74890. };
  74891. map.addInteraction(me.pointerInteraction);
  74892. }
  74893. }
  74894. }
  74895. /**
  74896. * @function MapvLayer.prototype.unbindEvent
  74897. * @description 解除绑定事件。
  74898. */
  74899. unbindEvent() {
  74900. var map = this.map;
  74901. if (this.options.methods) {
  74902. if (this.options.methods.click) {
  74903. map.un('click', this.clickEvent);
  74904. }
  74905. if (this.options.methods.mousemove) {
  74906. map.removeInteraction(this.pointerInteraction)
  74907. }
  74908. }
  74909. }
  74910. /**
  74911. * @function MapvLayer.prototype.addData
  74912. * @description 添加数据。
  74913. * @param {Object} data - 待添加的数据。
  74914. * @param {Object} options - 待添加的数据信息。
  74915. */
  74916. addData(data, options) {
  74917. var _data = data;
  74918. if (data && data.get) {
  74919. _data = data.get();
  74920. }
  74921. this.dataSet.add(_data);
  74922. this.update({
  74923. options: options
  74924. });
  74925. }
  74926. /**
  74927. * @function MapvLayer.prototype.update
  74928. * @description 更新图层。
  74929. * @param {Object} opt - 待更新的数据。
  74930. * @param {Object} opt.data - mapv 数据集。
  74931. */
  74932. update(opt) {
  74933. var update = opt || {};
  74934. var _data = update.data;
  74935. if (_data && _data.get) {
  74936. _data = _data.get();
  74937. }
  74938. if (_data != undefined) {
  74939. this.dataSet.set(_data);
  74940. }
  74941. super.update({
  74942. options: update.options
  74943. });
  74944. }
  74945. draw() {
  74946. this.canvasLayer.draw();
  74947. }
  74948. /**
  74949. * @function MapvLayer.prototype.getData
  74950. * @description 获取数据。
  74951. */
  74952. getData() {
  74953. return this.dataSet;
  74954. }
  74955. /**
  74956. * @function MapvLayer.prototype.removeData
  74957. * @description 删除符合过滤条件的数据。
  74958. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  74959. */
  74960. removeData(filter) {
  74961. if (!this.dataSet) {
  74962. return;
  74963. }
  74964. var newData = this.dataSet.get({
  74965. filter: function (data) {
  74966. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  74967. }
  74968. });
  74969. this.dataSet.set(newData);
  74970. this.update({
  74971. options: null
  74972. });
  74973. }
  74974. /**
  74975. * @function MapvLayer.prototype.clearData
  74976. * @description 清除数据。
  74977. */
  74978. clearData() {
  74979. this.dataSet && this.dataSet.clear();
  74980. this.update({
  74981. options: null
  74982. });
  74983. }
  74984. _canvasUpdate(time) {
  74985. if (!this.canvasLayer) {
  74986. return;
  74987. }
  74988. var self = this;
  74989. var animationOptions = self.options.animation;
  74990. var map = self.map;
  74991. var context = self.canvasLayer.canvas.getContext(self.context);
  74992. if (self.isEnabledTime()) {
  74993. if (time === undefined) {
  74994. self.clear(context);
  74995. return;
  74996. }
  74997. if (!self.context || self.context === '2d') {
  74998. context.save();
  74999. context.globalCompositeOperation = 'destination-out';
  75000. context.fillStyle = 'rgba(0, 0, 0, .1)';
  75001. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  75002. context.restore();
  75003. }
  75004. } else {
  75005. this.clear(context);
  75006. }
  75007. if (!self.context || self.context === '2d') {
  75008. for (var key in self.options) {
  75009. context[key] = self.options[key];
  75010. }
  75011. } else {
  75012. context.clear(context.COLOR_BUFFER_BIT);
  75013. }
  75014. var ext = map.getView().calculateExtent();
  75015. var topLeftPx = map.getPixelFromCoordinate([ext[0], ext[3]]);
  75016. self._mapCenter = map.getView().getCenter();
  75017. self._mapCenterPx = map.getPixelFromCoordinate(self._mapCenter);
  75018. self._reselutions = map.getView().getResolution();
  75019. self._rotation = -map.getView().getRotation();
  75020. var zoomUnit = self._reselutions;
  75021. var scaleRatio = 1;
  75022. if (this.context != '2d') {
  75023. var global$2 = typeof window === 'undefined' ? {} : window;
  75024. var devicePixelRatio = global$2.devicePixelRatio || 1;
  75025. scaleRatio = devicePixelRatio;
  75026. }
  75027. var dataGetOptions = {
  75028. transferCoordinate: function (coordinate) {
  75029. var x = (coordinate[0] - self._mapCenter[0]) / self._reselutions,
  75030. y = (self._mapCenter[1] - coordinate[1]) / self._reselutions;
  75031. var scaledP = [x + self._mapCenterPx[0], y + self._mapCenterPx[1]];
  75032. scaledP = scale(scaledP, self._mapCenterPx, 1);
  75033. /*//有旋转量的时候处理旋转
  75034. if (self._rotation !== 0) {
  75035. var rotatedP = rotate(scaledP, self._rotation, self._mapCenterPx);
  75036. return [rotatedP[0] + self.offset[0], rotatedP[1] + self.offset[1]];
  75037. }
  75038. //处理放大或缩小级别*/
  75039. return [(scaledP[0] + self.offset[0]) * scaleRatio, (scaledP[1] + self.offset[1]) * scaleRatio];
  75040. }
  75041. };
  75042. // //获取某像素坐标点pixelP绕中心center逆时针旋转rotation弧度后的像素点坐标。
  75043. // function rotate(pixelP, rotation, center) {
  75044. // var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  75045. // var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  75046. // return [x, y];
  75047. // }
  75048. //获取某像素坐标点pixelP相对于中心center进行缩放scaleRatio倍后的像素点坐标。
  75049. function scale(pixelP, center, scaleRatio) {
  75050. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  75051. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  75052. return [x, y];
  75053. }
  75054. if (time !== undefined) {
  75055. dataGetOptions.filter = function (item) {
  75056. var trails = animationOptions.trails || 10;
  75057. return (time && item.time > (time - trails) && item.time < time);
  75058. };
  75059. }
  75060. if (self.isEnabledTime() && !self.notFirst) {
  75061. self.canvasLayer.resize(self.mapWidth, self.mapHeight);
  75062. self.notFirst = true;
  75063. }
  75064. var data = self.dataSet.get(dataGetOptions);
  75065. self.processData(data);
  75066. // 兼容unit为'm'的情况
  75067. if (self.options.unit === 'm') {
  75068. if (self.options.size) {
  75069. self.options._size = self.options.size / zoomUnit;
  75070. }
  75071. if (self.options.width) {
  75072. self.options._width = self.options.width / zoomUnit;
  75073. }
  75074. if (self.options.height) {
  75075. self.options._height = self.options.height / zoomUnit;
  75076. }
  75077. } else {
  75078. self.options._size = self.options.size;
  75079. self.options._height = self.options.height;
  75080. self.options._width = self.options.width;
  75081. }
  75082. var pixel = map.getPixelFromCoordinate([0, 0]);
  75083. pixel = [pixel[0] - topLeftPx[0], pixel[1] - topLeftPx[1]];
  75084. this.drawContext(context, data, self.options, {
  75085. x: pixel[0],
  75086. y: pixel[1]
  75087. });
  75088. if (self.isEnabledTime()) {
  75089. this.source.changed();
  75090. }
  75091. self.options.updateCallback && self.options.updateCallback(time);
  75092. }
  75093. isEnabledTime() {
  75094. var animationOptions = this.options.animation;
  75095. return animationOptions && !(animationOptions.enabled === false);
  75096. }
  75097. argCheck(options) {
  75098. if (options.draw === 'heatmap') {
  75099. if (options.strokeStyle) {
  75100. console.warn('[heatmap] options.strokeStyle is discard, pleause use options.strength [eg: options.strength = 0.1]');
  75101. }
  75102. }
  75103. }
  75104. getContext() {
  75105. return this.canvasLayer.canvas.getContext(this.context);
  75106. }
  75107. clear(context) {
  75108. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  75109. }
  75110. }
  75111. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Mapv.js
  75112. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75113. * This program are made available under the terms of the Apache License, Version 2.0
  75114. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75115. /**
  75116. * @class ol.source.Mapv
  75117. * @category Visualization MapV
  75118. * @classdesc MapV 图层源。
  75119. * @param {Object} opt_options - 参数。
  75120. * @param {ol/Map} opt_options.map - 当前 Map 对象。
  75121. * @param {Mapv.DataSet} opt_options.dataSet - MapV 的数据集。
  75122. * @param {Object} opt_options.mapvOptions - MapV 的配置对象。
  75123. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  75124. * @param {ol/proj/Projection} [opt_option.projection] - 投影信息。
  75125. * @param {number} [opt_option.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。 必须是 1 或更高。
  75126. * @param {Array} [opt_option.resolutions] - 分辨率数组。
  75127. * @param {ol/source/State} [opt_option.state] - 资源状态。
  75128. * @param {(string|Object)} [opt_option.attributions='© 2018 百度 MapV with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  75129. * @extends {ol/source/ImageCanvas}
  75130. */
  75131. class Mapv extends (external_ol_source_ImageCanvas_default()) {
  75132. constructor(opt_options) {
  75133. var options = opt_options ? opt_options : {};
  75134. super({
  75135. attributions: options.attributions || "© 2018 百度 MapV with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>",
  75136. canvasFunction: canvasFunctionInternal_,
  75137. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  75138. projection: options.projection,
  75139. ratio: options.ratio,
  75140. resolutions: options.resolutions,
  75141. state: options.state
  75142. });
  75143. this.map = opt_options.map;
  75144. this.dataSet = opt_options.dataSet;
  75145. this.mapvOptions = opt_options.mapvOptions;
  75146. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  75147. var mapWidth = size[0] / pixelRatio;
  75148. var mapHeight = size[1] / pixelRatio;
  75149. var width = this.map.getSize()[0];
  75150. var height = this.map.getSize()[1];
  75151. if (!this.layer) {
  75152. this.layer = new MapvLayer(this.map, this.dataSet, this.mapvOptions, mapWidth, mapHeight, this);
  75153. }
  75154. this.layer.pixelRatio = pixelRatio;
  75155. this.layer.offset = [(mapWidth - width) / 2 , (mapHeight - height) / 2 ];
  75156. if (!this.rotate) {
  75157. this.rotate = this.map.getView().getRotation();
  75158. } else {
  75159. if (this.rotate !== this.map.getView().getRotation()) {
  75160. this.layer.canvasLayer.resize(mapWidth, mapHeight);
  75161. this.rotate = this.map.getView().getRotation()
  75162. }
  75163. }
  75164. var canvas = this.layer.canvasLayer.canvas;
  75165. if (!this.layer.isEnabledTime()) {
  75166. this.layer.canvasLayer.resize(mapWidth, mapHeight);
  75167. this.layer.canvasLayer.draw();
  75168. }
  75169. if (!this.context) {
  75170. this.context = core_Util_Util.createCanvasContext2D(mapWidth, mapHeight);
  75171. }
  75172. var canvas2 = this.context.canvas;
  75173. this.context.clearRect(0, 0, canvas2.width, canvas2.height);
  75174. canvas2.width = size[0];
  75175. canvas2.height = size[1];
  75176. canvas2.style.width = size[0] + "px";
  75177. canvas2.style.height = size[1] + "px";
  75178. this.context.drawImage(canvas, 0, 0);
  75179. if (this.resolution !== resolution || JSON.stringify(this.extent) !== JSON.stringify(extent)) {
  75180. this.resolution = resolution;
  75181. this.extent = extent;
  75182. }
  75183. return this.context.canvas;
  75184. }
  75185. }
  75186. /**
  75187. * @function ol.source.Mapv.prototype.addData
  75188. * @description 追加数据。
  75189. * @param {Object} data - 要追加的数据。
  75190. * @param {Object} options - 要追加的值。
  75191. */
  75192. addData(data, options) {
  75193. this.layer.addData(data, options);
  75194. }
  75195. /**
  75196. * @function ol.source.Mapv.prototype.getData
  75197. * @description 获取数据。
  75198. * @returns {mapv.DataSet} MapV 数据集。
  75199. */
  75200. getData() {
  75201. if (this.layer) {
  75202. this.dataSet = this.layer.getData();
  75203. }
  75204. return this.dataSet;
  75205. }
  75206. /**
  75207. * @function ol.source.Mapv.prototype.removeData
  75208. * @description 删除符合过滤条件的数据。
  75209. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  75210. * @example
  75211. * filter=function(data){
  75212. * if(data.id=="1"){
  75213. * return true
  75214. * }
  75215. * return false;
  75216. * }
  75217. */
  75218. removeData(filter) {
  75219. this.layer && this.layer.removeData(filter);
  75220. }
  75221. /**
  75222. * @function ol.source.Mapv.prototype.clearData
  75223. * @description 清除数据。
  75224. */
  75225. clearData() {
  75226. this.layer.clearData();
  75227. }
  75228. /**
  75229. * @function ol.source.Mapv.prototype.update
  75230. * @description 更新数据。
  75231. * @param {Object} options - 待更新的数据。
  75232. * @param {Object} options.data - mapv 数据集。
  75233. */
  75234. update(options) {
  75235. this.layer.update(options);
  75236. this.changed();
  75237. }
  75238. }
  75239. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Range.js
  75240. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75241. * This program are made available under the terms of the Apache License, Version 2.0
  75242. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75243. /**
  75244. * @class ol.source.Range
  75245. * @category Visualization Theme
  75246. * @classdesc 分段专题图图层源。
  75247. * @param {string} name - 名称
  75248. * @param {Object} opt_options - 参数。
  75249. * @param {ol/Map} opt_options.map - 当前map对象。
  75250. * @param {string} opt_options.themeField - 指定创建专题图字段。
  75251. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  75252. * @param {number} [opt_options.opacity = 1] - 图层透明度。
  75253. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  75254. * @param {ol/proj/Projection} [opt_options.projection] - 投影信息。
  75255. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是 1 或更高。
  75256. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  75257. * @param {ol/source/State} [opt_options.state] - 资源状态。
  75258. * @param {Object} [opt_options.style] - 专题图样式。
  75259. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  75260. * @param {boolean} [opt_options.isHoverAble = false] - 是否开启 hover 事件。
  75261. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  75262. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  75263. * @extends {GeoFeature}
  75264. */
  75265. class Range extends GeoFeature {
  75266. constructor(name, opt_options) {
  75267. super(name, opt_options);
  75268. this.style = opt_options.style;
  75269. this.isHoverAble = opt_options.isHoverAble;
  75270. this.highlightStyle = opt_options.highlightStyle;
  75271. this.themeField = opt_options.themeField;
  75272. this.styleGroups = opt_options.styleGroups;
  75273. }
  75274. /**
  75275. * @function ol.source.Range.prototype.destroy
  75276. * @description 释放资源,将引用资源的属性置空。
  75277. */
  75278. destroy() {
  75279. this.style = null;
  75280. this.themeField = null;
  75281. this.styleGroups = null;
  75282. GeoFeature.prototype.destroy.apply(this, arguments);
  75283. }
  75284. /**
  75285. * @private
  75286. * @function ol.source.Range.prototype.createThematicFeature
  75287. * @description 创建专题图要素。
  75288. * @param {Object} feature - 要创建的专题图形要素。
  75289. */
  75290. createThematicFeature(feature) {
  75291. //赋 style
  75292. var style = this.getStyleByData(feature);
  75293. //创建专题要素时的可选参数
  75294. var options = {};
  75295. options.nodesClipPixel = this.nodesClipPixel;
  75296. options.isHoverAble = this.isHoverAble;
  75297. options.isMultiHover = this.isMultiHover;
  75298. options.isClickAble = this.isClickAble;
  75299. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  75300. //将数据转为专题要素(ThemeVector)
  75301. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  75302. //直接添加图形到渲染器
  75303. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  75304. this.renderer.addShape(thematicFeature.shapes[m]);
  75305. }
  75306. return thematicFeature;
  75307. }
  75308. /**
  75309. * @private
  75310. * @function ol.source.Range.prototype.getStyleByData
  75311. * @description 通过数据获取 style。
  75312. * @param {Object} fea - 要素数据。
  75313. */
  75314. getStyleByData(fea) {
  75315. var style = {};
  75316. var feature = fea;
  75317. style = Util.copyAttributesWithClip(style, this.style);
  75318. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  75319. var Sf = this.themeField;
  75320. var Attrs = feature.attributes;
  75321. var Gro = this.styleGroups;
  75322. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  75323. var attr = null; //属性值
  75324. for (var property in Attrs) {
  75325. if (Sf === property) {
  75326. isSfInAttrs = true;
  75327. attr = Attrs[property];
  75328. break;
  75329. }
  75330. }
  75331. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  75332. if (isSfInAttrs) {
  75333. for (var i = 0, len = Gro.length; i < len; i++) {
  75334. if ((attr >= Gro[i].start) && (attr < Gro[i].end)) {
  75335. //feature.style = SuperMap.Util.copyAttributes(feature.style, this.defaultStyle);
  75336. var sty1 = Gro[i].style;
  75337. style = Util.copyAttributesWithClip(style, sty1);
  75338. }
  75339. }
  75340. }
  75341. }
  75342. if (feature.style && this.isAllowFeatureStyle === true) {
  75343. style = Util.copyAttributesWithClip(feature.style);
  75344. }
  75345. return style;
  75346. }
  75347. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  75348. return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);
  75349. }
  75350. }
  75351. ;// CONCATENATED MODULE: ./src/openlayers/overlay/RankSymbol.js
  75352. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75353. * This program are made available under the terms of the Apache License, Version 2.0
  75354. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75355. /**
  75356. * @class ol.source.RankSymbol
  75357. * @category Visualization Theme
  75358. * @classdesc 等级符号专题图图层源。
  75359. * @param {string} name - 专题图层名。
  75360. * @param {string} symbolType - 标志类型。
  75361. * @param {Object} opt_options - 参数。
  75362. * @param {ol/Map} opt_options.map - 当前 Map 对象。
  75363. * @param {string} opt_options.themeFields - 指定创建专题图字段。
  75364. * @param {Object} opt_options.symbolSetting - 符号 Circle 配置对象 symbolSetting(<SuperMap.Layer.RankSymbol::setting>)。
  75365. * @param {Array.<number>} opt_options.symbolSetting.codomain - 图表允许展示的数据值域,长度为 2 的一维数组,第一个元素表示值域下限,第二个元素表示值域上限。
  75366. * @param {number} [opt_options.symbolSetting.maxR] - 圆形的最大半径。
  75367. * @param {number} [opt_options.symbolSetting.minR] - 圆形的最小半径。
  75368. * @param {string} [opt_options.symbolSetting.fillColor] - 圆形的填充色,如:fillColor: "#FFB980"。
  75369. * @param {Object} [opt_options.symbolSetting.circleStyle] - 圆形的基础 style,此参数控制圆形基础样式,优先级低于 circleStyleByFields 和 circleStyleByCodomain。
  75370. * @param {number} [opt_options.symbolSetting.decimalNumber] - 数据值数组 dataValues 元素值小数位数,数据的小数位处理参数,取值范围:[0, 16]。如果不设置此参数,在取数据值时不对数据做小数位处理。
  75371. * @param {Object} [opt_options.symbolSetting.circleHoverStyle] - 圆形 hover 状态时的样式,circleHoverAble 为 true 时有效。
  75372. * @param {boolean} [opt_options.symbolSetting.circleHoverAble=true] - 是否允许圆形使用 hover 状态。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  75373. * @param {boolean} [opt_options.symbolSetting.circleClickAble=true] - 是否允许圆形被点击。同时设置 circleHoverAble 和 circleClickAble 为 false,可以直接屏蔽图形对专题图层事件的响应。
  75374. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层 ID。
  75375. * @param {number} [opt_options.opacity=1] - 图层透明度。
  75376. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  75377. * @param {ol/proj/Projection} [opt_options.projection] - 投影信息。
  75378. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。 必须是 1 或更高。
  75379. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  75380. * @param {ol/source/State} [opt_options.state] - 资源状态。
  75381. * @param {boolean} [opt_options.isOverLay=true] - 是否进行压盖处理,如果设为 true,图表绘制过程中将隐藏对已在图层中绘制的图表产生压盖的图表。
  75382. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  75383. * @extends {Graph}
  75384. */
  75385. class RankSymbol_RankSymbol extends Graph_Graph {
  75386. constructor(name, symbolType, opt_options) {
  75387. super(name, symbolType, opt_options);
  75388. this.symbolType = symbolType;
  75389. this.symbolSetting = opt_options.symbolSetting;
  75390. this.themeField = opt_options.themeField;
  75391. }
  75392. /**
  75393. * @function ol.source.RankSymbol.prototype.destroy
  75394. * @description 释放资源,将引用资源的属性置空。
  75395. */
  75396. destroy() {
  75397. this.symbolType = null;
  75398. this.symbolSetting = null;
  75399. this.themeField = null;
  75400. Graph_Graph.prototype.destroy.apply(this, arguments);
  75401. }
  75402. /**
  75403. * @function ol.source.RankSymbol.prototype.setSymbolType
  75404. * @description 设置标志符号。
  75405. * @param {string} symbolType - 符号类型。
  75406. */
  75407. setSymbolType(symbolType) {
  75408. this.symbolType = symbolType;
  75409. this.redraw();
  75410. }
  75411. /**
  75412. * @private
  75413. * @function ol.source.RankSymbol.prototype.createThematicFeature
  75414. * @description 创建专题图形要素。
  75415. * @param {Object} feature - 要创建的专题图形要素。
  75416. */
  75417. createThematicFeature(feature) {
  75418. var thematicFeature;
  75419. // 检查图形创建条件并创建图形
  75420. if (Theme_Theme[this.symbolType] && this.themeField && this.symbolSetting) {
  75421. thematicFeature = new Theme_Theme[this.symbolType](feature, this, [this.themeField], this.symbolSetting);
  75422. }
  75423. // thematicFeature 是否创建成功
  75424. if (!thematicFeature) {
  75425. return false;
  75426. }
  75427. // 对专题要素执行图形装载
  75428. thematicFeature.assembleShapes();
  75429. return thematicFeature;
  75430. }
  75431. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  75432. return Graph_Graph.prototype.canvasFunctionInternal_.apply(this, arguments);
  75433. }
  75434. }
  75435. ;// CONCATENATED MODULE: external "function(){try{return turf}catch(e){return {}}}()"
  75436. const external_function_try_return_turf_catch_e_return_namespaceObject = function(){try{return turf}catch(e){return {}}}();
  75437. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Turf.js
  75438. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75439. * This program are made available under the terms of the Apache License, Version 2.0
  75440. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75441. /**
  75442. * @class ol.source.Turf
  75443. * @category Visualization Turf
  75444. * @classdesc Turf.js 图层源。
  75445. * @param {Object} opt_options - 参数。
  75446. * @extends {ol/source/Vector}
  75447. */
  75448. class Turf extends (external_ol_source_Vector_default()) {
  75449. constructor(opt_options) {
  75450. var options = opt_options ? opt_options : {};
  75451. super({
  75452. attributions: options.attributions || "<span>© <a href='https://turfjs.org/' target='_blank'>turfjs</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>",
  75453. features: options.features,
  75454. format: options.format,
  75455. extent: options.extent,
  75456. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  75457. projection: options.projection,
  75458. wrapX: options.wrapX
  75459. });
  75460. this.turfMap = {
  75461. "Measurement.along": ["line", "distance", "units"],
  75462. "Measurement.area": ["geojson"],
  75463. "Measurement.bbox": ["geojson"],
  75464. "Measurement.bboxPolygon": ["bbox"],
  75465. "Measurement.bearing": ["start", "end", "final"],
  75466. "Measurement.center": ["geojson", "properties"],
  75467. "Measurement.centerOfMass": ["geojson", "properties"],
  75468. "Measurement.centroid": ["geojson", "properties"],
  75469. "Measurement.destination": ["origin", "distance", "bearing", "units"],
  75470. "Measurement.distance": ["from", "to", "units"],
  75471. "Measurement.envelope": ["geojson"],
  75472. "Measurement.length": ["geojson", "units"],
  75473. "Measurement.midpoint": ["point1", "point2"],
  75474. "Measurement.pointOnFeature": ["geojson"],
  75475. "Measurement.polygonTangents": ["point", "polygon"],
  75476. "Measurement.rhumbBearing": ["start", "end", "final"],
  75477. "Measurement.rhumbDestination": ["origin", "distance", "bearing", "units"],
  75478. "Measurement.rhumbDistance": ["from", "to", "units"],
  75479. "Measurement.square": ["bbox"],
  75480. "Measurement.greatCircle": ["start", "end", "properties", "npoints", "offset"],
  75481. "CoordinateMutation.cleanCoords":["geojson","mutate"],
  75482. "CoordinateMutation.flip": ["geojson", "mutate"],
  75483. "CoordinateMutation.rewind": ["geojson", "reverse", "mutate"],
  75484. "CoordinateMutation.round": ["num", "precision"],
  75485. "CoordinateMutation.truncate": ["geojson", "precision", "coordinates", "mutate"],
  75486. "Transformation.bboxClip": ["feature", "bbox"],
  75487. "Transformation.bezierSpline": ["line", "resolution", "sharpness"],
  75488. "Transformation.buffer": ["geojson", "radius", "units", "steps"],
  75489. "Transformation.circle": ["center", "radius", "steps", "units", "properties"],
  75490. "Transformation.clone": ["geojson"],
  75491. "Transformation.concave": ["points", "maxEdge", "units"],
  75492. "Transformation.convex": ["geojson","concavity"],
  75493. "Transformation.difference": ["polygon1", "polygon2"],
  75494. "Transformation.dissolve": ["featureCollection", "propertyName"],
  75495. "Transformation.intersect": ["poly1", "poly2"],
  75496. "Transformation.lineOffset": ["geojson", "distance", "units"],
  75497. "Transformation.simplify": ["feature", "tolerance", "highQuality"],
  75498. "Transformation.tesselate": ["poly"],
  75499. "Transformation.transformRotate": ["geojson", "angle", "pivot", "mutate"],
  75500. "Transformation.transformTranslate": ["geojson", "distance", "direction", "units", "zTranslation", "mutate"],
  75501. "Transformation.transformScale": ["geojson", "factor", "origin", "mutate"],
  75502. "Transformation.union": ["A"],
  75503. "Transformation.voronoi": ["points","bbox"],
  75504. "featureConversion.combine": ["fc"],
  75505. "featureConversion.explode": ["geojson"],
  75506. "featureConversion.flatten": ["geojson"],
  75507. "featureConversion.lineStringToPolygon": ["lines", "properties", "autoComplete", "orderCoords"],
  75508. "featureConversion.polygonize": ["geojson"],
  75509. "featureConversion.polygonToLineString": ["polygon", "properties"],
  75510. "Misc.kinks": ["featureIn"],
  75511. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  75512. "Misc.lineChunk": ["geojson", "segmentLength", "units", "reverse"],
  75513. "Misc.lineIntersect": ["line1", "line2"],
  75514. "Misc.lineOverlap": ["line1", "line2"],
  75515. "Misc.lineSegment": ["geojson"],
  75516. "Misc.lineSlice": ["startPt", "stopPt", "line"],
  75517. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", "units"],
  75518. "Misc.lineSplit": ["line", "splitter"],
  75519. "Misc.mask": ["polygon", "mask"],
  75520. "Misc.pointOnLine": ["lines", "pt", "units"],
  75521. "Misc.sector": ["center", "radius", "bearing1", "bearing2", "steps", "units"],
  75522. "Misc.shortestPath": ["start", "end", "obstacles", "units","resolution"],
  75523. "Misc.unkinkPolygon": ["geojson"],
  75524. "Helper.featureCollection": ["features","bbox","id"],
  75525. "Helper.feature": ["geometry", "properties","bbox","id"],
  75526. "Helper.geometryCollection": ["geometries", "properties","bbox","id"],
  75527. "Helper.lineString": ["coordinates", "properties","bbox","id"],
  75528. "Helper.multiLineString": ["coordinates", "properties","bbox","id"],
  75529. "Helper.multiPoint": ["coordinates", "properties","bbox","id"],
  75530. "Helper.multiPolygon": ["coordinates", "properties","bbox","id"],
  75531. "Helper.point": ["coordinates", "properties","bbox","id"],
  75532. "Helper.polygon": ["coordinates", "properties","bbox","id"],
  75533. "Data.sample": ["featurecollection", "num"],
  75534. "Interpolation.interpolate": ["points", "cellSize", "gridType", "property", "units", "weight"],
  75535. "Interpolation.isobands": ["pointGrid", "breaks", "zProperty", "commonProperties","breaksProperties"],
  75536. "Interpolation.isolines": ["pointGrid", "breaks", "zProperty", "commonProperties", "breaksProperties"],
  75537. "Interpolation.planepoint": ["point", "triangle"],
  75538. "Interpolation.tin": ["points", "z"],
  75539. "Joins.pointsWithinPolygon": ["points", "polygons"],
  75540. "Joins.tag": ["points", "polygons", "field", "outField","mask","properties"],
  75541. "Grids.hexGrid": ["bbox", "cellSide", "units", "triangles"],
  75542. "Grids.pointGrid": ["bbox", "cellSide", "units", "mask","properties"],
  75543. "Grids.squareGrid": ["bbox", "cellSide", "units", "mask","properties"],
  75544. "Grids.triangleGrid": ["bbox", "cellSide", "units", "mask","properties"],
  75545. "Classification.nearestPoint": ["targetPoint", "points"],
  75546. "Aggregation.collect": ["polygons", "points", "inProperty", "outProperty"],
  75547. "Aggregation.clustersDbscan": ["points", "maxDistance", "units", "minPoints","mutate"],
  75548. "Aggregation.clustersKmeans": ["points", "numberOfClusters", "mutate"],
  75549. "Meta.coordAll": ["geojson"],
  75550. "Meta.coordEach": ["geojson", "callback", "excludeWrapCoord"],
  75551. "Meta.coordReduce": ["geojson", "callback", "initialValue", "excludeWrapCoord"],
  75552. "Meta.featureEach": ["geojson", "callback"],
  75553. "Meta.featureReduce": ["geojson", "callback", "initialValue"],
  75554. "Meta.flattenEach": ["geojson", "callback"],
  75555. "Meta.flattenReduce": ["geojson", "callback", "initialValue"],
  75556. "Meta.getCoord": ["coord"],
  75557. "Meta.getCoords": ["coords"],
  75558. "Meta.getGeom": ["geojson"],
  75559. "Meta.getGeomType": ["geojson","name"],
  75560. "Meta.geomEach": ["geojson", "callback"],
  75561. "Meta.geomReduce": ["geojson", "callback", "initialValue"],
  75562. "Meta.propEach": ["geojson", "callback"],
  75563. "Meta.propReduce": ["geojson", "callback", "initialValue"],
  75564. "Meta.segmentEach": ["geojson", "callback"],
  75565. "Meta.segmentReduce": ["geojson", "callback", "initialValue"],
  75566. "Meta.getCluster": ["geojson", "filter"],
  75567. "Meta.clusterEach": ["geojson", "property", "callback"],
  75568. "Meta.clusterReduce": ["geojson", "property", "callback", "initialValue"],
  75569. "Assertions.collectionOf": ["featureCollection", "type", "name"],
  75570. "Assertions.containsNumber": ["coordinates"],
  75571. "Assertions.geojsonType": ["value", "type", "name"],
  75572. "Assertions.featureOf": ["feature", "type", "name"],
  75573. "Booleans.booleanClockwise": ["line"],
  75574. "Booleans.booleanContains": ["feature1", "feature2"],
  75575. "Booleans.booleanCrosses": ["feature1", "feature2"],
  75576. "Booleans.booleanDisjoint": ["feature1", "feature2"],
  75577. "Booleans.booleanEqual": ["feature1", "feature2"],
  75578. "Booleans.booleanOverlap": ["feature1", "feature2"],
  75579. "Booleans.booleanParallel": ["feature1", "feature2"],
  75580. "Booleans.booleanPointInPolygon": ["point", "polygon", "ignoreBoundary"],
  75581. "Booleans.booleanPointOnLine": ["point", "linestring", "ignoreEndVertices"],
  75582. "UnitConversion.bearingToAngle": ["bearing"],
  75583. "UnitConversion.convertArea": ["area", "originalUnit", "finalUnit"],
  75584. "UnitConversion.convertLength": ["length", "originalUnit", "finalUnit"],
  75585. "UnitConversion.degreesToradians": ["degrees"],
  75586. "UnitConversion.lengthToRadians": ["distance", "units"],
  75587. "UnitConversion.lengthToDegrees": ["distance", "units"],
  75588. "UnitConversion.radiansToLength": ["radians", "units"],
  75589. "UnitConversion.radiansToDegrees": ["radians"],
  75590. "UnitConversion.toMercator": ["geojson","mutate"],
  75591. "UnitConversion.toWgs84": ["geojson","mutate"]
  75592. };
  75593. // 5.0.0 及以上版本参数配置
  75594. this.turfOptionMap={
  75595. "Measurement.along": ["line", "distance", {units:""}],
  75596. "Measurement.bboxPolygon": ["bbox",{properties:"",id:""}],
  75597. "Measurement.bearing": ["start", "end", {final:""}],
  75598. "Measurement.center": ["geojson", {properties:""}],
  75599. "Measurement.destination": ["origin", "distance", "bearing", {units:"",properties:""}],
  75600. "Measurement.distance": ["from", "to", {units:""}],
  75601. "Measurement.length": ["geojson", {units:""}],
  75602. "Measurement.rhumbBearing": ["start", "end", {final:""}],
  75603. "Measurement.rhumbDestination": ["origin", "distance", "bearing", {units:"",properties:""}],
  75604. "Measurement.rhumbDistance": ["from", "to", {units:""}],
  75605. "Measurement.greatCircle": ["start", "end", {properties:"", npoints:"", offset:""}],
  75606. "CoordinateMutation.cleanCoords":["geojson",{mutate:""}],
  75607. "CoordinateMutation.flip": ["geojson", {mutate:""}],
  75608. "CoordinateMutation.rewind": ["geojson",{mutate:"",reverse:""}],
  75609. "CoordinateMutation.truncate": ["geojson", {precision:"", coordinates:"", mutate:""}],
  75610. "Transformation.bezierSpline": ["line", {resolution:"", sharpness:""}],
  75611. "Transformation.buffer": ["geojson", "radius", {units:"", steps:""}],
  75612. "Transformation.circle": ["center", "radius", {units:"", steps:"",properties:""}],
  75613. "Transformation.concave": ["points", {maxEdge:"", units:""}],
  75614. "Transformation.convex": ["geojson",{concavity:""}],
  75615. "Transformation.dissolve": ["featureCollection", {propertyName:""}],
  75616. "Transformation.lineOffset": ["geojson", "distance", {units:""}],
  75617. "Transformation.simplify": ["geojson", {tolerance:"", highQuality:""}],
  75618. "Transformation.transformRotate": ["geojson", "angle", {pivot:"", mutate:""}],
  75619. "Transformation.transformTranslate": ["geojson", "distance", "direction", {units:"", zTranslation:"", mutate:""}],
  75620. "Transformation.transformScale": ["geojson", "factor", {origin:"", mutate:""}],
  75621. "Transformation.voronoi": ["points",{bbox:""}],
  75622. "featureConversion.lineStringToPolygon": ["lines",{properties:"", autoComplete:"", orderCoords:""}],
  75623. "featureConversion.polygonToLineString": ["polygon", {properties:""}],
  75624. "Misc.lineArc": ["center", "radius", "bearing1", "bearing2", {steps:"", units:""}],
  75625. "Misc.lineChunk": ["geojson", "segmentLength", {units:"", reverse:""}],
  75626. "Misc.lineOverlap": ["line1", "line2",{tolerance:""}],
  75627. "Misc.lineSliceAlong": ["line", "startDist", "stopDist", {units:""}],
  75628. "Misc.pointOnLine": ["lines", "pt", {units:""}],
  75629. "Misc.sector": ["center", "radius", "bearing1", "bearing2", {units:"",steps:"",properties:""}],
  75630. "Misc.shortestPath": ["start", "end", {obstacles:"", units:"",resolution:""}],
  75631. "Helper.feature": ["geometry", "properties",{bbox:"",id:""}],
  75632. "Helper.geometryCollection": ["geometries", "properties",{bbox:"",id:""}],
  75633. "Helper.lineString": ["coordinates", "properties",{bbox:"",id:""}],
  75634. "Helper.multiLineString": ["coordinates", "properties",{bbox:"",id:""}],
  75635. "Helper.multiPoint": ["coordinates", "properties",{bbox:"",id:""}],
  75636. "Helper.multiPolygon": ["coordinates", "properties",{bbox:"",id:""}],
  75637. "Helper.point": ["coordinates", "properties",{bbox:"",id:""}],
  75638. "Helper.polygon": ["coordinates", "properties",{bbox:"",id:""}],
  75639. "Interpolation.interpolate": ["points", "cellSize", {gridType:"", property:"", units:"", weight:""}],
  75640. "Interpolation.isobands": ["pointGrid", "breaks", {zProperty:"", commonProperties:"",breaksProperties:""}],
  75641. "Interpolation.isolines": ["pointGrid", "breaks", {zProperty:"", commonProperties:"", breaksProperties:""}],
  75642. "Grids.hexGrid": ["bbox", "cellSide", {units:"", triangles:"",properties:"",mask:""}],
  75643. "Grids.pointGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  75644. "Grids.squareGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  75645. "Grids.triangleGrid": ["bbox", "cellSide", {units:"", mask:"",properties:""}],
  75646. "Aggregation.clustersDbscan": ["points", "maxDistance", {units:"", minPoints:"",mutate:""}],
  75647. "Aggregation.clustersKmeans": ["points", {numberOfClusters:"", mutate:""}],
  75648. "Booleans.booleanPointInPolygon": ["point", "polygon", {ignoreBoundary:""}],
  75649. "Booleans.booleanPointOnLine": ["point", "linestring", {ignoreEndVertices:""}],
  75650. "UnitConversion.toMercator": ["geojson",{mutate:""}],
  75651. "UnitConversion.toWgs84": ["geojson",{mutate:""}]
  75652. }
  75653. }
  75654. /**
  75655. * @function ol.source.turf.prototype.process
  75656. * @description 执行 Turf.js 提供的相关空间分析方法。
  75657. * @param {string} type - Turf.js 提供的空间分析方法名。
  75658. * @param {Object} args - Turf.js 提供的空间分析方法对应的参数对象。
  75659. * @param {function} callback - 空间分析完成执行的回调函数,返回执行的结果。
  75660. * @param {boolean} addFeaturesToMap - 是否添加到 Map。
  75661. */
  75662. process(type, args, callback, addFeaturesToMap) {
  75663. var result;
  75664. // 兼容版本4到5
  75665. try{
  75666. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parse(type, args));
  75667. }catch(e){
  75668. result = external_function_try_return_turf_catch_e_return_namespaceObject[type.split('.')[1]].apply(this, this.parseOption(type, args));
  75669. }
  75670. var features = null;
  75671. try {
  75672. features = (new (external_ol_format_GeoJSON_default())()).readFeatures(result);
  75673. } catch (e) {
  75674. if (callback) {
  75675. callback(result);
  75676. }
  75677. return;
  75678. }
  75679. addFeaturesToMap = addFeaturesToMap == null ? true : addFeaturesToMap;
  75680. if (addFeaturesToMap) {
  75681. this.addFeatures(features);
  75682. }
  75683. if (callback) {
  75684. callback(result);
  75685. }
  75686. }
  75687. parse(type, args) {
  75688. if (type === 'Transformation.union') {
  75689. return args['A'];
  75690. }
  75691. var result = [];
  75692. var tempArgs = this.turfMap[type];
  75693. if (tempArgs) {
  75694. tempArgs.map(function (key) {
  75695. result.push(args[key]);
  75696. return args[key];
  75697. });
  75698. }
  75699. return result;
  75700. }
  75701. parseOption(type,args){
  75702. var result = [];
  75703. var tempArgs = this.turfOptionMap[type];
  75704. tempArgs.map(function(key){
  75705. if(key instanceof Object){
  75706. var options = key;
  75707. Object.keys(options).forEach(function(k){
  75708. options[k]=args[k]
  75709. })
  75710. result.push(options);
  75711. }else{
  75712. result.push(args[key])
  75713. }
  75714. return args;
  75715. })
  75716. return result;
  75717. }
  75718. }
  75719. ;// CONCATENATED MODULE: ./src/openlayers/overlay/Unique.js
  75720. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75721. * This program are made available under the terms of the Apache License, Version 2.0
  75722. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75723. /**
  75724. * @class ol.source.Unique
  75725. * @category Visualization Theme
  75726. * @classdesc 单值专题图图层源。
  75727. * @param {string} name - 图层名称
  75728. * @param {Object} opt_options - 参数。
  75729. * @param {ol/Map} opt_options.map - 当前 Map 对象。
  75730. * @param {string} [opt_options.id] - 专题图层 ID。默认使用 CommonUtil.createUniqueID("themeLayer_") 创建专题图层ID。
  75731. * @param {number} [opt_options.opacity=1] - 图层透明度。
  75732. * @param {string} [opt_options.logo] - Logo(openLayers 5.0.0 及更高版本不再支持此参数)。
  75733. * @param {ol/proj/Projection} [opt_options.projection] - 投影信息。
  75734. * @param {number} [opt_options.ratio=1.5] - 视图比,1 表示画布是地图视口的大小,2 表示地图视口的宽度和高度的两倍,依此类推。必须是1 或更高。
  75735. * @param {Array} [opt_options.resolutions] - 分辨率数组。
  75736. * @param {ol/source/State} [opt_options.state] - 资源状态。
  75737. * @param {string} [opt_options.themeField] - 指定创建专题图字段。
  75738. * @param {Object} [opt_options.style] - 专题图样式。
  75739. * @param {Object} [opt_options.styleGroups] - 各专题类型样式组。
  75740. * @param {boolean} [opt_options.isHoverAble=false] - 是否开启 hover 事件。
  75741. * @param {Object} [opt_options.highlightStyle] - 开启 hover 事件后,触发的样式风格。
  75742. * @param {(string|Object)} [opt_option.attributions='Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  75743. * @extends {GeoFeature}
  75744. */
  75745. class Unique extends GeoFeature {
  75746. constructor(name, opt_options) {
  75747. super(name, opt_options);
  75748. this.themeField = opt_options.themeField;
  75749. this.style = opt_options.style;
  75750. this.styleGroups = opt_options.styleGroups;
  75751. this.isHoverAble = opt_options.isHoverAble;
  75752. this.highlightStyle = opt_options.highlightStyle;
  75753. }
  75754. /**
  75755. * @function ol.source.Unique.prototype.destroy
  75756. * @description 释放资源,将引用资源的属性置空。
  75757. */
  75758. destroy() {
  75759. this.style = null;
  75760. this.themeField = null;
  75761. this.styleGroups = null;
  75762. GeoFeature.prototype.destroy.apply(this, arguments);
  75763. }
  75764. /**
  75765. * @private
  75766. * @function ol.source.Unique.prototype.createThematicFeature
  75767. * @description 创建专题要素。
  75768. * @param {Object} feature - 要素。
  75769. */
  75770. createThematicFeature(feature) {
  75771. var style = this.getStyleByData(feature);
  75772. //创建专题要素时的可选参数
  75773. var options = {};
  75774. options.nodesClipPixel = this.nodesClipPixel;
  75775. options.isHoverAble = this.isHoverAble;
  75776. options.isMultiHover = this.isMultiHover;
  75777. options.isClickAble = this.isClickAble;
  75778. options.highlightStyle = ShapeFactory.transformStyle(this.highlightStyle);
  75779. //将数据转为专题要素(ThemeVector)
  75780. var thematicFeature = new ThemeVector(feature, this, ShapeFactory.transformStyle(style), options);
  75781. //直接添加图形到渲染器
  75782. for (var m = 0; m < thematicFeature.shapes.length; m++) {
  75783. this.renderer.addShape(thematicFeature.shapes[m]);
  75784. }
  75785. return thematicFeature;
  75786. }
  75787. /**
  75788. * @private
  75789. * @function ol.source.Unique.prototype.getStyleByData
  75790. * @description 根据用户数据(feature)设置专题要素的 Style。
  75791. * @param {Object} fea - 用户要素数据。
  75792. */
  75793. getStyleByData(fea) {
  75794. var style = {};
  75795. var feature = fea;
  75796. style = Util.copyAttributesWithClip(style, this.style);
  75797. if (this.themeField && this.styleGroups && this.styleGroups.length > 0 && feature.attributes) {
  75798. var tf = this.themeField;
  75799. var Attrs = feature.attributes;
  75800. var Gro = this.styleGroups;
  75801. var isSfInAttrs = false; //指定的 themeField 是否是 feature 的属性字段之一
  75802. var attr = null; //属性值
  75803. for (var property in Attrs) {
  75804. if (tf === property) {
  75805. isSfInAttrs = true;
  75806. attr = Attrs[property];
  75807. break;
  75808. }
  75809. }
  75810. //判断属性值是否属于styleGroups的某一个范围,以便对获取分组 style
  75811. if (isSfInAttrs) {
  75812. for (var i = 0, len = Gro.length; i < len; i++) {
  75813. if ((attr).toString() === ( Gro[i].value).toString()) {
  75814. //feature.style = CommonUtil.copyAttributes(feature.style, this.defaultStyle);
  75815. var sty1 = Gro[i].style;
  75816. style = Util.copyAttributesWithClip(style, sty1);
  75817. }
  75818. }
  75819. }
  75820. }
  75821. if (feature.style && this.isAllowFeatureStyle === true) {
  75822. style = Util.copyAttributesWithClip(feature.style);
  75823. }
  75824. return style;
  75825. }
  75826. canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  75827. return GeoFeature.prototype.canvasFunctionInternal_.apply(this, arguments);
  75828. }
  75829. }
  75830. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/VectorTileStyles.js
  75831. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  75832. * This program are made available under the terms of the Apache License, Version 2.0
  75833. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  75834. /**
  75835. * @class ol.supermap.VectorTileStyles
  75836. * @classdesc 矢量瓦片风格。
  75837. * @category Visualization VectorTile
  75838. * @param {Object} options - 交互时所需可选参数。
  75839. * @extends {ol/Observable}
  75840. */
  75841. class VectorTileStyles extends (external_ol_Observable_default()) {
  75842. constructor(options) {
  75843. super();
  75844. if (!options) {
  75845. return;
  75846. }
  75847. var donotNeedServerCartoCss = false;
  75848. if (options.donotNeedServerCartoCss !== undefined) {
  75849. donotNeedServerCartoCss = options.donotNeedServerCartoCss
  75850. }
  75851. VectorTileStyles.setDonotNeedServerCartoCss(donotNeedServerCartoCss);
  75852. if (options.view) {
  75853. VectorTileStyles.setView(options.view);
  75854. }
  75855. if (options.url) {
  75856. VectorTileStyles.setUrl(options.url);
  75857. }
  75858. if (options.cartoCss) {
  75859. VectorTileStyles.setCartoCss(options.cartoCss);
  75860. }
  75861. var selectedPointStyle = getDefaultSelectedPointStyle();
  75862. if (options.selectedPointStyle) {
  75863. selectedPointStyle = options.selectedPointStyle;
  75864. }
  75865. VectorTileStyles.setSelectedPointStyle(selectedPointStyle);
  75866. var selectedLineStyle = getDefaultSelectedLineStyle();
  75867. if (options.selectedLineStyle) {
  75868. selectedLineStyle = options.selectedLineStyle;
  75869. }
  75870. VectorTileStyles.setSelectedLineStyle(selectedLineStyle);
  75871. var selectedRegionStyle = getDefaultSelectedRegionStyle();
  75872. if (options.selectedRegionStyle) {
  75873. selectedRegionStyle = options.selectedRegionStyle;
  75874. }
  75875. VectorTileStyles.setSelectedRegionStyle(selectedRegionStyle);
  75876. var selectedTextStyle = getDefaultSelectedTextStyle();
  75877. if (options.selectedTextStyle) {
  75878. selectedTextStyle = options.selectedTextStyle;
  75879. }
  75880. VectorTileStyles.setSelectedTextStyle(selectedTextStyle);
  75881. var layersXHR = new XMLHttpRequest();
  75882. layersXHR.onreadystatechange = function () {
  75883. if (layersXHR.readyState == 4) {
  75884. var result = JSON.parse(layersXHR.responseText);
  75885. var layersInfo = {};
  75886. for (var i = 0, len = result.length; i < len; i++) {
  75887. var layers = result[i].subLayers.layers;
  75888. for (var j = 0, len1 = layers.length; j < len1; j++) {
  75889. layers[j].layerIndex = len1 - j;
  75890. layersInfo[layers[j].name] = layers[j];
  75891. }
  75892. }
  75893. VectorTileStyles.setLayersInfo(layersInfo);
  75894. if (!VectorTileStyles.getDonotNeedServerCartoCss()) {
  75895. var vectorStylesXHR = new XMLHttpRequest();
  75896. vectorStylesXHR.open("GET", Util.urlPathAppend(VectorTileStyles.getUrl(), "tileFeature/vectorstyles.json"), false);
  75897. vectorStylesXHR.onreadystatechange = function () {
  75898. if (vectorStylesXHR.readyState == 4) {
  75899. var vectorStyles = new JSONFormat().read(vectorStylesXHR.responseText);
  75900. var cartoCss;
  75901. if (vectorStyles.style && vectorStyles.type === 'cartoCSS') {
  75902. cartoCss = vectorStyles.style;
  75903. cartoCss = cartoCss.replace(/[@]/gi, "___");
  75904. cartoCss = cartoCss.replace(/\\#/gi, "___");
  75905. //替换一些关键符号
  75906. for (var attr in layersInfo) {
  75907. var newAttr = attr.replace(/[@#\s]/gi, "___");
  75908. cartoCss = cartoCss.replace(attr.replace(/[#]/gi, "\\#"), newAttr);
  75909. }
  75910. cartoCss = cartoCss.replace(/[#]/gi, "\n#");
  75911. //将zoom转化为scale,以免引起混淆
  75912. cartoCss = cartoCss.replace(/\[zoom/gi, "[scale");
  75913. }
  75914. var cartoShadersArray = new CartoCSS(cartoCss).getShaders();
  75915. var cartoShaders = {};
  75916. cartoShadersArray.map(function (cartoShader) {
  75917. cartoShaders[cartoShader.elements[0].clean] = cartoShaders[cartoShader.elements[0].clean] || {};
  75918. cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
  75919. cartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
  75920. return cartoShader;
  75921. });
  75922. VectorTileStyles.setCartoShaders(cartoShaders);
  75923. }
  75924. };
  75925. vectorStylesXHR.send(null);
  75926. }
  75927. if (VectorTileStyles.getCartoCss()) {
  75928. var clientCartoShadersArray = new CartoCSS(VectorTileStyles.getCartoCss()).getShaders();
  75929. var clientCartoShaders = {};
  75930. clientCartoShadersArray.map(function (cartoShader) {
  75931. clientCartoShaders[cartoShader.elements[0].clean] = clientCartoShaders[cartoShader.elements[0].clean] || {};
  75932. clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] = clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment] || [];
  75933. clientCartoShaders[cartoShader.elements[0].clean][cartoShader.attachment].push(cartoShader);
  75934. return cartoShader;
  75935. });
  75936. VectorTileStyles.setClientCartoShaders(clientCartoShaders);
  75937. }
  75938. }
  75939. };
  75940. layersXHR.open("GET", Util.urlPathAppend(VectorTileStyles.getUrl(), "layers.json"), false);
  75941. layersXHR.send(null);
  75942. this.on('featureSelected', function (e) {
  75943. VectorTileStyles.setSelectedId(e.selectedId);
  75944. VectorTileStyles.setLayerName(e.layerName);
  75945. });
  75946. /**
  75947. * @function VectorTileStyles.prototype.getDefaultSelectedPointStyle
  75948. * @description 设置默认选择后的点样式。
  75949. */
  75950. function getDefaultSelectedPointStyle() {
  75951. return new (external_ol_style_Style_default())({
  75952. image: new (external_ol_style_Circle_default())({
  75953. radius: 5,
  75954. fill: new (external_ol_style_Fill_default())({
  75955. color: 'blue'
  75956. })
  75957. })
  75958. })
  75959. }
  75960. /**
  75961. * @function VectorTileStyles.prototype.getDefaultSelectedLineStyle
  75962. * @description 设置默认选择后的线样式。
  75963. */
  75964. function getDefaultSelectedLineStyle() {
  75965. return new (external_ol_style_Style_default())({
  75966. stroke: new (external_ol_style_Stroke_default())({
  75967. color: 'blue',
  75968. width: 3
  75969. })
  75970. })
  75971. }
  75972. /**
  75973. * @function VectorTileStyles.prototype.getDefaultSelectedRegionStyle
  75974. * @description 设置默认选择后的面样式。
  75975. */
  75976. function getDefaultSelectedRegionStyle() {
  75977. return new (external_ol_style_Style_default())({
  75978. fill: new (external_ol_style_Fill_default())({
  75979. color: [0, 0, 255, 0.5]
  75980. }),
  75981. stroke: new (external_ol_style_Stroke_default())({
  75982. color: 'blue',
  75983. width: 3
  75984. })
  75985. })
  75986. }
  75987. /**
  75988. * @function VectorTileStyles.prototype.getDefaultSelectedTextStyle
  75989. * @description 设置默认选择后的文本样式。
  75990. */
  75991. function getDefaultSelectedTextStyle() {
  75992. return new (external_ol_style_Style_default())({
  75993. text: new (external_ol_style_Text_default())({
  75994. font: '15px Microsoft YaHei',
  75995. fill: new (external_ol_style_Fill_default())({
  75996. color: 'blue'
  75997. }),
  75998. stroke: new (external_ol_style_Stroke_default())({
  75999. color: 'white',
  76000. width: 1
  76001. })
  76002. })
  76003. });
  76004. }
  76005. }
  76006. /**
  76007. * @function ol.supermap.VectorTileStyles.setCartoShaders
  76008. * @description 设置 Carto 的阴影。
  76009. * @param {Array} cartoShaders - Carto 阴影。
  76010. */
  76011. static setCartoShaders(cartoShaders) {
  76012. this.cartoShaders = cartoShaders;
  76013. }
  76014. /**
  76015. * @function ol.supermap.VectorTileStyles.getCartoShaders
  76016. * @description 获取客户端 Carto 的阴影。
  76017. */
  76018. static getCartoShaders() {
  76019. return this.cartoShaders;
  76020. }
  76021. /**
  76022. * @function ol.supermap.VectorTileStyles.setClientCartoShaders
  76023. * @description 设置客户端 Carto 的阴影。
  76024. * @param {Array} clientCartoShaders - 客户端 Carto 阴影。
  76025. */
  76026. static setClientCartoShaders(clientCartoShaders) {
  76027. this.clientCartoShaders = clientCartoShaders;
  76028. }
  76029. /**
  76030. * @function ol.supermap.VectorTileStyles.getClientCartoShaders
  76031. * @description 获取客户端 Carto 的阴影。
  76032. */
  76033. static getClientCartoShaders() {
  76034. return this.clientCartoShaders;
  76035. }
  76036. /**
  76037. * @function VectorTileStyles.setCartoCss
  76038. * @description 设置 cartoCss 的样式。
  76039. * @param {Object} cartoCss - cartoCss 的样式。
  76040. */
  76041. static setCartoCss(cartoCss) {
  76042. this.cartoCss = cartoCss;
  76043. }
  76044. /**
  76045. * @function ol.supermap.VectorTileStyles.getCartoCss
  76046. * @description 获取 cartoCss 的样式。
  76047. */
  76048. static getCartoCss() {
  76049. return this.cartoCss;
  76050. }
  76051. /**
  76052. * @function ol.supermap.VectorTileStyles.setDonotNeedServerCartoCss
  76053. * @description 设置是否需要 CartoCss 服务。
  76054. * @param {Object} donotNeedServerCartoCss - 是否需要 CartoCss 服务。
  76055. */
  76056. static setDonotNeedServerCartoCss(donotNeedServerCartoCss) {
  76057. this.donotNeedServerCartoCss = donotNeedServerCartoCss;
  76058. }
  76059. /**
  76060. * @function ol.supermap.VectorTileStyles.getDonotNeedServerCartoCss
  76061. * @description 获取是否需要 CartoCss 服务。
  76062. */
  76063. static getDonotNeedServerCartoCss() {
  76064. return this.donotNeedServerCartoCss;
  76065. }
  76066. /**
  76067. * @function ol.supermap.VectorTileStyles.setLayersInfo
  76068. * @description 设置图层信息服务。
  76069. * @param {Object} layersInfo - 图层信息。
  76070. */
  76071. static setLayersInfo(layersInfo) {
  76072. this.layersInfo = layersInfo;
  76073. }
  76074. /**
  76075. * @function ol.supermap.VectorTileStyles.getLayersInfo
  76076. * @description 获取图层信息服务。
  76077. */
  76078. static getLayersInfo() {
  76079. return this.layersInfo;
  76080. }
  76081. /**
  76082. * @function ol.supermap.VectorTileStyles.setUrl
  76083. * @description 设置地址。
  76084. * @param {string} url - 地址。
  76085. */
  76086. static setUrl(url) {
  76087. this.url = url;
  76088. }
  76089. /**
  76090. * @function ol.supermap.VectorTileStyles.getUrl
  76091. * @description 获取地址。
  76092. */
  76093. static getUrl() {
  76094. return this.url;
  76095. }
  76096. /**
  76097. * @function ol.supermap.VectorTileStyles.setView
  76098. * @description 设置视图。
  76099. * @param {Object} view - 视图。
  76100. */
  76101. static setView(view) {
  76102. this.view = view;
  76103. }
  76104. /**
  76105. * @function ol.supermap.VectorTileStyles.getView
  76106. * @description 获取视图。
  76107. */
  76108. static getView() {
  76109. return this.view;
  76110. }
  76111. /**
  76112. * @function ol.supermap.VectorTileStyles.setSelectedId
  76113. * @description 设置选择序号。
  76114. * @param {number} selectedId - 选择序号。
  76115. */
  76116. static setSelectedId(selectedId) {
  76117. this.selectedId = selectedId;
  76118. }
  76119. /**
  76120. * @function ol.supermap.VectorTileStyles.getSelectedId
  76121. * @description 获取选择序号。
  76122. */
  76123. static getSelectedId() {
  76124. return this.selectedId;
  76125. }
  76126. /**
  76127. * @function ol.supermap.VectorTileStyles.setLayerName
  76128. * @description 设置图层名称。
  76129. * @param {string} layerName - 图层名称。
  76130. */
  76131. static setLayerName(layerName) {
  76132. this.layerName = layerName;
  76133. }
  76134. /**
  76135. * @function ol.supermap.VectorTileStyles.getLayerName
  76136. * @description 获取图层名称。
  76137. */
  76138. static getLayerName() {
  76139. return this.layerName;
  76140. }
  76141. /**
  76142. * @function ol.supermap.VectorTileStyles.setSelectedPointStyle
  76143. * @description 设置选择后点样式。
  76144. * @param {Object} selectedPointStyle - 选择后点样式。
  76145. */
  76146. static setSelectedPointStyle(selectedPointStyle) {
  76147. this.selectedPointStyle = selectedPointStyle;
  76148. }
  76149. /**
  76150. * @function ol.supermap.VectorTileStyles.setSelectedLineStyle
  76151. * @description 设置选择后线样式。
  76152. * @param {Object} selectedLineStyle - 选择后线样式。
  76153. */
  76154. static setSelectedLineStyle(selectedLineStyle) {
  76155. this.selectedLineStyle = selectedLineStyle;
  76156. }
  76157. /**
  76158. * @function ol.supermap.VectorTileStyles.setSelectedRegionStyle
  76159. * @description 设置选择后面样式。
  76160. * @param {Object} selectedRegionStyle - 选择后面样式。
  76161. */
  76162. static setSelectedRegionStyle(selectedRegionStyle) {
  76163. this.selectedRegionStyle = selectedRegionStyle;
  76164. }
  76165. /**
  76166. * @function ol.supermap.VectorTileStyles.setSelectedRegionStyle
  76167. * @description 设置选择后文本样式。
  76168. * @param {Object} selectedTextStyle - 选择后文本样式。
  76169. */
  76170. static setSelectedTextStyle(selectedTextStyle) {
  76171. this.selectedTextStyle = selectedTextStyle;
  76172. }
  76173. /**
  76174. * @function ol.supermap.VectorTileStyles.getSelectedStyle
  76175. * @description 设置选择后的样式。
  76176. * @param {string} type - 选择后的样式。
  76177. */
  76178. static getSelectedStyle(type) {
  76179. if (type === 'POINT' || type === 'MULTIPOINT') {
  76180. return this.selectedPointStyle;
  76181. }
  76182. if (type === 'LINESTRING' || type === 'MULTILINESTRING') {
  76183. return this.selectedLineStyle;
  76184. }
  76185. if (type === 'POLYGON' || type === 'MULTIPOLYGON') {
  76186. return this.selectedRegionStyle;
  76187. }
  76188. if (type === 'TEXT') {
  76189. return this.selectedTextStyle;
  76190. }
  76191. }
  76192. /**
  76193. * @function ol.supermap.VectorTileStyles.getLayerInfo
  76194. * @description 获取图层的信息。
  76195. * @param {string} layerName - 图层名。
  76196. */
  76197. static getLayerInfo(layerName) {
  76198. var layersInfo = VectorTileStyles.getLayersInfo();
  76199. if (layersInfo === undefined) {
  76200. return null;
  76201. }
  76202. var layerInfo = layersInfo[layerName];
  76203. if (!layerInfo) {
  76204. return null;
  76205. }
  76206. var layerInfo_simple = {layerIndex: layerInfo.layerIndex, ugcLayerType: layerInfo.ugcLayerType};
  76207. switch (layerInfo.ugcLayerType) {
  76208. case "VECTOR":
  76209. layerInfo_simple.layerStyle = layerInfo.style ? layerInfo.style : null;
  76210. break;
  76211. case "THEME":
  76212. var theme = layerInfo.theme;
  76213. layerInfo_simple.layerStyle = theme ? theme.defaultStyle : null;
  76214. if (theme && theme.type === "LABEL") {
  76215. layerInfo_simple.type = theme.type;
  76216. layerInfo_simple.textField = theme.labelExpression;
  76217. }
  76218. break;
  76219. default :
  76220. //SVTile发布出来的地图没有ugcLayerType属性
  76221. if (layerInfo.style) {
  76222. layerInfo_simple.layerStyle = layerInfo.style;
  76223. }
  76224. break;
  76225. }
  76226. return layerInfo_simple;
  76227. }
  76228. /**
  76229. * @function ol.supermap.VectorTileStyles.getStyle
  76230. * @description 获取样式。
  76231. * @param {string} originalLayerName - 原始图层信息。
  76232. * @param {Object} feature - 要素对象。
  76233. */
  76234. static getStyle(originalLayerName, feature) {
  76235. var url = VectorTileStyles.getUrl(),
  76236. view = VectorTileStyles.getView(),
  76237. zoom = view.getZoom(),
  76238. dpi = 96,
  76239. scale = core_Util_Util.resolutionToScale(view.getResolution(), dpi, REST_Unit.METER),
  76240. layerName = originalLayerName.replace(/(@)/gi, '___').replace(/(#)/gi, '___');
  76241. // feature对象样式的配置遵循以下优先级:
  76242. // 客户端CartoCSS > 服务器端CartoCSS > 服务器端layer样式 > 客户端默认样式。
  76243. if (VectorTileStyles.getCartoCss() && VectorTileStyles.getClientCartoShaders()[layerName]) {
  76244. return getStyleArray(VectorTileStyles.getClientCartoShaders()[layerName]);
  76245. }
  76246. var layerInfo = VectorTileStyles.getLayerInfo(originalLayerName);
  76247. if (!VectorTileStyles.getDonotNeedServerCartoCss() && VectorTileStyles.getCartoShaders()[layerName]) {
  76248. //如果是文本,这里特殊处理。
  76249. if (feature.getProperties().textStyle || feature.getProperties().TEXT_FEATURE_CONTENT || layerInfo.type == 'LABEL' && layerInfo.textField) {
  76250. var featureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  76251. if (feature.getGeometry().getType().toUpperCase() === "POINT") {
  76252. featureStyle = mergeTextFeatureStyle(layerInfo, feature, url);
  76253. }
  76254. return featureStyle;
  76255. }
  76256. return getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
  76257. }
  76258. if (layerInfo) {
  76259. return StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  76260. }
  76261. function getStyleArray(shaderAttachment) {
  76262. var styleArray = [];
  76263. for (var j in shaderAttachment) {
  76264. shaderAttachment[j].map(function (shader) {
  76265. styleArray.push(StyleUtils.getStyleFromCarto(zoom, scale, shader, feature, true, url))
  76266. return shader;
  76267. })
  76268. }
  76269. return styleArray;
  76270. }
  76271. /**
  76272. * @function ol.supermap.VectorTileStyles.prototype.mergeTextFeatureStyle
  76273. * @description 合并文本要素样式。
  76274. * @param {string} layerInfo - 图层信息。
  76275. * @param {Object} feature - 获取的要素。
  76276. * @param {string} url - 地址。
  76277. */
  76278. function mergeTextFeatureStyle(layerInfo, feature, url) {
  76279. var textFeatureStyle = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, url);
  76280. if (layerInfo.type == 'LABEL') {
  76281. feature.setProperties({type: "TEXT"});
  76282. var cartoTextStyles = getStyleArray(VectorTileStyles.getCartoShaders()[layerName]);
  76283. var textStyle = textFeatureStyle.getText();
  76284. for (var i = 0; i < cartoTextStyles.length; i++) {
  76285. if (!textStyle) {
  76286. textStyle = cartoTextStyles[i].getText();
  76287. } else {
  76288. textStyle.setText(cartoTextStyles[i].getText().getText());
  76289. }
  76290. }
  76291. textFeatureStyle.setText(textStyle);
  76292. return textFeatureStyle;
  76293. }
  76294. return textFeatureStyle;
  76295. }
  76296. }
  76297. /**
  76298. * @function ol.supermap.VectorTileStyles.prototype.getFeatureStyle
  76299. * @description 获取要素样式。
  76300. * @param {Object} feature - 要素。
  76301. */
  76302. getFeatureStyle(feature) {
  76303. var selectedStyle;
  76304. var layerName = feature.getProperties().layerName || feature.getProperties().layer;
  76305. var id = feature.getProperties().id || parseInt(feature.getProperties().SmID);
  76306. if (feature.getProperties().type && feature.getProperties().type.toUpperCase() === 'TEXT') {
  76307. selectedStyle = VectorTileStyles.getSelectedStyle(feature.getProperties().type.toUpperCase());
  76308. if (feature.getProperties().texts) {
  76309. selectedStyle.getText().text_ = feature.getProperties().texts[0];
  76310. } else {
  76311. selectedStyle.getText().text_ = "";
  76312. }
  76313. } else {
  76314. selectedStyle = VectorTileStyles.getSelectedStyle(feature.getGeometry().getType().toUpperCase());
  76315. }
  76316. if (selectedStyle) {
  76317. var selectedLayerName = VectorTileStyles.getLayerName();
  76318. var selectedId = VectorTileStyles.getSelectedId();
  76319. if (selectedLayerName === layerName && id === selectedId) {
  76320. return selectedStyle;
  76321. }
  76322. }
  76323. return VectorTileStyles.getStyle(layerName, feature);
  76324. }
  76325. }
  76326. ;// CONCATENATED MODULE: external "ol.source.VectorTile"
  76327. const external_ol_source_VectorTile_namespaceObject = ol.source.VectorTile;
  76328. var external_ol_source_VectorTile_default = /*#__PURE__*/__webpack_require__.n(external_ol_source_VectorTile_namespaceObject);
  76329. ;// CONCATENATED MODULE: external "ol.format.MVT"
  76330. const external_ol_format_MVT_namespaceObject = ol.format.MVT;
  76331. var external_ol_format_MVT_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_MVT_namespaceObject);
  76332. ;// CONCATENATED MODULE: external "ol.proj.Projection"
  76333. const external_ol_proj_Projection_namespaceObject = ol.proj.Projection;
  76334. var external_ol_proj_Projection_default = /*#__PURE__*/__webpack_require__.n(external_ol_proj_Projection_namespaceObject);
  76335. ;// CONCATENATED MODULE: ./src/openlayers/overlay/VectorTileSuperMapRest.js
  76336. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76337. * This program are made available under the terms of the Apache License, Version 2.0
  76338. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76339. /**
  76340. * @class ol.source.VectorTileSuperMapRest
  76341. * @category Visualization VectorTile
  76342. * @classdesc 矢量瓦片图层源。
  76343. * @param {Object} options - 参数。
  76344. * @param {(string|undefined)} options.url - SuperMap iServer 地图服务地址。
  76345. * @param {(string|Object|undefined)} options.style - Mapbox Style JSON 对象或获取 Mapbox Style JSON 对象的 URL。当 `options.format` 为 `ol/format/MVT ` 且 `options.source` 不为空时有效,优先级高于 `options.url`。
  76346. * @param {(string|undefined)} options.source - Mapbox Style JSON 对象中的source名称。当 `options.style` 设置时有效。当不配置时,默认为 Mapbox Style JSON 的 `sources` 对象中的第一个。
  76347. * @param {(string|Object)} [options.attributions='Tile Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>'] - 版权信息。
  76348. * @param {Object} [options.format] - 瓦片的要素格式化。
  76349. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  76350. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  76351. * @extends {ol/source/VectorTile}
  76352. */
  76353. class VectorTileSuperMapRest extends (external_ol_source_VectorTile_default()) {
  76354. constructor(options) {
  76355. if (options.url === undefined && options.style === undefined) {
  76356. console.error("one of 'options.style' or 'options.style' is required");
  76357. }
  76358. var zRegEx = /\{z\}/g;
  76359. var xRegEx = /\{x\}/g;
  76360. var yRegEx = /\{y\}/g;
  76361. var dashYRegEx = /\{-y\}/g;
  76362. options.attributions =
  76363. options.attributions ||
  76364. "Tile Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>";
  76365. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) {
  76366. options.tileSize = options.format instanceof (external_ol_format_MVT_default()) && options.style ? 512 : 256;
  76367. }
  76368. super({
  76369. attributions: options.attributions,
  76370. cacheSize: options.cacheSize,
  76371. format: options.format || new (external_ol_format_GeoJSON_default())(),
  76372. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  76373. overlaps: options.overlaps,
  76374. projection: options.projection,
  76375. state:
  76376. options.format instanceof (external_ol_format_MVT_default()) &&
  76377. options.style &&
  76378. Object.prototype.toString.call(options.style) == '[object String]'
  76379. ? 'loading'
  76380. : options.state,
  76381. tileClass: options.tileClass,
  76382. tileGrid: options.tileGrid,
  76383. tilePixelRatio: options.tilePixelRatio,
  76384. tileUrlFunction: options.format instanceof (external_ol_format_MVT_default()) && options.style ? zxyTileUrlFunction : tileUrlFunction,
  76385. tileLoadFunction: options.format instanceof (external_ol_format_MVT_default()) ? mvtTileLoadFunction : tileLoadFunction,
  76386. wrapX: options.wrapX !== undefined ? options.wrapX : false,
  76387. tileSize: options.tileSize || null,
  76388. zDirection: ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? null : 0
  76389. });
  76390. var me = this;
  76391. me.withCredentials = options.withCredentials;
  76392. me._tileType = options.tileType || 'ScaleXY';
  76393. this.vectorTileStyles = new VectorTileStyles();
  76394. if (options.format instanceof (external_ol_format_MVT_default()) && options.style) {
  76395. if (Object.prototype.toString.call(options.style) == '[object String]') {
  76396. FetchRequest.get(options.style, null, { withCredentials: options.withCredentials })
  76397. .then((response) => response.json())
  76398. .then((mbStyle) => {
  76399. this._fillByStyleJSON(mbStyle, options.source);
  76400. this.setState('ready');
  76401. });
  76402. } else {
  76403. this._fillByStyleJSON(options.style, options.source);
  76404. }
  76405. } else {
  76406. this._fillByRestMapOptions(options.url, options);
  76407. }
  76408. function tileUrlFunction(tileCoord, pixelRatio, projection) {
  76409. if (!me.tileGrid) {
  76410. me.tileGrid = me.getTileGridForProjection(projection);
  76411. }
  76412. var z = tileCoord[0];
  76413. var x = tileCoord[1];
  76414. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  76415. var tileSize = external_ol_size_namespaceObject.toSize(me.tileGrid.getTileSize(z, me.tmpSize));
  76416. var params = '';
  76417. if (me.tileType === 'ZXY') {
  76418. params = '&width=' + tileSize[0] + '&height=' + tileSize[1] + '&x=' + x + '&y=' + y + '&z=' + z;
  76419. } else if (me.tileType === 'ViewBounds') {
  76420. var tileExtent = me.tileGrid.getTileCoordExtent(tileCoord);
  76421. params =
  76422. '&width=' +
  76423. tileSize[0] +
  76424. '&height=' +
  76425. tileSize[1] +
  76426. '&viewBounds=' +
  76427. tileExtent[0] +
  76428. ',' +
  76429. tileExtent[1] +
  76430. ',' +
  76431. tileExtent[2] +
  76432. ',' +
  76433. tileExtent[3];
  76434. } else {
  76435. var origin = me.tileGrid.getOrigin(z);
  76436. var resolution = me.tileGrid.getResolution(z);
  76437. var dpi = 96;
  76438. var unit = projection.getUnits() || 'degrees';
  76439. if (unit === 'degrees') {
  76440. unit = REST_Unit.DEGREE;
  76441. }
  76442. if (unit === 'm') {
  76443. unit = REST_Unit.METER;
  76444. }
  76445. var scale = core_Util_Util.resolutionToScale(resolution, dpi, unit);
  76446. params =
  76447. '&x=' +
  76448. x +
  76449. '&y=' +
  76450. y +
  76451. '&width=' +
  76452. tileSize[0] +
  76453. '&height=' +
  76454. tileSize[1] +
  76455. '&scale=' +
  76456. scale +
  76457. "&origin={'x':" +
  76458. origin[0] +
  76459. ",'y':" +
  76460. origin[1] +
  76461. '}';
  76462. }
  76463. return me._tileUrl + encodeURI(params);
  76464. }
  76465. function zxyTileUrlFunction(tileCoord) {
  76466. if (!tileCoord) {
  76467. return undefined;
  76468. } else {
  76469. return me._tileUrl
  76470. .replace(zRegEx, tileCoord[0].toString())
  76471. .replace(xRegEx, tileCoord[1].toString())
  76472. .replace(yRegEx, function () {
  76473. var y = ['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1 ? -tileCoord[2] - 1 : tileCoord[2];
  76474. return y.toString();
  76475. })
  76476. .replace(dashYRegEx, function () {
  76477. var z = tileCoord[0];
  76478. var range = me.tileGrid.getFullTileRange(z);
  76479. var y = range.getHeight() + tileCoord[2];
  76480. return y.toString();
  76481. });
  76482. }
  76483. }
  76484. /**
  76485. * @private
  76486. * @function ol.source.VectorTileSuperMapRest.prototype.tileLoadFunction
  76487. * @description 加载瓦片。
  76488. * @param {Object} tile -瓦片类。
  76489. * @param {string} tileUrl - 瓦片地址。
  76490. */
  76491. function tileLoadFunction(tile, tileUrl) {
  76492. var regWidth = new RegExp('(^|\\?|&)' + 'width' + '=([^&]*)(\\s|&|$)');
  76493. var regHeight = new RegExp('(^|\\?|&)' + 'height' + '=([^&]*)(\\s|&|$)');
  76494. var width = Number(tileUrl.match(regWidth)[2]);
  76495. var height = Number(tileUrl.match(regHeight)[2]);
  76496. tile.setLoader(function (extent, resolution, projection) {
  76497. FetchRequest.get(tileUrl)
  76498. .then(function (response) {
  76499. if (tile.getFormat() instanceof (external_ol_format_GeoJSON_default())) {
  76500. return response.json();
  76501. }
  76502. })
  76503. .then(function (tileFeatureJson) {
  76504. var features = [];
  76505. if (tile.getFormat() instanceof (external_ol_format_GeoJSON_default())) {
  76506. tileFeatureJson.recordsets.map(function (recordset) {
  76507. recordset.features.map(function (feature) {
  76508. var points = [];
  76509. var startIndex = 0;
  76510. for (var i = 0; i < feature.geometry.parts.length; i++) {
  76511. var partPointsLength = feature.geometry.parts[i] * 2;
  76512. for (var j = 0, index = startIndex; j < partPointsLength; j += 2, index += 2) {
  76513. points.push(
  76514. new Point(
  76515. feature.geometry.points[index],
  76516. feature.geometry.points[index + 1]
  76517. )
  76518. );
  76519. }
  76520. startIndex += partPointsLength;
  76521. }
  76522. feature.geometry.points = points;
  76523. return feature;
  76524. });
  76525. return recordset;
  76526. });
  76527. tileFeatureJson.recordsets.map(function (recordset) {
  76528. recordset.features.map(function (feature) {
  76529. feature.layerName = recordset.layerName;
  76530. feature.type = feature.geometry.type;
  76531. features.push(feature);
  76532. return feature;
  76533. });
  76534. return recordset;
  76535. });
  76536. let dataProjection = new (external_ol_proj_Projection_default())({
  76537. extent: [0, 0, 256, 256],
  76538. code: 'TILE_PIXELS',
  76539. units: 'tile-pixels'
  76540. });
  76541. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1) {
  76542. tile.setExtent([0, 0, width, height]);
  76543. tile.setProjection(dataProjection);
  76544. features = tile.getFormat().readFeatures(core_Util_Util.toGeoJSON(features));
  76545. } else {
  76546. features = tile.getFormat().readFeatures(core_Util_Util.toGeoJSON(features), {
  76547. extent,
  76548. dataProjection,
  76549. featureProjection: projection
  76550. });
  76551. }
  76552. tile.setFeatures(features);
  76553. }
  76554. });
  76555. });
  76556. }
  76557. /**
  76558. * @private
  76559. * @function ol.source.VectorTileSuperMapRest.prototype.tileLoadFunction
  76560. * @description 加载瓦片。
  76561. * @param {Object} tile -瓦片类。
  76562. * @param {string} tileUrl - 瓦片地址。
  76563. */
  76564. function mvtTileLoadFunction(tile, tileUrl) {
  76565. const format = tile.getFormat();
  76566. const success = tile.onLoad.bind(tile);
  76567. const failure = tile.onError.bind(tile);
  76568. tile.setLoader(function (extent, resolution, projection) {
  76569. const xhr = new XMLHttpRequest();
  76570. xhr.open(
  76571. 'GET',
  76572. typeof tileUrl === 'function' ? tileUrl(extent, resolution, projection) : tileUrl,
  76573. true
  76574. );
  76575. if (format.getType() == 'arraybuffer') {
  76576. xhr.responseType = 'arraybuffer';
  76577. }
  76578. xhr.withCredentials = me.withCredentials;
  76579. xhr.onload = function () {
  76580. if (!xhr.status || (xhr.status >= 200 && xhr.status < 300)) {
  76581. const type = format.getType();
  76582. let source = void 0;
  76583. if (type === 'json' || type === 'text') {
  76584. source = xhr.responseText;
  76585. } else if (type === 'xml') {
  76586. source = xhr.responseXML;
  76587. if (!source) {
  76588. source = new DOMParser().parseFromString(xhr.responseText, 'application/xml');
  76589. }
  76590. } else if (type === 'arraybuffer') {
  76591. source = xhr.response;
  76592. }
  76593. if (source) {
  76594. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) > -1) {
  76595. success.call(
  76596. this,
  76597. format.readFeatures(source, { featureProjection: projection }),
  76598. format.readProjection(source),
  76599. format.getLastExtent()
  76600. );
  76601. } else {
  76602. success.call(
  76603. this,
  76604. format.readFeatures(source, {
  76605. extent: extent,
  76606. featureProjection: projection
  76607. }),
  76608. format.readProjection(source)
  76609. );
  76610. }
  76611. } else {
  76612. failure.call(this);
  76613. }
  76614. } else {
  76615. failure.call(this);
  76616. }
  76617. }.bind(this);
  76618. xhr.onerror = function () {
  76619. failure.call(this);
  76620. }.bind(this);
  76621. xhr.send();
  76622. });
  76623. }
  76624. }
  76625. _fillByStyleJSON(style, source) {
  76626. if (!source) {
  76627. source = Object.keys(style.sources)[0];
  76628. }
  76629. if (style.sources && style.sources[source]) {
  76630. //ToDo 支持多个tiles地址
  76631. this._tileUrl = style.sources[source].tiles[0];
  76632. }
  76633. if (style.metadata && style.metadata.indexbounds) {
  76634. const indexbounds = style.metadata.indexbounds;
  76635. var max = Math.max(indexbounds[2] - indexbounds[0], indexbounds[3] - indexbounds[1]);
  76636. const defaultResolutions = [];
  76637. for (let index = 0; index < 30; index++) {
  76638. defaultResolutions.push(max / 512 / Math.pow(2, index));
  76639. }
  76640. this.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  76641. extent: style.metadata.indexbounds,
  76642. resolutions: defaultResolutions,
  76643. tileSize: [512, 512]
  76644. });
  76645. }
  76646. }
  76647. _fillByRestMapOptions(url, options) {
  76648. this._tileUrl = Util.urlPathAppend(options.url, 'tileFeature.json');
  76649. if (options.format instanceof (external_ol_format_MVT_default())) {
  76650. this._tileUrl = Util.urlPathAppend(options.url, 'tileFeature.mvt');
  76651. }
  76652. //为url添加安全认证信息片段
  76653. options.serverType = options.serverType || ServerType.ISERVER;
  76654. this._tileUrl = appendCredential(this._tileUrl, options.serverType);
  76655. function appendCredential(url, serverType) {
  76656. var newUrl = url,
  76657. credential,
  76658. value;
  76659. switch (serverType) {
  76660. case ServerType.IPORTAL:
  76661. value = SecurityManager.getToken(url);
  76662. credential = value ? new Credential(value, 'token') : null;
  76663. if (!credential) {
  76664. value = SecurityManager.getKey(url);
  76665. credential = value ? new Credential(value, 'key') : null;
  76666. }
  76667. break;
  76668. case ServerType.ONLINE:
  76669. value = SecurityManager.getKey(url);
  76670. credential = value ? new Credential(value, 'key') : null;
  76671. break;
  76672. default:
  76673. //iserver or others
  76674. value = SecurityManager.getToken(url);
  76675. credential = value ? new Credential(value, 'token') : null;
  76676. break;
  76677. }
  76678. if (credential) {
  76679. newUrl = Util.urlAppend(newUrl,credential.getUrlParameters());
  76680. }
  76681. return newUrl;
  76682. }
  76683. var returnAttributes = true;
  76684. if (options.returnAttributes !== undefined) {
  76685. returnAttributes = options.returnAttributes;
  76686. }
  76687. var params = {};
  76688. params['returnAttributes'] = returnAttributes;
  76689. if (options._cache !== undefined) {
  76690. params['_cache'] = options._cache;
  76691. }
  76692. if (options.layersID !== undefined) {
  76693. params['layersID'] = options.layersID;
  76694. }
  76695. if (options.layerNames !== undefined) {
  76696. params['layerNames'] = options.layerNames;
  76697. }
  76698. if (options.expands !== undefined) {
  76699. params['expands'] = options.expands;
  76700. }
  76701. if (options.compressTolerance !== undefined) {
  76702. params['compressTolerance'] = options.compressTolerance;
  76703. }
  76704. if (options.coordinateType !== undefined) {
  76705. params['coordinateType'] = options.coordinateType;
  76706. }
  76707. if (options.returnCutEdges !== undefined) {
  76708. params['returnCutEdges'] = options.returnCutEdges;
  76709. }
  76710. this._tileUrl = Util.urlAppend(this._tileUrl,Util.getParameterString(params));
  76711. }
  76712. /**
  76713. * @function ol.source.VectorTileSuperMapRest.optionsFromMapJSON
  76714. * @param {string} url - 地址。
  76715. * @param {Object} mapJSONObj - 地图 JSON。
  76716. * @description 获取地图 JSON 信息。
  76717. */
  76718. static optionsFromMapJSON(url, mapJSONObj) {
  76719. var options = {};
  76720. options.url = url;
  76721. options.crossOrigin = 'anonymous';
  76722. var extent = [mapJSONObj.bounds.left, mapJSONObj.bounds.bottom, mapJSONObj.bounds.right, mapJSONObj.bounds.top];
  76723. var resolutions = getResolutions();
  76724. function getResolutions() {
  76725. var level = 17;
  76726. var dpi = 96;
  76727. var width = extent[2] - extent[0];
  76728. var height = extent[3] - extent[1];
  76729. var tileSize = width >= height ? width : height;
  76730. var maxReolution;
  76731. if (tileSize === width) {
  76732. maxReolution = tileSize / mapJSONObj.viewer.width;
  76733. } else {
  76734. maxReolution = tileSize / mapJSONObj.viewer.height;
  76735. }
  76736. var resolutions = [];
  76737. var unit = REST_Unit.METER;
  76738. if (mapJSONObj.coordUnit === REST_Unit.DEGREE) {
  76739. unit = REST_Unit.DEGREE;
  76740. }
  76741. if (mapJSONObj.visibleScales.length > 0) {
  76742. var scales = initScales(mapJSONObj);
  76743. for (let i = 0; i < scales.length; i++) {
  76744. resolutions.push(core_Util_Util.scaleToResolution(scales[i], dpi, unit));
  76745. }
  76746. } else {
  76747. for (let i = 0; i < level; i++) {
  76748. resolutions.push(maxReolution / Math.pow(2, i));
  76749. }
  76750. }
  76751. return resolutions;
  76752. }
  76753. function initScales(mapJSONObj) {
  76754. var scales = mapJSONObj.visibleScales;
  76755. if (!scales) {
  76756. return null;
  76757. }
  76758. var viewBounds = mapJSONObj.viewBounds,
  76759. coordUnit = mapJSONObj.coordUnit,
  76760. viewer = mapJSONObj.viewer,
  76761. scale = mapJSONObj.scale,
  76762. datumAxis = mapJSONObj.datumAxis;
  76763. //将jsonObject转化为SuperMap.Bounds,用于计算dpi。
  76764. viewBounds = new Bounds(viewBounds.left, viewBounds.bottom, viewBounds.right, viewBounds.top);
  76765. viewer = new Size(viewer.rightBottom.x, viewer.rightBottom.y);
  76766. coordUnit = coordUnit.toLowerCase();
  76767. datumAxis = datumAxis || 6378137;
  76768. var units = coordUnit;
  76769. var dpi = Util.calculateDpi(viewBounds, viewer, scale, units, datumAxis);
  76770. var resolutions = _resolutionsFromScales(scales);
  76771. var len = resolutions.length;
  76772. scales = [len];
  76773. for (var i = 0; i < len; i++) {
  76774. scales[i] = Util.getScaleFromResolutionDpi(resolutions[i], dpi, units, datumAxis);
  76775. }
  76776. function _resolutionsFromScales(scales) {
  76777. if (scales === null) {
  76778. return;
  76779. }
  76780. var resolutions, len;
  76781. len = scales.length;
  76782. resolutions = [len];
  76783. for (var i = 0; i < len; i++) {
  76784. resolutions[i] = Util.getResolutionFromScaleDpi(scales[i], dpi, units, datumAxis);
  76785. }
  76786. return resolutions;
  76787. }
  76788. return scales;
  76789. }
  76790. options.tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  76791. extent: extent,
  76792. resolutions: resolutions
  76793. });
  76794. //options.projection = 'EPSG:' + mapJSONObj.prjCoordSys.epsgCode;
  76795. return options;
  76796. }
  76797. }
  76798. ;// CONCATENATED MODULE: ./src/openlayers/overlay/HeatMap.js
  76799. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  76800. * This program are made available under the terms of the Apache License, Version 2.0
  76801. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  76802. /**
  76803. * @class ol.source.HeatMap
  76804. * @classdesc 热力图层类。
  76805. * @category Visualization HeatMap
  76806. * @param {string} name - 图层名称s
  76807. * @param {Object} options - 构造参数。
  76808. * @param {ol/Map} options.map - openlayers 的 map 对象。
  76809. * @param {string} [options.id] - 专题图层 ID,默认使用 CommonUtil.createUniqueID("HeatMapSource_") 创建专题图层 ID。
  76810. * @param {string} [options.featureWeight] - 对应 feature 属性中的热点权重字段名称,权重值类型为 float。
  76811. * @param {number} [options.radius=50] - 热点渲染的最大半径(热点像素半径),单位为 px,当 useGeoUnit 参数 为 true 时,单位使用当前图层地理坐标单位。热点显示的时候以精确点为中心点开始往四周辐射衰减,其衰减半径和权重值成比列。
  76812. * @param {number} [options.opacity=1] - 图层透明度。
  76813. * @param {Array.<string>} [options.colors=['blue','cyan','lime','yellow','red']] - 颜色线性渐变数组,颜色值必须为 canvas 所支持的。
  76814. * @param {boolean} [options.useGeoUnit=false] - 使用地理单位,false 表示默认热点半径默认使用像素单位。当设置为 true 时,热点半径和图层地理坐标保持一致。
  76815. * @extends {ol/source/ImageCanvas}
  76816. */
  76817. class HeatMap extends (external_ol_source_ImageCanvas_default()) {
  76818. constructor(name, opt_options) {
  76819. var options = opt_options ? opt_options : {};
  76820. super({
  76821. attributions: options.attributions || "Map Data <span>© <a href='http://support.supermap.com.cn/product/iServer.aspx' target='_blank'>SuperMap iServer</a></span> with <span>© <a href='https://iclient.supermap.io' target='_blank'>SuperMap iClient</a></span>",
  76822. canvasFunction: canvasFunctionInternal_,
  76823. logo: core_Util_Util.getOlVersion() === '4' ? options.logo : null,
  76824. projection: options.projection,
  76825. ratio: options.ratio,
  76826. resolutions: options.resolutions,
  76827. state: options.state
  76828. });
  76829. function canvasFunctionInternal_(extent, resolution, pixelRatio, size, projection) { // eslint-disable-line no-unused-vars
  76830. var mapWidth = size[0] * pixelRatio;
  76831. var mapHeight = size[1] * pixelRatio;
  76832. this.rootCanvas.width = this.maxWidth = mapWidth;
  76833. this.rootCanvas.height = this.maxHeight = mapHeight;
  76834. if (!this.features) {
  76835. return this.rootCanvas;
  76836. }
  76837. this.pixelRatio = pixelRatio;
  76838. //记录偏移量
  76839. var width = this.map.getSize()[0] * pixelRatio;
  76840. var height = this.map.getSize()[1] * pixelRatio;
  76841. this.offset = [(mapWidth - width) / 2 / pixelRatio, (mapHeight - height) / 2 / pixelRatio];
  76842. this.updateHeatPoints(resolution);
  76843. return this.rootCanvas;
  76844. }
  76845. //初始化成员变量
  76846. this.canvasFunctionInternal_ = canvasFunctionInternal_;
  76847. this.features = [];
  76848. this.name = name;
  76849. if (!options.map) {
  76850. throw new Error('options.map is not found.');
  76851. }
  76852. this.map = options.map;
  76853. // this.TFEvents = options.TFEvents || [];
  76854. this.id = options.id ? options.id : Util.createUniqueID("HeatMapSource_");
  76855. this.opacity = options.opacity ? options.opacity : 1;
  76856. this.colors = options.colors ? options.colors : ['blue', 'cyan', 'lime', 'yellow', 'red'];
  76857. this.useGeoUnit = options.useGeoUnit ? options.useGeoUnit : false;
  76858. this.radius = options.radius ? options.radius : 50;
  76859. this.featureWeight = options.featureWeight ? options.featureWeight : null;
  76860. this.maxWeight = null;
  76861. this.minWeight = null;
  76862. this.maxWidth = null;
  76863. this.maxHeight = null;
  76864. //创建热力图绘制面板
  76865. this.rootCanvas = document.createElement("canvas");
  76866. var mapSize = this.map.getSize();
  76867. this.rootCanvas.width = this.maxWidth = parseInt(mapSize[0]);
  76868. this.rootCanvas.height = this.maxHeight = parseInt(mapSize[1]);
  76869. Util.modifyDOMElement(this.rootCanvas, null, null, null,
  76870. null, null, null, this.opacity);
  76871. this.canvasContext = this.rootCanvas.getContext('2d');
  76872. }
  76873. /**
  76874. * @function ol.source.HeatMap.prototype.addFeatures
  76875. * @description 添加热点信息。
  76876. * @param {(GeoJSONObject|Array.<ol/Feature>)} features - 待添加的要素数组。
  76877. * @example
  76878. * var geojson = {
  76879. * "type": "FeatureCollection",
  76880. * "features": [
  76881. * {
  76882. * "type": "feature",
  76883. * "geometry": {
  76884. * "type": "Point", //只支持point类型
  76885. * "coordinates": [0, 0]
  76886. * },
  76887. * "properties": {
  76888. * "height": Math.random()*9,
  76889. * }
  76890. * }
  76891. * ]
  76892. * };
  76893. * var heatMapSource = new ol.source.HeatMap("heatMap",{"map": map});
  76894. * heatMapSource.addFeatures(geojson);
  76895. * map.addLayer(new ol.layer.Image({
  76896. * source: heatMapSource
  76897. * }));
  76898. */
  76899. addFeatures(features) {
  76900. this.features = this.toiClientFeature(features);
  76901. //支持更新features,刷新底图
  76902. this.changed();
  76903. }
  76904. /**
  76905. * @function ol.source.HeatMap.prototype.setOpacity
  76906. * @description 设置图层的不透明度,取值 [0-1] 之间。
  76907. * @param {number} opacity - 不透明度。
  76908. */
  76909. setOpacity(opacity) {
  76910. if (opacity !== this.opacity) {
  76911. this.opacity = opacity;
  76912. var element = this.rootCanvas;
  76913. Util.modifyDOMElement(element, null, null, null,
  76914. null, null, null, opacity);
  76915. if (this.map !== null) {
  76916. // this.dispatchEvent({type: 'changelayer', value: {layer: this, property: "opacity"}});
  76917. this.changed();
  76918. }
  76919. }
  76920. }
  76921. /**
  76922. * @function ol.source.HeatMap.prototype.updateHeatPoints
  76923. * @description 刷新热点图显示。
  76924. * @param {ol.LngLatBounds} resolution - 当前显示范围。
  76925. * @private
  76926. */
  76927. updateHeatPoints(resolution) {
  76928. if (this.features && this.features.length > 0) {
  76929. this.convertFastToPixelPoints(resolution);
  76930. } else {
  76931. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxWidth);
  76932. }
  76933. }
  76934. /**
  76935. * @function ol.source.HeatMap.prototype.convertFastToPixelPoints
  76936. * @description 过滤位于当前显示范围内的热点,并转换其为当前分辨率下的像素坐标。
  76937. * @param {number} resolution - 当前分辨率。
  76938. * @private
  76939. */
  76940. convertFastToPixelPoints(resolution) {
  76941. var data = [], x, y, k, maxTemp, minTemp, maxWeightTemp;
  76942. //热点半径
  76943. this.useRadius = this.useGeoUnit ? parseInt(this.radius / resolution) : this.radius;
  76944. for (var i = 0; i < this.features.length; i++) {
  76945. var feature = this.features[i];
  76946. var point = feature.geometry;
  76947. //过滤,只显示当前范围
  76948. // if (mapBounds.contains(point.x, point.y)) {
  76949. var pixelPoint = this.getLocalXY(new LonLat(point.x, point.y));
  76950. if (this.featureWeight) {
  76951. pixelPoint.weight = feature.attributes[this.featureWeight];//point.value;
  76952. if (!this.maxWeight) {
  76953. //找出最大最小权重值
  76954. maxTemp = maxTemp ? maxTemp : pixelPoint.weight;
  76955. minTemp = minTemp ? minTemp : pixelPoint.weight;
  76956. maxTemp = Math.max(maxTemp, pixelPoint.weight);
  76957. minTemp = Math.min(minTemp, pixelPoint.weight);
  76958. }
  76959. } else {
  76960. pixelPoint.weight = 1;
  76961. }
  76962. x = Math.floor(pixelPoint[0]);
  76963. y = Math.floor(pixelPoint[1]);
  76964. k = pixelPoint.weight;
  76965. data.push([x, y, k]);
  76966. // }
  76967. }
  76968. //无最大权重设置
  76969. if (!this.maxWeight) {
  76970. if (maxTemp && minTemp) {
  76971. maxWeightTemp = (maxTemp + minTemp) / 2;
  76972. } else {
  76973. maxWeightTemp = 1;
  76974. }
  76975. this.draw(data, maxWeightTemp);
  76976. } else {
  76977. this.draw(data, this.maxWeight);
  76978. }
  76979. }
  76980. /**
  76981. * @function ol.source.HeatMap.prototype.draw
  76982. * @description 绘制热点图。
  76983. * @param {Array} data - convertToPixelPoints 方法计算出的点。
  76984. * @param {number} maxWeight -最大权重。
  76985. * @private
  76986. */
  76987. draw(data, maxWeight) {
  76988. if (this.maxHeight > 0 && this.maxWidth > 0) {
  76989. //清空
  76990. var ctx = this.canvasContext;
  76991. this.canvasContext.clearRect(0, 0, this.maxWidth, this.maxHeight);
  76992. this.drawCircle(this.useRadius);
  76993. this.createGradient();
  76994. for (var i = 0; i < data.length; i++) {
  76995. var p = data[i];
  76996. this.canvasContext.globalAlpha = Math.max(p[2] / maxWeight, 0.05);
  76997. this.canvasContext.drawImage(this.circle, p[0] - this.useRadius, p[1] - this.useRadius);
  76998. }
  76999. var colored = ctx.getImageData(0, 0, this.maxWidth, this.maxHeight);
  77000. this.colorize(colored.data, this.grad);
  77001. ctx.putImageData(colored, 0, 0);
  77002. } else {
  77003. return false;
  77004. }
  77005. }
  77006. /**
  77007. * @function ol.source.HeatMap.prototype.colorize
  77008. * @description 根据渐变色重置热点图 rgb 值。
  77009. * @param {Object} pixels - 像素 rgba 值。
  77010. * @param {Array} gradient - 渐变 canvas.getImageData.data。
  77011. * @private
  77012. */
  77013. colorize(pixels, gradient) {
  77014. for (var i = 0, j; i < pixels.length; i += 4) {
  77015. j = pixels[i + 3] * 4;
  77016. if (j) {
  77017. pixels[i] = gradient[j];
  77018. pixels[i + 1] = gradient[j + 1];
  77019. pixels[i + 2] = gradient[j + 2];
  77020. }
  77021. }
  77022. }
  77023. /**
  77024. * @function ol.source.HeatMap.drawCircle
  77025. * @description 绘制热点半径圆。
  77026. * @param {number} r - 热点半径。
  77027. * @private
  77028. */
  77029. drawCircle(r) {
  77030. var blur = r / 2;
  77031. var circle = this.circle = document.createElement('canvas'),
  77032. ctx = circle.getContext("2d");
  77033. circle.height = 2 * r;
  77034. circle.width = 2 * r;
  77035. ctx.shadowOffsetX = ctx.shadowOffsetY = 2 * r;
  77036. ctx.shadowBlur = blur;
  77037. ctx.shadowColor = "#000000";
  77038. ctx.beginPath();
  77039. ctx.arc(-r, -r, r / 2, 0, Math.PI * 2, true);
  77040. ctx.closePath();
  77041. ctx.fill();
  77042. }
  77043. /**
  77044. * @function ol.source.HeatMap.createGradient
  77045. * @description 根据 this.canvasColors 设置渐变并 getImageData。
  77046. * @private
  77047. */
  77048. createGradient() {
  77049. var colors = this.colors;
  77050. var canvas = document.createElement('canvas'),
  77051. ctx = canvas.getContext("2d"),
  77052. gradient = ctx.createLinearGradient(0, 0, 0, 256);
  77053. canvas.height = 256;
  77054. canvas.width = 1;
  77055. var index = 1;
  77056. for (var i = 0, len = colors.length; i < len; i++) {
  77057. gradient.addColorStop(index / len, colors[i]);
  77058. index++;
  77059. }
  77060. ctx.fillStyle = gradient;
  77061. ctx.fillRect(0, 0, 1, 256);
  77062. this.grad = ctx.getImageData(0, 0, 1, 256).data;
  77063. }
  77064. /**
  77065. * @function ol.source.HeatMap.prototype.getLocalXY
  77066. * @description 获取坐标系统。
  77067. * @param {Object} coordinate - 坐标位置。
  77068. */
  77069. getLocalXY(coordinate) {
  77070. var pixelP, map = this.map;
  77071. if (coordinate instanceof Point || coordinate instanceof GeoText) {
  77072. pixelP = map.getPixelFromCoordinate([coordinate.x, coordinate.y]);
  77073. }
  77074. if (coordinate instanceof LonLat) {
  77075. pixelP = map.getPixelFromCoordinate([coordinate.lon, coordinate.lat]);
  77076. }
  77077. var rotation = -map.getView().getRotation();
  77078. var center = map.getPixelFromCoordinate(map.getView().getCenter());
  77079. var rotatedP = pixelP;
  77080. if (this.pixelRatio) {
  77081. rotatedP = this.scale(pixelP, center, this.pixelRatio);
  77082. }
  77083. if (pixelP && center) {
  77084. rotatedP = this.rotate(rotatedP, rotation, center);
  77085. }
  77086. if (this.offset && rotatedP) {
  77087. return [rotatedP[0] + this.offset[0], rotatedP[1] + this.offset[1]];
  77088. }
  77089. return rotatedP;
  77090. }
  77091. /**
  77092. * @function ol.source.HeatMap.prototype.rotate
  77093. * @description 获取某像素坐标点 pixelP 绕中心 center 逆时针旋转 rotation 弧度后的像素点坐标。
  77094. * @param {number} pixelP - 像素坐标点位置。
  77095. * @param {number} rotation - 旋转角度。
  77096. * @param {number} center - 中心位置。
  77097. */
  77098. rotate(pixelP, rotation, center) {
  77099. var x = Math.cos(rotation) * (pixelP[0] - center[0]) - Math.sin(rotation) * (pixelP[1] - center[1]) + center[0];
  77100. var y = Math.sin(rotation) * (pixelP[0] - center[0]) + Math.cos(rotation) * (pixelP[1] - center[1]) + center[1];
  77101. return [x, y];
  77102. }
  77103. /**
  77104. * @function ol.source.HeatMap.prototype.scale
  77105. * @description 获取某像素坐标点 pixelP 相对于中心 center 进行缩放 scaleRatio 倍后的像素点坐标。
  77106. * @param {Object} pixelP - 像素点。
  77107. * @param {Object} center - 中心点。
  77108. * @param {number} scaleRatio - 缩放倍数。
  77109. * @returns {Array.<number>} 返回数组形比例
  77110. */
  77111. scale(pixelP, center, scaleRatio) {
  77112. var x = (pixelP[0] - center[0]) * scaleRatio + center[0];
  77113. var y = (pixelP[1] - center[1]) * scaleRatio + center[1];
  77114. return [x, y];
  77115. }
  77116. /**
  77117. * @function ol.source.HeatMap.prototype.removeFeatures
  77118. * @description 移除指定的热点信息。
  77119. * @param {Array.<SuperMap.Feature.Vector>} features - 热点信息数组。
  77120. */
  77121. removeFeatures(features) {
  77122. if (!features || features.length === 0 || !this.features || this.features.length === 0) {
  77123. return;
  77124. }
  77125. if (features === this.features) {
  77126. return this.removeAllFeatures();
  77127. }
  77128. if (!(Util.isArray(features))) {
  77129. features = [features];
  77130. }
  77131. var heatPoint, index, heatPointsFailedRemoved = [];
  77132. for (var i = 0, len = features.length; i < len; i++) {
  77133. heatPoint = features[i];
  77134. index = Util.indexOf(this.features, heatPoint);
  77135. //找不到视为删除失败
  77136. if (index === -1) {
  77137. heatPointsFailedRemoved.push(heatPoint);
  77138. continue;
  77139. }
  77140. //删除热点
  77141. this.features.splice(index, 1);
  77142. }
  77143. var succeed = heatPointsFailedRemoved.length == 0 ? true : false;
  77144. //派发删除features成功的事件
  77145. this.dispatchEvent({type: 'featuresremoved', value: {features: heatPointsFailedRemoved, succeed: succeed}});
  77146. this.changed();
  77147. }
  77148. /**
  77149. * @function ol.source.HeatMapprototype.removeAllFeatures
  77150. * @description 移除全部的热点信息。
  77151. */
  77152. removeAllFeatures() {
  77153. this.features = [];
  77154. this.changed();
  77155. }
  77156. /**
  77157. * @function ol.source.HeatMap.prototype.toiClientFeature
  77158. * @description 转为 iClient 要素。
  77159. * @param {GeoJSONObject|Array.<ol/Feature>} features - 待添加的要素数组。
  77160. * @returns {SuperMap.Feature.Vector} 转换后的 iClient 要素
  77161. */
  77162. toiClientFeature(features) {
  77163. if (!core_Util_Util.isArray(features)) {
  77164. features = [features];
  77165. }
  77166. let featuresTemp = [], geometry, attributes;
  77167. for (let i = 0, len = features.length; i < len; i++) {
  77168. if (features[i] instanceof (external_ol_Feature_default())) {
  77169. //热点图支支持传入点对象要素
  77170. if (features[i].getGeometry() instanceof (external_ol_geom_Point_default())) {
  77171. geometry = new Point(features[i].getGeometry().getCoordinates()[0], features[i].getGeometry().getCoordinates()[1]);
  77172. //固定属性字段为 "Properties"
  77173. attributes = features[i].getProperties()["Properties"] ? features[i].getProperties()["Properties"] : {};
  77174. featuresTemp.push(new Vector(geometry, attributes));
  77175. }
  77176. } else if (["FeatureCollection", "Feature", "Geometry"].indexOf(features[i].type) != -1) {
  77177. let format = new GeoJSON();
  77178. featuresTemp = featuresTemp.concat(format.read(features[i]));
  77179. } else if (features[i].geometry && features[i].geometry.parts) {
  77180. //iServer服务器返回数据格式
  77181. featuresTemp.push(ServerFeature.fromJson(features[i]).toFeature());
  77182. } else {
  77183. throw new Error(`Features[${i}]'s type does not match, please check.`);
  77184. }
  77185. }
  77186. return featuresTemp;
  77187. }
  77188. }
  77189. ;// CONCATENATED MODULE: ./src/openlayers/overlay/graphic/index.js
  77190. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77191. * This program are made available under the terms of the Apache License, Version 2.0
  77192. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77193. ;// CONCATENATED MODULE: ./src/openlayers/overlay/mapv/index.js
  77194. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77195. * This program are made available under the terms of the Apache License, Version 2.0
  77196. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77197. ;// CONCATENATED MODULE: ./src/openlayers/overlay/theme/index.js
  77198. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77199. * This program are made available under the terms of the Apache License, Version 2.0
  77200. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77201. ;// CONCATENATED MODULE: external "ol.geom.LineString"
  77202. const external_ol_geom_LineString_namespaceObject = ol.geom.LineString;
  77203. var external_ol_geom_LineString_default = /*#__PURE__*/__webpack_require__.n(external_ol_geom_LineString_namespaceObject);
  77204. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/olExtends.js
  77205. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77206. * This program are made available under the terms of the Apache License, Version 2.0
  77207. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77208. var olExtends = function(targetMap) {
  77209. //解决olms.js插件,在使用ol.js时沿线标注不显示的问题,因为ol.geom.LineString.getFlatMidpoint未非公开方法
  77210. if (!(external_ol_geom_LineString_default()).prototype.getFlatMidpoint) {
  77211. (external_ol_geom_LineString_default()).prototype.getFlatMidpoint = function() {
  77212. return this.getCoordinateAt(0.5);
  77213. };
  77214. }
  77215. if (core_Util_Util.getOlVersion() === '4' && window && window.ol && window.ol.geom.flat) {
  77216. // for ol4-debug
  77217. window.targetMapCache = targetMap;
  77218. let ol = window.ol;
  77219. //解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
  77220. // eslint-disable-next-line no-unused-vars
  77221. ol.format.MVT.prototype.readProjection = function(source) {
  77222. return new ol.proj.Projection({
  77223. code: '',
  77224. units: ol.proj.Units.TILE_PIXELS
  77225. });
  77226. };
  77227. //解决 new ol.format.MVT({featureClass: ol.Feature})时,非3857显示异常的问题。ol即将发布的5.0版本已解决。
  77228. // eslint-disable-next-line no-unused-vars
  77229. ol.format.MVT.prototype.readProjection = function(source) {
  77230. return new ol.proj.Projection({
  77231. code: '',
  77232. units: ol.proj.Units.TILE_PIXELS
  77233. });
  77234. };
  77235. //解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
  77236. // eslint-disable-next-line no-unused-vars
  77237. ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
  77238. var fillStyle = state.fillStyle;
  77239. var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
  77240. if (typeof fillStyle !== 'string') {
  77241. var viewExtent = window.targetMapCache
  77242. .getView()
  77243. .getProjection()
  77244. .getExtent();
  77245. fillInstruction.push([viewExtent[0], viewExtent[3]]);
  77246. }
  77247. this.instructions.push(fillInstruction);
  77248. };
  77249. //解决面填充时不能整版填充的问题。ol即将发布的5.0版本已解决。
  77250. // eslint-disable-next-line no-unused-vars
  77251. ol.render.canvas.Replay.prototype.applyFill = function(state, geometry) {
  77252. var fillStyle = state.fillStyle;
  77253. var fillInstruction = [ol.render.canvas.Instruction.SET_FILL_STYLE, fillStyle];
  77254. if (typeof fillStyle !== 'string') {
  77255. var viewExtent = window.targetMapCache
  77256. .getView()
  77257. .getProjection()
  77258. .getExtent();
  77259. fillInstruction.push([viewExtent[0], viewExtent[3]]);
  77260. }
  77261. this.instructions.push(fillInstruction);
  77262. };
  77263. //解决在多面时,第一个面是逆时针时无法显示的问题。该问题由组件修复。
  77264. ol.format.MVT.prototype.createFeature_ = function(pbf, rawFeature, opt_options) {
  77265. var type = rawFeature.type;
  77266. if (type === 0) {
  77267. return null;
  77268. }
  77269. var feature;
  77270. var id = rawFeature.id;
  77271. var values = rawFeature.properties;
  77272. values[this.layerName_] = rawFeature.layer.name;
  77273. var flatCoordinates = [];
  77274. var ends = [];
  77275. ol.format.MVT.readRawGeometry_(pbf, rawFeature, flatCoordinates, ends);
  77276. var geometryType = ol.format.MVT.getGeometryType_(type, ends.length);
  77277. if (this.featureClass_ === ol.render.Feature) {
  77278. feature = new this.featureClass_(geometryType, flatCoordinates, ends, values, id);
  77279. } else {
  77280. var geom;
  77281. if (geometryType == ol.geom.GeometryType.POLYGON) {
  77282. var endss = [];
  77283. var offset = 0;
  77284. var prevEndIndex = 0;
  77285. for (var i = 0, ii = ends.length; i < ii; ++i) {
  77286. var end = ends[i];
  77287. if (!ol.geom.flat.orient.linearRingIsClockwise(flatCoordinates, offset, end, 2)) {
  77288. endss.push(ends.slice(prevEndIndex, i + 1));
  77289. prevEndIndex = i + 1;
  77290. }
  77291. offset = end;
  77292. }
  77293. if (endss.length > 1) {
  77294. ends = endss;
  77295. geom = new ol.geom.MultiPolygon(null);
  77296. } else {
  77297. geom = new ol.geom.Polygon(null);
  77298. }
  77299. } else {
  77300. geom =
  77301. geometryType === ol.geom.GeometryType.POINT
  77302. ? new ol.geom.Point(null)
  77303. : geometryType === ol.geom.GeometryType.LINE_STRING
  77304. ? new ol.geom.LineString(null)
  77305. : geometryType === ol.geom.GeometryType.POLYGON
  77306. ? new ol.geom.Polygon(null)
  77307. : geometryType === ol.geom.GeometryType.MULTI_POINT
  77308. ? new ol.geom.MultiPoint(null)
  77309. : geometryType === ol.geom.GeometryType.MULTI_LINE_STRING
  77310. ? new ol.geom.MultiLineString(null)
  77311. : null;
  77312. }
  77313. if (geom) {
  77314. geom.setFlatCoordinates(ol.geom.GeometryLayout.XY, flatCoordinates, ends);
  77315. feature = new this.featureClass_();
  77316. if (this.geometryName_) {
  77317. feature.setGeometryName(this.geometryName_);
  77318. }
  77319. var geometry = ol.format.Feature.transformWithOptions(geom, false, this.adaptOptions(opt_options));
  77320. feature.setGeometry(geometry);
  77321. feature.setId(id);
  77322. feature.setProperties(values);
  77323. }
  77324. }
  77325. return feature;
  77326. };
  77327. //解决中文沿线表述显示不符合中文阅读习惯的问题
  77328. ol.geom.flat.textpath.lineString = function(
  77329. flatCoordinates,
  77330. offset,
  77331. end,
  77332. stride,
  77333. text,
  77334. measure,
  77335. startM,
  77336. maxAngle
  77337. ) {
  77338. var result = [];
  77339. // Keep text upright
  77340. var anglereverse = Math.atan2(
  77341. flatCoordinates[end - stride + 1] - flatCoordinates[offset + 1],
  77342. flatCoordinates[end - stride] - flatCoordinates[offset]
  77343. );
  77344. var reverse = anglereverse < -0.785 || anglereverse > 2.356; //0.785//2.356
  77345. var isRotateUp =
  77346. (anglereverse < -0.785 && anglereverse > -2.356) || (anglereverse > 0.785 && anglereverse < 2.356);
  77347. var numChars = text.length;
  77348. var x1 = flatCoordinates[offset];
  77349. var y1 = flatCoordinates[offset + 1];
  77350. offset += stride;
  77351. var x2 = flatCoordinates[offset];
  77352. var y2 = flatCoordinates[offset + 1];
  77353. var segmentM = 0;
  77354. var segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  77355. while (offset < end - stride && segmentM + segmentLength < startM) {
  77356. x1 = x2;
  77357. y1 = y2;
  77358. offset += stride;
  77359. x2 = flatCoordinates[offset];
  77360. y2 = flatCoordinates[offset + 1];
  77361. segmentM += segmentLength;
  77362. segmentLength = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2));
  77363. }
  77364. var interpolate = (startM - segmentM) / segmentLength;
  77365. var x0 = ol.math.lerp(x1, x2, interpolate); //起始点
  77366. var y0 = ol.math.lerp(y1, y2, interpolate); //起始点
  77367. var chunk = '';
  77368. var chunkLength = 0;
  77369. var data, index, previousAngle, previousLang;
  77370. for (var i = 0; i < numChars; ++i) {
  77371. index = reverse ? numChars - i - 1 : i;
  77372. var char = text.charAt(index);
  77373. var charcode = char.charCodeAt(0);
  77374. var ischinese = charcode >= 19968 && charcode <= 40907;
  77375. chunk = reverse ? char + chunk : chunk + char;
  77376. var charLength = measure(chunk) - chunkLength;
  77377. chunkLength += charLength;
  77378. //var charM = startM + charLength / 2;
  77379. while (
  77380. offset < end - stride &&
  77381. Math.sqrt(Math.pow(x2 - x0, 2) + Math.pow(y2 - y0, 2)) < charLength / 2
  77382. ) {
  77383. x1 = x2;
  77384. y1 = y2;
  77385. offset += stride;
  77386. x2 = flatCoordinates[offset];
  77387. y2 = flatCoordinates[offset + 1];
  77388. }
  77389. var a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
  77390. var b = 2 * (x2 - x1) * (x1 - x0) + 2 * (y2 - y1) * (y1 - y0);
  77391. var c = Math.pow(x1 - x0, 2) + Math.pow(y1 - y0, 2) - Math.pow(charLength / 2, 2);
  77392. var scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  77393. var scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  77394. interpolate =
  77395. scale1 < 0 || scale1 > 1
  77396. ? scale2
  77397. : scale2 < 0 || scale2 > 1
  77398. ? scale1
  77399. : scale1 < scale2
  77400. ? scale2
  77401. : scale1;
  77402. var x = ol.math.lerp(x1, x2, interpolate);
  77403. var y = ol.math.lerp(y1, y2, interpolate);
  77404. while (offset < end - stride && Math.sqrt(Math.pow(x2 - x, 2) + Math.pow(y2 - y, 2)) < charLength / 2) {
  77405. x1 = x2;
  77406. y1 = y2;
  77407. offset += stride;
  77408. x2 = flatCoordinates[offset];
  77409. y2 = flatCoordinates[offset + 1];
  77410. }
  77411. a = Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2);
  77412. b = 2 * (x2 - x1) * (x1 - x) + 2 * (y2 - y1) * (y1 - y);
  77413. c = Math.pow(x1 - x, 2) + Math.pow(y1 - y, 2) - Math.pow(charLength / 2, 2);
  77414. scale1 = (-b + Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  77415. scale2 = (-b - Math.sqrt(b * b - 4 * a * c)) / (2 * a);
  77416. interpolate =
  77417. scale1 < 0 || scale1 > 1
  77418. ? scale2
  77419. : scale2 < 0 || scale2 > 1
  77420. ? scale1
  77421. : scale1 < scale2
  77422. ? scale2
  77423. : scale1;
  77424. var x3 = ol.math.lerp(x1, x2, interpolate);
  77425. var y3 = ol.math.lerp(y1, y2, interpolate);
  77426. var angle = Math.atan2(y3 - y0, x3 - x0);
  77427. if (reverse) {
  77428. angle += angle > 0 ? -Math.PI : Math.PI;
  77429. }
  77430. if (ischinese && isRotateUp) {
  77431. angle += angle > 0 ? -Math.PI / 2 : Math.PI / 2;
  77432. }
  77433. if (previousAngle !== undefined) {
  77434. var delta = angle - previousAngle;
  77435. delta += delta > Math.PI ? -2 * Math.PI : delta < -Math.PI ? 2 * Math.PI : 0;
  77436. if (
  77437. ischinese === previousLang
  77438. ? Math.abs(delta) > maxAngle
  77439. : Math.abs(delta) > maxAngle + Math.PI / 2
  77440. ) {
  77441. return null;
  77442. }
  77443. }
  77444. if (previousAngle == angle && !isRotateUp) {
  77445. if (reverse) {
  77446. data[0] = x;
  77447. data[1] = y;
  77448. data[2] = charLength / 2;
  77449. }
  77450. data[4] = chunk;
  77451. } else {
  77452. chunk = char;
  77453. chunkLength = charLength;
  77454. data = [x, y, charLength / 2, angle, chunk];
  77455. if (reverse) {
  77456. result.unshift(data);
  77457. } else {
  77458. result.push(data);
  77459. }
  77460. previousAngle = angle;
  77461. previousLang = ischinese;
  77462. }
  77463. x0 = x3;
  77464. y0 = y3;
  77465. startM += charLength;
  77466. }
  77467. return result;
  77468. };
  77469. //以下两个方法解决在大数据量图斑时,内存疯长的问题。该改法引发新问题:无法点选要素
  77470. ol.layer.VectorTile.prototype.setFastRender = function(fastRender) {
  77471. return (this.fastRender = fastRender);
  77472. };
  77473. ol.renderer.canvas.VectorTileLayer.prototype.postCompose = function(context, frameState, layerState) {
  77474. var layer = this.getLayer();
  77475. var declutterReplays = layer.getDeclutter() ? {} : null;
  77476. var source = /** @type {ol.source.VectorTile} */ (layer.getSource());
  77477. var renderMode = layer.getRenderMode();
  77478. var replayTypes = ol.renderer.canvas.VectorTileLayer.VECTOR_REPLAYS[renderMode];
  77479. var pixelRatio = frameState.pixelRatio;
  77480. var rotation = frameState.viewState.rotation;
  77481. var size = frameState.size;
  77482. var offsetX, offsetY;
  77483. if (rotation) {
  77484. offsetX = Math.round((pixelRatio * size[0]) / 2);
  77485. offsetY = Math.round((pixelRatio * size[1]) / 2);
  77486. ol.render.canvas.rotateAtOffset(context, -rotation, offsetX, offsetY);
  77487. }
  77488. if (declutterReplays) {
  77489. this.declutterTree_.clear();
  77490. }
  77491. var tiles = this.renderedTiles;
  77492. var tileGrid = source.getTileGridForProjection(frameState.viewState.projection);
  77493. var clips = [];
  77494. var zs = [];
  77495. for (var i = tiles.length - 1; i >= 0; --i) {
  77496. var tile = /** @type {ol.VectorImageTile} */ (tiles[i]);
  77497. if (tile.getState() == ol.TileState.ABORT) {
  77498. continue;
  77499. }
  77500. var tileCoord = tile.tileCoord;
  77501. var worldOffset =
  77502. tileGrid.getTileCoordExtent(tileCoord)[0] - tileGrid.getTileCoordExtent(tile.wrappedTileCoord)[0];
  77503. var transform = undefined;
  77504. for (var t = 0, tt = tile.tileKeys.length; t < tt; ++t) {
  77505. var sourceTile = tile.getTile(tile.tileKeys[t]);
  77506. if (sourceTile.getState() == ol.TileState.ERROR) {
  77507. continue;
  77508. }
  77509. var replayGroup = sourceTile.getReplayGroup(layer, tileCoord.toString());
  77510. if (
  77511. renderMode != ol.layer.VectorTileRenderType.VECTOR &&
  77512. (!replayGroup || !replayGroup.hasReplays(replayTypes))
  77513. ) {
  77514. if (layer.fastRender === true) {
  77515. sourceTile.replayGroups_ = {};
  77516. sourceTile.features_ = [];
  77517. }
  77518. continue;
  77519. }
  77520. if (!transform) {
  77521. transform = this.getTransform(frameState, worldOffset);
  77522. }
  77523. var currentZ = sourceTile.tileCoord[0];
  77524. var currentClip = replayGroup.getClipCoords(transform);
  77525. context.save();
  77526. context.globalAlpha = layerState.opacity;
  77527. // Create a clip mask for regions in this low resolution tile that are
  77528. // already filled by a higher resolution tile
  77529. for (var j = 0, jj = clips.length; j < jj; ++j) {
  77530. var clip = clips[j];
  77531. if (currentZ < zs[j]) {
  77532. context.beginPath();
  77533. // counter-clockwise (outer ring) for current tile
  77534. context.moveTo(currentClip[0], currentClip[1]);
  77535. context.lineTo(currentClip[2], currentClip[3]);
  77536. context.lineTo(currentClip[4], currentClip[5]);
  77537. context.lineTo(currentClip[6], currentClip[7]);
  77538. // clockwise (inner ring) for higher resolution tile
  77539. context.moveTo(clip[6], clip[7]);
  77540. context.lineTo(clip[4], clip[5]);
  77541. context.lineTo(clip[2], clip[3]);
  77542. context.lineTo(clip[0], clip[1]);
  77543. context.clip();
  77544. }
  77545. }
  77546. replayGroup.replay(context, transform, rotation, {}, replayTypes, declutterReplays);
  77547. context.restore();
  77548. clips.push(currentClip);
  77549. zs.push(currentZ);
  77550. }
  77551. }
  77552. if (declutterReplays) {
  77553. ol.render.canvas.ReplayGroup.replayDeclutter(declutterReplays, context, rotation);
  77554. }
  77555. if (rotation) {
  77556. ol.render.canvas.rotateAtOffset(
  77557. context,
  77558. rotation,
  77559. /** @type {number} */
  77560. (offsetX),
  77561. /** @type {number} */ (offsetY)
  77562. );
  77563. }
  77564. ol.renderer.canvas.TileLayer.prototype.postCompose.apply(this, arguments);
  77565. };
  77566. }
  77567. };
  77568. window.olExtends = olExtends;
  77569. // EXTERNAL MODULE: ./node_modules/lodash.remove/index.js
  77570. var lodash_remove = __webpack_require__(794);
  77571. var lodash_remove_default = /*#__PURE__*/__webpack_require__.n(lodash_remove);
  77572. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/MapboxStyles.js
  77573. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77574. * This program are made available under the terms of the Apache License, Version 2.0
  77575. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77576. /**
  77577. * @class ol.supermap.MapboxStyles
  77578. * @classdesc Mapbox 矢量瓦片风格。
  77579. * <div style="padding: 20px;border: 1px solid #eee;border-left-width: 5px;border-radius: 3px;border-left-color: #ce4844;">
  77580. * <p style="color: #ce4844">Notice</p>
  77581. * <p style="font-size: 13px">该功能依赖 <a href='https://github.com/boundlessgeo/ol-mapbox-style'>ol-mapbox-style</a> 插件,请确认引入该插件。</p>
  77582. * `<script type="text/javascript" src="https://rawgit.com/boundlessgeo/ol-mapbox-style/v2.11.2-1/dist/olms.js"></script>`
  77583. * </div>
  77584. * @category Visualization VectorTile
  77585. * @param {Object} options - 初始化参数。
  77586. * @param {(string|undefined)} [options.url] - SuperMap iServer 地图服务地址,例如'http://localhost:8090/iserver/services/map-mvt-test/rest/maps/test',与options.style互斥,优先级低于options.style。
  77587. * @param {(Object|string|undefined)} [opStyleMaptions.style] - Mapbox Style JSON 对象或获取 Mapbox Style JSON 对象的 URL。与 options.url 互斥,优先级高于 options.url。
  77588. * @param {Array.<number>} [options.resolutions] - 地图分辨率数组,用于映射 zoom 值。通常情況与地图的 {@link ol/View} 的分辨率一致。</br>
  77589. * 默认值为:[78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564, 1222.99245256282,611.49622628141,305.748113140705,152.8740565703525, 76.43702828517625,38.21851414258813,19.109257071294063,9.554628535647032, 4.777314267823516,2.388657133911758,1.194328566955879,0.5971642834779395, 0.29858214173896974,0.14929107086948487,0.07464553543474244]。
  77590. * @param {(string|Array.<string>|undefined)} [options.source] - Mapbox Style 'source'的 key 值或者 'layer' 的 ID 数组。
  77591. * 当配置 'source' 的 key 值时,source 为该值的 layer 会被加载;
  77592. * 当配置为 'layer' 的 ID 数组时,指定的 layer 会被加载,注意被指定的 layer 需要有相同的 source。
  77593. * 当不配置时,默认为 Mapbox Style JSON 的 `sources` 对象中的第一个。
  77594. * @param {ol/Map} [options.map] - Openlayers 地图对象,仅用于面填充样式,若没有面填充样式可不填。
  77595. * @param {ol/StyleFunction} [options.selectedStyle] -选中样式Function。
  77596. * @param {boolean} [options.withCredentials] - 请求是否携带 cookie。
  77597. * @example
  77598. * var mbStyle = new ol.supermap.MapboxStyles({
  77599. url: url,
  77600. source: 'California',
  77601. resolutions: [78271.51696402048,39135.75848201024, 19567.87924100512,9783.93962050256,4891.96981025128,2445.98490512564]
  77602. })
  77603. mbStyle.on('styleLoaded', function () {
  77604. var vectorLayer = new ol.layer.VectorTile({
  77605. //设置避让参数
  77606. declutter: true,
  77607. source: new ol.source.VectorTileSuperMapRest({
  77608. url: url,
  77609. format: new ol.format.MVT({
  77610. featureClass: ol.Feature
  77611. }),
  77612. tileType: 'ScaleXY'
  77613. }),
  77614. style: mbStyle.featureStyleFuntion
  77615. });
  77616. map.addLayer(vectorLayer);
  77617. })
  77618. */
  77619. class MapboxStyles extends (external_ol_Observable_default()) {
  77620. constructor(options) {
  77621. super();
  77622. options = options || {};
  77623. this.spriteRegEx = /^(.*)(\?.*)$/;
  77624. this.defaultFont = ["DIN Offc Pro Medium", "Arial Unicode MS Regular"];
  77625. this.map = options.map;
  77626. this.source = options.source;
  77627. this.styleTarget =
  77628. options.style ||
  77629. Util.urlAppend(
  77630. Util.urlPathAppend(options.url, 'tileFeature/vectorstyles'),
  77631. 'type=MapBox_GL&styleonly=true'
  77632. );
  77633. this.resolutions = options.resolutions;
  77634. this.withCredentials = options.withCredentials;
  77635. this.selectedObjects = [];
  77636. this.selectedStyle =
  77637. options.selectedStyle ||
  77638. function() {
  77639. return new (external_ol_style_Style_default())({
  77640. fill: new (external_ol_style_Fill_default())({
  77641. color: "rgba(255, 0, 0, 1)"
  77642. }),
  77643. stroke: new (external_ol_style_Stroke_default())({
  77644. color: "rgba(255, 0, 0, 1)",
  77645. width: 10
  77646. }),
  77647. text: new (external_ol_style_Text_default())({
  77648. font: 'normal 400 11.19px "Microsoft YaHei"',
  77649. placement: "point",
  77650. fill: new (external_ol_style_Fill_default())({
  77651. color: "blue"
  77652. })
  77653. }),
  77654. image: new (external_ol_style_Circle_default())({
  77655. radius: 5,
  77656. fill: new (external_ol_style_Fill_default())({
  77657. color: "blue"
  77658. })
  77659. })
  77660. });
  77661. };
  77662. this.layersBySourceLayer = {};
  77663. olExtends(this.map);
  77664. this._loadStyle(this.styleTarget);
  77665. }
  77666. /**
  77667. * @function ol.supermap.MapboxStyles.prototype.getStyleFunction
  77668. * @description 获取 ol/StyleFunction。
  77669. * @returns {ol/StyleFunction} 返回 ol/StyleFunction
  77670. */
  77671. getStyleFunction() {
  77672. return this.featureStyleFuntion;
  77673. }
  77674. /**
  77675. * @function ol.supermap.MapboxStyles.prototype.getStylesBySourceLayer
  77676. * @description 根据图层名称获取样式。
  77677. * @param {string} sourceLayer - 数据图层名称。
  77678. */
  77679. getStylesBySourceLayer(sourceLayer) {
  77680. if (this.layersBySourceLayer[sourceLayer]) {
  77681. return this.layersBySourceLayer[sourceLayer];
  77682. }
  77683. const layers = [];
  77684. for (let index = 0; index < this._mbStyle.layers.length; index++) {
  77685. const layer = this._mbStyle.layers[index];
  77686. if (layer["source-layer"] !== sourceLayer) {
  77687. continue;
  77688. }
  77689. layers.push(layer);
  77690. }
  77691. this.layersBySourceLayer[sourceLayer] = layers;
  77692. return layers;
  77693. }
  77694. /**
  77695. * @function ol.supermap.MapboxStyles.prototype.setSelectedId
  77696. * @description 设置选中要素,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。
  77697. * @param {number} selectedId - 要素ID。
  77698. * @param {string} sourceLayer - 要素所在图层名称。
  77699. */
  77700. setSelectedId(selectedId, sourceLayer) {
  77701. this.selectedObjects = [];
  77702. this.selectedObjects.push({
  77703. id: selectedId,
  77704. sourceLayer: sourceLayer
  77705. });
  77706. }
  77707. /**
  77708. * @typedef {Object} ol.supermap.MapboxStyles.selectedObject
  77709. * @description 要选择的要素对象。
  77710. * @property {number} selectedId - 要素ID。
  77711. * @property {string} sourceLayer - 要素所在图层名称。
  77712. */
  77713. /**
  77714. * @function ol.supermap.MapboxStyles.prototype.setSelectedObjects
  77715. * @version 10.0.0
  77716. * @description 设置选中要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。
  77717. * @param {ol.supermap.MapboxStyles.selectedObject|Array.<ol.supermap.MapboxStyles.selectedObject>} addSelectedObjects - 选择的要素或要素数组。
  77718. */
  77719. setSelectedObjects(selectedObjects) {
  77720. if (!Array.isArray(selectedObjects)) {
  77721. selectedObjects = [selectedObjects];
  77722. }
  77723. this.selectedObjects = [];
  77724. this.selectedObjects = selectedObjects;
  77725. }
  77726. /**
  77727. * @function ol.supermap.MapboxStyles.prototype.addSelectedObjects
  77728. * @version 10.0.0
  77729. * @description 增加选中的要素或要素数组,该要素将会用 `selectedStyle` 样式绘制。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。
  77730. * @param {ol.supermap.MapboxStyles.selectedObject|Array.<ol.supermap.MapboxStyles.selectedObject>} addSelectedObjects - 选择的要素或要素数组。
  77731. */
  77732. addSelectedObjects(selectedObjects) {
  77733. if (!Array.isArray(selectedObjects)) {
  77734. selectedObjects = [selectedObjects];
  77735. }
  77736. this.selectedObjects.push(...selectedObjects);
  77737. }
  77738. /**
  77739. * @function ol.supermap.MapboxStyles.prototype.clearSelectedObjects
  77740. * @version 10.0.0
  77741. * @description 清空选中状态。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。
  77742. */
  77743. removeSelectedObjects(selectedObjects) {
  77744. if (!Array.isArray(selectedObjects)) {
  77745. selectedObjects = [selectedObjects];
  77746. }
  77747. selectedObjects.forEach(element => {
  77748. lodash_remove_default()(this.selectedObjects, obj => {
  77749. return element.id === obj.id && element.sourceLayer === obj.sourceLayer;
  77750. });
  77751. });
  77752. }
  77753. /**
  77754. * @function ol.supermap.MapboxStyles.prototype.clearSelectedObjects
  77755. * @version 10.0.0
  77756. * @description 清空选中状态。调用该方法后需要调用 `ol/layer/VectorTile` 的 `changed`,才能生效。
  77757. */
  77758. clearSelectedObjects() {
  77759. this.selectedObjects = [];
  77760. }
  77761. /**
  77762. * @function ol.supermap.MapboxStyles.prototype.updateStyles
  77763. * @description 更新图层样式。
  77764. * @param {Object} layerStyles - 图层样式或图层样式数组。
  77765. */
  77766. updateStyles(layerStyles) {
  77767. if (Object.prototype.toString.call(layerStyles) !== "[object Array]") {
  77768. layerStyles = [layerStyles];
  77769. }
  77770. const layerObj = {};
  77771. layerStyles.forEach(layerStyle => {
  77772. layerObj[layerStyle.id] = layerStyle;
  77773. });
  77774. let count = 0;
  77775. for (const key in this._mbStyle.layers) {
  77776. const oldLayerStyle = this._mbStyle.layers[key];
  77777. if (count >= layerStyles.length) {
  77778. break;
  77779. }
  77780. if (!layerObj[oldLayerStyle.id]) {
  77781. continue;
  77782. }
  77783. const newLayerStyle = JSON.parse(JSON.stringify(layerObj[oldLayerStyle.id]));
  77784. if(newLayerStyle.paint){
  77785. newLayerStyle.paint = Object.assign({},oldLayerStyle.paint,newLayerStyle.paint);
  77786. }
  77787. if(newLayerStyle.layout){
  77788. newLayerStyle.layout = Object.assign({},oldLayerStyle.layout,newLayerStyle.layout);
  77789. }
  77790. Object.assign(oldLayerStyle,newLayerStyle);
  77791. count++;
  77792. }
  77793. this._createStyleFunction();
  77794. }
  77795. /**
  77796. * @function ol.supermap.MapboxStyles.prototype.setStyle
  77797. * @version 9.1.1
  77798. * @description 设置 Mapbox style 对象。
  77799. * @param {Object} style - Mapbox style 对象。
  77800. */
  77801. setStyle(style) {
  77802. this.layersBySourceLayer = {};
  77803. this._loadStyle(style);
  77804. }
  77805. _loadStyle(style) {
  77806. if (Object.prototype.toString.call(style) == "[object Object]") {
  77807. this._mbStyle = style;
  77808. this._resolve();
  77809. } else {
  77810. FetchRequest.get(style,null,{withCredentials:this.withCredentials})
  77811. .then(response => response.json())
  77812. .then(mbStyle => {
  77813. this._mbStyle = mbStyle;
  77814. this._resolve();
  77815. });
  77816. }
  77817. }
  77818. _resolve() {
  77819. if (!this.source) {
  77820. this.source = Object.keys(this._mbStyle.sources)[0];
  77821. }
  77822. if (this._mbStyle.sprite) {
  77823. const spriteScale = window.devicePixelRatio >= 1.5 ? 0.5 : 1;
  77824. const sizeFactor = spriteScale == 0.5 ? "@2x" : "";
  77825. //兼容一下iServer 等iServer修改
  77826. this._mbStyle.sprite = this._mbStyle.sprite.replace("@2x", "");
  77827. const spriteUrl = this._toSpriteUrl(this._mbStyle.sprite, this.path, sizeFactor + ".json");
  77828. FetchRequest.get(spriteUrl,null,{withCredentials:this.withCredentials})
  77829. .then(response => response.json())
  77830. .then(spritesJson => {
  77831. this._spriteData = spritesJson;
  77832. this._spriteImageUrl = this._toSpriteUrl(this._mbStyle.sprite, this.path, sizeFactor + ".png");
  77833. this._spriteImage = null;
  77834. const img = new Image();
  77835. img.crossOrigin = this.withCredentials?"use-credentials":"anonymous";
  77836. img.onload = () => {
  77837. this._spriteImage = img;
  77838. this._initStyleFunction();
  77839. };
  77840. img.onerror = () => {
  77841. this._spriteImage = null;
  77842. this._initStyleFunction();
  77843. }
  77844. img.src = this._spriteImageUrl;
  77845. });
  77846. } else {
  77847. this._initStyleFunction();
  77848. }
  77849. }
  77850. _initStyleFunction() {
  77851. if (!this.resolutions && this._mbStyle.metadata && this._mbStyle.metadata.indexbounds) {
  77852. const indexbounds = this._mbStyle.metadata.indexbounds;
  77853. var max = Math.max(indexbounds[2] - indexbounds[0], indexbounds[3] - indexbounds[1]);
  77854. const defaultResolutions = [];
  77855. for (let index = 0; index < 30; index++) {
  77856. defaultResolutions.push(max / 512 / Math.pow(2, index));
  77857. }
  77858. this.resolutions = defaultResolutions;
  77859. }
  77860. this._createStyleFunction();
  77861. /**
  77862. * @event ol.supermap.MapboxStyles#styleloaded
  77863. * @description 样式加载成功后触发。
  77864. */
  77865. this.dispatchEvent("styleloaded");
  77866. }
  77867. _createStyleFunction() {
  77868. if (this.map) {
  77869. window.olms.applyBackground(this.map, this._mbStyle);
  77870. }
  77871. this.featureStyleFuntion = this._getStyleFunction();
  77872. }
  77873. _getStyleFunction() {
  77874. this.fun = window.olms.stylefunction(
  77875. { setStyle: function() {}, set: function() {}, changed: function() {} },
  77876. this._mbStyle,
  77877. this.source,
  77878. this.resolutions,
  77879. this._spriteData,
  77880. "",
  77881. this._spriteImage
  77882. );
  77883. return (feature, resolution) => {
  77884. const style = this.fun(feature, resolution);
  77885. if (
  77886. this.selectedObjects.length > 0 &&
  77887. this.selectedObjects.find(element => {
  77888. return element.id === feature.getId() && element.sourceLayer === feature.get("layer");
  77889. })
  77890. ) {
  77891. const styleIndex = style && style[0] ? style[0].getZIndex() : 99999;
  77892. let selectStyles = this.selectedStyle(feature, resolution);
  77893. if (!Array.isArray(selectStyles)) {
  77894. selectStyles = [selectStyles];
  77895. }
  77896. for (let index = 0; index < selectStyles.length; index++) {
  77897. const selectStyle = selectStyles[index];
  77898. if (feature.getGeometry().getType() === "Point" && style[0].getText() && selectStyle.getText()) {
  77899. selectStyle.setFill(null);
  77900. selectStyle.setStroke(null);
  77901. selectStyle.setImage();
  77902. selectStyle.getText().setText(style[0].getText().getText());
  77903. }
  77904. selectStyle.setZIndex(styleIndex);
  77905. }
  77906. return selectStyles;
  77907. }
  77908. return style;
  77909. };
  77910. }
  77911. _withPath(url, path) {
  77912. if (path && url.indexOf("http") != 0) {
  77913. url = path + url;
  77914. }
  77915. return url;
  77916. }
  77917. _toSpriteUrl(url, path, extension) {
  77918. url = this._withPath(url, path);
  77919. const parts = url.match(this.spriteRegEx);
  77920. return parts ? parts[1] + extension + (parts.length > 2 ? parts[2] : "") : url + extension;
  77921. }
  77922. }
  77923. ;// CONCATENATED MODULE: ./src/openlayers/overlay/vectortile/index.js
  77924. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77925. * This program are made available under the terms of the Apache License, Version 2.0
  77926. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77927. ;// CONCATENATED MODULE: ./src/openlayers/overlay/index.js
  77928. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77929. * This program are made available under the terms of the Apache License, Version 2.0
  77930. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77931. ;// CONCATENATED MODULE: ./src/openlayers/services/AddressMatchService.js
  77932. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  77933. * This program are made available under the terms of the Apache License, Version 2.0
  77934. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  77935. /**
  77936. * @class ol.supermap.AddressMatchService
  77937. * @category iServer AddressMatch
  77938. * @classdesc 地址匹配服务。
  77939. * @example
  77940. * new ol.supermap.AddressMatchService(url,options)
  77941. * .code(function(result){
  77942. * //doSomething
  77943. * })
  77944. * @param {string} url - 与客户端交互的服务地址。
  77945. * @param {Object} options - 参数。
  77946. * @param {string} [options.proxy] - 服务代理地址。
  77947. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  77948. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  77949. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  77950. * @param {Object} [options.headers] - 请求头。
  77951. * @extends {ol.supermap.ServiceBase}
  77952. */
  77953. class AddressMatchService extends ServiceBase {
  77954. constructor(url, options) {
  77955. super(url, options);
  77956. }
  77957. /**
  77958. * @function ol.supermap.AddressMatchService.prototype.code
  77959. * @description 获取正向地址匹配结果。
  77960. * @param {SuperMap.GeoCodingParameter} params - 正向匹配参数。
  77961. * @param {RequestCallback} callback 请求结果的回调函数。
  77962. */
  77963. code(params, callback) {
  77964. var me = this;
  77965. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  77966. proxy: me.options.proxy,
  77967. withCredentials: me.options.withCredentials,
  77968. crossOrigin: me.options.crossOrigin,
  77969. headers: me.options.headers,
  77970. serverType: me.options.serverType,
  77971. eventListeners: {
  77972. scope: me,
  77973. processCompleted: callback,
  77974. processFailed: callback
  77975. }
  77976. });
  77977. addressMatchService.code(Util.urlPathAppend(me.url, 'geocoding'), params);
  77978. }
  77979. /**
  77980. * @function ol.supermap.AddressMatchService.prototype.decode
  77981. * @description 获取反向地址匹配结果。
  77982. * @param {SuperMap.GeoDecodingParameter} params - 反向匹配参数。
  77983. * @param {RequestCallback} callback 请求结果的回调函数。
  77984. */
  77985. decode(params, callback) {
  77986. var me = this;
  77987. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  77988. proxy: me.options.proxy,
  77989. withCredentials: me.options.withCredentials,
  77990. crossOrigin: me.options.crossOrigin,
  77991. headers: me.options.headers,
  77992. serverType: me.options.serverType,
  77993. eventListeners: {
  77994. scope: me,
  77995. processCompleted: callback,
  77996. processFailed: callback
  77997. }
  77998. });
  77999. addressMatchService.decode(Util.urlPathAppend(me.url, 'geodecoding'), params);
  78000. }
  78001. }
  78002. ;// CONCATENATED MODULE: ./src/openlayers/services/ChartService.js
  78003. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78004. * This program are made available under the terms of the Apache License, Version 2.0
  78005. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78006. /**
  78007. * @class ol.supermap.ChartService
  78008. * @category iServer Map Chart
  78009. * @classdesc 海图服务。
  78010. * @extends {ol.supermap.ServiceBase}
  78011. * @example
  78012. * new ol.supermap.ChartService(url)
  78013. * .queryChart(param,function(result){
  78014. * //doSomething
  78015. * })
  78016. * @param {string} url - 与客户端交互的海图服务地址。
  78017. * @param {Object} options - 参数。
  78018. * @param {string} [options.proxy] - 服务代理地址。
  78019. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78020. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78021. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78022. * @param {Object} [options.headers] - 请求头。
  78023. */
  78024. class ChartService extends ServiceBase {
  78025. constructor(url, options) {
  78026. super(url, options);
  78027. }
  78028. /**
  78029. * @function ol.supermap.ChartService.prototype.queryChart
  78030. * @description 查询海图服务。
  78031. * @param {SuperMap.ChartQueryParameters} params - 海图查询所需参数类。
  78032. * @param {RequestCallback} callback - 回调函数。
  78033. * @param {SuperMap.DataFormat} resultFormat - 返回的结果格式类型。
  78034. */
  78035. queryChart(params, callback, resultFormat) {
  78036. var me = this,
  78037. param = me._processParams(params),
  78038. format = me._processFormat(resultFormat);
  78039. var chartQueryService = new ChartQueryService(me.url, {
  78040. proxy: me.options.proxy,
  78041. withCredentials: me.options.withCredentials,
  78042. crossOrigin: me.options.crossOrigin,
  78043. headers: me.options.headers,
  78044. serverType: me.options.serverType,
  78045. eventListeners: {
  78046. scope: me,
  78047. processCompleted: callback,
  78048. processFailed: callback
  78049. },
  78050. format: format
  78051. });
  78052. chartQueryService.processAsync(param);
  78053. }
  78054. /**
  78055. * @function ol.supermap.ChartService.prototype.getChartFeatureInfo
  78056. * @description 获取海图物标信息服务。
  78057. * @param {RequestCallback} callback 回调函数。
  78058. */
  78059. getChartFeatureInfo(callback) {
  78060. var me = this;
  78061. var url = Util.urlPathAppend(me.url, 'chartFeatureInfoSpecs');
  78062. var chartFeatureInfoSpecsService = new ChartFeatureInfoSpecsService(url, {
  78063. proxy: me.options.proxy,
  78064. withCredentials: me.options.withCredentials,
  78065. crossOrigin: me.options.crossOrigin,
  78066. headers: me.options.headers,
  78067. serverType: me.options.serverType,
  78068. eventListeners: {
  78069. scope: me,
  78070. processCompleted: callback,
  78071. processFailed: callback
  78072. }
  78073. });
  78074. chartFeatureInfoSpecsService.processAsync();
  78075. }
  78076. _processParams(params) {
  78077. if (!params) {
  78078. return {};
  78079. }
  78080. params.returnContent = (params.returnContent == null) ? true : params.returnContent;
  78081. if (params.filter) {
  78082. params.chartQueryFilterParameters = core_Util_Util.isArray(params.filter) ? params.filter : [params.filter];
  78083. }
  78084. if (params.bounds) {
  78085. params.bounds = new Bounds(
  78086. params.bounds[0],
  78087. params.bounds[1],
  78088. params.bounds[2],
  78089. params.bounds[3]
  78090. );
  78091. }
  78092. }
  78093. _processFormat(resultFormat) {
  78094. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  78095. }
  78096. }
  78097. ;// CONCATENATED MODULE: ./src/openlayers/services/FieldService.js
  78098. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78099. * This program are made available under the terms of the Apache License, Version 2.0
  78100. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78101. /**
  78102. * @class ol.supermap.FieldService
  78103. * @category iServer Data Field
  78104. * @classdesc 字段服务类。
  78105. * @example
  78106. * new ol.supermap.FieldService(url).getFields(function(result){
  78107. * //doSomething
  78108. * });
  78109. * @param {string} url - 与客户端交互的服务地址。
  78110. * @param {Object} options - 参数。
  78111. * @param {string} [options.proxy] - 服务代理地址。
  78112. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78113. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78114. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78115. * @param {Object} [options.headers] - 请求头。
  78116. * @extends {ol.supermap.ServiceBase}
  78117. */
  78118. class FieldService extends ServiceBase {
  78119. constructor(url, options) {
  78120. super(url, options);
  78121. }
  78122. /**
  78123. * @function ol.supermap.FieldService.prototype.getFields
  78124. * @description 字段查询服务。
  78125. * @param {SuperMap.FieldParameters} params - 字段信息查询参数类。
  78126. * @param {RequestCallback} callback - 回调函数。
  78127. */
  78128. getFields(params, callback) {
  78129. var me = this;
  78130. var getFieldsService = new GetFieldsService(me.url, {
  78131. proxy: me.options.proxy,
  78132. withCredentials: me.options.withCredentials,
  78133. crossOrigin: me.options.crossOrigin,
  78134. headers: me.options.headers,
  78135. serverType: me.options.serverType,
  78136. eventListeners: {
  78137. scope: me,
  78138. processCompleted: callback,
  78139. processFailed: callback
  78140. },
  78141. datasource: params.datasource,
  78142. dataset: params.dataset
  78143. });
  78144. getFieldsService.processAsync();
  78145. }
  78146. /**
  78147. * @function ol.supermap.FieldService.prototype.getFieldStatisticsInfo
  78148. * @description 字段统计服务。
  78149. * @param {SuperMap.FieldStatisticsParameters} params - 查询所需参数类。
  78150. * @param {RequestCallback} callback - 回调函数。
  78151. */
  78152. getFieldStatisticsInfo(params, callback) {
  78153. var me = this,
  78154. fieldName = params.fieldName,
  78155. modes = params.statisticMode;
  78156. if (modes && !core_Util_Util.isArray(modes)) {
  78157. modes = [modes];
  78158. }
  78159. me.currentStatisticResult = {fieldName: fieldName};
  78160. me._statisticsCallback = callback;
  78161. //针对每种统计方式分别进行请求
  78162. modes.forEach(mode => {
  78163. me.currentStatisticResult[mode] = null;
  78164. me._fieldStatisticRequest(params.datasource, params.dataset, fieldName, mode);
  78165. })
  78166. }
  78167. _fieldStatisticRequest(datasource, dataset, fieldName, statisticMode) {
  78168. var me = this;
  78169. var statisticService = new FieldStatisticService(me.url, {
  78170. eventListeners: {
  78171. scope: me,
  78172. processCompleted: me._processCompleted,
  78173. processFailed: me._statisticsCallback
  78174. },
  78175. crossOrigin: me.options.crossOrigin,
  78176. headers: me.options.headers,
  78177. datasource: datasource,
  78178. dataset: dataset,
  78179. field: fieldName,
  78180. statisticMode: statisticMode
  78181. });
  78182. statisticService.processAsync();
  78183. }
  78184. _processCompleted(fieldStatisticResult) {
  78185. var me = this;
  78186. var getAll = true,
  78187. result = fieldStatisticResult.result;
  78188. if (this.currentStatisticResult) {
  78189. if (null == me.currentStatisticResult[result.mode]) {
  78190. this.currentStatisticResult[result.mode] = result.result;
  78191. }
  78192. }
  78193. for (var mode in me.currentStatisticResult) {
  78194. if (null == me.currentStatisticResult[mode]) {
  78195. getAll = false;
  78196. break;
  78197. }
  78198. }
  78199. if (getAll) {
  78200. me._statisticsCallback({result: me.currentStatisticResult});
  78201. }
  78202. }
  78203. }
  78204. ;// CONCATENATED MODULE: ./src/openlayers/services/GridCellInfosService.js
  78205. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78206. * This program are made available under the terms of the Apache License, Version 2.0
  78207. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78208. /**
  78209. /**
  78210. * @class ol.supermap.GridCellInfosService
  78211. * @category iServer Data Grid
  78212. * @classdesc 数据栅格查询服务。
  78213. * @extends {ol.supermap.ServiceBase}
  78214. * @example
  78215. * new ol.supermap.GridCellInfosService(url)
  78216. * .getGridCellInfos(param,function(result){
  78217. * //doSomething
  78218. * })
  78219. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  78220. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  78221. * @param {Object} options - 参数。
  78222. * @param {string} [options.proxy] - 服务代理地址。
  78223. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78224. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78225. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78226. * @param {Object} [options.headers] - 请求头。
  78227. */
  78228. class GridCellInfosService extends ServiceBase {
  78229. constructor(url, options) {
  78230. super(url, options);
  78231. }
  78232. /**
  78233. * @function ol.supermap.GridCellInfosService.prototype.getGridCellInfos
  78234. * @param {SuperMap.GetGridCellInfosParameters} params - 查询所需参数类。
  78235. * @param {RequestCallback} callback - 回调函数。
  78236. */
  78237. getGridCellInfos(params, callback) {
  78238. if (!params) {
  78239. return null;
  78240. }
  78241. var me = this;
  78242. var gridCellQueryService = new GetGridCellInfosService(me.url, {
  78243. proxy: me.options.proxy,
  78244. withCredentials: me.options.withCredentials,
  78245. crossOrigin: me.options.crossOrigin,
  78246. headers: me.options.headers,
  78247. serverType: me.options.serverType,
  78248. eventListeners: {
  78249. scope: me,
  78250. processCompleted: callback,
  78251. processFailed: callback
  78252. }
  78253. });
  78254. gridCellQueryService.processAsync(params);
  78255. }
  78256. }
  78257. ;// CONCATENATED MODULE: ./src/openlayers/services/GeoprocessingService.js
  78258. /**
  78259. * @class ol.supermap.GeoprocessingService
  78260. * @classdesc 地理处理服务接口类。
  78261. * @version 10.1.0
  78262. * @category iServer GeoprocessingService
  78263. * @extends {ol.supermap.ServiceBase}
  78264. * @example
  78265. * //为了安全访问受保护的地理处理服务,必须通过传递iserver令牌(token),才能正确访问相关资源。
  78266. * SuperMap.SecurityManager.registerToken(serviceUrl, token);
  78267. * var geoprocessingService = new L.supermap.geoprocessingService("http://localhost:8090/iserver/services/geoprocessing/restjsr/gp/v2")
  78268. geoprocessingService.submitJob(identifier,params, environments, function(serverResult) {
  78269. console.log(serverResult.result);
  78270. var jobID = serverResult.result.jobID;
  78271. var options = {
  78272. interval: 5000,
  78273. statusCallback: function(state) {
  78274. console.log("Job Status: ", state);
  78275. }
  78276. };
  78277. geoprocessingService.waitForJobCompletion(jobID, identifier, options, function(serverResult) {
  78278. console.log(serverResult);
  78279. })
  78280. })
  78281. * @param {string} url - 服务地址。
  78282. * @param {Object} options - 参数。
  78283. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 iServer|iPortal|online。
  78284. */
  78285. class GeoprocessingService extends ServiceBase {
  78286. constructor(url, options) {
  78287. super(url, options);
  78288. this.headers = true;
  78289. this.crossOrigin = true;
  78290. this.withCredentials = true;
  78291. this.proxy = true;
  78292. }
  78293. /**
  78294. * @function ol.supermap.GeoprocessingService.prototype.getTools
  78295. * @description 获取地理处理工具列表。
  78296. * @param {RequestCallback} callback 请求结果的回调函数。
  78297. */
  78298. getTools(callback) {
  78299. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78300. proxy: this.options.proxy,
  78301. withCredentials: this.options.withCredentials,
  78302. crossOrigin: this.options.crossOrigin,
  78303. headers: this.options.headers,
  78304. serverType: this.options.serverType,
  78305. eventListeners: {
  78306. scope: this,
  78307. processCompleted: callback,
  78308. processFailed: callback
  78309. }
  78310. });
  78311. geoprocessingJobsService.getTools();
  78312. }
  78313. /**
  78314. * @function ol.supermap.GeoprocessingService.prototype.getTool
  78315. * @description 获取地理处理工具的ID、名称、描述、输入参数、环境参数和输出结果等相关参数。
  78316. * @param {string} identifier - 地理处理工具ID。
  78317. * @param {RequestCallback} callback 请求结果的回调函数。
  78318. */
  78319. getTool(identifier, callback) {
  78320. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78321. proxy: this.options.proxy,
  78322. withCredentials: this.options.withCredentials,
  78323. crossOrigin: this.options.crossOrigin,
  78324. headers: this.options.headers,
  78325. serverType: this.options.serverType,
  78326. eventListeners: {
  78327. scope: this,
  78328. processCompleted: callback,
  78329. processFailed: callback
  78330. }
  78331. });
  78332. geoprocessingJobsService.getTool(identifier);
  78333. }
  78334. /**
  78335. * @function ol.supermap.GeoprocessingService.prototype.execute
  78336. * @description 同步执行地理处理工具。
  78337. * @param {string} identifier - 地理处理工具ID。
  78338. * @param {Object} parameter - 地理处理工具的输入参数。
  78339. * @param {Object} environment - 地理处理工具的环境参数。
  78340. * @param {RequestCallback} callback 回调函数。
  78341. */
  78342. execute(identifier, parameter, environment, callback) {
  78343. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78344. proxy: this.options.proxy,
  78345. withCredentials: this.options.withCredentials,
  78346. crossOrigin: this.options.crossOrigin,
  78347. headers: this.options.headers,
  78348. serverType: this.options.serverType,
  78349. eventListeners: {
  78350. scope: this,
  78351. processCompleted: callback,
  78352. processFailed: callback
  78353. }
  78354. });
  78355. geoprocessingJobsService.execute(identifier, parameter, environment);
  78356. }
  78357. /**
  78358. * @function ol.supermap.GeoprocessingService.prototype.submitJob
  78359. * @description 异步执行地理处理工具。
  78360. * @param {string} identifier - 地理处理工具ID。
  78361. * @param {Object} parameter - 地理处理工具的输入参数。
  78362. * @param {Object} environment - 地理处理工具的环境参数。
  78363. * @param {RequestCallback} callback 回调函数。
  78364. */
  78365. submitJob(identifier, parameter, environment, callback) {
  78366. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78367. proxy: this.options.proxy,
  78368. withCredentials: this.options.withCredentials,
  78369. crossOrigin: this.options.crossOrigin,
  78370. headers: this.options.headers,
  78371. serverType: this.options.serverType,
  78372. eventListeners: {
  78373. scope: this,
  78374. processCompleted: callback,
  78375. processFailed: callback
  78376. }
  78377. });
  78378. geoprocessingJobsService.submitJob(identifier, parameter, environment);
  78379. }
  78380. /**
  78381. * @function ol.supermap.GeoprocessingService.prototype.waitForJobCompletion
  78382. * @description 获取地理处理异步执行状态信息。
  78383. * @param {string} jobId - 地理处理任务ID。
  78384. * @param {string} identifier - 地理处理工具ID。
  78385. * @param {Object} options - 状态信息参数。
  78386. * @param {number} options.interval - 定时器时间间隔。
  78387. * @param {Callback} options.statusCallback - 任务状态的回调函数。
  78388. * @param {RequestCallback} callback 回调函数。
  78389. */
  78390. waitForJobCompletion(jobId, identifier, options, callback) {
  78391. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78392. proxy: this.options.proxy,
  78393. withCredentials: this.options.withCredentials,
  78394. crossOrigin: this.options.crossOrigin,
  78395. headers: this.options.headers,
  78396. serverType: this.options.serverType,
  78397. eventListeners: {
  78398. scope: this,
  78399. processCompleted: callback,
  78400. processFailed: callback
  78401. }
  78402. });
  78403. geoprocessingJobsService.waitForJobCompletion(jobId, identifier, options);
  78404. }
  78405. /**
  78406. * @function ol.supermap.GeoprocessingService.prototype.getJobInfo
  78407. * @description 获取地理处理任务的执行信息。
  78408. * @param {string} identifier - 地理处理工具ID。
  78409. * @param {string} jobId - 地理处理任务ID。
  78410. * @param {RequestCallback} callback 回调函数。
  78411. */
  78412. getJobInfo(identifier, jobId, callback) {
  78413. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78414. proxy: this.options.proxy,
  78415. withCredentials: this.options.withCredentials,
  78416. crossOrigin: this.options.crossOrigin,
  78417. headers: this.options.headers,
  78418. serverType: this.options.serverType,
  78419. eventListeners: {
  78420. scope: this,
  78421. processCompleted: callback,
  78422. processFailed: callback
  78423. }
  78424. });
  78425. geoprocessingJobsService.getJobInfo(identifier, jobId);
  78426. }
  78427. /**
  78428. * @function ol.supermap.GeoprocessingService.prototype.cancelJob
  78429. * @description 取消地理处理任务的异步执行。
  78430. * @param {string} identifier - 地理处理工具ID。
  78431. * @param {string} jobId - 地理处理任务ID。
  78432. * @param {RequestCallback} callback 回调函数。
  78433. */
  78434. cancelJob(identifier, jobId, callback) {
  78435. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78436. proxy: this.options.proxy,
  78437. withCredentials: this.options.withCredentials,
  78438. crossOrigin: this.options.crossOrigin,
  78439. headers: this.options.headers,
  78440. serverType: this.options.serverType,
  78441. eventListeners: {
  78442. scope: this,
  78443. processCompleted: callback,
  78444. processFailed: callback
  78445. }
  78446. });
  78447. geoprocessingJobsService.cancelJob(identifier, jobId);
  78448. }
  78449. /**
  78450. * @function ol.supermap.GeoprocessingService.prototype.getJobs
  78451. * @description 获取地理处理服务任务列表。
  78452. * @param {string} identifier - 地理处理工具ID。(可选,传参代表identifier算子的任务列表,不传参代表所有任务的列表)
  78453. * @param {RequestCallback} callback 回调函数。
  78454. */
  78455. getJobs(identifier, callback) {
  78456. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78457. proxy: this.options.proxy,
  78458. withCredentials: this.options.withCredentials,
  78459. crossOrigin: this.options.crossOrigin,
  78460. headers: this.options.headers,
  78461. serverType: this.options.serverType,
  78462. eventListeners: {
  78463. scope: this,
  78464. processCompleted: callback,
  78465. processFailed: callback
  78466. }
  78467. });
  78468. geoprocessingJobsService.getJobs(identifier);
  78469. }
  78470. /**
  78471. * @function ol.supermap.GeoprocessingService.prototype.getResults
  78472. * @description 地理处理工具异步执行的结果,支持结果过滤。
  78473. * @param {string} identifier - 地理处理工具ID。
  78474. * @param {string} jobId - 地理处理任务ID。
  78475. * @param {string} filter - 输出异步结果的id。(可选,传入filter参数时对该地理处理工具执行的结果进行过滤获取,不填参时显示所有的执行结果)
  78476. * @param {RequestCallback} callback 请求结果的回调函数。
  78477. */
  78478. getResults(identifier, jobId, filter, callback) {
  78479. const geoprocessingJobsService = new GeoprocessingService_GeoprocessingService(this.url, {
  78480. proxy: this.options.proxy,
  78481. withCredentials: this.options.withCredentials,
  78482. crossOrigin: this.options.crossOrigin,
  78483. headers: this.options.headers,
  78484. serverType: this.options.serverType,
  78485. eventListeners: {
  78486. scope: this,
  78487. processCompleted: callback,
  78488. processFailed: callback
  78489. }
  78490. });
  78491. geoprocessingJobsService.getResults(identifier, jobId, filter);
  78492. }
  78493. }
  78494. ;// CONCATENATED MODULE: ./src/openlayers/services/LayerInfoService.js
  78495. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78496. * This program are made available under the terms of the Apache License, Version 2.0
  78497. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78498. /**
  78499. * @class ol.supermap.LayerInfoService
  78500. * @category iServer Map Layer
  78501. * @classdesc 图层信息服务类。
  78502. * @extends {ol.supermap.ServiceBase}
  78503. * @example
  78504. * new ol.supermap.LayerInfoService(url).getLayersInfo(function(result){
  78505. * //doSomething
  78506. * })
  78507. * @param {string} url - 与客户端交互的地图服务地址。请求地图服务,URL 应为:
  78508. * http://{服务器地址}:{服务端口号}/iserver/services/{地图服务名}/rest/maps/{地图名}/tempLayersSet/{tempLayerID}/Rivers@World@@World"。
  78509. * @param {Object} options - 参数。
  78510. * @param {string} [options.proxy] - 服务代理地址。
  78511. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78512. * @param {boolean} [options.withCredentials=false] - 请求是否携带cookie。
  78513. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78514. * @param {Object} [options.headers] - 请求头。
  78515. */
  78516. class LayerInfoService extends ServiceBase {
  78517. constructor(url, options) {
  78518. super(url, options);
  78519. }
  78520. /**
  78521. * @function ol.supermap.LayerInfoService.prototype.getLayersInfo
  78522. * @description 获取图层信息服务。
  78523. * @param {RequestCallback} callback - 回调函数。
  78524. */
  78525. getLayersInfo(callback) {
  78526. var me = this;
  78527. var getLayersInfoService = new GetLayersInfoService(me.url, {
  78528. proxy: me.options.proxy,
  78529. withCredentials: me.options.withCredentials,
  78530. crossOrigin: me.options.crossOrigin,
  78531. headers: me.options.headers,
  78532. serverType: me.options.serverType,
  78533. eventListeners: {
  78534. processCompleted: callback,
  78535. processFailed: callback
  78536. }
  78537. });
  78538. getLayersInfoService.processAsync();
  78539. }
  78540. /**
  78541. * @function ol.supermap.LayerInfoService.prototype.setLayerInfo
  78542. * @description 设置图层信息服务。可以实现临时图层中子图层的修改。
  78543. * @param {SuperMap.SetLayerInfoParameters} params - 设置图层信息参数类。
  78544. * @param {RequestCallback} callback - 回调函数。
  78545. */
  78546. setLayerInfo(params, callback) {
  78547. if (!params) {
  78548. return;
  78549. }
  78550. var me = this,
  78551. resourceID = params.resourceID,
  78552. tempLayerName = params.tempLayerName,
  78553. layerInfoParams = params.layerInfo;
  78554. if (!resourceID || !tempLayerName) {
  78555. return;
  78556. }
  78557. var url = Util.urlPathAppend(me.url, "tempLayersSet/" + resourceID + "/" + tempLayerName);
  78558. var setLayerInfoService = new SetLayerInfoService(url, {
  78559. proxy: me.options.proxy,
  78560. withCredentials: me.options.withCredentials,
  78561. crossOrigin: me.options.crossOrigin,
  78562. headers: me.options.headers,
  78563. serverType: me.options.serverType,
  78564. eventListeners: {
  78565. processCompleted: callback,
  78566. processFailed: callback
  78567. }
  78568. });
  78569. setLayerInfoService.processAsync(layerInfoParams);
  78570. }
  78571. /**
  78572. * @function ol.supermap.LayerInfoService.prototype.setLayersInfo
  78573. * @description 设置图层信息服务。可以实现创建新的临时图层和对现有临时图层的修改。
  78574. * @param {SuperMap.SetLayersInfoParameters} params - 设置图层信息参数类,包括临时图层。
  78575. * @param {RequestCallback} callback - 回调函数。
  78576. */
  78577. setLayersInfo(params, callback) {
  78578. if (!params) {
  78579. return;
  78580. }
  78581. var me = this,
  78582. resourceID = params.resourceID,
  78583. isTempLayers = params.isTempLayers ? params.isTempLayers : false,
  78584. layersInfo = params.layersInfo;
  78585. if ((isTempLayers && !resourceID) || !layersInfo) {
  78586. return;
  78587. }
  78588. var setLayersInfoService = new SetLayersInfoService(me.url, {
  78589. proxy: me.options.proxy,
  78590. withCredentials: me.options.withCredentials,
  78591. crossOrigin: me.options.crossOrigin,
  78592. headers: me.options.headers,
  78593. serverType: me.options.serverType,
  78594. eventListeners: {
  78595. processCompleted: callback,
  78596. processFailed: callback
  78597. },
  78598. resourceID: resourceID,
  78599. isTempLayers: isTempLayers
  78600. });
  78601. setLayersInfoService.processAsync(layersInfo);
  78602. }
  78603. /**
  78604. * @function ol.supermap.LayerInfoService.prototype.setLayerStatus
  78605. * @description 子图层显示控制服务。负责将子图层显示控制参数传递到服务端,并获取服务端返回的图层显示状态。
  78606. * @param {SuperMap.SetLayerStatusParameters} params - 子图层显示控制参数类。
  78607. * @param {RequestCallback} callback - 回调函数。
  78608. */
  78609. setLayerStatus(params, callback) {
  78610. if (!params) {
  78611. return;
  78612. }
  78613. var me = this;
  78614. var setLayerStatusService = new SetLayerStatusService(me.url, {
  78615. proxy: me.options.proxy,
  78616. withCredentials: me.options.withCredentials,
  78617. crossOrigin: me.options.crossOrigin,
  78618. headers: me.options.headers,
  78619. serverType: me.options.serverType,
  78620. eventListeners: {
  78621. processCompleted: callback,
  78622. processFailed: callback
  78623. }
  78624. });
  78625. setLayerStatusService.processAsync(params);
  78626. }
  78627. }
  78628. ;// CONCATENATED MODULE: ./src/openlayers/services/MeasureService.js
  78629. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78630. * This program are made available under the terms of the Apache License, Version 2.0
  78631. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78632. /**
  78633. * @class ol.supermap.MeasureService
  78634. * @category iServer Map Measure
  78635. * @classdesc 测量服务。
  78636. * @extends ol.supermap.ServiceBase
  78637. * @param {string} url - 服务访问的地址。如:http://localhost:8090/iserver/services/map-world/rest/maps/World+Map 。
  78638. * @param {Object} options - 交互服务时所需可选参数。
  78639. * @param {string} [options.proxy] - 服务代理地址。
  78640. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78641. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78642. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78643. * @param {Object} [options.headers] - 请求头。
  78644. */
  78645. class MeasureService extends ServiceBase {
  78646. constructor(url, options) {
  78647. super(url, options);
  78648. }
  78649. /**
  78650. * @function ol.supermap.MeasureService.prototype.measureDistance
  78651. * @description 测距。
  78652. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  78653. * @param {RequestCallback} callback - 回调函数。
  78654. */
  78655. measureDistance(params, callback) {
  78656. this.measure(params, 'DISTANCE', callback);
  78657. }
  78658. /**
  78659. * @function ol.supermap.MeasureService.prototype.measureArea
  78660. * @description 测面积。
  78661. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  78662. * @param {RequestCallback} callback - 回调函数。
  78663. */
  78664. measureArea(params, callback) {
  78665. this.measure(params, 'AREA', callback);
  78666. }
  78667. /**
  78668. * @function ol.supermap.MeasureService.prototype.measure
  78669. * @description 测量。
  78670. * @param {SuperMap.MeasureParameters} params - 测量相关参数类。
  78671. * @param {string} type - 类型。
  78672. * @param {RequestCallback} callback - 回调函数。
  78673. * @returns {ol.supermap.MeasureService} 测量服务。
  78674. */
  78675. measure(params, type, callback) {
  78676. var me = this;
  78677. var measureService = new MeasureService_MeasureService(me.url, {
  78678. proxy: me.options.proxy,
  78679. withCredentials: me.options.withCredentials,
  78680. crossOrigin: me.options.crossOrigin,
  78681. headers: me.options.headers,
  78682. serverType: me.options.serverType,
  78683. measureMode: type,
  78684. eventListeners: {
  78685. scope: me,
  78686. processCompleted: callback,
  78687. processFailed: callback
  78688. }
  78689. });
  78690. measureService.processAsync(me._processParam(params));
  78691. }
  78692. _processParam(params) {
  78693. if (params && params.geometry) {
  78694. params.geometry = core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(params.geometry)));
  78695. }
  78696. return params;
  78697. }
  78698. }
  78699. ;// CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalyst3DService.js
  78700. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78701. * This program are made available under the terms of the Apache License, Version 2.0
  78702. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78703. /**
  78704. * @class ol.supermap.NetworkAnalyst3DService
  78705. * @category iServer FacilityAnalyst3D
  78706. * @classdesc 3D 网络分析服务类。
  78707. * @extends {ol.supermap.ServiceBase}
  78708. * @example
  78709. * new ol.supermap.NetworkAnalyst3DService(url)
  78710. * .sinksFacilityAnalyst(params,function(result){
  78711. * //doSomething
  78712. * })
  78713. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  78714. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};
  78715. * 例如:"http://localhost:8090/iserver/services/components-rest/rest/networkanalyst/RoadNet@Changchun"。
  78716. * @param {Object} options - 参数。
  78717. * @param {string} [options.proxy] - 服务代理地址。
  78718. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78719. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78720. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78721. * @param {Object} [options.headers] - 请求头。
  78722. */
  78723. class NetworkAnalyst3DService extends ServiceBase {
  78724. constructor(url, options) {
  78725. super(url, options);
  78726. }
  78727. /**
  78728. * @function ol.supermap.NetworkAnalyst3DService.prototype.sinksFacilityAnalyst
  78729. * @description 汇查找服务
  78730. * @param {SuperMap.FacilityAnalystSinks3DParameters} params- 最近设施分析参数类(汇查找资源)。
  78731. * @param {RequestCallback} callback - 回调函数。
  78732. * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  78733. */
  78734. sinksFacilityAnalyst(params, callback) {
  78735. var me = this;
  78736. var facilityAnalystSinks3DService = new FacilityAnalystSinks3DService(me.url, {
  78737. proxy: me.options.proxy,
  78738. withCredentials: me.options.withCredentials,
  78739. crossOrigin: me.options.crossOrigin,
  78740. headers: me.options.headers,
  78741. serverType: me.options.serverType,
  78742. eventListeners: {
  78743. scope: me,
  78744. processCompleted: callback,
  78745. processFailed: callback
  78746. }
  78747. });
  78748. facilityAnalystSinks3DService.processAsync(params);
  78749. }
  78750. /**
  78751. * @function ol.supermap.NetworkAnalyst3DService.prototype.sourcesFacilityAnalyst
  78752. * @description 源查找服务。
  78753. * @param {SuperMap.FacilityAnalystSources3DParameters} params - 最近设施分析参数类(源查找服务)。
  78754. * @param {RequestCallback} callback - 回调函数。
  78755. * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  78756. */
  78757. sourcesFacilityAnalyst(params, callback) {
  78758. var me = this;
  78759. var facilityAnalystSources3DService = new FacilityAnalystSources3DService(me.url, {
  78760. proxy: me.options.proxy,
  78761. withCredentials: me.options.withCredentials,
  78762. crossOrigin: me.options.crossOrigin,
  78763. headers: me.options.headers,
  78764. serverType: me.options.serverType,
  78765. eventListeners: {
  78766. scope: me,
  78767. processCompleted: callback,
  78768. processFailed: callback
  78769. }
  78770. });
  78771. facilityAnalystSources3DService.processAsync(params);
  78772. }
  78773. /**
  78774. * @function ol.supermap.NetworkAnalyst3DService.prototype.traceUpFacilityAnalyst
  78775. * @description 上游追踪资源服务。
  78776. * @param {SuperMap.FacilityAnalystTraceup3DParameters} params - 上游追踪资源参数类。
  78777. * @param {RequestCallback} callback - 回调函数。
  78778. * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  78779. */
  78780. traceUpFacilityAnalyst(params, callback) {
  78781. var me = this;
  78782. var facilityAnalystTraceup3DService = new FacilityAnalystTraceup3DService(me.url, {
  78783. proxy: me.options.proxy,
  78784. withCredentials: me.options.withCredentials,
  78785. crossOrigin: me.options.crossOrigin,
  78786. headers: me.options.headers,
  78787. serverType: me.options.serverType,
  78788. eventListeners: {
  78789. scope: me,
  78790. processCompleted: callback,
  78791. processFailed: callback
  78792. }
  78793. });
  78794. facilityAnalystTraceup3DService.processAsync(params);
  78795. }
  78796. /**
  78797. * @function ol.supermap.NetworkAnalyst3DService.prototype.traceDownFacilityAnalyst
  78798. * @description 下游追踪资源服务。
  78799. * @param {SuperMap.FacilityAnalystTracedown3DParameters} params - 下游追踪资源服务参数类。
  78800. * @param {RequestCallback} callback - 回调函数。
  78801. * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  78802. */
  78803. traceDownFacilityAnalyst(params, callback) {
  78804. var me = this;
  78805. var facilityAnalystTracedown3DService = new FacilityAnalystTracedown3DService(me.url, {
  78806. proxy: me.options.proxy,
  78807. withCredentials: me.options.withCredentials,
  78808. crossOrigin: me.options.crossOrigin,
  78809. headers: me.options.headers,
  78810. serverType: me.options.serverType,
  78811. eventListeners: {
  78812. scope: me,
  78813. processCompleted: callback,
  78814. processFailed: callback
  78815. }
  78816. });
  78817. facilityAnalystTracedown3DService.processAsync(params);
  78818. }
  78819. /**
  78820. * @function ol.supermap.NetworkAnalyst3DService.prototype.upstreamFacilityAnalyst
  78821. * @description 上游关键设施查找服务。
  78822. * @param {SuperMap.FacilityAnalystUpstream3DParameters} params - 上游关键设施查找服务参数类。
  78823. * @param {RequestCallback} callback - 回调函数。
  78824. * @returns {ol.supermap.NetworkAnalyst3DService} 3D 网络分析服务。
  78825. */
  78826. upstreamFacilityAnalyst(params, callback) {
  78827. var me = this;
  78828. var facilityAnalystUpstream3DService = new FacilityAnalystUpstream3DService(me.url, {
  78829. proxy: me.options.proxy,
  78830. withCredentials: me.options.withCredentials,
  78831. crossOrigin: me.options.crossOrigin,
  78832. headers: me.options.headers,
  78833. serverType: me.options.serverType,
  78834. eventListeners: {
  78835. scope: me,
  78836. processCompleted: callback,
  78837. processFailed: callback
  78838. }
  78839. });
  78840. facilityAnalystUpstream3DService.processAsync(params);
  78841. }
  78842. }
  78843. ;// CONCATENATED MODULE: ./src/openlayers/services/NetworkAnalystService.js
  78844. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  78845. * This program are made available under the terms of the Apache License, Version 2.0
  78846. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  78847. /**
  78848. * @class ol.supermap.NetworkAnalystService
  78849. * @category iServer NetworkAnalyst
  78850. * @classdesc 网络分析服务类。
  78851. * @extends {ol.supermap.ServiceBase}
  78852. * @example
  78853. * new ol.supermap.NetworkAnalystService(url)
  78854. * .findPath(params,function(result){
  78855. * //doSomething
  78856. * })
  78857. * @param {string} url - 网络分析服务地址。请求网络分析服务,URL 应为:
  78858. * http://{服务器地址}:{服务端口号}/iserver/services/{网络分析服务名}/rest/networkanalyst/{网络数据集@数据源};<br>
  78859. * 例如: "http://localhost:8090/iserver/services/test/rest/networkanalyst/WaterNet@FacilityNet"。
  78860. * @param {Object} options - 参数。
  78861. * @param {string} [options.proxy] - 服务代理地址。
  78862. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  78863. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  78864. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  78865. * @param {Object} [options.headers] - 请求头。
  78866. */
  78867. class NetworkAnalystService extends ServiceBase {
  78868. constructor(url, options) {
  78869. super(url, options);
  78870. }
  78871. /**
  78872. * @function ol.supermap.NetworkAnalystService.prototype.burstPipelineAnalyst
  78873. * @description 爆管分析服务:即将给定弧段或节点作为爆管点来进行分析,返回关键结点 ID 数组,普通结点 ID 数组及其上下游弧段 ID 数组。
  78874. * @param {SuperMap.BurstPipelineAnalystParameters} params - 爆管分析服务参数类。
  78875. * @param {RequestCallback} callback 回调函数。
  78876. */
  78877. burstPipelineAnalyst(params, callback) {
  78878. var me = this;
  78879. var burstPipelineAnalystService = new BurstPipelineAnalystService(me.url, {
  78880. proxy: me.options.proxy,
  78881. withCredentials: me.options.withCredentials,
  78882. crossOrigin: me.options.crossOrigin,
  78883. headers: me.options.headers,
  78884. serverType: me.options.serverType,
  78885. eventListeners: {
  78886. scope: me,
  78887. processCompleted: callback,
  78888. processFailed: callback
  78889. }
  78890. });
  78891. burstPipelineAnalystService.processAsync(me._processParams(params));
  78892. }
  78893. /**
  78894. * @function ol.supermap.NetworkAnalystService.prototype.computeWeightMatrix
  78895. * @description 耗费矩阵分析服务:根据交通网络分析参数中的耗费字段返回一个耗费矩阵。该矩阵是一个二维数组,用来存储任意两点间的资源消耗。
  78896. * @param {SuperMap.ComputeWeightMatrixParameters} params - 耗费矩阵分析服务参数类。
  78897. * @param {RequestCallback} callback - 回调函数。
  78898. */
  78899. computeWeightMatrix(params, callback) {
  78900. var me = this;
  78901. var computeWeightMatrixService = new ComputeWeightMatrixService(me.url, {
  78902. proxy: me.options.proxy,
  78903. withCredentials: me.options.withCredentials,
  78904. crossOrigin: me.options.crossOrigin,
  78905. headers: me.options.headers,
  78906. serverType: me.options.serverType,
  78907. eventListeners: {
  78908. scope: me,
  78909. processCompleted: callback,
  78910. processFailed: callback
  78911. }
  78912. });
  78913. computeWeightMatrixService.processAsync(me._processParams(params));
  78914. }
  78915. /**
  78916. * @function ol.supermap.NetworkAnalystService.prototype.findClosestFacilities
  78917. * @description 最近设施分析服务:指在网络上给定一个事件点和一组设施点,查找从事件点到设施点(或从设施点到事件点)以最小耗费能到达的最佳路径。
  78918. * @param {SuperMap.FindClosestFacilitiesParameters} params - 最近设施分析服务参数类。
  78919. * @param {RequestCallback} callback - 回调函数。
  78920. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  78921. */
  78922. findClosestFacilities(params, callback, resultFormat) {
  78923. var me = this;
  78924. var findClosestFacilitiesService = new FindClosestFacilitiesService(me.url, {
  78925. proxy: me.options.proxy,
  78926. withCredentials: me.options.withCredentials,
  78927. crossOrigin: me.options.crossOrigin,
  78928. headers: me.options.headers,
  78929. serverType: me.options.serverType,
  78930. eventListeners: {
  78931. scope: me,
  78932. processCompleted: callback,
  78933. processFailed: callback
  78934. },
  78935. format: me._processFormat(resultFormat)
  78936. });
  78937. findClosestFacilitiesService.processAsync(me._processParams(params));
  78938. }
  78939. /**
  78940. * @function ol.supermap.NetworkAnalystService.prototype.streamFacilityAnalyst
  78941. * @description 上游/下游 关键设施查找资源服务:查找给定弧段或节点的上游/下游中的关键设施结点,返回关键结点 ID 数组及其下游弧段 ID 数组。
  78942. * @param {SuperMap.FacilityAnalystStreamParameters} params - 上游/下游 关键设施查找资源服务参数类。
  78943. * @param {RequestCallback} callback - 回调函数。
  78944. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  78945. */
  78946. streamFacilityAnalyst(params, callback, resultFormat) {
  78947. var me = this;
  78948. var facilityAnalystStreamService = new FacilityAnalystStreamService(me.url, {
  78949. proxy: me.options.proxy,
  78950. withCredentials: me.options.withCredentials,
  78951. crossOrigin: me.options.crossOrigin,
  78952. headers: me.options.headers,
  78953. serverType: me.options.serverType,
  78954. eventListeners: {
  78955. scope: me,
  78956. processCompleted: callback,
  78957. processFailed: callback
  78958. },
  78959. format: me._processFormat(resultFormat)
  78960. });
  78961. facilityAnalystStreamService.processAsync(me._processParams(params));
  78962. }
  78963. /**
  78964. * @function ol.supermap.NetworkAnalystService.prototype.findLocation
  78965. * @description 选址分区分析服务:确定一个或多个待建设施的最佳或最优位置。
  78966. * @param {SuperMap.FindLocationParameters} params - 选址分区分析服务参数类。
  78967. * @param {RequestCallback} callback - 回调函数。
  78968. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  78969. */
  78970. findLocation(params, callback, resultFormat) {
  78971. var me = this;
  78972. var findLocationService = new FindLocationService(me.url, {
  78973. proxy: me.options.proxy,
  78974. withCredentials: me.options.withCredentials,
  78975. crossOrigin: me.options.crossOrigin,
  78976. headers: me.options.headers,
  78977. serverType: me.options.serverType,
  78978. eventListeners: {
  78979. scope: me,
  78980. processCompleted: callback,
  78981. processFailed: callback
  78982. },
  78983. format: me._processFormat(resultFormat)
  78984. });
  78985. findLocationService.processAsync(me._processParams(params));
  78986. }
  78987. /**
  78988. * @function ol.supermap.NetworkAnalystService.prototype.findPath
  78989. * @description 最佳路径分析服务:在网络数据集中指定一些节点,按照节点的选择顺序,顺序访问这些节点从而求解起止点之间阻抗最小的路经。
  78990. * @param {SuperMap.FindPathParameters} params - 最佳路径分析服务参数类。
  78991. * @param {RequestCallback} callback - 回调函数。
  78992. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  78993. */
  78994. findPath(params, callback, resultFormat) {
  78995. var me = this;
  78996. var findPathService = new FindPathService(me.url, {
  78997. proxy: me.options.proxy,
  78998. withCredentials: me.options.withCredentials,
  78999. crossOrigin: me.options.crossOrigin,
  79000. headers: me.options.headers,
  79001. serverType: me.options.serverType,
  79002. eventListeners: {
  79003. scope: me,
  79004. processCompleted: callback,
  79005. processFailed: callback
  79006. },
  79007. format: me._processFormat(resultFormat)
  79008. });
  79009. findPathService.processAsync(me._processParams(params));
  79010. }
  79011. /**
  79012. * @function ol.supermap.NetworkAnalystService.prototype.findTSPPaths
  79013. * @description 旅行商分析服务:路径分析的一种,它从起点开始(默认为用户指定的第一点)查找能够遍历所有途经点且花费最小的路径。
  79014. * @param {SuperMap.SuperMap.FindTSPPathsParameters} params - 旅行商分析服务参数类。
  79015. * @param {RequestCallback} callback - 回调函数。
  79016. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79017. */
  79018. findTSPPaths(params, callback, resultFormat) {
  79019. var me = this;
  79020. var findTSPPathsService = new FindTSPPathsService(me.url, {
  79021. proxy: me.options.proxy,
  79022. withCredentials: me.options.withCredentials,
  79023. crossOrigin: me.options.crossOrigin,
  79024. headers: me.options.headers,
  79025. serverType: me.options.serverType,
  79026. eventListeners: {
  79027. scope: me,
  79028. processCompleted: callback,
  79029. processFailed: callback
  79030. },
  79031. format: me._processFormat(resultFormat)
  79032. });
  79033. findTSPPathsService.processAsync(me._processParams(params));
  79034. }
  79035. /**
  79036. * @function ol.supermap.NetworkAnalystService.prototype.findMTSPPaths
  79037. * @description 多旅行商分析服务:也称为物流配送,是指在网络数据集中,给定 M 个配送中心点和 N 个配送目的地(M,N 为大于零的整数)。查找经济有效的配送路径,并给出相应的行走路线。
  79038. * @param {SuperMap.FindMTSPPathsParameters} params - 多旅行商分析服务参数类。
  79039. * @param {RequestCallback} callback - 回调函数。
  79040. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79041. */
  79042. findMTSPPaths(params, callback, resultFormat) {
  79043. var me = this;
  79044. var findMTSPPathsService = new FindMTSPPathsService(me.url, {
  79045. proxy: me.options.proxy,
  79046. withCredentials: me.options.withCredentials,
  79047. crossOrigin: me.options.crossOrigin,
  79048. headers: me.options.headers,
  79049. serverType: me.options.serverType,
  79050. eventListeners: {
  79051. scope: me,
  79052. processCompleted: callback,
  79053. processFailed: callback
  79054. },
  79055. format: me._processFormat(resultFormat)
  79056. });
  79057. findMTSPPathsService.processAsync(me._processParams(params));
  79058. }
  79059. /**
  79060. * @function ol.supermap.NetworkAnalystService.prototype.findServiceAreas
  79061. * @description 服务区分析服务:以指定服务站点为中心,在一定服务范围内查找网络上服务站点能够提供服务的区域范围。
  79062. * @param {SuperMap.FindServiceAreasParameters} params - 服务区分析服务参数类。
  79063. * @param {RequestCallback} callback - 回调函数。
  79064. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79065. */
  79066. findServiceAreas(params, callback, resultFormat) {
  79067. var me = this;
  79068. var findServiceAreasService = new FindServiceAreasService(me.url, {
  79069. proxy: me.options.proxy,
  79070. withCredentials: me.options.withCredentials,
  79071. crossOrigin: me.options.crossOrigin,
  79072. headers: me.options.headers,
  79073. serverType: me.options.serverType,
  79074. eventListeners: {
  79075. scope: me,
  79076. processCompleted: callback,
  79077. processFailed: callback
  79078. },
  79079. format: me._processFormat(resultFormat)
  79080. });
  79081. findServiceAreasService.processAsync(me._processParams(params));
  79082. }
  79083. /**
  79084. * @function ol.supermap.NetworkAnalystService.prototype.updateEdgeWeight
  79085. * @description 更新边的耗费权重服务。
  79086. * @param {SuperMap.UpdateEdgeWeightParameters} params - 更新边的耗费权重服务参数类。
  79087. * @param {RequestCallback} callback 回调函数。
  79088. */
  79089. updateEdgeWeight(params, callback) {
  79090. var me = this;
  79091. var updateEdgeWeightService = new UpdateEdgeWeightService(me.url, {
  79092. proxy: me.options.proxy,
  79093. withCredentials: me.options.withCredentials,
  79094. crossOrigin: me.options.crossOrigin,
  79095. headers: me.options.headers,
  79096. serverType: me.options.serverType,
  79097. eventListeners: {
  79098. scope: me,
  79099. processCompleted: callback,
  79100. processFailed: callback
  79101. }
  79102. });
  79103. updateEdgeWeightService.processAsync(params);
  79104. }
  79105. /**
  79106. * @function ol.supermap.NetworkAnalystService.prototype.updateTurnNodeWeight
  79107. * @description 转向耗费权重更新服务。
  79108. * @param {SuperMap.UpdateTurnNodeWeightParameters} params - 转向耗费权重更新服务参数类。
  79109. * @param {RequestCallback} callback - 回调函数。
  79110. */
  79111. updateTurnNodeWeight(params, callback) {
  79112. var me = this;
  79113. var updateTurnNodeWeightService = new UpdateTurnNodeWeightService(me.url, {
  79114. proxy: me.options.proxy,
  79115. withCredentials: me.options.withCredentials,
  79116. crossOrigin: me.options.crossOrigin,
  79117. headers: me.options.headers,
  79118. serverType: me.options.serverType,
  79119. eventListeners: {
  79120. scope: me,
  79121. processCompleted: callback,
  79122. processFailed: callback
  79123. }
  79124. });
  79125. updateTurnNodeWeightService.processAsync(params);
  79126. }
  79127. _processParams(params) {
  79128. if (!params) {
  79129. return {};
  79130. }
  79131. if (params.centers && core_Util_Util.isArray(params.centers)) {
  79132. params.centers.map(function (point, key) {
  79133. params.centers[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  79134. x: point.getCoordinates()[0],
  79135. y: point.getCoordinates()[1]
  79136. } : point;
  79137. return params.centers[key];
  79138. });
  79139. }
  79140. if (params.nodes && core_Util_Util.isArray(params.nodes)) {
  79141. params.nodes.map(function (point, key) {
  79142. params.nodes[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  79143. x: point.getCoordinates()[0],
  79144. y: point.getCoordinates()[1]
  79145. } : point;
  79146. return params.nodes[key];
  79147. });
  79148. }
  79149. if (params.event && params.event instanceof (external_ol_geom_Point_default())) {
  79150. params.event = {x: params.event.getCoordinates()[0], y: params.event.getCoordinates()[1]};
  79151. }
  79152. if (params.facilities && core_Util_Util.isArray(params.facilities)) {
  79153. params.facilities.map(function (point, key) {
  79154. params.facilities[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  79155. x: point.getCoordinates()[0],
  79156. y: point.getCoordinates()[1]
  79157. } : point;
  79158. return params.facilities[key];
  79159. });
  79160. }
  79161. if (params.parameter && params.parameter.barrierPoints) {
  79162. var barrierPoints = params.parameter.barrierPoints;
  79163. if (core_Util_Util.isArray(barrierPoints)) {
  79164. barrierPoints.map(function (point, key) {
  79165. params.parameter.barrierPoints[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  79166. x: point.getCoordinates()[0],
  79167. y: point.getCoordinates()[1]
  79168. } : point;
  79169. return params.parameter.barrierPoints[key];
  79170. });
  79171. } else {
  79172. params.parameter.barrierPoints = [(barrierPoints instanceof (external_ol_geom_Point_default())) ? {
  79173. x: barrierPoints.getCoordinates()[0],
  79174. y: barrierPoints.getCoordinates()[1]
  79175. } : barrierPoints];
  79176. }
  79177. }
  79178. return params;
  79179. }
  79180. _processFormat(resultFormat) {
  79181. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  79182. }
  79183. }
  79184. ;// CONCATENATED MODULE: ./src/openlayers/services/ProcessingService.js
  79185. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  79186. * This program are made available under the terms of the Apache License, Version 2.0
  79187. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  79188. /**
  79189. * @class ol.supermap.ProcessingService
  79190. * @category iServer ProcessingService
  79191. * @classdesc 分布式分析相关服务类。
  79192. * @extends {ol.supermap.ServiceBase}
  79193. * @example
  79194. * new ol.supermap.ProcessingService(url,options)
  79195. * .getKernelDensityJobs(function(result){
  79196. * //doSomething
  79197. * })
  79198. * @param {string} url - 分布式分析服务地址。
  79199. * @param {Object} options - 参数。
  79200. * @param {string} [options.proxy] - 服务代理地址。
  79201. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  79202. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  79203. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  79204. * @param {Object} [options.headers] - 请求头。
  79205. */
  79206. class ProcessingService extends ServiceBase {
  79207. constructor(url, options) {
  79208. super(url, options);
  79209. this.kernelDensityJobs = {};
  79210. this.summaryMeshJobs = {};
  79211. this.queryJobs = {};
  79212. this.summaryRegionJobs = {};
  79213. this.vectorClipJobs = {};
  79214. this.overlayGeoJobs = {};
  79215. this.buffersJobs = {};
  79216. this.topologyValidatorJobs = {};
  79217. this.summaryAttributesJobs = {};
  79218. }
  79219. /**
  79220. * @function ol.supermap.ProcessingService.prototype.getKernelDensityJobs
  79221. * @description 获取密度分析的列表。
  79222. * @param {RequestCallback} callback - 请求结果的回调函数。
  79223. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79224. */
  79225. getKernelDensityJobs(callback, resultFormat) {
  79226. var me = this,
  79227. format = me._processFormat(resultFormat);
  79228. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79229. proxy: me.options.proxy,
  79230. withCredentials: me.options.withCredentials,
  79231. crossOrigin: me.options.crossOrigin,
  79232. headers: me.options.headers,
  79233. serverType: me.options.serverType,
  79234. eventListeners: {
  79235. scope: me,
  79236. processCompleted: callback,
  79237. processFailed: callback
  79238. },
  79239. format: format
  79240. });
  79241. kernelDensityJobsService.getKernelDensityJobs();
  79242. }
  79243. /**
  79244. * @function ol.supermap.ProcessingService.prototype.getKernelDensityJob
  79245. * @description 获取某一个密度分析。
  79246. * @param {string} id - 空间分析的 ID。
  79247. * @param {RequestCallback} callback - 请求结果的回调函数。
  79248. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79249. */
  79250. getKernelDensityJob(id, callback, resultFormat) {
  79251. var me = this,
  79252. format = me._processFormat(resultFormat);
  79253. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79254. proxy: me.options.proxy,
  79255. withCredentials: me.options.withCredentials,
  79256. crossOrigin: me.options.crossOrigin,
  79257. headers: me.options.headers,
  79258. serverType: me.options.serverType,
  79259. eventListeners: {
  79260. scope: me,
  79261. processCompleted: callback,
  79262. processFailed: callback
  79263. },
  79264. format: format
  79265. });
  79266. kernelDensityJobsService.getKernelDensityJob(id);
  79267. }
  79268. /**
  79269. * @function ol.supermap.ProcessingService.prototype.addKernelDensityJob
  79270. * @description 新建一个密度分析。
  79271. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  79272. * @param {RequestCallback} callback - 请求结果的回调函数。
  79273. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79274. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79275. */
  79276. addKernelDensityJob(params, callback, seconds, resultFormat) {
  79277. var me = this,
  79278. param = me._processParams(params),
  79279. format = me._processFormat(resultFormat);
  79280. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  79281. proxy: me.proxy,
  79282. crossOrigin: me.options.crossOrigin,
  79283. headers: me.options.headers,
  79284. eventListeners: {
  79285. scope: me,
  79286. processCompleted: callback,
  79287. processFailed: callback,
  79288. processRunning: function (job) {
  79289. me.kernelDensityJobs[job.id] = job.state;
  79290. }
  79291. },
  79292. format: format
  79293. });
  79294. kernelDensityJobsService.addKernelDensityJob(param, seconds);
  79295. }
  79296. /**
  79297. * @function ol.supermap.ProcessingService.prototype.getKernelDensityJobState
  79298. * @description 获取密度分析的状态。
  79299. * @param {string} id - 密度分析的 ID。
  79300. * @returns {Object} 密度分析的状态
  79301. */
  79302. getKernelDensityJobState(id) {
  79303. return this.kernelDensityJobs[id];
  79304. }
  79305. /**
  79306. * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJobs
  79307. * @description 获取点聚合分析的列表。
  79308. * @param {RequestCallback} callback - 请求结果的回调函数。
  79309. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79310. */
  79311. getSummaryMeshJobs(callback, resultFormat) {
  79312. var me = this,
  79313. format = me._processFormat(resultFormat);
  79314. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  79315. proxy: me.options.proxy,
  79316. withCredentials: me.options.withCredentials,
  79317. crossOrigin: me.options.crossOrigin,
  79318. headers: me.options.headers,
  79319. serverType: me.options.serverType,
  79320. eventListeners: {
  79321. scope: me,
  79322. processCompleted: callback,
  79323. processFailed: callback
  79324. },
  79325. format: format
  79326. });
  79327. summaryMeshJobsService.getSummaryMeshJobs();
  79328. }
  79329. /**
  79330. * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJob
  79331. * @description 获取某一个点聚合分析。
  79332. * @param {string} id - 空间分析的 ID。
  79333. * @param {RequestCallback} callback - 请求结果的回调函数。
  79334. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79335. */
  79336. getSummaryMeshJob(id, callback, resultFormat) {
  79337. var me = this,
  79338. format = me._processFormat(resultFormat);
  79339. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  79340. proxy: me.options.proxy,
  79341. crossOrigin: me.options.crossOrigin,
  79342. headers: me.options.headers,
  79343. withCredentials: me.options.withCredentials,
  79344. serverType: me.options.serverType,
  79345. eventListeners: {
  79346. scope: me,
  79347. processCompleted: callback,
  79348. processFailed: callback
  79349. },
  79350. format: format
  79351. });
  79352. summaryMeshJobsService.getSummaryMeshJob(id);
  79353. }
  79354. /**
  79355. * @function ol.supermap.ProcessingService.prototype.addSummaryMeshJob
  79356. * @description 新建一个点聚合分析。
  79357. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  79358. * @param {RequestCallback} callback - 请求结果的回调函数。
  79359. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79360. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79361. */
  79362. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  79363. var me = this,
  79364. param = me._processParams(params),
  79365. format = me._processFormat(resultFormat);
  79366. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  79367. proxy: me.proxy,
  79368. crossOrigin: me.options.crossOrigin,
  79369. headers: me.options.headers,
  79370. eventListeners: {
  79371. scope: me,
  79372. processCompleted: callback,
  79373. processFailed: callback,
  79374. processRunning: function (job) {
  79375. me.summaryMeshJobs[job.id] = job.state;
  79376. }
  79377. },
  79378. format: format
  79379. });
  79380. summaryMeshJobsService.addSummaryMeshJob(param, seconds);
  79381. }
  79382. /**
  79383. * @function ol.supermap.ProcessingService.prototype.getSummaryMeshJobState
  79384. * @description 获取点聚合分析的状态。
  79385. * @param {string} id - 点聚合分析的 ID。
  79386. * @returns {Object} 点聚合分析的状态
  79387. */
  79388. getSummaryMeshJobState(id) {
  79389. return this.summaryMeshJobs[id];
  79390. }
  79391. /**
  79392. * @function ol.supermap.ProcessingService.prototype.getQueryJobs
  79393. * @description 获取单对象查询分析的列表。
  79394. * @param {RequestCallback} callback - 请求结果的回调函数。
  79395. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79396. */
  79397. getQueryJobs(callback, resultFormat) {
  79398. var me = this,
  79399. format = me._processFormat(resultFormat);
  79400. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  79401. proxy: me.options.proxy,
  79402. withCredentials: me.options.withCredentials,
  79403. crossOrigin: me.options.crossOrigin,
  79404. headers: me.options.headers,
  79405. serverType: me.options.serverType,
  79406. eventListeners: {
  79407. scope: me,
  79408. processCompleted: callback,
  79409. processFailed: callback
  79410. },
  79411. format: format
  79412. });
  79413. singleObjectQueryJobsService.getQueryJobs();
  79414. }
  79415. /**
  79416. * @function ol.supermap.ProcessingService.prototype.getQueryJob
  79417. * @description 获取某一个单对象查询分析。
  79418. * @param {string} id - 空间分析的 ID。
  79419. * @param {RequestCallback} callback - 请求结果的回调函数。
  79420. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79421. */
  79422. getQueryJob(id, callback, resultFormat) {
  79423. var me = this,
  79424. format = me._processFormat(resultFormat);
  79425. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  79426. proxy: me.options.proxy,
  79427. withCredentials: me.options.withCredentials,
  79428. crossOrigin: me.options.crossOrigin,
  79429. headers: me.options.headers,
  79430. serverType: me.options.serverType,
  79431. eventListeners: {
  79432. scope: me,
  79433. processCompleted: callback,
  79434. processFailed: callback
  79435. },
  79436. format: format
  79437. });
  79438. singleObjectQueryJobsService.getQueryJob(id);
  79439. }
  79440. /**
  79441. * @function ol.supermap.ProcessingService.prototype.addQueryJob
  79442. * @description 新建一个单对象查询分析。
  79443. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  79444. * @param {RequestCallback} callback - 请求结果的回调函数。
  79445. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79446. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79447. */
  79448. addQueryJob(params, callback, seconds, resultFormat) {
  79449. var me = this,
  79450. param = me._processParams(params),
  79451. format = me._processFormat(resultFormat);
  79452. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  79453. proxy: me.proxy,
  79454. crossOrigin: me.options.crossOrigin,
  79455. headers: me.options.headers,
  79456. eventListeners: {
  79457. scope: me,
  79458. processCompleted: callback,
  79459. processFailed: callback,
  79460. processRunning: function (job) {
  79461. me.queryJobs[job.id] = job.state;
  79462. }
  79463. },
  79464. format: format
  79465. });
  79466. singleObjectQueryJobsService.addQueryJob(param, seconds);
  79467. }
  79468. /**
  79469. * @function ol.supermap.ProcessingService.prototype.getQueryJobState
  79470. * @description 获取单对象查询分析的状态。
  79471. * @param {string} id - 单对象查询分析的 ID。
  79472. * @returns {Object} 单对象查询分析的状态
  79473. */
  79474. getQueryJobState(id) {
  79475. return this.queryJobs[id];
  79476. }
  79477. /**
  79478. * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJobs
  79479. * @description 获取区域汇总分析的列表。
  79480. * @param {RequestCallback} callback - 请求结果的回调函数。
  79481. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79482. */
  79483. getSummaryRegionJobs(callback, resultFormat) {
  79484. var me = this,
  79485. format = me._processFormat(resultFormat);
  79486. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  79487. proxy: me.options.proxy,
  79488. withCredentials: me.options.withCredentials,
  79489. crossOrigin: me.options.crossOrigin,
  79490. headers: me.options.headers,
  79491. serverType: me.options.serverType,
  79492. eventListeners: {
  79493. scope: me,
  79494. processCompleted: callback,
  79495. processFailed: callback
  79496. },
  79497. format: format
  79498. });
  79499. summaryRegionJobsService.getSummaryRegionJobs();
  79500. }
  79501. /**
  79502. * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJob
  79503. * @description 获取某一个区域汇总分析。
  79504. * @param {string} id - 区域汇总分析的 ID。
  79505. * @param {RequestCallback} callback - 请求结果的回调函数。
  79506. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79507. */
  79508. getSummaryRegionJob(id, callback, resultFormat) {
  79509. var me = this,
  79510. format = me._processFormat(resultFormat);
  79511. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  79512. proxy: me.options.proxy,
  79513. withCredentials: me.options.withCredentials,
  79514. crossOrigin: me.options.crossOrigin,
  79515. headers: me.options.headers,
  79516. serverType: me.options.serverType,
  79517. eventListeners: {
  79518. scope: me,
  79519. processCompleted: callback,
  79520. processFailed: callback
  79521. },
  79522. format: format
  79523. });
  79524. summaryRegionJobsService.getSummaryRegionJob(id);
  79525. }
  79526. /**
  79527. * @function ol.supermap.ProcessingService.prototype.addSummaryRegionJob
  79528. * @description 新建一个区域汇总分析。
  79529. * @param {SuperMap.SummaryRegionJobParameter} params - 区域汇总分析参数类。
  79530. * @param {RequestCallback} callback - 请求结果的回调函数。
  79531. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79532. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79533. */
  79534. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  79535. var me = this,
  79536. param = me._processParams(params),
  79537. format = me._processFormat(resultFormat);
  79538. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  79539. proxy: me.proxy,
  79540. crossOrigin: me.options.crossOrigin,
  79541. headers: me.options.headers,
  79542. eventListeners: {
  79543. scope: me,
  79544. processCompleted: callback,
  79545. processFailed: callback,
  79546. processRunning: function (job) {
  79547. me.summaryRegionJobs[job.id] = job.state;
  79548. }
  79549. },
  79550. format: format
  79551. });
  79552. summaryRegionJobsService.addSummaryRegionJob(param, seconds);
  79553. }
  79554. /**
  79555. * @function ol.supermap.ProcessingService.prototype.getSummaryRegionJobState
  79556. * @description 获取区域汇总分析的状态。
  79557. * @param {string} id - 生成区域汇总分析的 ID。
  79558. * @returns {Object} 区域汇总分析的状态。
  79559. */
  79560. getSummaryRegionJobState(id) {
  79561. return this.summaryRegionJobs[id];
  79562. }
  79563. /**
  79564. * @function ol.supermap.ProcessingService.prototype.getVectorClipJobs
  79565. * @description 获取矢量裁剪分析的列表。
  79566. * @param {RequestCallback} callback 请求结果的回调函数。
  79567. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79568. */
  79569. getVectorClipJobs(callback, resultFormat) {
  79570. var me = this,
  79571. format = me._processFormat(resultFormat);
  79572. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  79573. proxy: me.options.proxy,
  79574. withCredentials: me.options.withCredentials,
  79575. crossOrigin: me.options.crossOrigin,
  79576. headers: me.options.headers,
  79577. serverType: me.options.serverType,
  79578. eventListeners: {
  79579. scope: me,
  79580. processCompleted: callback,
  79581. processFailed: callback
  79582. },
  79583. format: format
  79584. });
  79585. vectorClipJobsService.getVectorClipJobs();
  79586. }
  79587. /**
  79588. * @function ol.supermap.ProcessingService.prototype.getVectorClipJob
  79589. * @description 获取某一个矢量裁剪分析。
  79590. * @param {string} id - 空间分析的 ID。
  79591. * @param {RequestCallback} callback 请求结果的回调函数。
  79592. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79593. */
  79594. getVectorClipJob(id, callback, resultFormat) {
  79595. var me = this,
  79596. format = me._processFormat(resultFormat);
  79597. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  79598. proxy: me.options.proxy,
  79599. withCredentials: me.options.withCredentials,
  79600. crossOrigin: me.options.crossOrigin,
  79601. headers: me.options.headers,
  79602. serverType: me.options.serverType,
  79603. eventListeners: {
  79604. scope: me,
  79605. processCompleted: callback,
  79606. processFailed: callback
  79607. },
  79608. format: format
  79609. });
  79610. vectorClipJobsService.getVectorClipJob(id);
  79611. }
  79612. /**
  79613. * @function ol.supermap.ProcessingService.prototype.addVectorClipJob
  79614. * @description 新建一个矢量裁剪分析。
  79615. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  79616. * @param {RequestCallback} callback 请求结果的回调函数。
  79617. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79618. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79619. */
  79620. addVectorClipJob(params, callback, seconds, resultFormat) {
  79621. var me = this,
  79622. param = me._processParams(params),
  79623. format = me._processFormat(resultFormat);
  79624. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  79625. proxy: me.options.proxy,
  79626. withCredentials: me.options.withCredentials,
  79627. crossOrigin: me.options.crossOrigin,
  79628. headers: me.options.headers,
  79629. serverType: me.options.serverType,
  79630. eventListeners: {
  79631. scope: me,
  79632. processCompleted: callback,
  79633. processFailed: callback,
  79634. processRunning: function (job) {
  79635. me.vectorClipJobs[job.id] = job.state;
  79636. }
  79637. },
  79638. format: format
  79639. });
  79640. vectorClipJobsService.addVectorClipJob(param, seconds);
  79641. }
  79642. /**
  79643. * @function ol.supermap.ProcessingService.prototype.getVectorClipJobState
  79644. * @description 获取矢量裁剪分析的状态。
  79645. * @param {number} id - 矢量裁剪分析的 ID。
  79646. * @returns {Object} 矢量裁剪分析的状态
  79647. */
  79648. getVectorClipJobState(id) {
  79649. return this.vectorClipJobs[id];
  79650. }
  79651. /**
  79652. * @function ol.supermap.processingService.prototype.getOverlayGeoJobs
  79653. * @description 获取叠加分析的列表。
  79654. * @param {RequestCallback} callback 请求结果的回调函数。
  79655. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79656. */
  79657. getOverlayGeoJobs(callback, resultFormat) {
  79658. var me = this,
  79659. format = me._processFormat(resultFormat);
  79660. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  79661. proxy: me.options.proxy,
  79662. withCredentials: me.options.withCredentials,
  79663. crossOrigin: me.options.crossOrigin,
  79664. headers: me.options.headers,
  79665. serverType: me.options.serverType,
  79666. eventListeners: {
  79667. scope: me,
  79668. processCompleted: callback,
  79669. processFailed: callback
  79670. },
  79671. format: format
  79672. });
  79673. overlayGeoJobsService.getOverlayGeoJobs();
  79674. }
  79675. /**
  79676. * @function ol.supermap.processingService.prototype.getOverlayGeoJob
  79677. * @description 获取某一个叠加分析。
  79678. * @param {string} id - 空间分析的 ID。
  79679. * @param {RequestCallback} callback 请求结果的回调函数。
  79680. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79681. */
  79682. getOverlayGeoJob(id, callback, resultFormat) {
  79683. var me = this,
  79684. format = me._processFormat(resultFormat);
  79685. var overlayGeoJobsService = new OverlayGeoJobsService(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: format
  79697. });
  79698. overlayGeoJobsService.getOverlayGeoJob(id);
  79699. }
  79700. /**
  79701. * @function ol.supermap.processingService.prototype.addOverlayGeoJob
  79702. * @description 新建一个叠加分析。
  79703. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  79704. * @param {RequestCallback} callback 请求结果的回调函数。
  79705. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79706. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79707. */
  79708. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  79709. var me = this,
  79710. param = me._processParams(params),
  79711. format = me._processFormat(resultFormat);
  79712. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  79713. proxy: me.options.proxy,
  79714. withCredentials: me.options.withCredentials,
  79715. serverType: me.options.serverType,
  79716. crossOrigin: me.options.crossOrigin,
  79717. headers: me.options.headers,
  79718. eventListeners: {
  79719. scope: me,
  79720. processCompleted: callback,
  79721. processFailed: callback,
  79722. processRunning: function (job) {
  79723. me.overlayGeoJobs[job.id] = job.state;
  79724. }
  79725. },
  79726. format: format
  79727. });
  79728. overlayGeoJobsService.addOverlayGeoJob(param, seconds);
  79729. }
  79730. /**
  79731. * @function ol.supermap.processingService.prototype.getoverlayGeoJobState
  79732. * @description 获取叠加分析的状态。
  79733. * @param {string} id - 叠加分析的 ID。
  79734. * @returns {Object} 叠加分析的状态
  79735. */
  79736. getoverlayGeoJobState(id) {
  79737. return this.overlayGeoJobs[id];
  79738. }
  79739. /**
  79740. * @function ol.supermap.processingService.prototype.getBuffersJobs
  79741. * @description 获取缓冲区分析的列表。
  79742. * @param {RequestCallback} callback 请求结果的回调函数。
  79743. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79744. */
  79745. getBuffersJobs(callback, resultFormat) {
  79746. var me = this,
  79747. format = me._processFormat(resultFormat);
  79748. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  79749. proxy: me.options.proxy,
  79750. withCredentials: me.options.withCredentials,
  79751. crossOrigin: me.options.crossOrigin,
  79752. headers: me.options.headers,
  79753. serverType: me.options.serverType,
  79754. eventListeners: {
  79755. scope: me,
  79756. processCompleted: callback,
  79757. processFailed: callback
  79758. },
  79759. format: format
  79760. });
  79761. buffersAnalystJobsService.getBuffersJobs();
  79762. }
  79763. /**
  79764. * @function ol.supermap.processingService.prototype.getBuffersJob
  79765. * @description 获取某一个缓冲区分析。
  79766. * @param {string} id - 空间分析的 ID。
  79767. * @param {RequestCallback} callback 请求结果的回调函数。
  79768. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79769. */
  79770. getBuffersJob(id, callback, resultFormat) {
  79771. var me = this,
  79772. format = me._processFormat(resultFormat);
  79773. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  79774. proxy: me.options.proxy,
  79775. withCredentials: me.options.withCredentials,
  79776. crossOrigin: me.options.crossOrigin,
  79777. headers: me.options.headers,
  79778. serverType: me.options.serverType,
  79779. eventListeners: {
  79780. scope: me,
  79781. processCompleted: callback,
  79782. processFailed: callback
  79783. },
  79784. format: format
  79785. });
  79786. buffersAnalystJobsService.getBuffersJob(id);
  79787. }
  79788. /**
  79789. * @function ol.supermap.processingService.prototype.addBuffersJob
  79790. * @description 新建一个缓冲区分析。
  79791. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  79792. * @param {RequestCallback} callback 请求结果的回调函数。
  79793. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79794. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79795. */
  79796. addBuffersJob(params, callback, seconds, resultFormat) {
  79797. var me = this,
  79798. param = me._processParams(params),
  79799. format = me._processFormat(resultFormat);
  79800. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  79801. proxy: me.options.proxy,
  79802. withCredentials: me.options.withCredentials,
  79803. crossOrigin: me.options.crossOrigin,
  79804. headers: me.options.headers,
  79805. serverType: me.options.serverType,
  79806. eventListeners: {
  79807. scope: me,
  79808. processCompleted: callback,
  79809. processFailed: callback,
  79810. processRunning: function (job) {
  79811. me.buffersJobs[job.id] = job.state;
  79812. }
  79813. },
  79814. format: format
  79815. });
  79816. buffersAnalystJobsService.addBuffersJob(param, seconds);
  79817. }
  79818. /**
  79819. * @function ol.supermap.processingService.prototype.getBuffersJobState
  79820. * @description 获取缓冲区分析的状态。
  79821. * @param {string} id - 缓冲区分析的 ID。
  79822. * @returns {Object} 缓冲区分析的状态。
  79823. */
  79824. getBuffersJobState(id) {
  79825. return this.buffersJobs[id];
  79826. }
  79827. /**
  79828. * @function ol.supermap.processingService.prototype.getTopologyValidatorJobs
  79829. * @description 获取拓扑检查分析的列表。
  79830. * @param {RequestCallback} callback 请求结果的回调函数。
  79831. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79832. */
  79833. getTopologyValidatorJobs(callback, resultFormat) {
  79834. var me = this,
  79835. format = me._processFormat(resultFormat);
  79836. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  79837. proxy: me.options.proxy,
  79838. withCredentials: me.options.withCredentials,
  79839. crossOrigin: me.options.crossOrigin,
  79840. headers: me.options.headers,
  79841. serverType: me.options.serverType,
  79842. eventListeners: {
  79843. scope: me,
  79844. processCompleted: callback,
  79845. processFailed: callback
  79846. },
  79847. format: format
  79848. });
  79849. topologyValidatorJobsService.getTopologyValidatorJobs();
  79850. }
  79851. /**
  79852. * @function ol.supermap.processingService.prototype.getTopologyValidatorJob
  79853. * @description 获取某一个拓扑检查分析。
  79854. * @param {string} id - 空间分析的 ID。
  79855. * @param {RequestCallback} callback - 请求结果的回调函数。
  79856. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79857. */
  79858. getTopologyValidatorJob(id, callback, resultFormat) {
  79859. var me = this,
  79860. format = me._processFormat(resultFormat);
  79861. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  79862. proxy: me.options.proxy,
  79863. withCredentials: me.options.withCredentials,
  79864. crossOrigin: me.options.crossOrigin,
  79865. headers: me.options.headers,
  79866. serverType: me.options.serverType,
  79867. eventListeners: {
  79868. scope: me,
  79869. processCompleted: callback,
  79870. processFailed: callback
  79871. },
  79872. format: format
  79873. });
  79874. topologyValidatorJobsService.getTopologyValidatorJob(id);
  79875. }
  79876. /**
  79877. * @function ol.supermap.processingService.prototype.addTopologyValidatorJob
  79878. * @description 新建一个拓扑检查分析。
  79879. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  79880. * @param {RequestCallback} callback - 请求结果的回调函数。
  79881. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79882. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79883. */
  79884. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  79885. var me = this,
  79886. param = me._processParams(params),
  79887. format = me._processFormat(resultFormat);
  79888. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  79889. proxy: me.options.proxy,
  79890. withCredentials: me.options.withCredentials,
  79891. crossOrigin: me.options.crossOrigin,
  79892. headers: me.options.headers,
  79893. serverType: me.options.serverType,
  79894. eventListeners: {
  79895. scope: me,
  79896. processCompleted: callback,
  79897. processFailed: callback,
  79898. processRunning: function (job) {
  79899. me.topologyValidatorJobs[job.id] = job.state;
  79900. }
  79901. },
  79902. format: format
  79903. });
  79904. topologyValidatorJobsService.addTopologyValidatorJob(param, seconds);
  79905. }
  79906. /**
  79907. * @function ol.supermap.processingService.prototype.getTopologyValidatorJobState
  79908. * @description 获取拓扑检查分析的状态。
  79909. * @param {string} id - 拓扑检查分析的 ID。
  79910. * @returns {Object} 拓扑检查分析的状态
  79911. */
  79912. getTopologyValidatorJobState(id) {
  79913. return this.topologyValidatorJobs[id];
  79914. }
  79915. /**
  79916. * @function ol.supermap.processingService.prototype.getSummaryAttributesJobs
  79917. * @description 获取拓扑检查属性汇总分析的列表。
  79918. * @param {RequestCallback} callback - 请求结果的回调函数。
  79919. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79920. */
  79921. getSummaryAttributesJobs(callback, resultFormat) {
  79922. var me = this,
  79923. format = me._processFormat(resultFormat);
  79924. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  79925. proxy: me.options.proxy,
  79926. withCredentials: me.options.withCredentials,
  79927. crossOrigin: me.options.crossOrigin,
  79928. headers: me.options.headers,
  79929. serverType: me.options.serverType,
  79930. eventListeners: {
  79931. scope: me,
  79932. processCompleted: callback,
  79933. processFailed: callback
  79934. },
  79935. format: format
  79936. });
  79937. summaryAttributesJobsService.getSummaryAttributesJobs();
  79938. }
  79939. /**
  79940. * @function ol.supermap.processingService.prototype.getSummaryAttributesJob
  79941. * @description 获取某一个属性汇总分析。
  79942. * @param {string} id - 空间分析的 ID。
  79943. * @param {RequestCallback} callback - 请求结果的回调函数。
  79944. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79945. */
  79946. getSummaryAttributesJob(id, callback, resultFormat) {
  79947. var me = this,
  79948. format = me._processFormat(resultFormat);
  79949. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  79950. proxy: me.options.proxy,
  79951. withCredentials: me.options.withCredentials,
  79952. crossOrigin: me.options.crossOrigin,
  79953. headers: me.options.headers,
  79954. serverType: me.options.serverType,
  79955. eventListeners: {
  79956. scope: me,
  79957. processCompleted: callback,
  79958. processFailed: callback
  79959. },
  79960. format: format
  79961. });
  79962. summaryAttributesJobsService.getSummaryAttributesJob(id);
  79963. }
  79964. /**
  79965. * @function ol.supermap.processingService.prototype.addSummaryAttributesJob
  79966. * @description 新建一个属性汇总分析。
  79967. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  79968. * @param {RequestCallback} callback - 请求结果的回调函数。
  79969. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  79970. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  79971. */
  79972. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  79973. var me = this,
  79974. param = me._processParams(params),
  79975. format = me._processFormat(resultFormat);
  79976. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  79977. proxy: me.options.proxy,
  79978. withCredentials: me.options.withCredentials,
  79979. crossOrigin: me.options.crossOrigin,
  79980. headers: me.options.headers,
  79981. serverType: me.options.serverType,
  79982. eventListeners: {
  79983. scope: me,
  79984. processCompleted: callback,
  79985. processFailed: callback,
  79986. processRunning: function (job) {
  79987. me.summaryAttributesJobs[job.id] = job.state;
  79988. }
  79989. },
  79990. format: format
  79991. });
  79992. summaryAttributesJobsService.addSummaryAttributesJob(param, seconds);
  79993. }
  79994. /**
  79995. * @function ol.supermap.processingService.prototype.getSummaryAttributesJobState
  79996. * @description 获取属性汇总分析的状态。
  79997. * @param {string} id - 属性汇总分析的 ID。
  79998. * @returns {Object} 属性汇总分析的状态。
  79999. */
  80000. getSummaryAttributesJobState(id) {
  80001. return this.summaryAttributesJobs[id];
  80002. }
  80003. _processFormat(resultFormat) {
  80004. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  80005. }
  80006. _processParams(params) {
  80007. if (!params) {
  80008. return {};
  80009. }
  80010. if (params.bounds) {
  80011. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  80012. }
  80013. if (params.query) {
  80014. params.query = core_Util_Util.toSuperMapBounds(params.query);
  80015. }
  80016. if (params.geometryQuery) {
  80017. params.geometryQuery = core_Util_Util.toProcessingParam(params.geometryQuery);
  80018. }
  80019. if (params.geometryClip) {
  80020. params.geometryClip = core_Util_Util.toProcessingParam(params.geometryClip);
  80021. }
  80022. return params;
  80023. }
  80024. }
  80025. ;// CONCATENATED MODULE: ./src/openlayers/services/SpatialAnalystService.js
  80026. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80027. * This program are made available under the terms of the Apache License, Version 2.0
  80028. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80029. /**
  80030. * @class ol.supermap.SpatialAnalystService
  80031. * @extends {ol.supermap.ServiceBase}
  80032. * @category iServer SpatialAnalyst
  80033. * @classdesc 空间分析服务类。提供:地区太阳辐射、缓冲区分析、点密度分析、动态分段分析、空间关系分析、插值分析、栅格代数运算、叠加分析、路由定位、路由测量计算、表面分析、地形曲率计算、泰森多边形分析。
  80034. * @example
  80035. * new ol.supermap.SpatialAnalystService(url)
  80036. * .bufferAnalysis(params,function(result){
  80037. * //doSomething
  80038. * })
  80039. * @param {string} url - 服务的访问地址。
  80040. * @param {Object} options - 参数。
  80041. * @param {string} [options.proxy] - 服务代理地址。
  80042. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  80043. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80044. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80045. * @param {Object} [options.headers] - 请求头。
  80046. */
  80047. class SpatialAnalystService extends ServiceBase {
  80048. constructor(url, options) {
  80049. super(url, options);
  80050. }
  80051. /**
  80052. * @function ol.supermap.SpatialAnalystService.prototype.getAreaSolarRadiationResult
  80053. * @description 地区太阳辐射。
  80054. * @param {SuperMap.AreaSolarRadiationParameters} params - 查询相关参数类。
  80055. * @param {RequestCallback} callback 回调函数。
  80056. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80057. */
  80058. getAreaSolarRadiationResult(params, callback, resultFormat) {
  80059. var me = this;
  80060. var areaSolarRadiationService = new AreaSolarRadiationService(me.url, {
  80061. proxy: me.options.proxy,
  80062. withCredentials: me.options.withCredentials,
  80063. crossOrigin: me.options.crossOrigin,
  80064. headers: me.options.headers,
  80065. serverType: me.options.serverType,
  80066. eventListeners: {
  80067. scope: me,
  80068. processCompleted: callback,
  80069. processFailed: callback
  80070. },
  80071. format: me._processFormat(resultFormat)
  80072. });
  80073. areaSolarRadiationService.processAsync(params);
  80074. }
  80075. /**
  80076. * @function ol.supermap.SpatialAnalystService.prototype.bufferAnalysis
  80077. * @description 缓冲区分析。
  80078. * @param {SuperMap.DatasetBufferAnalystParameters} params - 查询相关参数类。
  80079. * @param {RequestCallback} callback 回调函数。
  80080. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80081. */
  80082. bufferAnalysis(params, callback, resultFormat) {
  80083. var me = this;
  80084. var bufferAnalystService = new BufferAnalystService(me.url, {
  80085. proxy: me.options.proxy,
  80086. withCredentials: me.options.withCredentials,
  80087. crossOrigin: me.options.crossOrigin,
  80088. headers: me.options.headers,
  80089. serverType: me.options.serverType,
  80090. eventListeners: {
  80091. scope: me,
  80092. processCompleted: callback,
  80093. processFailed: callback
  80094. },
  80095. format: me._processFormat(resultFormat)
  80096. });
  80097. bufferAnalystService.processAsync(me._processParams(params));
  80098. }
  80099. /**
  80100. * @function ol.supermap.SpatialAnalystService.prototype.densityAnalysis
  80101. * @description 点密度分析。
  80102. * @param {SuperMap.DensityKernelAnalystParameters} params - 查询相关参数类。
  80103. * @param {RequestCallback} callback 回调函数。
  80104. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80105. */
  80106. densityAnalysis(params, callback, resultFormat) {
  80107. var me = this;
  80108. var densityAnalystService = new DensityAnalystService(me.url, {
  80109. proxy: me.options.proxy,
  80110. withCredentials: me.options.withCredentials,
  80111. crossOrigin: me.options.crossOrigin,
  80112. headers: me.options.headers,
  80113. serverType: me.options.serverType,
  80114. eventListeners: {
  80115. scope: me,
  80116. processCompleted: callback,
  80117. processFailed: callback
  80118. },
  80119. format: me._processFormat(resultFormat)
  80120. });
  80121. densityAnalystService.processAsync(me._processParams(params));
  80122. }
  80123. /**
  80124. * @function ol.supermap.SpatialAnalystService.prototype.generateSpatialData
  80125. * @description 动态分段分析。
  80126. * @param {SuperMap.GenerateSpatialDataParameters} params - 查询相关参数类。
  80127. * @param {RequestCallback} callback 回调函数。
  80128. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80129. */
  80130. generateSpatialData(params, callback, resultFormat) {
  80131. var me = this;
  80132. var generateSpatialDataService = new GenerateSpatialDataService(me.url, {
  80133. proxy: me.options.proxy,
  80134. withCredentials: me.options.withCredentials,
  80135. crossOrigin: me.options.crossOrigin,
  80136. headers: me.options.headers,
  80137. serverType: me.options.serverType,
  80138. eventListeners: {
  80139. scope: me,
  80140. processCompleted: callback,
  80141. processFailed: callback
  80142. },
  80143. format: me._processFormat(resultFormat)
  80144. });
  80145. generateSpatialDataService.processAsync(params);
  80146. }
  80147. /**
  80148. * @function ol.supermap.SpatialAnalystService.prototype.geoRelationAnalysis
  80149. * @description 空间关系分析。
  80150. * @param {SuperMap.GeoRelationAnalystParameters} params - 查询相关参数类。
  80151. * @param {RequestCallback} callback 回调函数。
  80152. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80153. */
  80154. geoRelationAnalysis(params, callback, resultFormat) {
  80155. var me = this;
  80156. var geoRelationAnalystService = new GeoRelationAnalystService(me.url, {
  80157. proxy: me.options.proxy,
  80158. withCredentials: me.options.withCredentials,
  80159. crossOrigin: me.options.crossOrigin,
  80160. headers: me.options.headers,
  80161. serverType: me.options.serverType,
  80162. eventListeners: {
  80163. scope: me,
  80164. processCompleted: callback,
  80165. processFailed: callback
  80166. },
  80167. format: me._processFormat(resultFormat)
  80168. });
  80169. geoRelationAnalystService.processAsync(params);
  80170. }
  80171. /**
  80172. * @function ol.supermap.SpatialAnalystService.prototype.interpolationAnalysis
  80173. * @description 插值分析。
  80174. * @param {SuperMap.InterpolationRBFAnalystParameters} params - 查询相关参数类。
  80175. * @param {RequestCallback} callback 回调函数。
  80176. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80177. */
  80178. interpolationAnalysis(params, callback, resultFormat) {
  80179. var me = this;
  80180. var interpolationAnalystService = new InterpolationAnalystService(me.url, {
  80181. proxy: me.options.proxy,
  80182. withCredentials: me.options.withCredentials,
  80183. crossOrigin: me.options.crossOrigin,
  80184. headers: me.options.headers,
  80185. serverType: me.options.serverType,
  80186. eventListeners: {
  80187. scope: me,
  80188. processCompleted: callback,
  80189. processFailed: callback
  80190. },
  80191. format: me._processFormat(resultFormat)
  80192. });
  80193. interpolationAnalystService.processAsync(me._processParams(params));
  80194. }
  80195. /**
  80196. * @function ol.supermap.SpatialAnalystService.prototype.mathExpressionAnalysis
  80197. * @description 栅格代数运算。
  80198. * @param {SuperMap.MathExpressionAnalysisParameters} params - 查询相关参数类。
  80199. * @param {RequestCallback} callback 回调函数。
  80200. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80201. */
  80202. mathExpressionAnalysis(params, callback, resultFormat) {
  80203. var me = this;
  80204. var mathExpressionAnalysisService = new MathExpressionAnalysisService(me.url, {
  80205. proxy: me.options.proxy,
  80206. withCredentials: me.options.withCredentials,
  80207. crossOrigin: me.options.crossOrigin,
  80208. headers: me.options.headers,
  80209. serverType: me.options.serverType,
  80210. eventListeners: {
  80211. scope: me,
  80212. processCompleted: callback,
  80213. processFailed: callback
  80214. },
  80215. format: me._processFormat(resultFormat)
  80216. });
  80217. mathExpressionAnalysisService.processAsync(me._processParams(params));
  80218. }
  80219. /**
  80220. * @function ol.supermap.SpatialAnalystService.prototype.overlayAnalysis
  80221. * @description 叠加分析。
  80222. * @param {SuperMap.DatasetOverlayAnalystParameters|SuperMap.GeometryOverlayAnalystParameters} params - 叠加分析参数类,支持批量几何要素叠加分析。
  80223. * @param {RequestCallback} callback 回调函数。
  80224. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80225. */
  80226. overlayAnalysis(params, callback, resultFormat) {
  80227. var me = this;
  80228. var overlayAnalystService = new OverlayAnalystService(me.url, {
  80229. proxy: me.options.proxy,
  80230. withCredentials: me.options.withCredentials,
  80231. crossOrigin: me.options.crossOrigin,
  80232. headers: me.options.headers,
  80233. serverType: me.options.serverType,
  80234. eventListeners: {
  80235. scope: me,
  80236. processCompleted: callback,
  80237. processFailed: callback
  80238. },
  80239. format: me._processFormat(resultFormat)
  80240. });
  80241. overlayAnalystService.processAsync(me._processParams(params));
  80242. }
  80243. /**
  80244. * @function ol.supermap.SpatialAnalystService.prototype.routeCalculateMeasure
  80245. * @description 路由测量计算。
  80246. * @param {SuperMap.RouteCalculateMeasureParameters} params - 查询相关参数类。
  80247. * @param {RequestCallback} callback 回调函数。
  80248. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80249. */
  80250. routeCalculateMeasure(params, callback, resultFormat) {
  80251. var me = this;
  80252. var routeCalculateMeasureService = new RouteCalculateMeasureService(me.url, {
  80253. proxy: me.options.proxy,
  80254. withCredentials: me.options.withCredentials,
  80255. crossOrigin: me.options.crossOrigin,
  80256. headers: me.options.headers,
  80257. serverType: me.options.serverType,
  80258. eventListeners: {
  80259. scope: me,
  80260. processCompleted: callback,
  80261. processFailed: callback
  80262. },
  80263. format: me._processFormat(resultFormat)
  80264. });
  80265. routeCalculateMeasureService.processAsync(me._processParams(params));
  80266. }
  80267. /**
  80268. * @function ol.supermap.SpatialAnalystService.prototype.routeLocate
  80269. * @description 路由定位。
  80270. * @param {SuperMap.RouteLocatorParameters} params - 查询相关参数类。
  80271. * @param {RequestCallback} callback 回调函数。
  80272. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80273. */
  80274. routeLocate(params, callback, resultFormat) {
  80275. var me = this;
  80276. var routeLocatorService = new RouteLocatorService(me.url, {
  80277. proxy: me.options.proxy,
  80278. withCredentials: me.options.withCredentials,
  80279. crossOrigin: me.options.crossOrigin,
  80280. headers: me.options.headers,
  80281. serverType: me.options.serverType,
  80282. eventListeners: {
  80283. scope: me,
  80284. processCompleted: callback,
  80285. processFailed: callback
  80286. },
  80287. format: me._processFormat(resultFormat)
  80288. });
  80289. routeLocatorService.processAsync(me._processParams(params));
  80290. }
  80291. /**
  80292. * @function ol.supermap.SpatialAnalystService.prototype.surfaceAnalysis
  80293. * @description 表面分析。
  80294. * @param {SuperMap.SurfaceAnalystParameters} params - 表面分析参数类。
  80295. * @param {RequestCallback} callback 回调函数。
  80296. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80297. */
  80298. surfaceAnalysis(params, callback, resultFormat) {
  80299. var me = this;
  80300. var surfaceAnalystService = new SurfaceAnalystService(me.url, {
  80301. proxy: me.options.proxy,
  80302. withCredentials: me.options.withCredentials,
  80303. crossOrigin: me.options.crossOrigin,
  80304. headers: me.options.headers,
  80305. serverType: me.options.serverType,
  80306. eventListeners: {
  80307. scope: me,
  80308. processCompleted: callback,
  80309. processFailed: callback
  80310. },
  80311. format: me._processFormat(resultFormat)
  80312. });
  80313. surfaceAnalystService.processAsync(me._processParams(params));
  80314. }
  80315. /**
  80316. * @function ol.supermap.SpatialAnalystService.prototype.terrainCurvatureCalculate
  80317. * @description 地形曲率计算。
  80318. * @param {SuperMap.TerrainCurvatureCalculationParameters} params - 地形曲率计算相关参数。
  80319. * @param {RequestCallback} callback 回调函数。
  80320. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80321. */
  80322. terrainCurvatureCalculate(params, callback, resultFormat) {
  80323. var me = this;
  80324. var terrainCurvatureCalculationService = new TerrainCurvatureCalculationService(me.url, {
  80325. proxy: me.options.proxy,
  80326. withCredentials: me.options.withCredentials,
  80327. crossOrigin: me.options.crossOrigin,
  80328. headers: me.options.headers,
  80329. serverType: me.options.serverType,
  80330. eventListeners: {
  80331. scope: me,
  80332. processCompleted: callback,
  80333. processFailed: callback
  80334. },
  80335. format: me._processFormat(resultFormat)
  80336. });
  80337. terrainCurvatureCalculationService.processAsync(params);
  80338. }
  80339. /**
  80340. * @function ol.supermap.SpatialAnalystService.prototype.thiessenAnalysis
  80341. * @description 泰森多边形分析。
  80342. * @param {SuperMap.DatasetThiessenAnalystParameters} params - 查询相关参数类。
  80343. * @param {RequestCallback} callback 回调函数。
  80344. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80345. */
  80346. thiessenAnalysis(params, callback, resultFormat) {
  80347. var me = this;
  80348. var thiessenAnalystService = new ThiessenAnalystService(me.url, {
  80349. proxy: me.options.proxy,
  80350. withCredentials: me.options.withCredentials,
  80351. crossOrigin: me.options.crossOrigin,
  80352. headers: me.options.headers,
  80353. serverType: me.options.serverType,
  80354. eventListeners: {
  80355. scope: me,
  80356. processCompleted: callback,
  80357. processFailed: callback
  80358. },
  80359. format: me._processFormat(resultFormat)
  80360. });
  80361. thiessenAnalystService.processAsync(me._processParams(params));
  80362. }
  80363. /**
  80364. * @function ol.supermap.SpatialAnalystService.prototype.geometrybatchAnalysis
  80365. * @description 批量空间分析。
  80366. * @param {Array} params - 批量分析参数对象数组。
  80367. * @param {Array.<Object>} params.analystName - 空间分析方法的名称。包括:</br>
  80368. * "buffer","overlay","interpolationDensity","interpolationidw","interpolationRBF","interpolationKriging","isoregion","isoline"。
  80369. * @param {Object} params.param - 空间分析类型对应的请求参数,包括:</br>
  80370. * {SuperMap.GeometryBufferAnalystParameters} 缓冲区分析参数类。</br>
  80371. * {SuperMap.GeometryOverlayAnalystParameters} 叠加分析参数类。</br>
  80372. * {SuperMap.InterpolationAnalystParameters} 插值分析参数类。</br>
  80373. * {SuperMap.SurfaceAnalystParameters} 表面分析参数类。</br>
  80374. * @param {RequestCallback} callback - 回调函数。
  80375. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  80376. */
  80377. geometrybatchAnalysis(params, callback, resultFormat) {
  80378. var me = this;
  80379. var geometryBatchAnalystService = new GeometryBatchAnalystService(me.url, {
  80380. serverType: me.options.serverType,
  80381. eventListeners: {
  80382. scope: me,
  80383. processCompleted: callback,
  80384. processFailed: callback
  80385. },
  80386. format: me._processFormat(resultFormat)
  80387. });
  80388. //处理批量分析中各个分类类型的参数:
  80389. var analystParameters = [];
  80390. for (var i = 0; i < params.length; i++) {
  80391. var tempParameter = params[i];
  80392. analystParameters.push({
  80393. analystName: tempParameter.analystName,
  80394. param: me._processParams(tempParameter.param)
  80395. })
  80396. }
  80397. geometryBatchAnalystService.processAsync(analystParameters);
  80398. }
  80399. _processParams(params) {
  80400. if (!params) {
  80401. return {};
  80402. }
  80403. if (params.bounds) {
  80404. params.bounds = core_Util_Util.toSuperMapBounds(params.bounds);
  80405. }
  80406. if (params.inputPoints) {
  80407. for (let i = 0; i < params.inputPoints.length; i++) {
  80408. var inputPoint = params.inputPoints[i];
  80409. if (core_Util_Util.isArray(inputPoint)) {
  80410. params.inputPoints[i] = {x: inputPoint[0], y: inputPoint[1], tag: inputPoint[2]};
  80411. } else {
  80412. params.inputPoints[i] = {
  80413. x: inputPoint.getCoordinates()[0],
  80414. y: inputPoint.getCoordinates()[1],
  80415. tag: inputPoint.tag
  80416. };
  80417. }
  80418. }
  80419. }
  80420. if (params.points) {
  80421. for (let i = 0; i < params.points.length; i++) {
  80422. let point = params.points[i];
  80423. if (core_Util_Util.isArray(point)) {
  80424. point.setCoordinates(point);
  80425. }
  80426. params.points[i] = new Point(point.getCoordinates()[0], point.getCoordinates()[1]);
  80427. }
  80428. }
  80429. if (params.point) {
  80430. let point = params.point;
  80431. if (core_Util_Util.isArray(point)) {
  80432. point.setCoordinates(point);
  80433. }
  80434. params.point = new Point(point.getCoordinates()[0], point.getCoordinates()[1]);
  80435. }
  80436. if (params.extractRegion) {
  80437. params.extractRegion = this.convertGeometry(params.extractRegion);
  80438. }
  80439. if (params.extractParameter && params.extractParameter.clipRegion) {
  80440. params.extractParameter.clipRegion = this.convertGeometry(params.extractParameter.clipRegion);
  80441. }
  80442. if (params.clipParam && params.clipParam.clipRegion) {
  80443. params.clipParam.clipRegion = this.convertGeometry(params.clipParam.clipRegion);
  80444. }
  80445. //支持格式:Vector Layers; GeoJson
  80446. if (params.sourceGeometry) {
  80447. var SRID = null;
  80448. if (params.sourceGeometrySRID) {
  80449. SRID = params.sourceGeometrySRID;
  80450. }
  80451. params.sourceGeometry = this.convertGeometry(params.sourceGeometry);
  80452. if (SRID) {
  80453. params.sourceGeometry.SRID = SRID;
  80454. }
  80455. delete params.sourceGeometry.sourceGeometrySRID;
  80456. }
  80457. if (params.operateGeometry) {
  80458. params.operateGeometry = this.convertGeometry(params.operateGeometry);
  80459. }
  80460. //支持传入多个几何要素进行叠加分析:
  80461. if (params.sourceGeometries) {
  80462. var sourceGeometries = [];
  80463. for (var k = 0; k < params.sourceGeometries.length; k++) {
  80464. sourceGeometries.push(this.convertGeometry(params.sourceGeometries[k]));
  80465. }
  80466. params.sourceGeometries = sourceGeometries;
  80467. }
  80468. //支持传入多个几何要素进行叠加分析:
  80469. if (params.operateGeometries) {
  80470. var operateGeometries = [];
  80471. for (var j = 0; j < params.operateGeometries.length; j++) {
  80472. operateGeometries.push(this.convertGeometry(params.operateGeometries[j]));
  80473. }
  80474. params.operateGeometries = operateGeometries;
  80475. }
  80476. if (params.sourceRoute) {
  80477. if (params.sourceRoute instanceof (external_ol_geom_LineString_default()) && params.sourceRoute.getCoordinates()) {
  80478. var target = {};
  80479. target.type = "LINEM";
  80480. target.parts = [params.sourceRoute.getCoordinates()[0].length];
  80481. target.points = [];
  80482. for (let i = 0; i < params.sourceRoute.getCoordinates()[0].length; i++) {
  80483. let point = params.sourceRoute.getCoordinates()[0][i];
  80484. target.points = target.points.concat({x: point[0], y: point[1], measure: point[2]})
  80485. }
  80486. params.sourceRoute = target;
  80487. }
  80488. }
  80489. var me = this;
  80490. if (params.operateRegions && core_Util_Util.isArray(params.operateRegions)) {
  80491. params.operateRegions.map(function (geometry, key) {
  80492. params.operateRegions[key] = me.convertGeometry(geometry);
  80493. return params.operateRegions[key];
  80494. });
  80495. }
  80496. if (params.sourceRoute && params.sourceRoute.components && core_Util_Util.isArray(params.sourceRoute.components)) {
  80497. params.sourceRoute.components.map(function (geometry, key) {
  80498. params.sourceRoute.components[key] = me.convertGeometry(geometry);
  80499. return params.sourceRoute.components[key];
  80500. });
  80501. }
  80502. return params;
  80503. }
  80504. _processFormat(resultFormat) {
  80505. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  80506. }
  80507. /**
  80508. * @private
  80509. * @function ol.supermap.SpatialAnalystService.prototype.convertGeometry
  80510. * @description 转换几何对象。
  80511. * @param {Object} ol3Geometry - 待转换的几何对象。
  80512. */
  80513. convertGeometry(ol3Geometry) {
  80514. //判断是否传入的是geojson 并作相应处理
  80515. if(["FeatureCollection", "Feature", "Geometry"].indexOf(ol3Geometry.type) != -1){
  80516. return core_Util_Util.toSuperMapGeometry(ol3Geometry);
  80517. }
  80518. return core_Util_Util.toSuperMapGeometry(JSON.parse((new (external_ol_format_GeoJSON_default())()).writeGeometry(ol3Geometry)));
  80519. }
  80520. }
  80521. ;// CONCATENATED MODULE: ./src/openlayers/services/ThemeService.js
  80522. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80523. * This program are made available under the terms of the Apache License, Version 2.0
  80524. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80525. /**
  80526. * @class ol.supermap.ThemeService
  80527. * @category iServer Map Theme
  80528. * @classdesc 专题图服务类。
  80529. * @extends {ol.supermap.ServiceBase}
  80530. * @example
  80531. * new ol.supermap.ThemeService(url,{
  80532. * projection:projection
  80533. * }).getThemeInfo(params,function(result){
  80534. * //doSomething
  80535. * });
  80536. * @param {string} url - 服务的访问地址。
  80537. * @param {Object} options - 参数。
  80538. * @param {string} [options.proxy] - 服务代理地址。
  80539. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  80540. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80541. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80542. * @param {Object} [options.headers] - 请求头。
  80543. */
  80544. class ThemeService extends ServiceBase {
  80545. constructor(url, options) {
  80546. super(url, options);
  80547. }
  80548. /**
  80549. * @function ol.supermap.ThemeService.prototype.getThemeInfo
  80550. * @description 获取专题图信息。
  80551. * @param {SuperMap.ThemeParameters} params - 专题图参数类。
  80552. * @param {RequestCallback} callback 回调函数。
  80553. */
  80554. getThemeInfo(params, callback) {
  80555. var me = this;
  80556. var themeService = new ThemeService_ThemeService(me.url, {
  80557. proxy: me.options.proxy,
  80558. withCredentials: me.options.withCredentials,
  80559. crossOrigin: me.options.crossOrigin,
  80560. headers: me.options.headers,
  80561. serverType: me.options.serverType,
  80562. eventListeners: {
  80563. scope: me,
  80564. processCompleted: callback,
  80565. processFailed: callback
  80566. }
  80567. });
  80568. themeService.processAsync(params);
  80569. }
  80570. }
  80571. ;// CONCATENATED MODULE: ./src/openlayers/services/TrafficTransferAnalystService.js
  80572. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80573. * This program are made available under the terms of the Apache License, Version 2.0
  80574. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80575. /**
  80576. * @class ol.supermap.TrafficTransferAnalystService
  80577. * @extends {ol.supermap.ServiceBase}
  80578. * @category iServer TrafficTransferAnalyst
  80579. * @classdesc 交通换乘分析服务类。
  80580. * @example
  80581. * new ol.supermap.TrafficTransferAnalystService(url)
  80582. * .queryStop(params,function(result){
  80583. * //doSomething
  80584. * })
  80585. * @param {string} url - 服务地址。
  80586. * @param {Object} options - 参数。
  80587. * @param {string} [options.proxy] - 服务代理地址。
  80588. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务来源 ISERVER|IPORTAL|ONLINE。
  80589. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80590. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80591. * @param {Object} [options.headers] - 请求头。
  80592. */
  80593. class TrafficTransferAnalystService extends ServiceBase {
  80594. constructor(url, options) {
  80595. super(url, options);
  80596. }
  80597. /**
  80598. * @function ol.supermap.TrafficTransferAnalystService.prototype.queryStop
  80599. * @description 站点查询服务。
  80600. * @param {SuperMap.StopQueryParameters} params - 查询相关参数类。
  80601. * @param {RequestCallback} callback - 回调函数。
  80602. */
  80603. queryStop(params, callback) {
  80604. var me = this;
  80605. var stopQueryService = new StopQueryService(me.url, {
  80606. proxy: me.options.proxy,
  80607. withCredentials: me.options.withCredentials,
  80608. crossOrigin: me.options.crossOrigin,
  80609. headers: me.options.headers,
  80610. serverType: me.options.serverType,
  80611. eventListeners: {
  80612. scope: me,
  80613. processCompleted: callback,
  80614. processFailed: callback
  80615. }
  80616. });
  80617. stopQueryService.processAsync(params);
  80618. }
  80619. /**
  80620. * @function ol.supermap.TrafficTransferAnalystService.prototype.analysisTransferPath
  80621. * @description 交通换乘线路查询服务。
  80622. * @param {SuperMap.TransferPathParameters} params - 查询相关参数类。
  80623. * @param {RequestCallback} callback - 回调函数。
  80624. */
  80625. analysisTransferPath(params, callback) {
  80626. var me = this;
  80627. var transferPathService = new TransferPathService(me.url, {
  80628. proxy: me.options.proxy,
  80629. withCredentials: me.options.withCredentials,
  80630. crossOrigin: me.options.crossOrigin,
  80631. headers: me.options.headers,
  80632. serverType: me.options.serverType,
  80633. eventListeners: {
  80634. scope: me,
  80635. processCompleted: callback,
  80636. processFailed: callback
  80637. }
  80638. });
  80639. transferPathService.processAsync(me._processParams(params));
  80640. }
  80641. /**
  80642. * @function ol.supermap.TrafficTransferAnalystService.prototype.analysisTransferSolution
  80643. * @description 交通换乘方案查询服务。
  80644. * @param {SuperMap.TransferSolutionParameters} params - 查询相关参数类。
  80645. * @param {RequestCallback} callback - 回调函数。
  80646. */
  80647. analysisTransferSolution(params, callback) {
  80648. var me = this;
  80649. var transferSolutionService = new TransferSolutionService(me.url, {
  80650. proxy: me.options.proxy,
  80651. withCredentials: me.options.withCredentials,
  80652. crossOrigin: me.options.crossOrigin,
  80653. headers: me.options.headers,
  80654. serverType: me.options.serverType,
  80655. eventListeners: {
  80656. scope: me,
  80657. processCompleted: callback,
  80658. processFailed: callback
  80659. }
  80660. });
  80661. transferSolutionService.processAsync(me._processParams(params));
  80662. }
  80663. _processParams(params) {
  80664. if (!params) {
  80665. return {};
  80666. }
  80667. if (params.transferLines && !core_Util_Util.isArray(params.transferLines)) {
  80668. params.transferLines = [params.transferLines];
  80669. }
  80670. if (params.points && core_Util_Util.isArray(params.points)) {
  80671. params.points.map(function (point, key) {
  80672. params.points[key] = (point instanceof (external_ol_geom_Point_default())) ? {
  80673. x: point.getCoordinates()[0],
  80674. y: point.getCoordinates()[1]
  80675. } : point;
  80676. return params.points[key];
  80677. });
  80678. }
  80679. return params;
  80680. }
  80681. }
  80682. ;// CONCATENATED MODULE: ./src/openlayers/services/WebPrintingJobService.js
  80683. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80684. * This program are made available under the terms of the Apache License, Version 2.0
  80685. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80686. /**
  80687. * @class ol.supermap.WebPrintingJobService
  80688. * @category iServer WebPrintingJob
  80689. * @version 10.1.0
  80690. * @classdesc Web 打印服务类。
  80691. * 提供:创建 Web 打印任务,获取 Web 打印任务内容,获取 Web 打印输出文档流,获取 Web 打印服务的布局模板信息。
  80692. * @extends {ol.supermap.ServiceBase}
  80693. * @param {string} url - 资源根地址。请求打印地图服务的 URL 应为:http://{服务器地址}:{服务端口号}/iserver/services/webprinting/rest/webprinting/v1。
  80694. * @param {Object} options - 服务交互时所需的可选参数。
  80695. * @param {string} [options.proxy] - 服务代理地址。
  80696. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  80697. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  80698. * @param {Object} [options.headers] - 请求头。
  80699. * @example
  80700. * new ol.supermap.WebPrintingJobService(url)
  80701. * .createWebPrintingJob(param,function(result){
  80702. * //doSomething
  80703. * })
  80704. */
  80705. class WebPrintingJobService extends ServiceBase {
  80706. constructor(url, options) {
  80707. super(url, options);
  80708. }
  80709. /**
  80710. * @function ol.supermap.WebPrintingJobService.prototype.createWebPrintingJob
  80711. * @description 创建 Web 打印任务。
  80712. * @param {SuperMap.WebPrintingJobParameters} params - 打印的相关参数类。
  80713. * @param {RequestCallback} callback - 回调函数。
  80714. */
  80715. createWebPrintingJob(params, callback) {
  80716. if (!params) {
  80717. return;
  80718. }
  80719. var me = this;
  80720. var webPrintingService = new WebPrintingService(me.url, {
  80721. proxy: me.options.proxy,
  80722. withCredentials: me.options.withCredentials,
  80723. crossOrigin: me.options.crossOrigin,
  80724. headers: me.options.headers,
  80725. serverType: me.options.serverType,
  80726. eventListeners: {
  80727. scope: me,
  80728. processCompleted: callback,
  80729. processFailed: callback
  80730. }
  80731. });
  80732. webPrintingService.createWebPrintingJob(me._processParams(params));
  80733. }
  80734. /**
  80735. * @function ol.supermap.WebPrintingJobService.prototype.getPrintingJob
  80736. * @description 获取 Web 打印输出文档任务。
  80737. * @param {String} jobId - Web 打印输入文档任务 Id。
  80738. * @param {RequestCallback} callback - 回调函数。
  80739. */
  80740. getPrintingJob(jobId, callback) {
  80741. var me = this;
  80742. var webPrintingService = new WebPrintingService(me.url, {
  80743. proxy: me.options.proxy,
  80744. withCredentials: me.options.withCredentials,
  80745. crossOrigin: me.options.crossOrigin,
  80746. headers: me.options.headers,
  80747. serverType: me.options.serverType,
  80748. eventListeners: {
  80749. scope: me,
  80750. processCompleted: callback,
  80751. processFailed: callback
  80752. }
  80753. });
  80754. webPrintingService.getPrintingJob(jobId);
  80755. }
  80756. /**
  80757. * @function ol.supermap.WebPrintingJobService.prototype.getPrintingJobResult
  80758. * @description 获取 Web 打印任务的输出文档。
  80759. * @param {String} jobId - Web 打印输入文档任务 Id。
  80760. * @param {RequestCallback} callback - 回调函数。
  80761. */
  80762. getPrintingJobResult(jobId, callback) {
  80763. var me = this;
  80764. var webPrintingService = new WebPrintingService(me.url, {
  80765. proxy: me.options.proxy,
  80766. withCredentials: me.options.withCredentials,
  80767. crossOrigin: me.options.crossOrigin,
  80768. headers: me.options.headers,
  80769. serverType: me.options.serverType,
  80770. eventListeners: {
  80771. scope: me,
  80772. processCompleted: callback,
  80773. processFailed: callback
  80774. }
  80775. });
  80776. webPrintingService.getPrintingJobResult(jobId);
  80777. }
  80778. /**
  80779. * @function ol.supermap.WebPrintingJobService.prototype.getLayoutTemplates
  80780. * @description 查询 Web 打印服务所有可用的模板信息。
  80781. * @param {RequestCallback} callback - 回调函数。
  80782. */
  80783. getLayoutTemplates(callback) {
  80784. var me = this;
  80785. var webPrintingService = new WebPrintingService(me.url, {
  80786. proxy: me.options.proxy,
  80787. withCredentials: me.options.withCredentials,
  80788. crossOrigin: me.options.crossOrigin,
  80789. headers: me.options.headers,
  80790. serverType: me.options.serverType,
  80791. eventListeners: {
  80792. scope: me,
  80793. processCompleted: callback,
  80794. processFailed: callback
  80795. }
  80796. });
  80797. webPrintingService.getLayoutTemplates();
  80798. }
  80799. _processParams(params) {
  80800. if (params.layoutOptions && params.layoutOptions.littleMapOptions) {
  80801. params.layoutOptions.littleMapOptions.center = this._toPointObject(
  80802. params.layoutOptions.littleMapOptions.center
  80803. );
  80804. }
  80805. if (params.exportOptions) {
  80806. params.exportOptions.center = this._toPointObject(params.exportOptions.center);
  80807. }
  80808. return params;
  80809. }
  80810. _toPointObject(point) {
  80811. if (core_Util_Util.isArray(point)) {
  80812. return {
  80813. x: point[0],
  80814. y: point[1]
  80815. };
  80816. } else if (point instanceof SuperMap.Geometry.Point || point instanceof (external_ol_geom_Point_default())) {
  80817. return {
  80818. x: point.x,
  80819. y: point.y
  80820. };
  80821. }
  80822. return point;
  80823. }
  80824. }
  80825. ;// CONCATENATED MODULE: ./src/openlayers/services/index.js
  80826. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80827. * This program are made available under the terms of the Apache License, Version 2.0
  80828. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80829. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/ProvinceCenter.json
  80830. const ProvinceCenter_namespaceObject = JSON.parse("[{\"name\":\"黑龙江省\",\"coord\":[127.64559817675396,48.48668098449708]},{\"name\":\"内蒙古自治区\",\"coord\":[118.34519572208615,45.370218276977525]},{\"name\":\"新疆维吾尔自治区\",\"coord\":[87.13479065593184,41.75497055053711]},{\"name\":\"吉林省\",\"coord\":[126.12985278813787,43.57983207702637]},{\"name\":\"辽宁省\",\"coord\":[124.02494773936439,41.105743408203125]},{\"name\":\"甘肃省\",\"coord\":[102.87785725633012,37.69582366943361]},{\"name\":\"河北省\",\"coord\":[115.66327227481898,39.33383178710938]},{\"name\":\"北京市\",\"coord\":[116.62199343603638,40.25053787231445]},{\"name\":\"山西省\",\"coord\":[112.45180235808988,37.666561126708984]},{\"name\":\"天津市\",\"coord\":[117.35711842642581,39.406789779663086]},{\"name\":\"陕西省\",\"coord\":[109.56294003056632,35.64754199981689]},{\"name\":\"宁夏回族自治区\",\"coord\":[105.96110877640074,37.3081169128418]},{\"name\":\"青海省\",\"coord\":[96.07301048277901,35.44417190551758]},{\"name\":\"山东省\",\"coord\":[118.03833752951093,36.29800605773925]},{\"name\":\"西藏自治区\",\"coord\":[87.47361520439412,31.6703872680664]},{\"name\":\"河南省\",\"coord\":[113.07832397097275,33.87751102447509]},{\"name\":\"江苏省\",\"coord\":[119.93926538201052,32.945452690124505]},{\"name\":\"安徽省\",\"coord\":[117.15146765881019,32.024482727050774]},{\"name\":\"四川省\",\"coord\":[102.28998890142759,30.182161331176758]},{\"name\":\"湖北省\",\"coord\":[112.87798261431585,31.157071113586426]},{\"name\":\"重庆市\",\"coord\":[107.870126637831,30.188085556030266]},{\"name\":\"上海市\",\"coord\":[121.42561166015514,31.276043891906745]},{\"name\":\"浙江省\",\"coord\":[119.75337092707514,29.175934791564945]},{\"name\":\"湖南省\",\"coord\":[111.52770282777405,27.38110256195069]},{\"name\":\"江西省\",\"coord\":[115.51091280655628,27.283511161804206]},{\"name\":\"云南省\",\"coord\":[101.27053825991308,25.19783210754396]},{\"name\":\"贵州省\",\"coord\":[106.49672346773299,26.92267990112305]},{\"name\":\"福建省\",\"coord\":[117.9976766946587,25.939599990844727]},{\"name\":\"广西壮族自治区\",\"coord\":[108.98706831086302,23.891559600830078]},{\"name\":\"台湾省\",\"coord\":[120.82468432537434,23.602651596069336]},{\"name\":\"香港特别行政区\",\"coord\":[114.21036850371561,22.374858856201172]},{\"name\":\"海南省\",\"coord\":[109.62792940960824,19.163116455078125]},{\"name\":\"广东省\",\"coord\":[113.32127888266032,22.873867034912106]},{\"name\":\"澳门特别行政区\",\"coord\":[113.56819996291901,22.160347992976]}]");
  80831. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/MunicipalCenter.json
  80832. const MunicipalCenter_namespaceObject = JSON.parse("[{\"name\":\"克拉玛依市\",\"coord\":[85.01486759299489,45.406422237230046]},{\"name\":\"昌吉回族自治州\",\"coord\":[88.7154624754753,44.26991024636568]},{\"name\":\"石河子市\",\"coord\":[86.0208600035924,44.239045558096805]},{\"name\":\"霍林郭勒市\",\"coord\":[114.73479243733115,44.16058374713977]},{\"name\":\"本溪市\",\"coord\":[124.64357865201586,41.177197783134275]},{\"name\":\"嘉峪关市\",\"coord\":[98.16891560537093,39.76279786284264]},{\"name\":\"莱芜市\",\"coord\":[117.65723565456207,36.27916499211527]},{\"name\":\"神农架林区\",\"coord\":[110.48296222218153,31.581260143666697]},{\"name\":\"天门市\",\"coord\":[113.00615321481195,30.64105781887143]},{\"name\":\"鄂州市\",\"coord\":[114.94764081970385,30.325634953844585]},{\"name\":\"潜江市\",\"coord\":[112.70703817700621,30.349210666019893]},{\"name\":\"仙桃市\",\"coord\":[113.34688900729822,30.315951161935402]},{\"name\":\"萍乡市\",\"coord\":[113.88072263074415,27.47193090553213]},{\"name\":\"台湾省\",\"coord\":[120.14338943402045,23.596002465926095]},{\"name\":\"东莞市\",\"coord\":[113.89443658529342,22.897826158636448]},{\"name\":\"中山市\",\"coord\":[113.37118387764659,22.501478858616522]},{\"name\":\"珠海市\",\"coord\":[113.21799258934986,22.23782602992192]},{\"name\":\"北海市\",\"coord\":[109.18248083043899,21.695773689750148]},{\"name\":\"香港\",\"coord\":[114.20689279508653,22.36016760139811]},{\"name\":\"舟山市\",\"coord\":[122.22514712841459,30.338633120695956]},{\"name\":\"克孜勒苏柯尔克孜\",\"coord\":[74.62910472637343,39.59886016069875]},{\"name\":\"喀什地区\",\"coord\":[77.19899922143753,37.85462871211595]},{\"name\":\"阿克苏地区\",\"coord\":[81.43930290016381,41.067304799230456]},{\"name\":\"和田地区\",\"coord\":[80.69780509160952,36.95287032287055]},{\"name\":\"阿里地区\",\"coord\":[82.536487505389,32.69566569631762]},{\"name\":\"日喀则地区\",\"coord\":[86.5996831353606,29.54861754814263]},{\"name\":\"那曲地区\",\"coord\":[88.32523292667608,33.20600450932715]},{\"name\":\"玉树藏族自治州\",\"coord\":[95.2107128446203,33.90320387919257]},{\"name\":\"迪庆藏族自治州\",\"coord\":[99.42465312188943,28.052797714348895]},{\"name\":\"怒江傈傈族自治州\",\"coord\":[98.85737910439825,26.98345757528851]},{\"name\":\"大理白族自治州\",\"coord\":[99.93934374816013,25.684737357453045]},{\"name\":\"德宏傣族景颇族自\",\"coord\":[98.13830877778075,24.593421919561205]},{\"name\":\"保山市\",\"coord\":[99.19031013453166,24.979380341662]},{\"name\":\"临沧市\",\"coord\":[99.62483778975081,24.058807858948214]},{\"name\":\"普洱市\",\"coord\":[100.94440267992684,23.44121660743221]},{\"name\":\"西双版纳傣族自治\",\"coord\":[100.86105801845994,21.882475641324206]},{\"name\":\"拉萨市\",\"coord\":[91.3684790613129,30.14176592960237]},{\"name\":\"山南地区\",\"coord\":[92.11665242621062,28.33000201578789]},{\"name\":\"林芝地区\",\"coord\":[94.9307847458166,29.125110156601963]},{\"name\":\"昌都地区\",\"coord\":[97.33912235873476,30.48520825551814]},{\"name\":\"丽江市\",\"coord\":[100.65713436205135,26.96190318191959]},{\"name\":\"攀枝花市\",\"coord\":[101.73355913301131,26.714486678752795]},{\"name\":\"凉山彝族自治州\",\"coord\":[102.08678551422615,27.683020519860396]},{\"name\":\"楚雄彝族自治州\",\"coord\":[101.68264761198458,25.369603845264024]},{\"name\":\"红河哈尼族彝族自\",\"coord\":[102.95101719613119,23.624860095239875]},{\"name\":\"文山壮族苗族自治\",\"coord\":[104.8708359910614,23.579587266862504]},{\"name\":\"百色市\",\"coord\":[106.69546907589859,23.98220841166522]},{\"name\":\"崇左市\",\"coord\":[107.3277087317123,22.49769755349952]},{\"name\":\"防城港市\",\"coord\":[107.88939931155171,21.94550204069006]},{\"name\":\"南宁市\",\"coord\":[108.67078983716917,23.12207641861882]},{\"name\":\"钦州市\",\"coord\":[108.8532307305186,22.157690108421384]},{\"name\":\"玉林市\",\"coord\":[110.26918466489103,22.391823643610415]},{\"name\":\"湛江市\",\"coord\":[109.93033457863683,21.086751055633457]},{\"name\":\"茂名市\",\"coord\":[110.80336192333934,22.069184739040775]},{\"name\":\"阳江市\",\"coord\":[111.70471342186183,22.108751366417575]},{\"name\":\"江门市\",\"coord\":[112.53715618649149,22.297368082806777]},{\"name\":\"广州市\",\"coord\":[113.4949302208309,23.28359314707863]},{\"name\":\"清远市\",\"coord\":[113.10957368131268,24.334444053233856]},{\"name\":\"肇庆市\",\"coord\":[112.11117530204233,23.60241158796112]},{\"name\":\"梧州市\",\"coord\":[111.01709510772797,23.518132876753846]},{\"name\":\"贺州市\",\"coord\":[111.50423061842756,24.4095096817199]},{\"name\":\"桂林市\",\"coord\":[110.44046163393094,25.353966673735407]},{\"name\":\"柳州市\",\"coord\":[109.34854449214147,24.972408051485047]},{\"name\":\"河池市\",\"coord\":[107.81191841865586,24.649291651298164]},{\"name\":\"黔东南苗族侗族自\",\"coord\":[108.39952601614591,26.429286420465576]},{\"name\":\"贵阳市\",\"coord\":[106.59784062851153,26.797907456479816]},{\"name\":\"安顺市\",\"coord\":[105.76161265300635,25.988644902171018]},{\"name\":\"黔西南布依族苗族\",\"coord\":[105.5954078788574,25.404850939549405]},{\"name\":\"曲靖市\",\"coord\":[103.9164335632742,25.697243690315265]},{\"name\":\"六盘水市\",\"coord\":[104.77723228072432,26.15402255629164]},{\"name\":\"毕节地区\",\"coord\":[105.03867422931839,27.077913968069666]},{\"name\":\"昭通市\",\"coord\":[104.29730513046874,27.62418247971078]},{\"name\":\"宜宾市\",\"coord\":[104.76748901448207,28.553501804266475]},{\"name\":\"乐山市\",\"coord\":[103.56027669102787,29.160754519210577]},{\"name\":\"自贡市\",\"coord\":[104.63272827056402,29.273152614922402]},{\"name\":\"内江市\",\"coord\":[104.82644562304716,29.61272653799929]},{\"name\":\"遵义市\",\"coord\":[106.82413636302059,28.191847588570702]},{\"name\":\"达州市\",\"coord\":[107.59704170009518,31.32138258839703]},{\"name\":\"遂宁市\",\"coord\":[105.48979445433736,30.677687821242678]},{\"name\":\"广安市\",\"coord\":[106.56708164098042,30.43500706741521]},{\"name\":\"泸州市\",\"coord\":[105.42591761727707,28.50277238478137]},{\"name\":\"资阳市\",\"coord\":[104.97995126874034,30.154251886139654]},{\"name\":\"雅安市\",\"coord\":[102.69931299964517,29.892630706195035]},{\"name\":\"眉山市\",\"coord\":[104.07052881858888,29.894202166560405]},{\"name\":\"甘孜藏族自治州\",\"coord\":[100.50721042614238,30.975216556269658]},{\"name\":\"果洛藏族自治州\",\"coord\":[99.30775565051923,34.03539865224808]},{\"name\":\"海南藏族自治州\",\"coord\":[100.39969108016373,35.90048272566899]},{\"name\":\"黄南藏族自治州\",\"coord\":[101.5360706381689,35.10286360841902]},{\"name\":\"赣南藏族自治州\",\"coord\":[102.97083885806067,34.326752803339026]},{\"name\":\"陇南市\",\"coord\":[105.24780098912132,33.57031117443431]},{\"name\":\"天水市\",\"coord\":[105.53503634660417,34.62320421368087]},{\"name\":\"定西市\",\"coord\":[104.58787768541339,35.08900966621695]},{\"name\":\"临夏回族自治州\",\"coord\":[103.2612870434902,35.591577124455235]},{\"name\":\"西宁市\",\"coord\":[101.57680657999033,36.84800271717157]},{\"name\":\"海东地区\",\"coord\":[102.30909850729282,36.287400615025646]},{\"name\":\"海北藏族自治州\",\"coord\":[100.27122484450717,37.892557516083826]},{\"name\":\"金昌市\",\"coord\":[102.02244049169511,38.497330414886164]},{\"name\":\"酒泉市\",\"coord\":[95.94486678270127,40.56891536586272]},{\"name\":\"海西蒙古族藏族自\",\"coord\":[94.67143298050689,36.022725148503724]},{\"name\":\"巴音郭楞蒙古自治\",\"coord\":[88.18116214759745,39.556478810319916]},{\"name\":\"哈密地区\",\"coord\":[93.84302392518026,42.95015211178875]},{\"name\":\"叶鲁番地区\",\"coord\":[89.82035217277885,42.399368632283505]},{\"name\":\"乌鲁木齐市\",\"coord\":[88.00048109561487,43.549986370786]},{\"name\":\"阿勒泰地区\",\"coord\":[88.11213933257655,47.05593413019629]},{\"name\":\"博尔塔拉蒙古自治\",\"coord\":[82.26402238163408,44.671135542630864]},{\"name\":\"伊犁哈萨克自治州\",\"coord\":[82.80778717477179,43.53783381365267]},{\"name\":\"阿拉善盟\",\"coord\":[103.29923966842289,40.10955801781495]},{\"name\":\"武威市\",\"coord\":[102.73362058791429,37.94211141321436]},{\"name\":\"兰州市\",\"coord\":[103.73793563506032,36.27379827886003]},{\"name\":\"中卫市\",\"coord\":[105.6943786030716,37.20654236148948]},{\"name\":\"银川市\",\"coord\":[106.20022174140034,38.52103167597483]},{\"name\":\"石嘴山市\",\"coord\":[106.41544011793628,38.84054137571417]},{\"name\":\"乌海市\",\"coord\":[106.8984175998405,39.54616572239788]},{\"name\":\"鄂尔多斯市\",\"coord\":[108.43285571424619,39.24036799350715]},{\"name\":\"巴彦淖尔市\",\"coord\":[107.45840392808307,41.30159860424196]},{\"name\":\"包头市\",\"coord\":[110.46472193224272,41.48017783644221]},{\"name\":\"呼和浩特市\",\"coord\":[111.48365173603975,40.498363056149884]},{\"name\":\"乌兰察布市\",\"coord\":[112.61568977597707,41.75789561273154]},{\"name\":\"大同市\",\"coord\":[113.7107192749083,39.898956799744184]},{\"name\":\"朔州市\",\"coord\":[112.65428748167508,39.681772914701924]},{\"name\":\"忻州市\",\"coord\":[112.36127575589583,38.88990233614568]},{\"name\":\"榆林市\",\"coord\":[109.68473112169593,38.19921027134876]},{\"name\":\"延安市\",\"coord\":[109.52425222161318,36.406522726136814]},{\"name\":\"庆阳市\",\"coord\":[107.73052193155061,36.183821532624464]},{\"name\":\"固原市\",\"coord\":[106.20191575442442,36.11634909496382]},{\"name\":\"白银市\",\"coord\":[104.68634478137065,36.51582865625868]},{\"name\":\"宝鸡市\",\"coord\":[107.33534779230747,34.3387216485855]},{\"name\":\"汉中市\",\"coord\":[107.03534754266246,33.00142998064871]},{\"name\":\"广元市\",\"coord\":[105.92928137563939,32.21872447205537]},{\"name\":\"巴中市\",\"coord\":[107.03422410306194,31.99874720836291]},{\"name\":\"南充市\",\"coord\":[106.32964805032347,31.156657700184095]},{\"name\":\"绵阳市\",\"coord\":[104.58949560201106,31.88628780630976]},{\"name\":\"德阳市\",\"coord\":[104.41542984932845,31.110558133718676]},{\"name\":\"成都市\",\"coord\":[103.8852290010473,30.777258040348634]},{\"name\":\"阿坝藏族羌族自治\",\"coord\":[102.26209319552814,32.45725845387284]},{\"name\":\"安康市\",\"coord\":[109.14236501848015,32.77467694678074]},{\"name\":\"十堰市\",\"coord\":[110.39934083416314,32.376209039347906]},{\"name\":\"襄阳市\",\"coord\":[111.97539147094662,31.93399822417465]},{\"name\":\"宜昌市\",\"coord\":[111.22204852395754,30.772457669035354]},{\"name\":\"恩施市\",\"coord\":[109.42158366502872,30.260366574390105]},{\"name\":\"张家界市\",\"coord\":[110.59760006538717,29.330107409240718]},{\"name\":\"吉首市\",\"coord\":[109.72176899848378,28.681903937242495]},{\"name\":\"铜仁地区\",\"coord\":[108.54247523485463,28.11736237519646]},{\"name\":\"重庆市\",\"coord\":[107.86007108564992,30.186253395053196]},{\"name\":\"怀化市\",\"coord\":[109.94325166787243,27.43919084801186]},{\"name\":\"益阳市\",\"coord\":[112.43060358108062,28.75127294553697]},{\"name\":\"娄底市\",\"coord\":[111.41891416951897,27.696312460064604]},{\"name\":\"常德市\",\"coord\":[111.72571610131646,29.27189463838195]},{\"name\":\"荆州市\",\"coord\":[112.65896596965268,30.05161542755362]},{\"name\":\"荆门市\",\"coord\":[112.6586855902184,31.01267124474617]},{\"name\":\"岳阳市\",\"coord\":[113.2595036144316,29.106247116930163]},{\"name\":\"长沙市\",\"coord\":[113.15415586456598,28.222934680488425]},{\"name\":\"湘潭市\",\"coord\":[112.51092596317824,27.69881544105668]},{\"name\":\"株州市\",\"coord\":[113.49665538546823,27.03993794610501]},{\"name\":\"衡阳市\",\"coord\":[112.48849636578527,26.783613569970782]},{\"name\":\"邵阳市\",\"coord\":[110.6723832117475,26.81652287086792]},{\"name\":\"永州市\",\"coord\":[111.8565364154186,25.768488267811968]},{\"name\":\"韶关市\",\"coord\":[113.53420325850979,24.69848878771937]},{\"name\":\"惠州市\",\"coord\":[114.32029589634925,23.25504544231892]},{\"name\":\"佛山市\",\"coord\":[112.95925897403649,23.10116677189257]},{\"name\":\"云浮市\",\"coord\":[111.78042514904234,22.840400494105687]},{\"name\":\"深圳市\",\"coord\":[114.13138648919008,22.649563063468342]},{\"name\":\"汕尾市\",\"coord\":[115.57412892884373,23.06989642104901]},{\"name\":\"河源市\",\"coord\":[114.89746229844398,23.97971937124767]},{\"name\":\"揭阳市\",\"coord\":[116.04290004239446,23.304802704715357]},{\"name\":\"汕头市\",\"coord\":[116.7008461897183,23.35898625947344]},{\"name\":\"潮州市\",\"coord\":[116.75405548481658,23.854381508863064]},{\"name\":\"梅州市\",\"coord\":[116.13719397345734,24.15633544812716]},{\"name\":\"漳州市\",\"coord\":[117.38279760543345,24.41111215459575]},{\"name\":\"厦门市\",\"coord\":[118.04275971554665,24.675908246507944]},{\"name\":\"龙岩市\",\"coord\":[116.69341144552507,25.20284542644492]},{\"name\":\"泉州市\",\"coord\":[118.12035864630246,25.22984144365049]},{\"name\":\"莆田市\",\"coord\":[118.82439690138142,25.439653480972687]},{\"name\":\"福州市\",\"coord\":[119.1608285845262,25.99117532466728]},{\"name\":\"三明市\",\"coord\":[117.51188176216434,26.318292906961602]},{\"name\":\"南平市\",\"coord\":[118.16153136678187,27.306303151805437]},{\"name\":\"抚州市\",\"coord\":[116.3455359885574,27.487043655935366]},{\"name\":\"鹰潭市\",\"coord\":[117.01082360702333,28.241253742969946]},{\"name\":\"吉安市\",\"coord\":[114.91377151807418,26.957486660664525]},{\"name\":\"赣州市\",\"coord\":[115.046455717572,25.81565075681663]},{\"name\":\"郴州市\",\"coord\":[113.1544526703492,25.871927095452524]},{\"name\":\"新余市\",\"coord\":[114.94161795877827,27.79044654578371]},{\"name\":\"宜春市\",\"coord\":[115.04574494880995,28.306428044943356]},{\"name\":\"南昌市\",\"coord\":[115.9963824234495,28.664803351584705]},{\"name\":\"九江市\",\"coord\":[115.53225905704193,29.362905920276297]},{\"name\":\"上饶市\",\"coord\":[117.8595355766598,28.765755150094634]},{\"name\":\"景德镇市\",\"coord\":[117.25387030721845,29.33426823662448]},{\"name\":\"黄山市\",\"coord\":[117.85476357809696,29.969632034273722]},{\"name\":\"池州市\",\"coord\":[117.34517113140791,30.208089337922335]},{\"name\":\"铜陵市\",\"coord\":[117.93160431300694,30.926442655001676]},{\"name\":\"安庆市\",\"coord\":[116.54307680610799,30.524265461641296]},{\"name\":\"黄石市\",\"coord\":[115.02354597728443,29.924060229331015]},{\"name\":\"咸宁市\",\"coord\":[114.26967602231792,29.652174021136048]},{\"name\":\"黄冈市\",\"coord\":[115.2859016705373,30.65856897065683]},{\"name\":\"武汉市\",\"coord\":[114.34552076948799,30.68836237966767]},{\"name\":\"随州市\",\"coord\":[113.3850627838818,31.87891659924412]},{\"name\":\"信阳市\",\"coord\":[114.81374730587638,32.0309685135914]},{\"name\":\"驻马店市\",\"coord\":[114.07756451509235,32.896720987266114]},{\"name\":\"商洛市\",\"coord\":[109.82044421310393,33.77403373563189]},{\"name\":\"西安市\",\"coord\":[109.11839808451401,34.225257215515896]},{\"name\":\"渭南市\",\"coord\":[109.75732444226935,35.025913644359306]},{\"name\":\"铜川市\",\"coord\":[108.98695328111377,35.19235092947735]},{\"name\":\"咸阳市\",\"coord\":[108.36398776446165,34.84311348287181]},{\"name\":\"三门峡市\",\"coord\":[110.80049688104964,34.31818709571671]},{\"name\":\"运城市\",\"coord\":[111.1736679525165,35.19010372283576]},{\"name\":\"洛阳市\",\"coord\":[111.87577573098216,34.33379926109848]},{\"name\":\"平顶山市\",\"coord\":[112.80931281928427,33.759895800153096]},{\"name\":\"漯河市\",\"coord\":[113.83505724178012,33.70034266174508]},{\"name\":\"许昌市\",\"coord\":[113.78762484088509,34.051835688452435]},{\"name\":\"郑州市\",\"coord\":[113.49619951867594,34.61181797865449]},{\"name\":\"焦作市\",\"coord\":[113.13404280173008,35.134167097471625]},{\"name\":\"晋城市\",\"coord\":[112.7495732073233,35.63186423091449]},{\"name\":\"长治市\",\"coord\":[112.85900842873183,36.45872910742828]},{\"name\":\"临汾市\",\"coord\":[111.49379787924448,36.22810800777857]},{\"name\":\"太原市\",\"coord\":[112.15628804033796,37.91704444063036]},{\"name\":\"吕梁市\",\"coord\":[111.31901105774872,37.712740463356496]},{\"name\":\"晋中市\",\"coord\":[113.08199599739676,37.36532613794343]},{\"name\":\"邯郸市\",\"coord\":[114.41824047234618,36.530119932543315]},{\"name\":\"安阳市\",\"coord\":[113.88883283163116,35.7797611183252]},{\"name\":\"鹤壁市\",\"coord\":[114.3654094911545,35.75770487428472]},{\"name\":\"新乡市\",\"coord\":[113.9184107718167,35.348471214026716]},{\"name\":\"开封市\",\"coord\":[114.52801677500626,34.61371216679872]},{\"name\":\"周口市\",\"coord\":[114.88509782391864,33.69999759722657]},{\"name\":\"阜阳市\",\"coord\":[115.44595951398213,32.98060371610532]},{\"name\":\"淮南市\",\"coord\":[116.68941991880993,32.79972275772595]},{\"name\":\"蚌埠市\",\"coord\":[117.38594715783302,33.106729536033896]},{\"name\":\"淮北市\",\"coord\":[116.69651711889378,33.69527529383458]},{\"name\":\"宿州市\",\"coord\":[117.30175405886838,33.943330421260015]},{\"name\":\"亳州市\",\"coord\":[116.12410804185097,33.46769392946132]},{\"name\":\"商丘市\",\"coord\":[115.59575176872548,34.28339840831147]},{\"name\":\"菏泽市\",\"coord\":[115.53631974831816,35.197319393220624]},{\"name\":\"濮阳市\",\"coord\":[115.3070485514902,35.775883510964334]},{\"name\":\"聊城市\",\"coord\":[115.8870069012884,36.40529594548765]},{\"name\":\"邢台市\",\"coord\":[114.74259008644859,37.251396750084155]},{\"name\":\"石家庄市\",\"coord\":[114.56923838363613,38.13141710980106]},{\"name\":\"阳泉市\",\"coord\":[113.39216149668508,38.09075470547468]},{\"name\":\"保定市\",\"coord\":[115.261524468934,39.09118520781398]},{\"name\":\"衡水市\",\"coord\":[115.8182936677897,37.715661598187154]},{\"name\":\"德州市\",\"coord\":[116.4582273790399,37.19372347888644]},{\"name\":\"沧州市\",\"coord\":[116.76192710911863,38.20240042039232]},{\"name\":\"廊坊市\",\"coord\":[116.50410772133856,39.27896741763884]},{\"name\":\"天津市\",\"coord\":[117.31988934444873,39.37154482470619]},{\"name\":\"北京市\",\"coord\":[116.59734730757869,40.237112944270976]},{\"name\":\"张家口市\",\"coord\":[115.1823606483226,40.83732566607167]},{\"name\":\"唐山市\",\"coord\":[117.8693184261954,39.71862889477249]},{\"name\":\"秦皇岛市\",\"coord\":[119.30467355367742,39.990574652162564]},{\"name\":\"承德市\",\"coord\":[117.16275671911026,41.36623845548547]},{\"name\":\"葫芦岛市\",\"coord\":[119.9342336210531,40.5628822626519]},{\"name\":\"朝阳市\",\"coord\":[120.11853493535794,41.471852354885755]},{\"name\":\"赤峰市\",\"coord\":[118.50943546234379,43.25452976059767]},{\"name\":\"锦州市\",\"coord\":[121.5167549323861,41.45933087433065]},{\"name\":\"营口市\",\"coord\":[122.58571915054674,40.42093503997384]},{\"name\":\"丹东市\",\"coord\":[124.33549382902183,40.46369290272115]},{\"name\":\"辽阳市\",\"coord\":[123.34064798039414,41.152331397771356]},{\"name\":\"盘锦市\",\"coord\":[122.06718005354679,41.05573599862555]},{\"name\":\"阜新市\",\"coord\":[121.93889757908204,42.27641773244204]},{\"name\":\"鞍山市\",\"coord\":[122.78904432242356,40.77781183142038]},{\"name\":\"沈阳市\",\"coord\":[122.99508899709724,42.1162195010079]},{\"name\":\"铁岭市\",\"coord\":[124.23100515588399,42.72666083611828]},{\"name\":\"扶顺市\",\"coord\":[124.46027188217573,41.82955407638859]},{\"name\":\"通辽市\",\"coord\":[122.0729370657937,43.90889130864869]},{\"name\":\"兴安盟\",\"coord\":[120.79456431092532,45.92003249442161]},{\"name\":\"白城市\",\"coord\":[123.10619907715235,45.25475749267784]},{\"name\":\"齐齐哈尔市\",\"coord\":[124.5462214659102,47.55395009317394]},{\"name\":\"大兴安岭地区\",\"coord\":[124.50992855161529,52.18438447846694]},{\"name\":\"黑河市\",\"coord\":[127.14721400335922,49.25080134026901]},{\"name\":\"大庆市\",\"coord\":[124.40329830095243,46.401048760966745]},{\"name\":\"绥化市\",\"coord\":[126.5214484055605,46.76992452194825]},{\"name\":\"松原市\",\"coord\":[124.21244334807682,44.75779381338502]},{\"name\":\"四平市\",\"coord\":[124.27839350328821,43.52139065090318]},{\"name\":\"通化市\",\"coord\":[125.67392830706305,41.91771808663852]},{\"name\":\"辽源市\",\"coord\":[125.33529527643432,42.758340204944986]},{\"name\":\"吉林市\",\"coord\":[126.83350281902375,43.60730120049175]},{\"name\":\"长春市\",\"coord\":[125.53597875970374,44.24624314701737]},{\"name\":\"白山市\",\"coord\":[127.16780160322108,42.093893880305075]},{\"name\":\"哈尔滨市\",\"coord\":[127.39125008786029,45.36200668820575]},{\"name\":\"鹤岗市\",\"coord\":[130.4703811258197,47.66520688940109]},{\"name\":\"伊春市\",\"coord\":[128.91240831703635,47.93833794565277]},{\"name\":\"七台河市\",\"coord\":[131.2677920224311,45.945099776108584]},{\"name\":\"鸡西市\",\"coord\":[132.38059153660274,45.722934218318535]},{\"name\":\"双鸭山市\",\"coord\":[132.3184817002743,46.65813679030265]},{\"name\":\"佳木斯市\",\"coord\":[132.26174446608726,47.17569713691394]},{\"name\":\"呼伦贝尔市\",\"coord\":[122.3210739998419,50.18176996070858]},{\"name\":\"孝感市\",\"coord\":[113.83749892135485,31.11757234692128]},{\"name\":\"贵港市\",\"coord\":[110.07354588052804,23.380735604767374]},{\"name\":\"黔南布依族苗族自\",\"coord\":[107.30931767543106,26.2976919432269]},{\"name\":\"宁德市\",\"coord\":[119.52482556634342,27.013151692716413]},{\"name\":\"温州市\",\"coord\":[120.30037042732202,27.8699145504001]},{\"name\":\"台州市\",\"coord\":[120.88886782713843,28.670799172772313]},{\"name\":\"丽水市\",\"coord\":[119.56796851966463,28.170268394477755]},{\"name\":\"衢州市\",\"coord\":[118.79479802644406,28.865874397158763]},{\"name\":\"金华市\",\"coord\":[119.99381920686633,29.093455548185744]},{\"name\":\"绍兴市\",\"coord\":[120.46546691682343,29.69382513836818]},{\"name\":\"宁波市\",\"coord\":[121.42142987830871,29.70001162878972]},{\"name\":\"杭州市\",\"coord\":[119.4405685790891,29.87218307296989]},{\"name\":\"宣城市\",\"coord\":[118.68748382914703,30.628143499626418]},{\"name\":\"湖州市\",\"coord\":[119.98261306633574,30.7945175862809]},{\"name\":\"嘉兴市\",\"coord\":[120.83889215988998,30.67538495499343]},{\"name\":\"上海市\",\"coord\":[121.37534147322967,31.25628247908459]},{\"name\":\"苏州市\",\"coord\":[120.6906182622391,31.381280695137775]},{\"name\":\"无锡市\",\"coord\":[120.32182300914366,31.54113306724517]},{\"name\":\"常州市\",\"coord\":[119.61953292830165,31.611878565375576]},{\"name\":\"南京市\",\"coord\":[118.71890548838064,31.910863187910323]},{\"name\":\"镇江市\",\"coord\":[119.42349332902813,31.97942313430778]},{\"name\":\"合肥市\",\"coord\":[117.30651975617157,31.79407863049138]},{\"name\":\"六安市\",\"coord\":[116.24668220575353,31.820846193819513]},{\"name\":\"滁州市\",\"coord\":[117.88422385307969,32.51792621904418]},{\"name\":\"泰州市\",\"coord\":[120.03124303305091,32.56503102346783]},{\"name\":\"南通市\",\"coord\":[120.85599446760912,32.18496706099728]},{\"name\":\"盐城市\",\"coord\":[120.01812490612667,33.54219948734023]},{\"name\":\"淮安市\",\"coord\":[119.0749424205415,33.39203631772854]},{\"name\":\"宿迁市\",\"coord\":[118.45404943216346,33.666258719120265]},{\"name\":\"徐州市\",\"coord\":[117.77482249295966,34.30847766157078]},{\"name\":\"济宁市\",\"coord\":[116.74147276546373,35.27488504351119]},{\"name\":\"枣庄市\",\"coord\":[117.43359942491492,34.884162021736]},{\"name\":\"连云港市\",\"coord\":[119.01553213785074,34.54316517587849]},{\"name\":\"临沂市\",\"coord\":[118.31478835349617,35.28173079028279]},{\"name\":\"日照市\",\"coord\":[119.14265350444272,35.54479073199592]},{\"name\":\"青岛市\",\"coord\":[120.27779044405756,36.3464117375903]},{\"name\":\"威海市\",\"coord\":[122.12963327195605,37.13879077904251]},{\"name\":\"烟台市\",\"coord\":[120.7689567423966,37.19772002195597]},{\"name\":\"潍坊市\",\"coord\":[119.02178548592039,36.49292234053931]},{\"name\":\"淄博市\",\"coord\":[117.92936024367185,36.60871347163638]},{\"name\":\"泰安市\",\"coord\":[116.93810893944303,36.0423330118612]},{\"name\":\"济南市\",\"coord\":[117.34560282551296,36.769574973846304]},{\"name\":\"东营市\",\"coord\":[118.4915054457184,37.52194690335787]},{\"name\":\"滨州市\",\"coord\":[117.67610299757533,37.4439597758601]},{\"name\":\"昆明市\",\"coord\":[102.93100245594789,25.481300763922075]},{\"name\":\"玉溪市\",\"coord\":[102.23080854291823,24.156168324611663]},{\"name\":\"塔城地区\",\"coord\":[83.60908162840168,45.3721852373893]},{\"name\":\"张掖市\",\"coord\":[100.47710030600572,38.704239320458385]},{\"name\":\"南阳市\",\"coord\":[112.1400670951149,33.03033276715801]},{\"name\":\"扬州市\",\"coord\":[119.48949608990988,32.80956776339646]},{\"name\":\"延边朝鲜族自治州\",\"coord\":[129.3577692895626,43.24968794080283]},{\"name\":\"牡丹江市\",\"coord\":[129.87240796405672,44.7073040108322]},{\"name\":\"澳门\",\"coord\":[113.56289691515346,22.14602596262204]},{\"name\":\"吴忠市\",\"coord\":[106.76894508116403,37.72566765880316]},{\"name\":\"来宾市\",\"coord\":[109.25592217010114,23.86346274681084]},{\"name\":\"平凉市\",\"coord\":[107.0708132782897,35.30329631658711]},{\"name\":\"马鞍山市\",\"coord\":[118.27245878467022,31.657727937739004]},{\"name\":\"芜湖市\",\"coord\":[118.32992684415504,31.081688223101658]},{\"name\":\"澄迈县\",\"coord\":[110.04198076060266,19.694955078668105]},{\"name\":\"保亭黎族苗族自治\",\"coord\":[109.6055304964257,18.6101488675304]},{\"name\":\"乐东黎族自治县\",\"coord\":[109.04051999525574,18.643137437909203]},{\"name\":\"儋州市\",\"coord\":[109.3431358337404,19.550974957403195]},{\"name\":\"定安县\",\"coord\":[110.38744429685676,19.47557074114284]},{\"name\":\"屯昌县\",\"coord\":[110.00574767630334,19.367175093044388]},{\"name\":\"白沙黎族自治县\",\"coord\":[109.36860737761768,19.214416393082217]},{\"name\":\"琼中黎族苗族自治\",\"coord\":[109.86691465937548,19.073671135862682]},{\"name\":\"东方市\",\"coord\":[108.86903802405428,19.017352815445214]},{\"name\":\"昌江黎族自治县\",\"coord\":[108.9686431884767,19.182594167127824]},{\"name\":\"海口市\",\"coord\":[110.420654296875,19.806565564640795]},{\"name\":\"济源市\",\"coord\":[112.38051465474433,35.07958362422394]},{\"name\":\"五指山市\",\"coord\":[109.53595187364496,18.832908264613966]},{\"name\":\"大连市\",\"coord\":[121.96662235866603,39.444150542439914]},{\"name\":\"文昌市三沙市\",\"coord\":[110.81828537536748,19.756501444162936]},{\"name\":\"三亚市\",\"coord\":[109.38424600793707,18.39186315877128]},{\"name\":\"万宁市\",\"coord\":[110.28485046979574,18.860240588635115]},{\"name\":\"陵水黎族自治县\",\"coord\":[109.95577603229562,18.594712684620465]},{\"name\":\"临高县\",\"coord\":[109.71915395436967,19.79420403032508]},{\"name\":\"琼海市\",\"coord\":[110.41650700703043,19.22315873149372]}]");
  80833. ;// CONCATENATED MODULE: ./src/openlayers/mapping/webmap/config/SampleDataInfo.json
  80834. const SampleDataInfo_namespaceObject = JSON.parse("[{\"id\":\"SalesJan2009\",\"fileName\":\"SalesJan2009\",\"xField\":\"Longitude\",\"yField\":\"Latitude\",\"type\":\"POINT\"},{\"id\":\"Sacramentorealestatetransactions\",\"fileName\":\"Ealestate transactions\",\"xField\":\"longitude\",\"yField\":\"latitude\",\"type\":\"POINT\"},{\"id\":\"BeijingResidentialDistrict\",\"fileName\":\"北京市住宅小区\",\"xField\":\"SmX\",\"yField\":\"SmY\",\"type\":\"POINT\"},{\"id\":\"GlobalRecordOfOver7Earthquakes\",\"fileName\":\"全球历史7级以上地震记录\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"ChinaRecordOfOver6Earthquakes\",\"fileName\":\"中国历史6级以上地震记录\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"ChinaMeteorologicalObservationStation\",\"fileName\":\"中国气象观测站\",\"xField\":\"经度\",\"yField\":\"纬度\",\"type\":\"POINT\"},{\"id\":\"BeijingSubwayLine\",\"fileName\":\"北京市地铁交通线路\",\"type\":\"LINE\"},{\"id\":\"ChinaEarthquakeIntensityZone\",\"fileName\":\"中国地震烈度区划面\",\"type\":\"POLYGON\"}]");
  80835. ;// CONCATENATED MODULE: external "ol.View"
  80836. const external_ol_View_namespaceObject = ol.View;
  80837. var external_ol_View_default = /*#__PURE__*/__webpack_require__.n(external_ol_View_namespaceObject);
  80838. ;// CONCATENATED MODULE: external "ol.proj.proj4"
  80839. const external_ol_proj_proj4_namespaceObject = ol.proj.proj4;
  80840. ;// CONCATENATED MODULE: external "ol.proj.Units"
  80841. const external_ol_proj_Units_namespaceObject = ol.proj.Units;
  80842. var external_ol_proj_Units_default = /*#__PURE__*/__webpack_require__.n(external_ol_proj_Units_namespaceObject);
  80843. ;// CONCATENATED MODULE: external "ol.layer"
  80844. const external_ol_layer_namespaceObject = ol.layer;
  80845. ;// CONCATENATED MODULE: external "ol.format.WMTSCapabilities"
  80846. const external_ol_format_WMTSCapabilities_namespaceObject = ol.format.WMTSCapabilities;
  80847. var external_ol_format_WMTSCapabilities_default = /*#__PURE__*/__webpack_require__.n(external_ol_format_WMTSCapabilities_namespaceObject);
  80848. ;// CONCATENATED MODULE: external "ol.geom"
  80849. const external_ol_geom_namespaceObject = ol.geom;
  80850. ;// CONCATENATED MODULE: external "ol.source"
  80851. const external_ol_source_namespaceObject = ol.source;
  80852. ;// CONCATENATED MODULE: external "ol.render.Feature"
  80853. const external_ol_render_Feature_namespaceObject = ol.render.Feature;
  80854. var external_ol_render_Feature_default = /*#__PURE__*/__webpack_require__.n(external_ol_render_Feature_namespaceObject);
  80855. ;// CONCATENATED MODULE: external "ol.Collection"
  80856. const external_ol_Collection_namespaceObject = ol.Collection;
  80857. var external_ol_Collection_default = /*#__PURE__*/__webpack_require__.n(external_ol_Collection_namespaceObject);
  80858. ;// CONCATENATED MODULE: ./src/openlayers/mapping/WebMap.js
  80859. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  80860. * This program are made available under the terms of the Apache License, Version 2.0
  80861. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  80862. // eslint-disable-line import/extensions
  80863. // eslint-disable-line import/extensions
  80864. // eslint-disable-line import/extensions
  80865. window.proj4 = lib;
  80866. window.Proj4js = lib;
  80867. //数据转换工具
  80868. const transformTools = new (external_ol_format_GeoJSON_default())();
  80869. // 迁徙图最大支持要素数量
  80870. const MAX_MIGRATION_ANIMATION_COUNT = 1000;
  80871. //不同坐标系单位。计算公式中的值
  80872. const metersPerUnit = {
  80873. DEGREES: 2 * Math.PI * 6370997 / 360,
  80874. DEGREE: 2 * Math.PI * 6370997 / 360,
  80875. FEET: 0.3048,
  80876. METERS: 1,
  80877. METER: 1,
  80878. M: 1,
  80879. USFEET: 1200 / 3937
  80880. };
  80881. const dpiConfig = {
  80882. default: 96, // 常用dpi
  80883. iServerWMTS: 90.7142857142857 // iserver使用的wmts图层dpi
  80884. }
  80885. /**
  80886. * @class ol.supermap.WebMap
  80887. * @category iPortal/Online
  80888. * @classdesc 对接 iPortal/Online 地图类
  80889. * @param {Object} options - 参数
  80890. * @param {string} [options.target='map'] - 地图容器id
  80891. * @param {Object | string} [options.webMap] - webMap对象,或者是获取webMap的url地址。存在webMap,优先使用webMap, id的选项则会被忽略
  80892. * @param {number} [options.id] - 地图的id
  80893. * @param {string} [options.server="https://www.supermapol.com"] - 地图的地址,如果使用传入id,server则会和id拼接成webMap请求地址
  80894. * @param {function} [options.successCallback] - 成功加载地图后调用的函数
  80895. * @param {function} [options.errorCallback] - 加载地图失败调用的函数
  80896. * @param {string} [options.credentialKey] - 凭证密钥。例如为"key"、"token",或者用户自定义的密钥。用户申请了密钥,此参数必填
  80897. * @param {string} [options.credentialValue] - 凭证密钥对应的值,credentialKey和credentialValue必须一起使用
  80898. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie
  80899. * @param {boolean} [options.excludePortalProxyUrl] - server传递过来的url是否带有代理
  80900. * @param {Object} [options.serviceProxy] - iportal内置代理信息, 仅矢量瓦片图层上图才会使用
  80901. * @param {string} [options.tiandituKey] - 天地图的key
  80902. * @param {string} [options.proxy] - 代理地址,当域名不一致,请求会加上代理。避免跨域
  80903. * @param {string} [options.tileFormat] - 地图瓦片出图格式,png/webp
  80904. * @param {function} [options.mapSetting.mapClickCallback] - 地图被点击的回调函数
  80905. * @param {function} [options.mapSetting.overlays] - 地图的overlayer
  80906. * @param {function} [options.mapSetting.controls] - 地图的控件
  80907. * @param {function} [options.mapSetting.interactions] - 地图控制的参数
  80908. * @extends {ol/Observable}
  80909. */
  80910. class WebMap extends (external_ol_Observable_default()) {
  80911. constructor(id, options) {
  80912. super();
  80913. if (core_Util_Util.isObject(id)) {
  80914. options = id;
  80915. this.mapId = options.id;
  80916. } else {
  80917. this.mapId = id;
  80918. }
  80919. options = options || {};
  80920. this.server = options.server;
  80921. this.successCallback = options.successCallback;
  80922. this.errorCallback = options.errorCallback;
  80923. this.credentialKey = options.credentialKey;
  80924. this.credentialValue = options.credentialValue;
  80925. this.withCredentials = options.withCredentials || false;
  80926. this.target = options.target || "map";
  80927. this.excludePortalProxyUrl = options.excludePortalProxyUrl || false;
  80928. this.serviceProxy = options.serviceProxy || null;
  80929. this.tiandituKey = options.tiandituKey;
  80930. this.proxy = options.proxy;
  80931. //计数叠加图层,处理过的数量(成功和失败都会计数)
  80932. this.layerAdded = 0;
  80933. this.layers = [];
  80934. this.events = new Events(this, null, ["updateDataflowFeature"], true);
  80935. this.webMap = options.webMap;
  80936. this.tileFormat = options.tileFormat && options.tileFormat.toLowerCase();
  80937. this.createMap(options.mapSetting);
  80938. if (this.webMap) {
  80939. // webmap有可能是url地址,有可能是webmap对象
  80940. core_Util_Util.isString(this.webMap) ? this.createWebmap(this.webMap) : this.getMapInfoSuccess(options.webMap);
  80941. } else {
  80942. if (!this.server) {
  80943. this.server = 'https://www.supermapol.com';
  80944. }
  80945. this.createWebmap();
  80946. }
  80947. }
  80948. /**
  80949. * @private
  80950. * @function ol.supermap.WebMap.prototype._removeBaseLayer
  80951. * @description 移除底图
  80952. */
  80953. _removeBaseLayer() {
  80954. const map = this.map;
  80955. const {layer, labelLayer} = this.baseLayer;
  80956. // 移除天地图标签图层
  80957. labelLayer && map.removeLayer(labelLayer);
  80958. // 移除图层
  80959. layer && map.removeLayer(layer);
  80960. this.baseLayer = null;
  80961. }
  80962. /**
  80963. * @private
  80964. * @function ol.supermap.WebMap.prototype._removeLayers
  80965. * @description 移除叠加图层
  80966. */
  80967. _removeLayers() {
  80968. const map = this.map;
  80969. this.layers.forEach(({layerType, layer, labelLayer, pathLayer, dataflowService}) => {
  80970. if (!layer) {
  80971. return;
  80972. }
  80973. if (layerType === 'MIGRATION') {
  80974. layer.remove();
  80975. return;
  80976. }
  80977. if (layerType === 'DATAFLOW_POINT_TRACK' || layerType === 'DATAFLOW_HEAT') {
  80978. // 移除轨迹图层
  80979. pathLayer && map.removeLayer(pathLayer);
  80980. // 取消订阅
  80981. dataflowService && dataflowService.unSubscribe();
  80982. }
  80983. // 移除标签图层
  80984. labelLayer && map.removeLayer(labelLayer);
  80985. // 移除图层
  80986. map.removeLayer(layer)
  80987. });
  80988. this.layers = [];
  80989. }
  80990. /**
  80991. * @private
  80992. * @function ol.supermap.WebMap.prototype.clear
  80993. * @description 清空地图
  80994. */
  80995. _clear() {
  80996. // 比例尺
  80997. this.scales = [];
  80998. // 分辨率
  80999. this.resolutionArray = [];
  81000. // 比例尺-分辨率 {scale: resolution}
  81001. this.resolutions = {};
  81002. // 计数叠加图层,处理过的数量(成功和失败都会计数)
  81003. this.layerAdded = 0;
  81004. this._removeBaseLayer();
  81005. this._removeLayers();
  81006. }
  81007. /**
  81008. * @function ol.supermap.WebMap.prototype.refresh
  81009. * @version 10.1.0
  81010. * @description 重新渲染地图
  81011. */
  81012. refresh() {
  81013. this._clear();
  81014. this.createWebmap();
  81015. }
  81016. /**
  81017. * @private
  81018. * @function ol.supermap.WebMap.prototype.createMap
  81019. * @description 创建地图对象以及注册地图事件
  81020. * @param {object} mapSetting - 关于地图的设置以及需要注册的事件
  81021. */
  81022. createMap(mapSetting) {
  81023. let overlays, controls, interactions;
  81024. if (mapSetting) {
  81025. interactions = mapSetting.interactions;
  81026. overlays = mapSetting.overlays;
  81027. controls = mapSetting.controls;
  81028. }
  81029. this.map = new (external_ol_Map_default())({
  81030. interactions: interactions,
  81031. overlays: overlays,
  81032. controls: controls,
  81033. target: this.target
  81034. });
  81035. mapSetting && this.registerMapEvent({
  81036. mapClickCallback: mapSetting.mapClickCallback
  81037. });
  81038. }
  81039. /**
  81040. * @private
  81041. * @function ol.supermap.WebMap.prototype.registerMapEvent
  81042. * @description 注册地图事件
  81043. * @param {object} mapSetting - 关于地图的设置以及需要注册的事件
  81044. */
  81045. registerMapEvent(mapSetting) {
  81046. let map = this.map;
  81047. map.on("click", function (evt) {
  81048. mapSetting.mapClickCallback && mapSetting.mapClickCallback(evt);
  81049. });
  81050. }
  81051. /**
  81052. * @private
  81053. * @function ol.supermap.WebMap.prototype.createWebmap
  81054. * @description 创建webmap
  81055. * @param {string} webMapUrl - 请求webMap的地址
  81056. */
  81057. createWebmap(webMapUrl) {
  81058. let mapUrl;
  81059. if (webMapUrl) {
  81060. mapUrl = webMapUrl;
  81061. } else {
  81062. let urlArr = this.server.split('');
  81063. if (urlArr[urlArr.length - 1] !== '/') {
  81064. this.server += '/';
  81065. }
  81066. mapUrl = this.server + 'web/maps/' + this.mapId + '/map';
  81067. let filter = 'getUrlResource.json?url=';
  81068. if (this.excludePortalProxyUrl && this.server.indexOf(filter) > -1) {
  81069. //大屏需求,或者有加上代理的
  81070. let urlArray = this.server.split(filter);
  81071. if (urlArray.length > 1) {
  81072. mapUrl = urlArray[0] + filter + this.server + 'web/maps/' + this.mapId + '/map.json';
  81073. }
  81074. }
  81075. }
  81076. this.getMapInfo(mapUrl);
  81077. }
  81078. /**
  81079. * @private
  81080. * @function ol.supermap.WebMap.prototype.getMapInfo
  81081. * @description 获取地图的json信息
  81082. * @param {string} url - 请求地图的url
  81083. */
  81084. getMapInfo(url) {
  81085. let that = this,
  81086. mapUrl = url;
  81087. if (url.indexOf('.json') === -1) {
  81088. //传递过来的url,没有包括.json,在这里加上。
  81089. mapUrl = `${url}.json`
  81090. }
  81091. FetchRequest.get(that.getRequestUrl(mapUrl), null, {
  81092. withCredentials: this.withCredentials
  81093. }).then(function (response) {
  81094. return response.json();
  81095. }).then(function (mapInfo) {
  81096. that.getMapInfoSuccess(mapInfo);
  81097. }).catch(function (error) {
  81098. that.errorCallback && that.errorCallback(error, 'getMapFaild', that.map);
  81099. });
  81100. }
  81101. /**
  81102. * @private
  81103. * @function ol.supermap.WebMap.prototype.getMapInfoSuccess
  81104. * @description 获取地图的json信息
  81105. * @param {Object} mapInfo - webMap对象
  81106. */
  81107. async getMapInfoSuccess(mapInfo) {
  81108. let that = this;
  81109. if (mapInfo.succeed === false) {
  81110. that.errorCallback && that.errorCallback(mapInfo.error, 'getMapFaild', that.map);
  81111. return;
  81112. }
  81113. let handleResult = await that.handleCRS(mapInfo.projection, mapInfo.baseLayer.url);
  81114. //存储地图的名称以及描述等信息,返回给用户
  81115. that.mapParams = {
  81116. title: mapInfo.title,
  81117. description: mapInfo.description
  81118. };
  81119. if (handleResult.action === "BrowseMap") {
  81120. that.createSpecLayer(mapInfo);
  81121. } else if (handleResult.action === "OpenMap") {
  81122. that.baseProjection = handleResult.newCrs || mapInfo.projection;
  81123. that.webMapVersion = mapInfo.version;
  81124. that.baseLayer = mapInfo.baseLayer;
  81125. // that.mapParams = {
  81126. // title: mapInfo.title,
  81127. // description: mapInfo.description
  81128. // }; //存储地图的名称以及描述等信息,返回给用户
  81129. that.isHaveGraticule = mapInfo.grid && mapInfo.grid.graticule;
  81130. if (mapInfo.baseLayer && mapInfo.baseLayer.layerType === 'MAPBOXSTYLE') {
  81131. // 添加矢量瓦片服务作为底图
  81132. that.addMVTMapLayer(mapInfo, mapInfo.baseLayer, 0).then(() => {
  81133. that.createView(mapInfo);
  81134. if (!mapInfo.layers || mapInfo.layers.length === 0) {
  81135. that.sendMapToUser(0);
  81136. } else {
  81137. that.addLayers(mapInfo);
  81138. }
  81139. that.addGraticule(mapInfo);
  81140. });
  81141. } else {
  81142. await that.addBaseMap(mapInfo);
  81143. if (!mapInfo.layers || mapInfo.layers.length === 0) {
  81144. that.sendMapToUser(0);
  81145. } else {
  81146. that.addLayers(mapInfo);
  81147. }
  81148. that.addGraticule(mapInfo);
  81149. }
  81150. } else {
  81151. // 不支持的坐标系
  81152. that.errorCallback && that.errorCallback({type: "Not support CS", errorMsg: `Not support CS: ${mapInfo.projection}`}, 'getMapFaild', that.map);
  81153. return;
  81154. }
  81155. }
  81156. /**
  81157. * 处理坐标系(底图)
  81158. * @private
  81159. * @param {string} crs 必传参数,值是webmap2中定义的坐标系,可能是 1、EGSG:xxx 2、WKT string
  81160. * @param {string} baseLayerUrl 可选参数,地图的服务地址;用于EPSG:-1 的时候,用于请求iServer提供的wkt
  81161. * @return {Object}
  81162. */
  81163. async handleCRS(crs, baseLayerUrl) {
  81164. let that = this, handleResult = {};
  81165. let newCrs = crs, action = "OpenMap";
  81166. if (crs === "EPSG:-1") {
  81167. // 去iServer请求wkt 否则只能预览出图
  81168. await FetchRequest.get(that.getRequestUrl(`${baseLayerUrl}/prjCoordSys.wkt`), null, {
  81169. withCredentials: that.withCredentials,
  81170. withoutFormatSuffix: true
  81171. }).then(function (response) {
  81172. return response.text();
  81173. }).then(async function (result) {
  81174. if(result.indexOf("<!doctype html>") === -1) {
  81175. that.addProjctionFromWKT(result, "EPSG:-1");
  81176. handleResult = {action, newCrs};
  81177. } else {
  81178. throw 'ERROR';
  81179. }
  81180. }).catch(function () {
  81181. action = "BrowseMap";
  81182. handleResult = {action, newCrs}
  81183. });
  81184. } else {
  81185. if (crs.indexOf("EPSG") === 0 && crs.split(":")[1] <= 0) {
  81186. // 自定义坐标系 rest map EPSG:-1(自定义坐标系) 支持编辑
  81187. // 未知坐标系情况特殊处理,只支持预览 1、rest map EPSG:-1000(没定义坐标系) 2、wms/wmts EPSG:0 (自定义坐标系)
  81188. action = "BrowseMap";
  81189. } else if (crs === 'EPSG:910111' || crs === 'EPSG:910112') {
  81190. // 早期数据存在的自定义坐标系 "EPSG:910111": "GCJ02MERCATOR", "EPSG:910112": "BDMERCATOR"
  81191. newCrs = "EPSG:3857";
  81192. } else if (crs === 'EPSG:910101' || crs === 'EPSG:910102') {
  81193. // 早期数据存在的自定义坐标系 "EPSG:910101": "GCJ02", "EPSG:910102": "BD",
  81194. newCrs = "EPSG:4326";
  81195. } else if (crs.indexOf("EPSG") !== 0) {
  81196. // wkt
  81197. that.addProjctionFromWKT(newCrs);
  81198. newCrs = that.getEpsgInfoFromWKT(crs);
  81199. }
  81200. handleResult = {action, newCrs};
  81201. }
  81202. return handleResult;
  81203. }
  81204. /**
  81205. * @private
  81206. * @function ol.supermap.WebMap.prototype.getScales
  81207. * @description 根据级别获取每个级别对应的分辨率
  81208. * @param {Object} baseLayerInfo - 底图的图层信息
  81209. */
  81210. getScales(baseLayerInfo) {
  81211. let scales = [], resolutions = {}, res, scale, resolutionArray = [],
  81212. coordUnit = baseLayerInfo.coordUnit || external_ol_proj_namespaceObject.get(baseLayerInfo.projection).getUnits();
  81213. if (!coordUnit) {
  81214. coordUnit = this.baseProjection === "EPSG:3857" ? "m" : "degree";
  81215. }
  81216. if (baseLayerInfo.visibleScales && baseLayerInfo.visibleScales.length > 0) {
  81217. //底部设置过固定比例尺,则使用设置的
  81218. baseLayerInfo.visibleScales.forEach(scale => {
  81219. let value = 1 / scale;
  81220. res = this.getResFromScale(value, coordUnit);
  81221. scale = `1:${value.toLocaleString()}`;
  81222. //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
  81223. resolutions[this.formatScale(scale)] = res;
  81224. resolutionArray.push(res);
  81225. scales.push(scale);
  81226. }, this)
  81227. } else if (baseLayerInfo.layerType === 'WMTS') {
  81228. baseLayerInfo.scales.forEach(scale => {
  81229. res = this.getResFromScale(scale, coordUnit, 90.7);
  81230. scale = `1:${scale.toLocaleString()}`;
  81231. //多此一举转换,因为toLocalString会自动保留小数点后三位,and当第二位小数是0就会保存小数点后两位。所有为了统一。
  81232. resolutions[this.formatScale(scale)] = res;
  81233. resolutionArray.push(res);
  81234. scales.push(scale);
  81235. }, this)
  81236. } else {
  81237. let {minZoom = 0, maxZoom = 22} = baseLayerInfo, view = this.map.getView();
  81238. for (let i = minZoom; i <= maxZoom; i++) {
  81239. res = view.getResolutionForZoom(i);
  81240. scale = this.getScaleFromRes(res, coordUnit);
  81241. if (scales.indexOf(scale) === -1) {
  81242. //不添加重复的比例尺
  81243. scales.push(scale);
  81244. let attr = scale.replace(/,/g, "");
  81245. resolutions[attr] = res;
  81246. resolutionArray.push(res);
  81247. }
  81248. }
  81249. }
  81250. this.scales = scales;
  81251. this.resolutions = resolutions;
  81252. this.resolutionArray = resolutionArray;
  81253. }
  81254. /**
  81255. * @private
  81256. * @function ol.supermap.WebMap.prototype.getResFromScale
  81257. * @description 将比例尺转换为分辨率
  81258. * @param {Number} scale - 比例尺
  81259. * @param {String} coordUnit - 比例尺单位
  81260. * @param {Number} dpi
  81261. */
  81262. getResFromScale(scale, coordUnit = "DEGREE", dpi = 96) {
  81263. let mpu = metersPerUnit[coordUnit.toUpperCase()];
  81264. return scale * .0254 / dpi / mpu;
  81265. }
  81266. /**
  81267. * @private
  81268. * @function ol.supermap.WebMap.prototype.getScaleFromRes
  81269. * @description 将分辨率转换为比例尺
  81270. * @param {Number} resolution - 分辨率
  81271. * @param {String} coordUnit - 比例尺单位
  81272. * @param {Number} dpi
  81273. */
  81274. getScaleFromRes(resolution, coordUnit = "DEGREE", dpi = 96) {
  81275. let scale, mpu = metersPerUnit[coordUnit.toUpperCase()];
  81276. scale = resolution * dpi * mpu / .0254;
  81277. return '1:' + scale.toLocaleString();
  81278. }
  81279. /**
  81280. * @private
  81281. * @function ol.supermap.WebMap.prototype.formatScale
  81282. * @description 将有千位符的数字转为普通数字。例如:1,234 => 1234
  81283. * @param {number} scale - 比例尺分母
  81284. */
  81285. formatScale(scale) {
  81286. return scale.replace(/,/g, "");
  81287. }
  81288. /**
  81289. * @private
  81290. * @function ol.supermap.WebMap.prototype.createSpecLayer
  81291. * @description 创建坐标系为0和-1000的图层
  81292. * @param {object} mapInfo - 地图信息
  81293. */
  81294. createSpecLayer(mapInfo) {
  81295. let me = this,
  81296. baseLayerInfo = mapInfo.baseLayer,
  81297. url = baseLayerInfo.url,
  81298. baseLayerType = baseLayerInfo.layerType;
  81299. let extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  81300. let proj = new external_ol_proj_namespaceObject.Projection({
  81301. extent,
  81302. units: 'm',
  81303. code: 'EPSG:0'
  81304. });
  81305. external_ol_proj_namespaceObject.addProjection(proj);
  81306. let options = {
  81307. center: mapInfo.center,
  81308. level: 0
  81309. }
  81310. //添加view
  81311. me.baseProjection = proj;
  81312. let viewOptions = {
  81313. center: options.center ? [options.center.x, options.center.y] : [0, 0],
  81314. zoom: 0,
  81315. projection: proj
  81316. }
  81317. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6
  81318. viewOptions.multiWorld = true;
  81319. }
  81320. let view = new (external_ol_View_default())(viewOptions);
  81321. me.map.setView(view);
  81322. if (me.mapParams) {
  81323. me.mapParams.extent = extent;
  81324. me.mapParams.projection = mapInfo.projection;
  81325. }
  81326. if (url && url.indexOf("?token=") > -1) {
  81327. //兼容iserver地址有token的情况
  81328. me.credentialKey = 'token';
  81329. me.credentialValue = mapInfo.baseLayer.credential = url.split("?token=")[1];
  81330. url = url.split("?token=")[0];
  81331. }
  81332. let source;
  81333. if (baseLayerType === "TILE") {
  81334. FetchRequest.get(me.getRequestUrl(`${url}.json`), null, {
  81335. withCredentials: this.withCredentials
  81336. }).then(function (response) {
  81337. return response.json();
  81338. }).then(function (result) {
  81339. baseLayerInfo.originResult = result;
  81340. let serverType = "IPORTAL", credential = baseLayerInfo.credential, keyfix = 'Token', keyParams = baseLayerInfo.url;
  81341. if (baseLayerInfo.url.indexOf("www.supermapol.com") > -1 || baseLayerInfo.url.indexOf("itest.supermapol.com") > -1) {
  81342. keyfix = 'Key';
  81343. keyParams = [keyParams];
  81344. serverType = "ONLINE";
  81345. }
  81346. if (credential) {
  81347. SecurityManager[`register${keyfix}`](keyParams, credential);
  81348. }
  81349. let options = {
  81350. serverType,
  81351. url,
  81352. tileGrid: TileSuperMapRest.optionsFromMapJSON(url, result).tileGrid
  81353. }
  81354. if (url && !me.isSameDomain(url)) {
  81355. options.tileProxy = me.server + 'apps/viewer/getUrlResource.png?url=';
  81356. }
  81357. source = new TileSuperMapRest(options);
  81358. me.addSpecToMap(source);
  81359. }).catch(function (error) {
  81360. me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map);
  81361. });
  81362. } else if (baseLayerType === "WMS") {
  81363. source = me.createWMSSource(baseLayerInfo);
  81364. me.addSpecToMap(source);
  81365. } else if (baseLayerType === "WMTS") {
  81366. FetchRequest.get(me.getRequestUrl(url, true), null, {
  81367. withCredentials: this.withCredentials
  81368. }).then(function (response) {
  81369. return response.text();
  81370. }).then(function (capabilitiesText) {
  81371. baseLayerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  81372. baseLayerInfo.scales = me.getWMTSScales(baseLayerInfo.tileMatrixSet, capabilitiesText);
  81373. baseLayerInfo.dpi = dpiConfig.iServerWMTS;
  81374. source = me.createWMTSSource(baseLayerInfo);
  81375. me.addSpecToMap(source);
  81376. }).catch(function (error) {
  81377. me.errorCallback && me.errorCallback(error, 'getMapFaild', me.map);
  81378. })
  81379. } else {
  81380. me.errorCallback && me.errorCallback({type: "Not support CS", errorMsg: `Not support CS: ${baseLayerType}`}, 'getMapFaild', me.map);
  81381. }
  81382. view && view.fit(extent);
  81383. }
  81384. /**
  81385. * @private
  81386. * @function ol.supermap.WebMap.prototype.addSpecToMap
  81387. * @description 将坐标系为0和-1000的图层添加到地图上
  81388. * @param {object} mapInfo - 地图信息
  81389. */
  81390. addSpecToMap(source) {
  81391. let layer = new external_ol_layer_namespaceObject.Tile({
  81392. source: source,
  81393. zIndex: 0
  81394. });
  81395. this.map.addLayer(layer);
  81396. this.sendMapToUser(0);
  81397. }
  81398. /**
  81399. * @private
  81400. * @function ol.supermap.WebMap.prototype.getWMTSScales
  81401. * @description 获取wmts的比例尺
  81402. * @param {object} identifier - 图层存储的标识信息
  81403. * @param {object} capabilitiesText - wmts信息
  81404. */
  81405. getWMTSScales(identifier, capabilitiesText) {
  81406. const format = new (external_ol_format_WMTSCapabilities_default())();
  81407. let capabilities = format.read(capabilitiesText);
  81408. let content = capabilities.Contents,
  81409. tileMatrixSet = content.TileMatrixSet;
  81410. let scales = [];
  81411. for (let i = 0; i < tileMatrixSet.length; i++) {
  81412. if (tileMatrixSet[i].Identifier === identifier) {
  81413. for (let h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) {
  81414. scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator)
  81415. }
  81416. break;
  81417. }
  81418. }
  81419. return scales;
  81420. }
  81421. /**
  81422. * @private
  81423. * @function ol.supermap.WebMap.prototype.addBaseMap
  81424. * @description 添加底图
  81425. * @param {string} mapInfo - 请求地图的url
  81426. */
  81427. async addBaseMap(mapInfo) {
  81428. let {baseLayer} = mapInfo, layerType = baseLayer.layerType;
  81429. //底图,使用默认的配置,不用存储的
  81430. if (layerType !== 'TILE' && layerType !== 'WMS' && layerType !== 'WMTS') {
  81431. this.getInternetMapInfo(baseLayer);
  81432. } else if (layerType === 'WMTS') {
  81433. // 通过请求完善信息
  81434. await this.getWmtsInfo(baseLayer);
  81435. } else if (layerType === 'TILE') {
  81436. await this.getTileInfo(baseLayer);
  81437. }
  81438. baseLayer.projection = mapInfo.projection;
  81439. if (!baseLayer.extent) {
  81440. baseLayer.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  81441. }
  81442. this.createView(mapInfo);
  81443. let layer = this.createBaseLayer(baseLayer, 0, null, null, true);
  81444. //底图增加图层类型,DV分享需要用它来识别版权信息
  81445. layer.setProperties({
  81446. layerType: layerType
  81447. });
  81448. this.map.addLayer(layer);
  81449. if (this.mapParams) {
  81450. this.mapParams.extent = baseLayer.extent;
  81451. this.mapParams.projection = mapInfo.projection;
  81452. }
  81453. if (baseLayer.labelLayerVisible) {
  81454. //存在天地图路网
  81455. let labelLayer = new external_ol_layer_namespaceObject.Tile({
  81456. source: this.createTiandituSource(baseLayer.layerType, mapInfo.projection, true),
  81457. zIndex: baseLayer.zIndex || 1,
  81458. visible: baseLayer.visible
  81459. });
  81460. this.map.addLayer(labelLayer);
  81461. // 挂载带baseLayer上,便于删除
  81462. baseLayer.labelLayer = labelLayer;
  81463. }
  81464. }
  81465. /**
  81466. * @private
  81467. * @function ol.supermap.WebMap.prototype.addMVTMapLayer
  81468. * @description 添加地图服务mapboxstyle图层
  81469. * @param {object} mapInfo - 地图信息
  81470. * @param {object} layerInfo - mapboxstyle图层信息
  81471. */
  81472. addMVTMapLayer(mapInfo, layerInfo, zIndex) {
  81473. layerInfo.zIndex = zIndex;
  81474. // 获取地图详细信息
  81475. return this.getMapboxStyleLayerInfo(mapInfo, layerInfo).then((msLayerInfo) => {
  81476. // 创建图层
  81477. return this.createMVTLayer(msLayerInfo).then(layer => {
  81478. let layerID = core_Util_Util.newGuid(8);
  81479. if (layerInfo.name) {
  81480. layer.setProperties({
  81481. name: layerInfo.name,
  81482. layerID: layerID,
  81483. layerType: 'VECTOR_TILE'
  81484. });
  81485. }
  81486. layerInfo.visibleScale && this.setVisibleScales(layer, layerInfo.visibleScale);
  81487. //否则没有ID,对不上号
  81488. layerInfo.layer = layer;
  81489. layerInfo.layerID = layerID;
  81490. this.map.addLayer(layer);
  81491. });
  81492. });
  81493. }
  81494. /**
  81495. * @private
  81496. * @function ol.supermap.WebMap.prototype.createView
  81497. * @description 创建地图视图
  81498. * @param {object} options - 关于地图的信息
  81499. */
  81500. createView(options) {
  81501. let oldcenter = options.center,
  81502. zoom = options.level !== undefined ? options.level : 1,
  81503. maxZoom = options.maxZoom || 22,
  81504. extent,
  81505. projection = this.baseProjection;
  81506. let center = [];
  81507. for (let key in oldcenter) {
  81508. center.push(oldcenter[key]);
  81509. }
  81510. if (center.length === 0) {
  81511. //兼容wms
  81512. center = [0, 0];
  81513. }
  81514. //与DV一致用底图的默认范围,不用存储的范围。否则会导致地图拖不动
  81515. this.baseLayerExtent = extent = options.baseLayer && options.baseLayer.extent;
  81516. if (this.mapParams) {
  81517. this.mapParams.extent = extent;
  81518. this.mapParams.projection = projection;
  81519. }
  81520. //当前中心点不在extent内,就用extent的中心点 todo
  81521. !(0,external_ol_extent_namespaceObject.containsCoordinate)(extent, center) && (center = (0,external_ol_extent_namespaceObject.getCenter)(extent));
  81522. // 计算当前最大分辨率
  81523. let baseLayer = options.baseLayer;
  81524. let maxResolution;
  81525. if ((baseLayer.visibleScales && baseLayer.visibleScales.length > 0) || (baseLayer.scales && baseLayer.scales.length > 0)) {
  81526. //底图有固定比例尺,就直接获取。不用view计算
  81527. this.getScales(baseLayer);
  81528. } else if (options.baseLayer && extent && extent.length === 4) {
  81529. let width = extent[2] - extent[0];
  81530. let height = extent[3] - extent[1];
  81531. let maxResolution1 = width / 512;
  81532. let maxResolution2 = height / 512;
  81533. maxResolution = Math.max(maxResolution1, maxResolution2);
  81534. }
  81535. // if(options.baseLayer.visibleScales && options.baseLayer.visibleScales.length > 0){
  81536. // maxZoom = options.baseLayer.visibleScales.length;
  81537. // }
  81538. let viewOptions = {};
  81539. if (baseLayer.scales && baseLayer.scales.length > 0 && baseLayer.layerType === "WMTS" ||
  81540. this.resolutionArray && this.resolutionArray.length > 0) {
  81541. viewOptions = { zoom, center, projection, resolutions: this.resolutionArray, maxZoom };
  81542. } else if (baseLayer.layerType === "WMTS") {
  81543. viewOptions = { zoom, center, projection, maxZoom };
  81544. this.getScales(baseLayer);
  81545. } else {
  81546. viewOptions = { zoom, center, projection, maxResolution, maxZoom };
  81547. this.getScales(baseLayer);
  81548. }
  81549. if (['4', '5'].indexOf(core_Util_Util.getOlVersion()) < 0) { // 兼容 ol 4,5,6
  81550. viewOptions.multiWorld = true;
  81551. viewOptions.showFullExtent = true;
  81552. viewOptions.enableRotation = false;
  81553. viewOptions.constrainResolution = true; //设置此参数,是因为需要显示整数级别。为了可视比例尺中包含当前比例尺
  81554. }
  81555. this.map.setView(new (external_ol_View_default())(viewOptions));
  81556. if (options.visibleExtent) {
  81557. const view = this.map.getView();
  81558. const resolution = view.getResolutionForExtent(options.visibleExtent, this.map.getSize());
  81559. view.setResolution(resolution);
  81560. view.setCenter((0,external_ol_extent_namespaceObject.getCenter)(options.visibleExtent));
  81561. }
  81562. }
  81563. /**
  81564. * @private
  81565. * @function ol.supermap.WebMap.prototype.createBaseLayer
  81566. * @description 创建矢量图层,包括底图及其叠加的矢量图层
  81567. * @param {object} layerInfo - 关于地图的信息
  81568. * @param {number} index - 当前图层在地图中的index
  81569. * @param {boolean} isCallBack - 是否调用回调函数
  81570. * @param {scope} {object} this对象
  81571. */
  81572. createBaseLayer(layerInfo, index, isCallBack, scope, isBaseLayer) {
  81573. let source, that = this;
  81574. if (scope) {
  81575. // 解决异步回调
  81576. that = scope;
  81577. }
  81578. let layerType = layerInfo.layerType; //底图和rest地图兼容
  81579. if (layerType.indexOf('TIANDITU_VEC') > -1 || layerType.indexOf('TIANDITU_IMG') > -1 ||
  81580. layerType.indexOf('TIANDITU_TER') > -1) {
  81581. layerType = layerType.substr(0, 12);
  81582. }
  81583. switch (layerType) {
  81584. case "TIANDITU_VEC":
  81585. case "TIANDITU_IMG":
  81586. case "TIANDITU_TER":
  81587. source = this.createTiandituSource(layerType, layerInfo.projection);
  81588. break;
  81589. case "BAIDU":
  81590. source = this.createBaiduSource();
  81591. break;
  81592. case 'BING':
  81593. source = this.createBingSource(layerInfo, layerInfo.projection);
  81594. break;
  81595. case "WMS":
  81596. source = this.createWMSSource(layerInfo);
  81597. break;
  81598. case "WMTS":
  81599. source = that.createWMTSSource(layerInfo);
  81600. break;
  81601. case 'TILE':
  81602. case 'SUPERMAP_REST':
  81603. source = that.createDynamicTiledSource(layerInfo, isBaseLayer);
  81604. break;
  81605. case 'CLOUD':
  81606. case 'CLOUD_BLACK':
  81607. case 'OSM':
  81608. case 'JAPAN_ORT':
  81609. case 'JAPAN_RELIEF':
  81610. case 'JAPAN_PALE':
  81611. case 'JAPAN_STD':
  81612. case 'GOOGLE_CN':
  81613. case 'GOOGLE':
  81614. source = this.createXYZSource(layerInfo);
  81615. break;
  81616. default:
  81617. break;
  81618. }
  81619. var layer = new external_ol_layer_namespaceObject.Tile({
  81620. source: source,
  81621. zIndex: layerInfo.zIndex || 1,
  81622. visible: layerInfo.visible
  81623. });
  81624. var layerID = core_Util_Util.newGuid(8);
  81625. if (layerInfo.name) {
  81626. layer.setProperties({
  81627. name: layerInfo.name,
  81628. layerID: layerID
  81629. });
  81630. }
  81631. if (layerInfo.visible === undefined || layerInfo.visible === null) {
  81632. layerInfo.visible = true;
  81633. }
  81634. layer.setVisible(layerInfo.visible);
  81635. layerInfo.opacity && layer.setOpacity(layerInfo.opacity);
  81636. //layerInfo没有存储index属性
  81637. index && layer.setZIndex(index);
  81638. //否则没有ID,对不上号
  81639. layerInfo.layer = layer;
  81640. layerInfo.layerID = layerID;
  81641. let {visibleScale, autoUpdateTime} = layerInfo, minResolution, maxResolution;
  81642. if (visibleScale) {
  81643. maxResolution = this.resolutions[visibleScale.minScale];
  81644. minResolution = this.resolutions[visibleScale.maxScale];
  81645. //比例尺和分别率是反比的关系
  81646. maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1);
  81647. layer.setMinResolution(minResolution);
  81648. }
  81649. if (autoUpdateTime && !layerInfo.autoUpdateInterval) {
  81650. //自动更新
  81651. layerInfo.autoUpdateInterval = setInterval(() => {
  81652. that.updateTileToMap(layerInfo, index);
  81653. }, autoUpdateTime);
  81654. }
  81655. if (isCallBack) {
  81656. layer.setZIndex(0); // wmts
  81657. that.map.addLayer(layer);
  81658. }
  81659. return layer;
  81660. }
  81661. /**
  81662. * @private
  81663. * @function ol.supermap.WebMap.prototype.updateTileToMap
  81664. * @description 获取底图对应的图层信息,不是用请求回来的底图信息
  81665. * @param {object} layerInfo - 图层信息
  81666. * @param {number} layerIndex - 图层index
  81667. */
  81668. updateTileToMap(layerInfo, layerIndex) {
  81669. this.map.removeLayer(layerInfo.layer);
  81670. this.map.addLayer(this.createBaseLayer(layerInfo, layerIndex));
  81671. }
  81672. /**
  81673. * @private
  81674. * @function ol.supermap.WebMap.prototype.getInternetMapInfo
  81675. * @description 获取底图对应的图层信息,不是用请求回来的底图信息
  81676. * @param {object} baseLayerInfo - 底图信息
  81677. * @returns {Object} 底图的具体信息
  81678. */
  81679. getInternetMapInfo(baseLayerInfo) {
  81680. const baiduBounds = [-20037508.3427892, -20037508.3427892, 20037508.3427892, 20037508.3427892];
  81681. const bounds_4326 = [-180, -90, 180, 90];
  81682. const osmBounds = [-20037508.34, -20037508.34, 20037508.34, 20037508.34];
  81683. const japanReliefBounds = [12555667.53929, 1281852.98656, 17525908.86651, 7484870.70596];
  81684. const japanOrtBounds = [-19741117.14519, -10003921.36848, 19981677.71404, 19660983.56089];
  81685. baseLayerInfo.units = "m";
  81686. switch (baseLayerInfo.layerType) {
  81687. case ('BAIDU'):
  81688. baseLayerInfo.iServerUrl = 'https://map.baidu.com/';
  81689. baseLayerInfo.epsgCode = 'EPSG:3857';
  81690. baseLayerInfo.minZoom = 1;
  81691. baseLayerInfo.maxZoom = 19;
  81692. baseLayerInfo.level = 1;
  81693. baseLayerInfo.extent = baiduBounds;
  81694. // thumbnail: this.getImagePath('bmap.png') 暂时不用到缩略图
  81695. break;
  81696. case ('CLOUD'):
  81697. baseLayerInfo.url = 'http://t2.dituhui.com/FileService/image?map=quanguo&type=web&x={x}&y={y}&z={z}';
  81698. baseLayerInfo.epsgCode = 'EPSG:3857';
  81699. baseLayerInfo.minZoom = 1;
  81700. baseLayerInfo.maxZoom = 18;
  81701. baseLayerInfo.level = 1;
  81702. baseLayerInfo.extent = baiduBounds;
  81703. break;
  81704. case ('CLOUD_BLACK'):
  81705. baseLayerInfo.url = 'http://t3.dituhui.com/MapService/getGdp?x={x}&y={y}&z={z}';
  81706. baseLayerInfo.epsgCode = 'EPSG:3857';
  81707. baseLayerInfo.minZoom = 1;
  81708. baseLayerInfo.maxZoom = 18;
  81709. baseLayerInfo.level = 1;
  81710. baseLayerInfo.extent = baiduBounds;
  81711. break;
  81712. case ('tencent'):
  81713. baseLayerInfo.epsgCode = 'EPSG:3857';
  81714. baseLayerInfo.minZoom = 1;
  81715. baseLayerInfo.maxZoom = 18;
  81716. baseLayerInfo.level = 1;
  81717. baseLayerInfo.extent = baiduBounds;
  81718. break;
  81719. case ('TIANDITU_VEC_3857'):
  81720. case ('TIANDITU_IMG_3857'):
  81721. case ('TIANDITU_TER_3857'):
  81722. baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/';
  81723. baseLayerInfo.epsgCode = 'EPSG:3857';
  81724. baseLayerInfo.minZoom = 0;
  81725. baseLayerInfo.maxZoom = 19;
  81726. baseLayerInfo.level = 1;
  81727. baseLayerInfo.extent = baiduBounds;
  81728. if (baseLayerInfo.layerType === "TIANDITU_TER_3857") {
  81729. baseLayerInfo.maxZoom = 14;
  81730. }
  81731. break;
  81732. case ('TIANDITU_VEC_4326'):
  81733. case ('TIANDITU_IMG_4326'):
  81734. case ('TIANDITU_TER_4326'):
  81735. baseLayerInfo.iserverUrl = 'https://map.tianditu.gov.cn/';
  81736. baseLayerInfo.epsgCode = 'EPSG:4326';
  81737. baseLayerInfo.minZoom = 0;
  81738. baseLayerInfo.maxZoom = 19;
  81739. baseLayerInfo.level = 1;
  81740. baseLayerInfo.extent = bounds_4326;
  81741. if (baseLayerInfo.layerType === "TIANDITU_TER_4326") {
  81742. baseLayerInfo.maxZoom = 14;
  81743. }
  81744. break;
  81745. case ('OSM'):
  81746. baseLayerInfo.url = 'http://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png';
  81747. baseLayerInfo.epsgCode = 'EPSG:3857';
  81748. baseLayerInfo.minZoom = 1;
  81749. baseLayerInfo.maxZoom = 19;
  81750. baseLayerInfo.level = 1;
  81751. baseLayerInfo.extent = osmBounds;
  81752. baseLayerInfo.iserverUrl = 'https://www.openstreetmap.org';
  81753. break;
  81754. case ('GOOGLE'):
  81755. baseLayerInfo.url = 'https://www.google.cn/maps/vt/pb=!1m4!1m3!1i{z}!2i{x}!3i{y}!2m3!1e0!2sm!3i380072576!3m8!2szh-CN!3scn!5e1105!12m4!1e68!2m2!1sset!2sRoadmap!4e0!5m1!1e0';
  81756. baseLayerInfo.epsgCode = 'EPSG:3857';
  81757. baseLayerInfo.minZoom = 1;
  81758. baseLayerInfo.maxZoom = 22;
  81759. baseLayerInfo.level = 1;
  81760. baseLayerInfo.extent = osmBounds;
  81761. baseLayerInfo.iserverUrl = 'https://www.google.cn/maps';
  81762. break;
  81763. case ('JAPAN_STD'):
  81764. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png';
  81765. baseLayerInfo.epsgCode = 'EPSG:3857';
  81766. baseLayerInfo.minZoom = 1;
  81767. baseLayerInfo.maxZoom = 19;
  81768. baseLayerInfo.level = 0;
  81769. baseLayerInfo.extent = osmBounds;
  81770. break;
  81771. case ('JAPAN_PALE'):
  81772. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/pale/{z}/{x}/{y}.png';
  81773. baseLayerInfo.epsgCode = 'EPSG:3857';
  81774. baseLayerInfo.minZoom = 2;
  81775. baseLayerInfo.maxZoom = 19;
  81776. baseLayerInfo.level = 2;
  81777. baseLayerInfo.extent = osmBounds;
  81778. break;
  81779. case ('JAPAN_RELIEF'):
  81780. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/relief/{z}/{x}/{y}.png';
  81781. baseLayerInfo.epsgCode = 'EPSG:3857';
  81782. baseLayerInfo.minZoom = 5;
  81783. baseLayerInfo.maxZoom = 14;
  81784. baseLayerInfo.level = 5;
  81785. baseLayerInfo.extent = japanReliefBounds;
  81786. break;
  81787. case ('JAPAN_ORT'):
  81788. baseLayerInfo.url = 'https://cyberjapandata.gsi.go.jp/xyz/ort/{z}/{x}/{y}.jpg';
  81789. baseLayerInfo.epsgCode = 'EPSG:3857';
  81790. baseLayerInfo.minZoom = 2;
  81791. baseLayerInfo.maxZoom = 12;
  81792. baseLayerInfo.level = 2;
  81793. baseLayerInfo.extent = japanOrtBounds;
  81794. break;
  81795. }
  81796. }
  81797. /**
  81798. * @private
  81799. * @function ol.supermap.WebMap.prototype.createDynamicTiledSource
  81800. * @description 获取supermap iServer类型的地图的source。
  81801. * @param {object} layerInfo
  81802. * @param {boolean} isBaseLayer 是否是底图
  81803. */
  81804. createDynamicTiledSource(layerInfo, isBaseLayer) {
  81805. let serverType = "IPORTAL",
  81806. credential = layerInfo.credential ? layerInfo.credential.token : undefined,
  81807. keyfix = 'Token',
  81808. keyParams = layerInfo.url;
  81809. if (layerInfo.url.indexOf("www.supermapol.com") > -1 || layerInfo.url.indexOf("itest.supermapol.com") > -1) {
  81810. keyfix = 'Key';
  81811. keyParams = [keyParams];
  81812. serverType = "ONLINE";
  81813. }
  81814. if (credential) {
  81815. SecurityManager[`register${keyfix}`](keyParams, credential);
  81816. }
  81817. // extent: isBaseLayer ? layerInfo.extent : ol.proj.transformExtent(layerInfo.extent, layerInfo.projection, this.baseProjection),
  81818. let options = {
  81819. transparent: true,
  81820. url: layerInfo.url,
  81821. wrapX: false,
  81822. serverType: serverType,
  81823. // crossOrigin: 'anonymous', //在IE11.0.9600版本,会影响通过注册服务打开的iserver地图,不出图。因为没有携带cookie会报跨域问题
  81824. // extent: this.baseLayerExtent,
  81825. // prjCoordSys: {epsgCode: isBaseLayer ? layerInfo.projection.split(':')[1] : this.baseProjection.split(':')[1]},
  81826. format: layerInfo.format
  81827. };
  81828. if(!isBaseLayer && this.baseProjection !== "EPSG:-1"){
  81829. options.prjCoordSys = { epsgCode : this.baseProjection.split(':')[1]};
  81830. }
  81831. if (layerInfo.visibleScales && layerInfo.visibleScales.length > 0) {
  81832. let visibleResolutions = [];
  81833. for (let i in layerInfo.visibleScales) {
  81834. let resolution = core_Util_Util.scaleToResolution(layerInfo.visibleScales[i], dpiConfig.default, layerInfo.coordUnit);
  81835. visibleResolutions.push(resolution);
  81836. }
  81837. layerInfo.visibleResolutions = visibleResolutions;
  81838. let tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  81839. extent: layerInfo.extent,
  81840. resolutions: visibleResolutions
  81841. });
  81842. options.tileGrid = tileGrid;
  81843. } else {
  81844. options.extent = this.baseLayerExtent;
  81845. //bug:ISVJ-2412,不添加下列代码出不了图。参照iserver ol3出图方式
  81846. let tileGrid = new (external_ol_tilegrid_TileGrid_default())({
  81847. extent: layerInfo.extent,
  81848. resolutions: this.getResolutionsFromBounds(layerInfo.extent)
  81849. });
  81850. options.tileGrid = tileGrid;
  81851. }
  81852. //主机名相同时不添加代理,iportal geturlResource不支持webp代理
  81853. if (layerInfo.url && !this.isSameDomain(layerInfo.url) && layerInfo.format !== 'webp') {
  81854. options.tileProxy = this.server + 'apps/viewer/getUrlResource.png?url=';
  81855. }
  81856. let source = new TileSuperMapRest(options);
  81857. SecurityManager[`register${keyfix}`](layerInfo.url);
  81858. return source;
  81859. }
  81860. /**
  81861. * @private
  81862. * @function ol.supermap.WebMap.prototype.getResolutionsFromBounds
  81863. * @description 获取比例尺数组
  81864. * @param bounds {Array} 范围数组
  81865. * @returns {styleResolutions} 比例尺数组
  81866. */
  81867. getResolutionsFromBounds(bounds) {
  81868. let styleResolutions = [];
  81869. let temp = Math.abs(bounds[0] - bounds[2]) / 512;
  81870. for (let i = 0; i < 22; i++) {
  81871. if (i === 0) {
  81872. styleResolutions[i] = temp;
  81873. continue;
  81874. }
  81875. temp = temp / 2;
  81876. styleResolutions[i] = temp;
  81877. }
  81878. return styleResolutions;
  81879. }
  81880. /**
  81881. * @private
  81882. * @function ol.supermap.WebMap.prototype.createTiandituSource
  81883. * @description 创建天地图的source。
  81884. * @param layerType 图层类型
  81885. * @param projection 地理坐标系
  81886. * @param isLabel 是否有路网图层
  81887. * @returns {ol.source.Tianditu} 天地图的source
  81888. */
  81889. createTiandituSource(layerType, projection, isLabel) {
  81890. let options = {
  81891. layerType: layerType.split('_')[1].toLowerCase(),
  81892. isLabel: isLabel || false,
  81893. projection: projection,
  81894. url: `https://t{0-7}.tianditu.gov.cn/{layer}_{proj}/wmts?tk=${this.tiandituKey}`
  81895. };
  81896. return new Tianditu(options);
  81897. }
  81898. /**
  81899. * @private
  81900. * @function ol.supermap.WebMap.prototype.createBaiduSource
  81901. * @description 创建百度地图的source。
  81902. * @returns {ol.source.BaiduMap} baidu地图的source
  81903. */
  81904. createBaiduSource() {
  81905. return new BaiduMap()
  81906. }
  81907. /**
  81908. * @private
  81909. * @function ol.supermap.WebMap.prototype.createBingSource
  81910. * @description 创建bing地图的source。
  81911. * @returns {ol/source/XYZ} bing地图的source
  81912. */
  81913. createBingSource(layerInfo, projection) {
  81914. let url = 'https://dynamic.t0.tiles.ditu.live.com/comp/ch/{quadKey}?it=G,TW,L,LA&mkt=zh-cn&og=109&cstl=w4c&ur=CN&n=z';
  81915. return new external_ol_source_namespaceObject.XYZ({
  81916. wrapX: false,
  81917. projection: projection,
  81918. crossOrigin: 'anonymous',
  81919. tileUrlFunction: function (coordinates) {
  81920. let /*quadDigits = '', */[z, x, y] = [...coordinates];
  81921. y = y > 0 ? y - 1 : -y - 1;
  81922. let index = '';
  81923. for (let i = z; i > 0; i--) {
  81924. let b = 0;
  81925. let mask = 1 << (i - 1);
  81926. if ((x & mask) !== 0) {
  81927. b++;
  81928. }
  81929. if ((y & mask) !== 0) {
  81930. b += 2;
  81931. }
  81932. index += b.toString()
  81933. }
  81934. return url.replace('{quadKey}', index);
  81935. }
  81936. })
  81937. }
  81938. /**
  81939. * @private
  81940. * @function ol.supermap.WebMap.prototype.createXYZSource
  81941. * @description 创建图层的XYZsource。
  81942. * @param {Object} layerInfo - 图层信息
  81943. * @returns {ol/source/XYZ} xyz的source
  81944. */
  81945. createXYZSource(layerInfo) {
  81946. return new external_ol_source_namespaceObject.XYZ({
  81947. url: layerInfo.url,
  81948. wrapX: false,
  81949. crossOrigin: 'anonymous'
  81950. })
  81951. }
  81952. /**
  81953. * @private
  81954. * @function ol.supermap.WebMap.prototype.createWMSSource
  81955. * @description 创建wms地图source。
  81956. * @param {Object} layerInfo - 图层信息。
  81957. * @returns {ol/source/TileWMS} wms的source
  81958. */
  81959. createWMSSource(layerInfo) {
  81960. let that = this;
  81961. return new external_ol_source_namespaceObject.TileWMS({
  81962. url: layerInfo.url,
  81963. wrapX: false,
  81964. params: {
  81965. LAYERS: layerInfo.layers ? layerInfo.layers[0] : "0",
  81966. FORMAT: 'image/png'
  81967. },
  81968. projection: layerInfo.projection || that.baseProjection,
  81969. tileLoadFunction: function (imageTile, src) {
  81970. imageTile.getImage().src = src
  81971. }
  81972. })
  81973. }
  81974. /**
  81975. * @private
  81976. * @function ol.supermap.WebMap.prototype.getTileLayerExtent
  81977. * @description 获取(Supermap RestMap)的图层参数。
  81978. * @param {Object} layerInfo - 图层信息。
  81979. * @param {function} callback - 获得tile图层参数执行的回调函数
  81980. * @param {function} failedCallback - 失败回调函数
  81981. */
  81982. async getTileLayerExtent(layerInfo, callback, failedCallback) {
  81983. let that = this;
  81984. // 默认使用动态投影方式请求数据
  81985. let dynamicLayerInfo = await that.getTileLayerExtentInfo(layerInfo)
  81986. if (dynamicLayerInfo.succeed === false) {
  81987. if (dynamicLayerInfo.error.code === 400) {
  81988. // dynamicLayerInfo.error.code === 400 不支持动态投影,请求restmap原始信息
  81989. let originLayerInfo = await that.getTileLayerExtentInfo(layerInfo, false);
  81990. if (originLayerInfo.succeed === false) {
  81991. failedCallback();
  81992. } else {
  81993. Object.assign(layerInfo, originLayerInfo);
  81994. callback(layerInfo);
  81995. }
  81996. } else {
  81997. failedCallback();
  81998. }
  81999. } else {
  82000. Object.assign(layerInfo, dynamicLayerInfo);
  82001. callback(layerInfo);
  82002. }
  82003. }
  82004. /**
  82005. * @private
  82006. * @function ol.supermap.WebMap.prototype.getTileLayerExtentInfo
  82007. * @description 获取rest map的图层参数。
  82008. * @param {Object} layerInfo - 图层信息。
  82009. * @param {Boolean} isDynamic - 是否请求动态投影信息
  82010. */
  82011. getTileLayerExtentInfo(layerInfo, isDynamic = true) {
  82012. let that = this,
  82013. token,
  82014. url = layerInfo.url.trim(),
  82015. credential = layerInfo.credential,
  82016. options = {
  82017. withCredentials: this.withCredentials,
  82018. withoutFormatSuffix: true
  82019. };
  82020. if (isDynamic) {
  82021. let projection = {
  82022. epsgCode: that.baseProjection.split(":")[1]
  82023. }
  82024. if (that.baseProjection !== "EPSG:-1") {
  82025. // bug IE11 不会自动编码
  82026. url += '.json?prjCoordSys=' + encodeURI(JSON.stringify(projection));
  82027. }
  82028. }
  82029. if (credential) {
  82030. url = `${url}&token=${encodeURI(credential.token)}`;
  82031. token = credential.token;
  82032. }
  82033. return FetchRequest.get(that.getRequestUrl(`${url}.json`), null, options).then(function (response) {
  82034. return response.json();
  82035. }).then(async (result) => {
  82036. if (result.succeed === false) {
  82037. return result
  82038. }
  82039. let format = 'png';
  82040. if(that.tileFormat === 'webp') {
  82041. const isSupportWebp = await that.isSupportWebp(layerInfo.url, token);
  82042. format = isSupportWebp ? 'webp' : 'png';
  82043. }
  82044. return {
  82045. units: result.coordUnit && result.coordUnit.toLowerCase(),
  82046. coordUnit: result.coordUnit,
  82047. visibleScales: result.visibleScales,
  82048. extent: [result.bounds.left, result.bounds.bottom, result.bounds.right, result.bounds.top],
  82049. projection: `EPSG:${result.prjCoordSys.epsgCode}`,
  82050. format
  82051. }
  82052. }).catch((error) => {
  82053. return {
  82054. succeed: false,
  82055. error: error
  82056. }
  82057. });
  82058. }
  82059. /**
  82060. * @private
  82061. * @function ol.supermap.WebMap.prototype.getTileInfo
  82062. * @description 获取rest map的图层参数。
  82063. * @param {Object} layerInfo - 图层信息。
  82064. * @param {function} callback - 获得wmts图层参数执行的回调函数
  82065. */
  82066. getTileInfo(layerInfo, callback, mapInfo) {
  82067. let that = this;
  82068. let options = {
  82069. withCredentials: this.withCredentials,
  82070. withoutFormatSuffix: true
  82071. };
  82072. if (layerInfo.url.indexOf("?token=") > -1) {
  82073. that.credentialKey = 'token';
  82074. that.credentialValue = layerInfo.credential = layerInfo.url.split("?token=")[1];
  82075. layerInfo.url = layerInfo.url.split("?token=")[0];
  82076. }
  82077. return FetchRequest.get(that.getRequestUrl(`${layerInfo.url}.json`), null, options).then(function (response) {
  82078. return response.json();
  82079. }).then(async function (result) {
  82080. // layerInfo.projection = mapInfo.projection;
  82081. // layerInfo.extent = [mapInfo.extent.leftBottom.x, mapInfo.extent.leftBottom.y, mapInfo.extent.rightTop.x, mapInfo.extent.rightTop.y];
  82082. // 比例尺 单位
  82083. if(result && result.code && result.code !== 200) {
  82084. throw result;
  82085. }
  82086. if (result.visibleScales) {
  82087. layerInfo.visibleScales = result.visibleScales;
  82088. layerInfo.coordUnit = result.coordUnit;
  82089. }
  82090. layerInfo.maxZoom = result.maxZoom;
  82091. layerInfo.maxZoom = result.minZoom;
  82092. let token = layerInfo.credential ? layerInfo.credential.token : undefined;
  82093. layerInfo.format = 'png';
  82094. // china_dark为默认底图,还是用png出图
  82095. if(that.tileFormat === 'webp' && layerInfo.url !== 'https://maptiles.supermapol.com/iserver/services/map_China/rest/maps/China_Dark') {
  82096. const isSupprtWebp = await that.isSupportWebp(layerInfo.url, token);
  82097. layerInfo.format = isSupprtWebp ? 'webp' : 'png';
  82098. }
  82099. // 请求结果完成 继续添加图层
  82100. if (mapInfo) {
  82101. //todo 这个貌似没有用到,下次优化
  82102. callback && callback(mapInfo, null, true, that);
  82103. } else {
  82104. callback && callback(layerInfo);
  82105. }
  82106. }).catch(function (error) {
  82107. that.errorCallback && that.errorCallback(error, 'getTileInfo', that.map)
  82108. });
  82109. }
  82110. /**
  82111. * @private
  82112. * @function ol.supermap.WebMap.prototype.getWMTSUrl
  82113. * @description 获取wmts请求文档的url
  82114. * @param {string} url - 图层信息。
  82115. * @param {boolean} isKvp - 是否为kvp模式
  82116. */
  82117. getWMTSUrl(url, isKvp) {
  82118. let splitStr = '?';
  82119. if (url.indexOf('?') > -1) {
  82120. splitStr = '&'
  82121. }
  82122. if (isKvp) {
  82123. url += splitStr + 'SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities';
  82124. } else {
  82125. url += splitStr + '/1.0.0/WMTSCapabilities.xml';
  82126. }
  82127. return this.getRequestUrl(url, true);
  82128. }
  82129. /**
  82130. * @private
  82131. * @function ol.supermap.WebMap.prototype.getWmtsInfo
  82132. * @description 获取wmts的图层参数。
  82133. * @param {Object} layerInfo - 图层信息。
  82134. * @param {function} callback - 获得wmts图层参数执行的回调函数
  82135. */
  82136. getWmtsInfo(layerInfo, callback) {
  82137. let that = this;
  82138. let options = {
  82139. withCredentials: that.withCredentials,
  82140. withoutFormatSuffix: true
  82141. };
  82142. const isKvp = !layerInfo.requestEncoding || layerInfo.requestEncoding === 'KVP';
  82143. return FetchRequest.get(that.getWMTSUrl(layerInfo.url, isKvp), null, options).then(function (response) {
  82144. return response.text();
  82145. }).then(function (capabilitiesText) {
  82146. const format = new (external_ol_format_WMTSCapabilities_default())();
  82147. let capabilities = format.read(capabilitiesText);
  82148. if (that.isValidResponse(capabilities)) {
  82149. let content = capabilities.Contents,
  82150. tileMatrixSet = content.TileMatrixSet,
  82151. layers = content.Layer,
  82152. layer, idx, layerFormat, style = 'default';
  82153. for (let n = 0; n < layers.length; n++) {
  82154. if (layers[n].Identifier === layerInfo.layer) {
  82155. idx = n;
  82156. layer = layers[idx];
  82157. layerFormat = layer.Format[0];
  82158. var layerBounds = layer.WGS84BoundingBox;
  82159. // tileMatrixSetLink = layer.TileMatrixSetLink;
  82160. break;
  82161. }
  82162. }
  82163. layer && layer.Style && layer.Style.forEach(value => {
  82164. if (value.isDefault) {
  82165. style = value.Identifier;
  82166. }
  82167. });
  82168. let scales = [], matrixIds = [];
  82169. for (let i = 0; i < tileMatrixSet.length; i++) {
  82170. if (tileMatrixSet[i].Identifier === layerInfo.tileMatrixSet) {
  82171. let wmtsLayerEpsg = `EPSG:${tileMatrixSet[i].SupportedCRS.split('::')[1]}`;
  82172. for (let h = 0; h < tileMatrixSet[i].TileMatrix.length; h++) {
  82173. scales.push(tileMatrixSet[i].TileMatrix[h].ScaleDenominator);
  82174. matrixIds.push(tileMatrixSet[i].TileMatrix[h].Identifier);
  82175. }
  82176. //bug wmts出图需要加上origin,否则会出现出图不正确的情况。偏移或者瓦片出不了
  82177. let origin = tileMatrixSet[i].TileMatrix[0].TopLeftCorner;
  82178. layerInfo.origin = ["EPSG:4326", "EPSG:4490"].indexOf(wmtsLayerEpsg) > -1 ? [origin[1], origin[0]] : origin;
  82179. break;
  82180. }
  82181. }
  82182. let name = layerInfo.name, extent;
  82183. if (layerBounds) {
  82184. extent = external_ol_proj_namespaceObject.transformExtent(layerBounds, 'EPSG:4326', that.baseProjection);
  82185. } else {
  82186. extent = external_ol_proj_namespaceObject.get(that.baseProjection).getExtent()
  82187. }
  82188. layerInfo.tileUrl = that.getTileUrl(capabilities.OperationsMetadata.GetTile.DCP.HTTP.Get, layer, layerFormat, isKvp);
  82189. //将需要的参数补上
  82190. layerInfo.extent = extent;
  82191. layerInfo.name = name;
  82192. layerInfo.orginEpsgCode = layerInfo.projection;
  82193. layerInfo.overLayer = true;
  82194. layerInfo.scales = scales;
  82195. layerInfo.style = style;
  82196. layerInfo.title = name;
  82197. layerInfo.unit = "m";
  82198. layerInfo.layerFormat = layerFormat;
  82199. layerInfo.matrixIds = matrixIds;
  82200. callback && callback(layerInfo);
  82201. }
  82202. }).catch(function (error) {
  82203. that.errorCallback && that.errorCallback(error, 'getWmtsFaild', that.map)
  82204. });
  82205. }
  82206. /**
  82207. * @private
  82208. * @function ol.supermap.WebMap.prototype.getTileUrl
  82209. * @description 获取wmts的图层参数。
  82210. * @param {array} getTileArray - 图层信息。
  82211. * @param {string} layer - 选择的图层
  82212. * @param {string} format - 选择的出图方式
  82213. * @param {boolean} isKvp - 是否是kvp方式
  82214. */
  82215. getTileUrl(getTileArray, layer, format, isKvp) {
  82216. let url;
  82217. if (isKvp) {
  82218. getTileArray.forEach(data => {
  82219. if (data.Constraint[0].AllowedValues.Value[0].toUpperCase() === 'KVP') {
  82220. url = data.href;
  82221. }
  82222. })
  82223. } else {
  82224. const reuslt = layer.ResourceURL.filter(resource => {
  82225. return resource.format === format;
  82226. })
  82227. url = reuslt[0].template;
  82228. }
  82229. return url;
  82230. }
  82231. /**
  82232. * @private
  82233. * @function ol.supermap.WebMap.prototype.createWMTSSource
  82234. * @description 获取WMTS类型图层的source。
  82235. * @param {Object} layerInfo - 图层信息。
  82236. * @returns {ol/source/WMTS} wmts的souce
  82237. */
  82238. createWMTSSource(layerInfo) {
  82239. let extent = layerInfo.extent || external_ol_proj_namespaceObject.get(layerInfo.projection).getExtent();
  82240. // 单位通过坐标系获取 (PS: 以前代码非4326 都默认是米)
  82241. let unit = external_ol_proj_namespaceObject.get(this.baseProjection).getUnits();
  82242. return new external_ol_source_namespaceObject.WMTS({
  82243. url: layerInfo.tileUrl || layerInfo.url,
  82244. layer: layerInfo.layer,
  82245. format: layerInfo.layerFormat,
  82246. style: layerInfo.style,
  82247. matrixSet: layerInfo.tileMatrixSet,
  82248. requestEncoding: layerInfo.requestEncoding || 'KVP',
  82249. tileGrid: this.getWMTSTileGrid(extent, layerInfo.scales, unit, layerInfo.dpi, layerInfo.origin, layerInfo.matrixIds),
  82250. tileLoadFunction: function (imageTile, src) {
  82251. imageTile.getImage().src = src
  82252. }
  82253. })
  82254. }
  82255. /**
  82256. * @private
  82257. * @function ol.supermap.WebMap.prototype.getWMTSTileGrid
  82258. * @description 获取wmts的瓦片。
  82259. * @param {Object} extent - 图层范围。
  82260. * @param {number} scales - 图层比例尺
  82261. * @param {string} unit - 单位
  82262. * @param {number} dpi - dpi
  82263. * @param {Array} origin 瓦片的原点
  82264. * @returns {ol/tilegrid/WMTS} wmts的瓦片
  82265. */
  82266. getWMTSTileGrid(extent, scales, unit, dpi, origin, matrixIds) {
  82267. let resolutionsInfo = this.getReslutionsFromScales(scales, dpi || dpiConfig.iServerWMTS, unit);
  82268. return new (external_ol_tilegrid_WMTS_default())({
  82269. origin,
  82270. extent: extent,
  82271. resolutions: resolutionsInfo.res,
  82272. matrixIds: matrixIds || resolutionsInfo.matrixIds
  82273. });
  82274. }
  82275. /**
  82276. * @private
  82277. * @function ol.supermap.WebMap.prototype.getReslutionsFromScales
  82278. * @description 根据比例尺(比例尺分母)、地图单位、dpi、获取一个分辨率数组
  82279. * @param {array} scales - 比例尺(比例尺分母)
  82280. * @param {number} dpi - 地图dpi
  82281. * @param {string} unit - 单位
  82282. * @param {number} datumAxis
  82283. * @returns {{res: Array, matrixIds: Array}}
  82284. */
  82285. getReslutionsFromScales(scales, dpi, unit, datumAxis) {
  82286. unit = (unit && unit.toLowerCase()) || 'degrees';
  82287. dpi = dpi || dpiConfig.iServerWMTS;
  82288. datumAxis = datumAxis || 6378137;
  82289. let res = [],
  82290. matrixIds = [];
  82291. //给个默认的
  82292. if (core_Util_Util.isArray(scales)) {
  82293. scales && scales.forEach(function (scale, idx) {
  82294. if (scale > 1.0) {
  82295. matrixIds.push(idx);
  82296. res.push(this.getResolutionFromScale(scale, dpi, unit, datumAxis));
  82297. }
  82298. }, this);
  82299. } else {
  82300. let tileMatrixSet = scales['TileMatrix'];
  82301. tileMatrixSet && tileMatrixSet.forEach(function (tileMatrix) {
  82302. matrixIds.push(tileMatrix['Identifier']);
  82303. res.push(this.getResolutionFromScale(tileMatrix['ScaleDenominator'], dpi, unit, datumAxis));
  82304. }, this);
  82305. }
  82306. return {
  82307. res: res,
  82308. matrixIds: matrixIds
  82309. };
  82310. }
  82311. /**
  82312. * @private
  82313. * @function ol.supermap.WebMap.prototype.getResolutionFromScale
  82314. * @description 获取一个WMTS source需要的tileGrid
  82315. * @param {number} scale - 比例尺(比例尺分母)
  82316. * @param {number} dpi - 地图dpi
  82317. * @param {string} unit - 单位
  82318. * @param {number} datumAxis
  82319. * @returns {{res: Array, matrixIds: Array}}
  82320. */
  82321. getResolutionFromScale(scale, dpi = dpiConfig.default, unit, datumAxis) {
  82322. //radio = 10000;
  82323. let res;
  82324. scale = +scale;
  82325. scale = (scale > 1.0) ? (1.0 / scale) : scale;
  82326. if (unit === 'degrees' || unit === 'dd' || unit === 'degree') {
  82327. res = 0.0254 * 10000 / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / 10000;
  82328. } else {
  82329. res = 0.0254 * 10000 / dpi / scale / 10000;
  82330. }
  82331. return res;
  82332. }
  82333. /**
  82334. * @private
  82335. * @function ol.supermap.WebMap.prototype.isValidResponse
  82336. * @description 返回信息是否符合对应类型的标准
  82337. * @param {object} response - 返回的信息
  82338. * @returns {boolean}
  82339. */
  82340. isValidResponse(response) {
  82341. let responseEnum = ['Contents', 'OperationsMetadata'],
  82342. valid = true;
  82343. for (let i = 0; i < responseEnum.length; i++) {
  82344. if (!response[responseEnum[i]] || response.error) {
  82345. valid = false;
  82346. break;
  82347. }
  82348. }
  82349. return valid;
  82350. }
  82351. /**
  82352. * @private
  82353. * @function ol.supermap.WebMap.prototype.addLayers
  82354. * @description 添加叠加图层
  82355. * @param {object} mapInfo - 地图信息
  82356. */
  82357. addLayers(mapInfo) {
  82358. let layers = mapInfo.layers,
  82359. that = this;
  82360. let features = [],
  82361. len = layers.length;
  82362. if (len > 0) {
  82363. //存储地图上所有的图层对象
  82364. this.layers = layers;
  82365. layers.forEach(function (layer, index) {
  82366. //加上底图的index
  82367. let layerIndex = index + 1,
  82368. dataSource = layer.dataSource,
  82369. isSampleData = dataSource && dataSource.type === "SAMPLE_DATA" && !!dataSource.name; //SAMPLE_DATA是本地示例数据
  82370. if (layer.layerType === "MAPBOXSTYLE") {
  82371. that.addMVTMapLayer(mapInfo, layer, layerIndex).then(() => {
  82372. that.layerAdded++;
  82373. that.sendMapToUser(len);
  82374. });
  82375. } else if ((dataSource && dataSource.serverId) || layer.layerType === "MARKER" || layer.layerType === 'HOSTED_TILE' || isSampleData) {
  82376. //数据存储到iportal上了
  82377. let dataSource = layer.dataSource,
  82378. serverId = dataSource ? dataSource.serverId : layer.serverId;
  82379. if (!serverId && !isSampleData) {
  82380. that.addLayer(layer, null, layerIndex);
  82381. that.layerAdded++;
  82382. that.sendMapToUser(len);
  82383. return;
  82384. }
  82385. if ((layer.layerType === "MARKER") || (dataSource && (!dataSource.accessType || dataSource.accessType === 'DIRECT')) || isSampleData) {
  82386. //原来二进制文件
  82387. let url = isSampleData ? `${that.server}apps/dataviz/libs/sample-datas/${dataSource.name}.json` : `${that.server}web/datas/${serverId}/content.json?pageSize=9999999&currentPage=1`;
  82388. url = that.getRequestUrl(url);
  82389. FetchRequest.get(url, null, {
  82390. withCredentials: this.withCredentials
  82391. }).then(function (response) {
  82392. return response.json()
  82393. }).then(async function (data) {
  82394. if (data.succeed === false) {
  82395. //请求失败
  82396. that.layerAdded++;
  82397. that.sendMapToUser(len);
  82398. that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map);
  82399. return;
  82400. }
  82401. if (data && data.type) {
  82402. if (data.type === "JSON" || data.type === "GEOJSON") {
  82403. data.content = data.content.type ? data.content : JSON.parse(data.content);
  82404. features = that.geojsonToFeature(data.content, layer);
  82405. } else if (data.type === 'EXCEL' || data.type === 'CSV') {
  82406. if (layer.dataSource && layer.dataSource.administrativeInfo) {
  82407. //行政规划信息
  82408. data.content.rows.unshift(data.content.colTitles);
  82409. let {divisionType, divisionField} = layer.dataSource.administrativeInfo;
  82410. let geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
  82411. features = that._parseGeoJsonData2Feature({allDatas: {features: geojson.features}, fileCode: layer.projection});
  82412. } else {
  82413. features = await that.excelData2Feature(data.content, layer);
  82414. }
  82415. } else if (data.type === 'SHP') {
  82416. let content = JSON.parse(data.content);
  82417. data.content = content.layers[0];
  82418. features = that.geojsonToFeature(data.content, layer);
  82419. }
  82420. that.addLayer(layer, features, layerIndex);
  82421. that.layerAdded++;
  82422. that.sendMapToUser(len);
  82423. }
  82424. }).catch(function (error) {
  82425. that.layerAdded++;
  82426. that.sendMapToUser(len);
  82427. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  82428. })
  82429. } else {
  82430. //关系型文件
  82431. let isMapService = layer.layerType === 'HOSTED_TILE',
  82432. serverId = dataSource ? dataSource.serverId : layer.serverId;
  82433. that.checkUploadToRelationship(serverId).then(function (result) {
  82434. if (result && result.length > 0) {
  82435. let datasetName = result[0].name,
  82436. featureType = result[0].type.toUpperCase();
  82437. that.getDataService(serverId, datasetName).then(function (data) {
  82438. let dataItemServices = data.dataItemServices;
  82439. if (dataItemServices.length === 0) {
  82440. that.layerAdded++;
  82441. that.sendMapToUser(len);
  82442. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  82443. return;
  82444. }
  82445. if (isMapService) {
  82446. //需要判断是使用tile还是mvt服务
  82447. let dataService = that.getService(dataItemServices, 'RESTDATA');
  82448. that.isMvt(dataService.address, datasetName).then(info => {
  82449. that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info);
  82450. }).catch(() => {
  82451. //判断失败就走之前逻辑,>数据量用tile
  82452. that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType);
  82453. })
  82454. } else {
  82455. that.getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType);
  82456. }
  82457. });
  82458. } else {
  82459. that.layerAdded++;
  82460. that.sendMapToUser(len);
  82461. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  82462. }
  82463. }).catch(function (error) {
  82464. that.layerAdded++;
  82465. that.sendMapToUser(len);
  82466. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  82467. })
  82468. }
  82469. } else if (dataSource && dataSource.type === "USER_DATA") {
  82470. that.addGeojsonFromUrl(layer, len, layerIndex, false);
  82471. } else if (layer.layerType === "TILE"){
  82472. that.getTileLayerExtent(layer, function (layerInfo) {
  82473. that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex));
  82474. that.layerAdded++;
  82475. that.sendMapToUser(len);
  82476. }, function (e) {
  82477. that.layerAdded++;
  82478. that.sendMapToUser(len);
  82479. that.errorCallback && that.errorCallback(e, 'getLayerFaild', that.map);
  82480. })
  82481. } else if (layer.layerType === 'SUPERMAP_REST' ||
  82482. layer.layerType === "WMS" ||
  82483. layer.layerType === "WMTS") {
  82484. if (layer.layerType === "WMTS") {
  82485. that.getWmtsInfo(layer, function (layerInfo) {
  82486. that.map.addLayer(that.createBaseLayer(layerInfo, layerIndex));
  82487. that.layerAdded++;
  82488. that.sendMapToUser(len);
  82489. })
  82490. } else {
  82491. layer.projection = that.baseProjection;
  82492. that.map.addLayer(that.createBaseLayer(layer, layerIndex));
  82493. that.layerAdded++;
  82494. that.sendMapToUser(len);
  82495. }
  82496. } else if (dataSource && dataSource.type === "REST_DATA") {
  82497. //从restData获取数据
  82498. that.getFeaturesFromRestData(layer, layerIndex, len);
  82499. } else if (dataSource && dataSource.type === "REST_MAP" && dataSource.url) {
  82500. //示例数据
  82501. core_Util_Util.queryFeatureBySQL(dataSource.url, dataSource.layerName, 'smid=1', null, null, function (result) {
  82502. var recordsets = result && result.result.recordsets;
  82503. var recordset = recordsets && recordsets[0];
  82504. var attributes = recordset.fields;
  82505. if (recordset && attributes) {
  82506. let fileterAttrs = [];
  82507. for (var i in attributes) {
  82508. var value = attributes[i];
  82509. if (value.indexOf('Sm') !== 0 || value === "SmID") {
  82510. fileterAttrs.push(value);
  82511. }
  82512. }
  82513. that.getFeatures(fileterAttrs, layer, function (features) {
  82514. that.addLayer(layer, features, layerIndex);
  82515. that.layerAdded++;
  82516. that.sendMapToUser(len);
  82517. }, function (e) {
  82518. that.layerAdded++;
  82519. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  82520. });
  82521. }
  82522. }, function (e) {
  82523. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  82524. })
  82525. } else if (layer.layerType === "DATAFLOW_POINT_TRACK" || layer.layerType === "DATAFLOW_HEAT") {
  82526. that.getDataflowInfo(layer, function () {
  82527. that.addLayer(layer, features, layerIndex);
  82528. that.layerAdded++;
  82529. that.sendMapToUser(len);
  82530. }, function (e) {
  82531. that.layerAdded++;
  82532. that.errorCallback && that.errorCallback(e, 'getFeatureFaild', that.map);
  82533. })
  82534. }
  82535. }, this);
  82536. }
  82537. }
  82538. /**
  82539. * @private
  82540. * @function ol.supermap.WebMap.prototype.addGeojsonFromUrl
  82541. * @description 从web服务输入geojson地址的图层
  82542. * @param {object} layerInfo - 图层信息
  82543. * @param {Number} len - 总的图层数量
  82544. * @param {Number} layerIndex - 当前图层index
  82545. * @param {Boolean} withCredentials - 是否携带cookie
  82546. */
  82547. addGeojsonFromUrl(layerInfo, len, layerIndex, withCredentials = this.withCredentials) {
  82548. // 通过web添加geojson不需要携带cookie
  82549. let {dataSource} = layerInfo, {url} = dataSource, that = this;
  82550. FetchRequest.get(url, null, {
  82551. withCredentials,
  82552. withoutFormatSuffix: true
  82553. }).then(function (response) {
  82554. return response.json()
  82555. }).then(async function (data) {
  82556. if (!data || data.succeed === false) {
  82557. //请求失败
  82558. if (len) {
  82559. that.errorCallback && that.errorCallback(data.error, 'autoUpdateFaild', that.map)
  82560. } else {
  82561. that.layerAdded++;
  82562. that.sendMapToUser(len);
  82563. that.errorCallback && that.errorCallback(data.error, 'getLayerFaild', that.map);
  82564. }
  82565. return;
  82566. }
  82567. var features;
  82568. if (data.type === 'CSV' || data.type === 'EXCEL') {
  82569. if (layerInfo.dataSource && layerInfo.dataSource.administrativeInfo) {
  82570. //行政规划信息
  82571. data.content.rows.unshift(data.content.colTitles);
  82572. let {divisionType, divisionField} = layerInfo.dataSource.administrativeInfo;
  82573. let geojson = that.excelData2FeatureByDivision(data.content, divisionType, divisionField);
  82574. features = that._parseGeoJsonData2Feature({allDatas: {features: geojson.features}, fileCode: layerInfo.projection});
  82575. } else {
  82576. features = await that.excelData2Feature(data.content, layerInfo);
  82577. }
  82578. } else {
  82579. var geoJson = data.content ? JSON.parse(data.content) : data;
  82580. features = that.geojsonToFeature(geoJson, layerInfo);
  82581. }
  82582. if (len) {
  82583. //上图
  82584. that.addLayer(layerInfo, features, layerIndex);
  82585. that.layerAdded++;
  82586. that.sendMapToUser(len);
  82587. } else {
  82588. //自动更新
  82589. that.map.removeLayer(layerInfo.layer);
  82590. layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer);
  82591. that.addLayer(layerInfo, features, layerIndex);
  82592. }
  82593. }).catch(function (error) {
  82594. that.layerAdded++;
  82595. that.sendMapToUser(len);
  82596. that.errorCallback && that.errorCallback(error, 'getLayerFaild', that.map);
  82597. })
  82598. }
  82599. /**
  82600. * @private
  82601. * @function ol.supermap.WebMap.prototype.getServiceInfoFromLayer
  82602. * @description 判断使用哪种服务上图
  82603. * @param {Number} layerIndex - 图层对应的index
  82604. * @param {Number} len - 成功添加的图层个数
  82605. * @param {Object} layer - 图层信息
  82606. * @param {Array} dataItemServices - 数据发布的服务
  82607. * @param {String} datasetName - 数据服务的数据集名称
  82608. * @param {String} featureType - feature类型
  82609. * @param {Object} info - 数据服务的信息
  82610. */
  82611. getServiceInfoFromLayer(layerIndex, len, layer, dataItemServices, datasetName, featureType, info) {
  82612. let that = this;
  82613. let isMapService = info ? !info.isMvt : layer.layerType === 'HOSTED_TILE',
  82614. isAdded = false;
  82615. dataItemServices.forEach(function (service) {
  82616. if (isAdded) {
  82617. return;
  82618. }
  82619. //有服务了,就不需要循环
  82620. if (service && isMapService && service.serviceType === 'RESTMAP') {
  82621. isAdded = true;
  82622. //地图服务,判断使用mvt还是tile
  82623. that.getTileLayerInfo(service.address).then(function (restMaps) {
  82624. restMaps.forEach(function (restMapInfo) {
  82625. let bounds = restMapInfo.bounds;
  82626. layer.layerType = 'TILE';
  82627. layer.orginEpsgCode = that.baseProjection;
  82628. layer.units = restMapInfo.coordUnit && restMapInfo.coordUnit.toLowerCase();
  82629. layer.extent = [bounds.left, bounds.bottom, bounds.right, bounds.top];
  82630. layer.visibleScales = restMapInfo.visibleScales;
  82631. layer.url = restMapInfo.url;
  82632. layer.sourceType = 'TILE';
  82633. that.map.addLayer(that.createBaseLayer(layer, layerIndex));
  82634. that.layerAdded++;
  82635. that.sendMapToUser(len);
  82636. })
  82637. })
  82638. } else if (service && !isMapService && service.serviceType === 'RESTDATA') {
  82639. isAdded = true;
  82640. if (info && info.isMvt) {
  82641. let bounds = info.bounds;
  82642. layer = Object.assign(layer, {
  82643. layerType: "VECTOR_TILE",
  82644. epsgCode: info.epsgCode,
  82645. projection: `EPSG:${info.epsgCode}`,
  82646. bounds: bounds,
  82647. extent: [bounds.left, bounds.bottom, bounds.right, bounds.top],
  82648. name: layer.name,
  82649. url: info.url,
  82650. visible: layer.visible,
  82651. featureType: featureType,
  82652. serverId: layer.serverId.toString()
  82653. });
  82654. that.map.addLayer(that.addVectorTileLayer(layer, layerIndex, 'RESTDATA'));
  82655. that.layerAdded++;
  82656. that.sendMapToUser(len);
  82657. } else {
  82658. //数据服务
  82659. isAdded = true;
  82660. //关系型文件发布的数据服务
  82661. that.getDatasources(service.address).then(function (datasourceName) {
  82662. layer.dataSource.dataSourceName = datasourceName + ":" + datasetName;
  82663. layer.dataSource.url = `${service.address}/data`;
  82664. that.getFeaturesFromRestData(layer, layerIndex, len);
  82665. });
  82666. }
  82667. }
  82668. });
  82669. if (!isAdded) {
  82670. //循环完成了,也没有找到合适的服务。有可能服务被删除
  82671. that.layerAdded++;
  82672. that.sendMapToUser(len);
  82673. that.errorCallback && that.errorCallback(null, 'getLayerFaild', that.map);
  82674. }
  82675. }
  82676. /**
  82677. * @private
  82678. * @function ol.supermap.WebMap.prototype.getDataflowInfo
  82679. * @description 获取数据流服务的参数
  82680. * @param {object} layerInfo - 图层信息
  82681. * @param {function} success - 成功回调函数
  82682. * @param {function} faild - 失败回调函数
  82683. */
  82684. getDataflowInfo(layerInfo, success, faild) {
  82685. let that = this;
  82686. let url = layerInfo.url, token;
  82687. let requestUrl = that.getRequestUrl(`${url}.json`, false);
  82688. if (layerInfo.credential && layerInfo.credential.token) {
  82689. token = layerInfo.credential.token;
  82690. requestUrl += `?token=${token}`;
  82691. }
  82692. FetchRequest.get(requestUrl, null, {
  82693. withCredentials: this.withCredentials
  82694. }).then(function (response) {
  82695. return response.json()
  82696. }).then(function (result) {
  82697. layerInfo.featureType = "POINT";
  82698. if (result && result.featureMetaData) {
  82699. layerInfo.featureType = result.featureMetaData.featureType.toUpperCase();
  82700. }
  82701. layerInfo.wsUrl = result.urls[0].url;
  82702. success();
  82703. }).catch(function () {
  82704. faild();
  82705. });
  82706. }
  82707. /**
  82708. * @private
  82709. * @function ol.supermap.WebMap.prototype.getFeaturesFromRestData
  82710. * @description 从数据服务中获取feature
  82711. * @param {object} layer - 图层信息
  82712. * @param {Number} layerIndex - 图层index
  82713. * @param {Number} layerLength - 图层数量
  82714. */
  82715. getFeaturesFromRestData(layer, layerIndex, layerLength) {
  82716. let that = this, dataSource = layer.dataSource,
  82717. url = layer.dataSource.url,
  82718. dataSourceName = dataSource.dataSourceName || layer.name;
  82719. let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
  82720. serviceOptions.withCredentials = this.withCredentials;
  82721. if (!this.excludePortalProxyUrl && !Util.isInTheSameDomain(requestUrl)) {
  82722. serviceOptions.proxy = this.getProxy();
  82723. }
  82724. if(['EPSG:-1', 'EPSG:0', 'EPSG:-1000'].includes(layer.projection)) {
  82725. // 不支持动态投影restData服务
  82726. that.layerAdded++;
  82727. that.sendMapToUser(layerLength);
  82728. that.errorCallback && that.errorCallback({}, 'getFeatureFaild', that.map);
  82729. return;
  82730. }
  82731. //因为itest上使用的https,iserver是http,所以要加上代理
  82732. core_Util_Util.getFeatureBySQL(requestUrl, [dataSourceName], serviceOptions, function (result) {
  82733. let features = that.parseGeoJsonData2Feature({
  82734. allDatas: {
  82735. features: result.result.features.features
  82736. },
  82737. fileCode: that.baseProjection, //因为获取restData用了动态投影,不需要再进行坐标转换。所以此处filecode和底图坐标系一致
  82738. featureProjection: that.baseProjection
  82739. });
  82740. that.addLayer(layer, features, layerIndex);
  82741. that.layerAdded++;
  82742. that.sendMapToUser(layerLength);
  82743. }, function (err) {
  82744. that.layerAdded++;
  82745. that.sendMapToUser(layerLength);
  82746. that.errorCallback && that.errorCallback(err, 'getFeatureFaild', that.map)
  82747. }, that.baseProjection.split("EPSG:")[1]);
  82748. }
  82749. /**
  82750. * @private
  82751. * @function ol.supermap.WebMap.prototype.getFeatures
  82752. * @description 从地图中获取feature
  82753. * @param {object} fields - 图层信息
  82754. * @param {Number} layerInfo - 图层index
  82755. * @param {Number} success - 成功回调
  82756. * @param {Number} faild - 失败回调
  82757. */
  82758. getFeatures(fields, layerInfo, success, faild) {
  82759. var that = this;
  82760. var source = layerInfo.dataSource;
  82761. var fileCode = layerInfo.projection;
  82762. core_Util_Util.queryFeatureBySQL(source.url, source.layerName, null, fields, null, function (result) {
  82763. var recordsets = result.result.recordsets[0];
  82764. var features = recordsets.features.features;
  82765. var featuresObj = that.parseGeoJsonData2Feature({
  82766. allDatas: {
  82767. features
  82768. },
  82769. fileCode: fileCode,
  82770. featureProjection: that.baseProjection
  82771. }, 'JSON');
  82772. success(featuresObj);
  82773. }, function (err) {
  82774. faild(err);
  82775. });
  82776. }
  82777. /**
  82778. * @private
  82779. * @function ol.supermap.WebMap.prototype.sendMapToUser
  82780. * @description 将所有叠加图层叠加后,返回最终的map对象给用户,供他们操作使用
  82781. * @param {number} layersLen - 叠加图层总数
  82782. */
  82783. sendMapToUser(layersLen) {
  82784. const lens = this.isHaveGraticule ? layersLen + 1 : layersLen;
  82785. if (this.layerAdded === lens && this.successCallback) {
  82786. this.successCallback(this.map, this.mapParams, this.layers, this.baseLayer);
  82787. }
  82788. }
  82789. /**
  82790. * @private
  82791. * @function ol.supermap.WebMap.prototype.excelData2Feature
  82792. * @description 将csv和xls文件内容转换成ol.feature
  82793. * @param {object} content - 文件内容
  82794. * @param {object} layerInfo - 图层信息
  82795. * @returns {Array} ol.feature的数组集合
  82796. */
  82797. async excelData2Feature(content, layerInfo) {
  82798. let rows = content.rows,
  82799. colTitles = content.colTitles;
  82800. // 解决V2恢复的数据中含有空格
  82801. for (let i in colTitles) {
  82802. if (core_Util_Util.isString(colTitles[i])) {
  82803. colTitles[i] = core_Util_Util.trim(colTitles[i]);
  82804. }
  82805. }
  82806. let fileCode = layerInfo.projection,
  82807. dataSource = layerInfo.dataSource,
  82808. baseLayerEpsgCode = this.baseProjection,
  82809. features = [],
  82810. xField = core_Util_Util.trim((layerInfo.xyField && layerInfo.xyField.xField) || (layerInfo.from && layerInfo.from.xField)),
  82811. yField = core_Util_Util.trim((layerInfo.xyField && layerInfo.xyField.yField) || (layerInfo.from && layerInfo.from.yField)),
  82812. xIdx = colTitles.indexOf(xField),
  82813. yIdx = colTitles.indexOf(yField);
  82814. // todo 优化 暂时这样处理
  82815. if (layerInfo.layerType === 'MIGRATION') {
  82816. try {
  82817. if (dataSource.type === 'PORTAL_DATA') {
  82818. const {dataMetaInfo} = await FetchRequest.get(`${this.server}web/datas/${dataSource.serverId}.json`, null, {
  82819. withCredentials: this.withCredentials
  82820. }).then(res => res.json());
  82821. // eslint-disable-next-line require-atomic-updates
  82822. layerInfo.xyField = {
  82823. xField: dataMetaInfo.xField,
  82824. yField: dataMetaInfo.yField
  82825. }
  82826. if (!dataMetaInfo.xIndex) {
  82827. xIdx = colTitles.indexOf(dataMetaInfo.xField);
  82828. yIdx = colTitles.indexOf(dataMetaInfo.yField);
  82829. } else {
  82830. xIdx = dataMetaInfo.xIndex;
  82831. yIdx = dataMetaInfo.yIndex;
  82832. }
  82833. } else if (dataSource.type === 'SAMPLE_DATA') {
  82834. // 示例数据从本地拿xyField
  82835. const sampleData = SampleDataInfo_namespaceObject.find(item => item.id === dataSource.name) || {};
  82836. xField = sampleData.xField;
  82837. yField = sampleData.yField
  82838. layerInfo.xyField = {
  82839. xField,
  82840. yField
  82841. }
  82842. xIdx = colTitles.findIndex(item => item === xField);
  82843. yIdx = colTitles.findIndex(item => item === yField);
  82844. }
  82845. } catch (error) {
  82846. console.error(error);
  82847. }
  82848. }
  82849. for (let i = 0, len = rows.length; i < len; i++) {
  82850. let rowDatas = rows[i],
  82851. attributes = {},
  82852. geomX = rows[i][xIdx],
  82853. geomY = rows[i][yIdx];
  82854. // 位置字段信息不存在 过滤数据
  82855. if (geomX !== '' && geomY !== '') {
  82856. let olGeom = new external_ol_geom_namespaceObject.Point([+geomX, +geomY]);
  82857. if (fileCode !== baseLayerEpsgCode) {
  82858. olGeom.transform(fileCode, baseLayerEpsgCode);
  82859. }
  82860. for (let j = 0, leng = rowDatas.length; j < leng; j++) {
  82861. let field = colTitles[j];
  82862. if (field === undefined || field === null) {continue;}
  82863. field = field.trim();
  82864. if (Object.keys(attributes).indexOf(field) > -1) {
  82865. //说明前面有个一模一样的字段
  82866. const newField = field + '_1';
  82867. attributes[newField] = rowDatas[j];
  82868. } else {
  82869. attributes[field] = rowDatas[j];
  82870. }
  82871. }
  82872. let feature = new (external_ol_Feature_default())({
  82873. geometry: olGeom,
  82874. attributes
  82875. });
  82876. features.push(feature);
  82877. }
  82878. }
  82879. return Promise.resolve(features);
  82880. }
  82881. /**
  82882. * @private
  82883. * @function ol.supermap.WebMap.prototype.excelData2FeatureByDivision
  82884. * @description 行政区划数据处理
  82885. * @param {object} content - 文件内容
  82886. * @param {object} layerInfo - 图层信息
  82887. * @returns {object} geojson对象
  82888. */
  82889. excelData2FeatureByDivision(content, divisionType, divisionField) {
  82890. let me = this;
  82891. let asyncInport;
  82892. if (divisionType === 'Province') {
  82893. asyncInport = window.ProvinceData;
  82894. } else if (divisionType === 'City') {
  82895. asyncInport = window.MunicipalData;
  82896. } else if (divisionType === 'GB-T_2260') {
  82897. // let geojso;
  82898. asyncInport = window.AdministrativeArea;
  82899. }
  82900. if (asyncInport) {
  82901. let geojson = me.changeExcel2Geojson(asyncInport.features, content.rows, divisionType, divisionField);
  82902. return geojson;
  82903. }
  82904. }
  82905. /**
  82906. * @private
  82907. * @function ol.supermap.WebMap.prototype._parseGeoJsonData2Feature
  82908. * @description 将geojson的数据转换成ol.Feature
  82909. * @param {object} metaData - 文件内容
  82910. * @returns {Array.<ol/Feature>} features
  82911. */
  82912. _parseGeoJsonData2Feature(metaData) {
  82913. let allFeatures = metaData.allDatas.features,
  82914. features = [];
  82915. for (let i = 0, len = allFeatures.length; i < len; i++) {
  82916. //不删除properties转换后,属性全都在feature上
  82917. let properties = Object.assign({}, allFeatures[i].properties);
  82918. delete allFeatures[i].properties;
  82919. let feature = transformTools.readFeature(allFeatures[i], {
  82920. dataProjection: metaData.fileCode,
  82921. featureProjection: this.baseProjection || 'ESPG:4326'
  82922. });
  82923. feature.setProperties({attributes: properties});
  82924. features.push(feature);
  82925. }
  82926. return features;
  82927. }
  82928. /**
  82929. * @private
  82930. * @function ol.supermap.WebMap.prototype.changeExcel2Geojson
  82931. * @description 将excel和csv数据转换成标准geojson数据
  82932. * @param {array} features - feature对象
  82933. * @param {array} datas - 数据内容
  82934. * @param {string} divisionType - 行政区划类型
  82935. * @param {string} divisionField - 行政区划字段
  82936. * @returns {object} geojson对象
  82937. */
  82938. changeExcel2Geojson(features, datas, divisionType, divisionField) {
  82939. let geojson = {
  82940. type: 'FeatureCollection',
  82941. features: []
  82942. };
  82943. if (datas.length < 2) {
  82944. return geojson; //只有一行数据时为标题
  82945. }
  82946. let titles = datas[0],
  82947. rows = datas.slice(1),
  82948. fieldIndex = titles.findIndex(title => title === divisionField);
  82949. rows.forEach(row => {
  82950. let feature;
  82951. if (divisionType === 'GB-T_2260') {
  82952. feature = features.find(item => item.properties.GB === row[fieldIndex])
  82953. } else {
  82954. feature = core_Util_Util.getHighestMatchAdministration(features, row[fieldIndex]);
  82955. }
  82956. //todo 需提示忽略无效数据
  82957. if (feature) {
  82958. let newFeature = window.cloneDeep(feature);
  82959. newFeature.properties = {};
  82960. row.forEach((item, idx) => {
  82961. //空格问题,看见DV多处处理空格问题,TODO统一整理
  82962. let key = titles[idx].trim();
  82963. newFeature.properties[key] = item;
  82964. });
  82965. geojson.features.push(newFeature);
  82966. }
  82967. });
  82968. return geojson;
  82969. }
  82970. /**
  82971. * @private
  82972. * @function ol.supermap.WebMap.prototype.geojsonToFeature
  82973. * @description geojson 转换为 feature
  82974. * @param {object} layerInfo - 图层信息
  82975. * @returns {Array} ol.feature的数组集合
  82976. */
  82977. geojsonToFeature(geojson, layerInfo) {
  82978. let allFeatures = geojson.features,
  82979. features = [];
  82980. for (let i = 0, len = allFeatures.length; i < len; i++) {
  82981. //转换前删除properties,这样转换后属性不会重复存储
  82982. let featureAttr = allFeatures[i].properties || {};
  82983. delete allFeatures[i].properties;
  82984. let feature = transformTools.readFeature(allFeatures[i], {
  82985. dataProjection: layerInfo.projection || 'EPSG:4326',
  82986. featureProjection: this.baseProjection || 'ESPG:4326'
  82987. });
  82988. //geojson格式的feature属性没有坐标系字段,为了统一,再次加上
  82989. let coordinate = feature.getGeometry().getCoordinates();
  82990. if (allFeatures[i].geometry.type === 'Point') {
  82991. // 标注图层 还没有属性值时候不加
  82992. if (allFeatures[i].properties) {
  82993. allFeatures[i].properties.lon = coordinate[0];
  82994. allFeatures[i].properties.lat = coordinate[1];
  82995. }
  82996. }
  82997. // 标注图层特殊处理
  82998. let isMarker = false;
  82999. let attributes;
  83000. let useStyle;
  83001. if (allFeatures[i].dv_v5_markerInfo) {
  83002. //因为优化代码之前,属性字段都存储在propertise上,markerInfo没有
  83003. attributes = Object.assign({}, allFeatures[i].dv_v5_markerInfo, featureAttr);
  83004. if (attributes.lon) {
  83005. //标注图层不需要
  83006. delete attributes.lon;
  83007. delete attributes.lat;
  83008. }
  83009. }
  83010. if (allFeatures[i].dv_v5_markerStyle) {
  83011. useStyle = allFeatures[i].dv_v5_markerStyle;
  83012. isMarker = true;
  83013. }
  83014. let properties;
  83015. if (isMarker) {
  83016. properties = Object.assign({}, {
  83017. attributes
  83018. }, {
  83019. useStyle
  83020. });
  83021. //feature上添加图层的id,为了对应图层
  83022. feature.layerId = layerInfo.timeId;
  83023. } else if (layerInfo.featureStyles) {
  83024. //V4 版本标注图层处理
  83025. let style = JSON.parse(layerInfo.featureStyles[i].style);
  83026. let attr = featureAttr;
  83027. let imgUrl;
  83028. if (attr._smiportal_imgLinkUrl.indexOf('http://') > -1 || attr._smiportal_imgLinkUrl.indexOf('https://') > -1) {
  83029. imgUrl = attr._smiportal_imgLinkUrl;
  83030. } else if (attr._smiportal_imgLinkUrl !== undefined && attr._smiportal_imgLinkUrl !== null &&
  83031. attr._smiportal_imgLinkUrl !== '') {
  83032. //上传的图片,加上当前地址
  83033. imgUrl = `${core_Util_Util.getIPortalUrl()}resources/markerIcon/${attr._smiportal_imgLinkUrl}`
  83034. }
  83035. attributes = {
  83036. dataViz_description: attr._smiportal_description,
  83037. dataViz_imgUrl: imgUrl,
  83038. dataViz_title: attr._smiportal_title,
  83039. dataViz_url: attr._smiportal_otherLinkUrl
  83040. };
  83041. style.anchor = [0.5, 1];
  83042. style.src = style.externalGraphic;
  83043. useStyle = style;
  83044. properties = Object.assign({}, {
  83045. attributes
  83046. }, {
  83047. useStyle
  83048. });
  83049. delete attr._smiportal_description;
  83050. delete attr._smiportal_imgLinkUrl;
  83051. delete attr._smiportal_title;
  83052. delete attr._smiportal_otherLinkUrl;
  83053. } else {
  83054. properties = {attributes: featureAttr};
  83055. }
  83056. feature.setProperties(properties);
  83057. features.push(feature);
  83058. }
  83059. return features;
  83060. }
  83061. /**
  83062. * @private
  83063. * @function ol.supermap.WebMap.prototype.parseGeoJsonData2Feature
  83064. * @description 将从restData地址上获取的json转换成feature(从iserver中获取的json转换成feature)
  83065. * @param {object} metaData - json内容
  83066. * @returns {Array} ol.feature的数组集合
  83067. */
  83068. parseGeoJsonData2Feature(metaData) {
  83069. let allFeatures = metaData.allDatas.features,
  83070. features = [];
  83071. for (let i = 0, len = allFeatures.length; i < len; i++) {
  83072. let properties = allFeatures[i].properties;
  83073. delete allFeatures[i].properties;
  83074. let feature = transformTools.readFeature(allFeatures[i], {
  83075. dataProjection: metaData.fileCode || 'EPSG:4326',
  83076. featureProjection: metaData.featureProjection || this.baseProjection || 'EPSG:4326'
  83077. });
  83078. //geojson格式的feature属性没有坐标系字段,为了统一,再次加上
  83079. let geometry = feature.getGeometry();
  83080. // 如果不存在geometry,也不需要组装feature
  83081. if(!geometry) {continue;}
  83082. let coordinate = geometry.getCoordinates();
  83083. if (allFeatures[i].geometry.type === 'Point') {
  83084. properties.lon = coordinate[0];
  83085. properties.lat = coordinate[1];
  83086. }
  83087. feature.setProperties({
  83088. attributes: properties
  83089. });
  83090. features.push(feature);
  83091. }
  83092. return features;
  83093. }
  83094. /**
  83095. * @private
  83096. * @function ol.supermap.WebMap.prototype.addLayer
  83097. * @description 将叠加图层添加到地图上
  83098. * @param {object} layerInfo - 图层信息
  83099. * @param {array} features - 图层上的feature集合
  83100. * @param {number} index 图层的顺序
  83101. */
  83102. addLayer(layerInfo, features, index) {
  83103. let layer, that = this;
  83104. if (layerInfo.layerType === "VECTOR") {
  83105. if (layerInfo.featureType === "POINT") {
  83106. if (layerInfo.style.type === 'SYMBOL_POINT') {
  83107. layer = this.createSymbolLayer(layerInfo, features);
  83108. } else {
  83109. layer = this.createGraphicLayer(layerInfo, features);
  83110. }
  83111. } else {
  83112. //线和面
  83113. layer = this.createVectorLayer(layerInfo, features)
  83114. }
  83115. } else if (layerInfo.layerType === "UNIQUE") {
  83116. layer = this.createUniqueLayer(layerInfo, features);
  83117. } else if (layerInfo.layerType === "RANGE") {
  83118. layer = this.createRangeLayer(layerInfo, features);
  83119. } else if (layerInfo.layerType === "HEAT") {
  83120. layer = this.createHeatLayer(layerInfo, features);
  83121. } else if (layerInfo.layerType === "MARKER") {
  83122. layer = this.createMarkerLayer(features);
  83123. } else if (layerInfo.layerType === "DATAFLOW_POINT_TRACK") {
  83124. layer = this.createDataflowLayer(layerInfo, index);
  83125. } else if (layerInfo.layerType === "DATAFLOW_HEAT") {
  83126. layer = this.createDataflowHeatLayer(layerInfo);
  83127. } else if (layerInfo.layerType === "RANK_SYMBOL") {
  83128. layer = this.createRankSymbolLayer(layerInfo, features);
  83129. } else if (layerInfo.layerType === "MIGRATION") {
  83130. layer = this.createMigrationLayer(layerInfo, features);
  83131. }
  83132. let layerID = core_Util_Util.newGuid(8);
  83133. if (layer) {
  83134. layerInfo.name && layer.setProperties({
  83135. name: layerInfo.name,
  83136. layerID: layerID,
  83137. layerType: layerInfo.layerType
  83138. });
  83139. //刷新下图层,否则feature样式出不来
  83140. if (layerInfo && layerInfo.style && layerInfo.style.imageInfo) {
  83141. let img = new Image();
  83142. img.src = layerInfo.style.imageInfo.url;
  83143. img.onload = function () {
  83144. layer.getSource().changed();
  83145. };
  83146. }
  83147. if (layerInfo.layerType === 'MIGRATION') {
  83148. layer.appendTo(this.map);
  83149. // 在这里恢复图层可见性状态
  83150. layer.setVisible(layerInfo.visible);
  83151. // 设置鼠标样式为默认
  83152. layer.setCursor();
  83153. } else {
  83154. layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity);
  83155. layer.setVisible(layerInfo.visible);
  83156. this.map.addLayer(layer);
  83157. }
  83158. layer.setZIndex(index);
  83159. const {visibleScale, autoUpdateTime} = layerInfo;
  83160. visibleScale && this.setVisibleScales(layer, visibleScale);
  83161. if (autoUpdateTime && !layerInfo.autoUpdateInterval) {
  83162. //自动更新数据
  83163. let dataSource = layerInfo.dataSource;
  83164. if (dataSource.accessType === "DIRECT" && !dataSource.url) {
  83165. // 二进制数据更新feautre所需的url
  83166. dataSource.url = `${this.server}web/datas/${dataSource.serverId}/content.json?pageSize=9999999&currentPage=1`
  83167. }
  83168. layerInfo.autoUpdateInterval = setInterval(() => {
  83169. that.updateFeaturesToMap(layerInfo, index, true);
  83170. }, autoUpdateTime);
  83171. }
  83172. }
  83173. layerInfo.layer = layer;
  83174. layerInfo.layerID = layerID;
  83175. if (layerInfo.labelStyle && layerInfo.labelStyle.labelField && layerInfo.layerType !== "DATAFLOW_POINT_TRACK") {
  83176. //存在标签专题图
  83177. //过滤条件过滤feature
  83178. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  83179. this.addLabelLayer(layerInfo, features);
  83180. }
  83181. }
  83182. /**
  83183. * @private
  83184. * @function ol.supermap.WebMap.prototype.updateFeaturesToMap
  83185. * @description 更新地图上的feature,适用于专题图
  83186. * @param {object} layerInfo - 图层信息
  83187. * @param {number} index 图层的顺序
  83188. */
  83189. updateFeaturesToMap(layerInfo, layerIndex) {
  83190. let that = this, dataSource = layerInfo.dataSource, url = layerInfo.dataSource.url,
  83191. dataSourceName = dataSource.dataSourceName || layerInfo.name;
  83192. if (dataSource.type === "USER_DATA" || dataSource.accessType === "DIRECT") {
  83193. that.addGeojsonFromUrl(layerInfo, null, layerIndex)
  83194. } else {
  83195. let requestUrl = that.formatUrlWithCredential(url), serviceOptions = {};
  83196. serviceOptions.withCredentials = this.withCredentials;
  83197. if (!this.excludePortalProxyUrl && !Util.isInTheSameDomain(requestUrl)) {
  83198. serviceOptions.proxy = this.getProxy();
  83199. }
  83200. //因为itest上使用的https,iserver是http,所以要加上代理
  83201. core_Util_Util.getFeatureBySQL(requestUrl, [dataSourceName], serviceOptions, function (result) {
  83202. let features = that.parseGeoJsonData2Feature({
  83203. allDatas: {
  83204. features: result.result.features.features
  83205. },
  83206. fileCode: layerInfo.projection,
  83207. featureProjection: that.baseProjection
  83208. });
  83209. //删除之前的图层和标签图层
  83210. that.map.removeLayer(layerInfo.layer);
  83211. layerInfo.labelLayer && that.map.removeLayer(layerInfo.labelLayer);
  83212. that.addLayer(layerInfo, features, layerIndex);
  83213. }, function (err) {
  83214. that.errorCallback && that.errorCallback(err, 'autoUpdateFaild', that.map);
  83215. });
  83216. }
  83217. }
  83218. /**
  83219. * @private
  83220. * @function ol.supermap.WebMap.prototype.addVectorTileLayer
  83221. * @description 添加vectorTILE图层
  83222. * @param {object} layerInfo - 图层信息
  83223. * @param {number} index 图层的顺序
  83224. * @param {String} type 创建的图层类型,restData为创建数据服务的mvt, restMap为创建地图服务的mvt
  83225. * @returns {ol/layer/VectorTile} 图层对象
  83226. */
  83227. addVectorTileLayer(layerInfo, index, type) {
  83228. let layer;
  83229. if (type === 'RESTDATA') {
  83230. //用的是restdata服务的mvt
  83231. layer = this.createDataVectorTileLayer(layerInfo)
  83232. }
  83233. let layerID = core_Util_Util.newGuid(8);
  83234. if (layer) {
  83235. layerInfo.name && layer.setProperties({
  83236. name: layerInfo.name,
  83237. layerID: layerID
  83238. });
  83239. layerInfo.opacity != undefined && layer.setOpacity(layerInfo.opacity);
  83240. layer.setVisible(layerInfo.visible);
  83241. layer.setZIndex(index);
  83242. }
  83243. layerInfo.layer = layer;
  83244. layerInfo.layerID = layerID;
  83245. return layer;
  83246. }
  83247. /**
  83248. * @private
  83249. * @function ol.supermap.WebMap.prototype.createDataVectorTileLayer
  83250. * @description 创建vectorTILE图层
  83251. * @param {object} layerInfo - 图层信息
  83252. * @returns {ol/layer/VectorTile} 图层对象
  83253. */
  83254. createDataVectorTileLayer(layerInfo) {
  83255. //创建图层
  83256. var format = new (external_ol_format_MVT_default())({
  83257. featureClass: (external_ol_Feature_default())
  83258. });
  83259. //要加上这一句,否则坐标,默认都是3857
  83260. (external_ol_format_MVT_default()).prototype.readProjection = function () {
  83261. return new external_ol_proj_namespaceObject.Projection({
  83262. code: '',
  83263. units: (external_ol_proj_Units_default()).TILE_PIXELS
  83264. });
  83265. };
  83266. let featureType = layerInfo.featureType;
  83267. let style = StyleUtils.toOpenLayersStyle(this.getDataVectorTileStyle(featureType), featureType);
  83268. return new external_ol_layer_namespaceObject.VectorTile({
  83269. //设置避让参数
  83270. source: new VectorTileSuperMapRest({
  83271. url: layerInfo.url,
  83272. projection: layerInfo.projection,
  83273. tileType: "ScaleXY",
  83274. format: format
  83275. }),
  83276. style: style
  83277. });
  83278. }
  83279. /**
  83280. * @private
  83281. * @function ol.supermap.WebMap.prototype.getDataVectorTileStyle
  83282. * @description 获取数据服务的mvt上图的默认样式
  83283. * @param {String} featureType - 要素类型
  83284. * @returns {Object} 样式参数
  83285. */
  83286. getDataVectorTileStyle(featureType) {
  83287. let styleParameters = {
  83288. radius: 8, //圆点半径
  83289. fillColor: '#EE4D5A', //填充色
  83290. fillOpacity: 0.9,
  83291. strokeColor: '#ffffff', //边框颜色
  83292. strokeWidth: 1,
  83293. strokeOpacity: 1,
  83294. lineDash: 'solid',
  83295. type: "BASIC_POINT"
  83296. };
  83297. if (["LINE", "LINESTRING", "MULTILINESTRING"].indexOf(featureType) > -1) {
  83298. styleParameters.strokeColor = '#4CC8A3';
  83299. styleParameters.strokeWidth = 2;
  83300. } else if (["REGION", "POLYGON", "MULTIPOLYGON"].indexOf(featureType) > -1) {
  83301. styleParameters.fillColor = '#826DBA';
  83302. }
  83303. return styleParameters;
  83304. }
  83305. /**
  83306. * @private
  83307. * @function ol.supermap.WebMap.prototype.getFiterFeatures
  83308. * @description 通过过滤条件查询满足的feature
  83309. * @param {string} filterCondition - 过滤条件
  83310. * @param {array} allFeatures - 图层上的feature集合
  83311. */
  83312. getFiterFeatures(filterCondition, allFeatures) {
  83313. let condition = this.parseFilterCondition(filterCondition);
  83314. let sql = "select * from json where (" + condition + ")";
  83315. let filterFeatures = [];
  83316. for (let i = 0; i < allFeatures.length; i++) {
  83317. let feature = allFeatures[i];
  83318. let filterResult = false;
  83319. try {
  83320. filterResult = window.jsonsql.query(sql, {
  83321. attributes: feature.get('attributes')
  83322. });
  83323. } catch (err) {
  83324. //必须把要过滤得内容封装成一个对象,主要是处理jsonsql(line : 62)中由于with语句遍历对象造成的问题
  83325. continue;
  83326. }
  83327. if (filterResult && filterResult.length > 0) {
  83328. //afterFilterFeatureIdx.push(i);
  83329. filterFeatures.push(feature);
  83330. }
  83331. }
  83332. return filterFeatures;
  83333. }
  83334. /**
  83335. * @private
  83336. * @function ol.supermap.WebMap.prototype.parseFilterCondition
  83337. * @description 1、替换查询语句 中的 and / AND / or / OR / = / !=
  83338. * 2、匹配 Name in ('', ''),多条件需用()包裹
  83339. * @param {string} filterCondition - 过滤条件
  83340. * @return {string} 换成组件能识别的字符串
  83341. */
  83342. parseFilterCondition(filterCondition) {
  83343. return filterCondition
  83344. .replace(/=/g, "==")
  83345. .replace(/AND|and/g, "&&")
  83346. .replace(/or|OR/g, "||")
  83347. .replace(/<==/g, "<=")
  83348. .replace(/>==/g, ">=")
  83349. .replace(/\(?[^\(]+?\s*in\s*\([^\)]+?\)\)?/gi, (res) => {
  83350. // res格式:(省份 in ('四川', '河南'))
  83351. const data = res.match(/([^(]+?)\s*in\s*\(([^)]+?)\)/i);
  83352. return data.length === 3
  83353. ? `(${data[2]
  83354. .split(",")
  83355. .map((c) => `${data[1]} == ${c.trim()}`)
  83356. .join(" || ")})`
  83357. : res;
  83358. });
  83359. }
  83360. /**
  83361. * @private
  83362. * @function ol.supermap.WebMap.prototype.createGraphicLayer
  83363. * @description 添加大数据图层到地图上
  83364. * @param {object} layerInfo - 图层信息
  83365. * @param {array} features - feature的集合
  83366. * @return {ol/layer/image} 大数据图层
  83367. */
  83368. createGraphicLayer(layerInfo, features) {
  83369. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  83370. let graphics = this.getGraphicsFromFeatures(features, layerInfo.style, layerInfo.featureType);
  83371. let source = new Graphic({
  83372. graphics: graphics,
  83373. render: 'canvas',
  83374. map: this.map,
  83375. isHighLight: false
  83376. });
  83377. return new external_ol_layer_namespaceObject.Image({
  83378. source: source
  83379. });
  83380. }
  83381. /**
  83382. * @private
  83383. * @function ol.supermap.WebMap.prototype.getGraphicsFromFeatures
  83384. * @description 将feature转换成大数据图层对应的Graphics要素
  83385. * @param {array} features - feature的集合
  83386. * @param {object} style - 图层样式
  83387. * @param {string} featureType - feature的类型
  83388. * @return {array} 大数据图层要素数组
  83389. */
  83390. getGraphicsFromFeatures(features, style, featureType) {
  83391. let olStyle = StyleUtils.getOpenlayersStyle(style, featureType),
  83392. shape = olStyle.getImage();
  83393. let graphics = [];
  83394. //构建graphic
  83395. for (let i in features) {
  83396. let graphic = new Graphic_Graphic(features[i].getGeometry());
  83397. graphic.setStyle(shape);
  83398. graphic.setProperties({attributes: features[i].get('attributes')})
  83399. graphics.push(graphic);
  83400. }
  83401. return graphics;
  83402. }
  83403. /**
  83404. * @private
  83405. * @function ol.supermap.WebMap.prototype.createSymbolLayer
  83406. * @description 添加符号图层
  83407. * @param {object} layerInfo - 图层信息
  83408. * @param {array} features - feature的集合
  83409. * @return {ol/layer/Vector} 符号图层
  83410. */
  83411. createSymbolLayer(layerInfo, features) {
  83412. let style = StyleUtils.getSymbolStyle(layerInfo.style);
  83413. return new external_ol_layer_namespaceObject.Vector({
  83414. style: style,
  83415. source: new external_ol_source_namespaceObject.Vector({
  83416. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  83417. wrapX: false
  83418. }),
  83419. renderMode: 'image'
  83420. });
  83421. }
  83422. /**
  83423. * @private
  83424. * @function ol.supermap.WebMap.prototype.addLabelLayer
  83425. * @description 添加标签图层
  83426. * @param {object} layerInfo - 图层信息
  83427. * @param {array} features -feature的集合
  83428. * @returns {ol/layer/Vector} 图层对象
  83429. */
  83430. addLabelLayer(layerInfo, features) {
  83431. let labelStyle = layerInfo.labelStyle;
  83432. let style = this.getLabelStyle(labelStyle, layerInfo);
  83433. let layer = layerInfo.labelLayer = new external_ol_layer_namespaceObject.Vector({
  83434. declutter: true,
  83435. styleOL: style,
  83436. labelField: labelStyle.labelField,
  83437. source: new external_ol_source_namespaceObject.Vector({
  83438. features: features,
  83439. wrapX: false
  83440. })
  83441. });
  83442. layer.setStyle(features => {
  83443. let labelField = labelStyle.labelField;
  83444. let label = features.get('attributes')[labelField.trim()] + "";
  83445. if (label === "undefined") {
  83446. return null;
  83447. }
  83448. let styleOL = layer.get('styleOL');
  83449. let text = styleOL.getText();
  83450. if (text && text.setText) {
  83451. text.setText(label);
  83452. }
  83453. return styleOL;
  83454. });
  83455. this.map.addLayer(layer);
  83456. layer.setVisible(layerInfo.visible);
  83457. layer.setZIndex(1000);
  83458. const {visibleScale} = layerInfo;
  83459. visibleScale && this.setVisibleScales(layer, visibleScale);
  83460. return layer;
  83461. }
  83462. /**
  83463. * @private
  83464. * @function ol.supermap.WebMap.prototype.setVisibleScales
  83465. * @description 改变图层可视范围
  83466. * @param {object} layer - 图层对象。ol.Layer
  83467. * @param {object} visibleScale - 图层样式参数
  83468. */
  83469. setVisibleScales(layer, visibleScale) {
  83470. let maxResolution = this.resolutions[visibleScale.minScale],
  83471. minResolution = this.resolutions[visibleScale.maxScale];
  83472. //比例尺和分别率是反比的关系
  83473. maxResolution > 1 ? layer.setMaxResolution(Math.ceil(maxResolution)) : layer.setMaxResolution(maxResolution * 1.1);
  83474. layer.setMinResolution(minResolution);
  83475. }
  83476. /**
  83477. * @private
  83478. * @function ol.supermap.WebMap.prototype.getLabelStyle
  83479. * @description 获取标签样式
  83480. * @param {object} parameters - 标签图层样式参数
  83481. * @param {object} layerInfo - 图层样式参数
  83482. * @returns {ol/style/Style} 标签样式
  83483. */
  83484. getLabelStyle(parameters, layerInfo) {
  83485. let style = layerInfo.style || layerInfo.pointStyle;
  83486. const {radius = 0, strokeWidth = 0} = style,
  83487. beforeOffsetY = -(radius + strokeWidth);
  83488. const {
  83489. fontSize = '14px',
  83490. fontFamily,
  83491. fill,
  83492. backgroundFill,
  83493. offsetX = 0,
  83494. offsetY = beforeOffsetY,
  83495. placement = "point",
  83496. textBaseline = "bottom",
  83497. textAlign = 'center',
  83498. outlineColor = "#000000",
  83499. outlineWidth = 0
  83500. } = parameters;
  83501. const option = {
  83502. font: `${fontSize} ${fontFamily}`,
  83503. placement,
  83504. textBaseline,
  83505. fill: new (external_ol_style_Fill_default())({color: fill}),
  83506. backgroundFill: new (external_ol_style_Fill_default())({color: backgroundFill}),
  83507. padding: [3, 3, 3, 3],
  83508. offsetX: layerInfo.featureType === 'POINT' ? offsetX : 0,
  83509. offsetY: layerInfo.featureType === 'POINT' ? offsetY : 0,
  83510. overflow: true,
  83511. maxAngle: 0
  83512. };
  83513. if (layerInfo.featureType === 'POINT') {
  83514. //线面不需要此参数,否则超出线面overflow:true,也不会显示标签
  83515. option.textAlign = textAlign;
  83516. }
  83517. if (outlineWidth > 0) {
  83518. option.stroke = new (external_ol_style_Stroke_default())({
  83519. color: outlineColor,
  83520. width: outlineWidth
  83521. });
  83522. }
  83523. return new (external_ol_style_Style_default())({
  83524. text: new (external_ol_style_Text_default())(option)
  83525. });
  83526. }
  83527. /**
  83528. * @private
  83529. * @function ol.supermap.WebMap.prototype.createVectorLayer
  83530. * @description 创建vector图层
  83531. * @param {object} layerInfo - 图层信息
  83532. * @param {array} features -feature的集合
  83533. * @returns {ol/layer/Vector} 矢量图层
  83534. */
  83535. createVectorLayer(layerInfo, features) {
  83536. const {featureType, style} = layerInfo;
  83537. let newStyle;
  83538. if (featureType === 'LINE' && core_Util_Util.isArray(style)) {
  83539. const [outlineStyle, strokeStyle] = style;
  83540. newStyle = strokeStyle.lineDash === 'solid' ? StyleUtils.getRoadPath(strokeStyle, outlineStyle)
  83541. : StyleUtils.getPathway(strokeStyle, outlineStyle);
  83542. } else {
  83543. newStyle = StyleUtils.toOpenLayersStyle(layerInfo.style, layerInfo.featureType);
  83544. }
  83545. return new external_ol_layer_namespaceObject.Vector({
  83546. style: newStyle,
  83547. source: new external_ol_source_namespaceObject.Vector({
  83548. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  83549. wrapX: false
  83550. })
  83551. });
  83552. }
  83553. /**
  83554. * @private
  83555. * @function ol.supermap.WebMap.prototype.createHeatLayer
  83556. * @description 创建热力图图层
  83557. * @param {object} layerInfo - 图层信息
  83558. * @param {array} features -feature的集合
  83559. * @returns {ol/layer/Heatmap} 热力图图层
  83560. */
  83561. createHeatLayer(layerInfo, features) {
  83562. //因为热力图,随着过滤,需要重新计算权重
  83563. features = layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features;
  83564. let source = new external_ol_source_namespaceObject.Vector({
  83565. features: features,
  83566. wrapX: false
  83567. });
  83568. let layerOptions = {
  83569. source: source
  83570. };
  83571. let themeSetting = layerInfo.themeSetting;
  83572. layerOptions.gradient = themeSetting.colors.slice();
  83573. layerOptions.radius = parseInt(themeSetting.radius);
  83574. //自定义颜色
  83575. let customSettings = themeSetting.customSettings;
  83576. for (let i in customSettings) {
  83577. layerOptions.gradient[i] = customSettings[i];
  83578. }
  83579. // 权重字段恢复
  83580. if (themeSetting.weight) {
  83581. this.changeWeight(features, themeSetting.weight);
  83582. }
  83583. return new external_ol_layer_namespaceObject.Heatmap(layerOptions);
  83584. }
  83585. /**
  83586. * @private
  83587. * @function ol.supermap.WebMap.prototype.changeWeight
  83588. * @description 改变当前权重字段
  83589. * @param {array} features - feature的集合
  83590. * @param {string} weightFeild - 权重字段
  83591. */
  83592. changeWeight(features, weightFeild) {
  83593. let that = this;
  83594. this.fieldMaxValue = {};
  83595. this.getMaxValue(features, weightFeild);
  83596. let maxValue = this.fieldMaxValue[weightFeild];
  83597. features.forEach(function (feature) {
  83598. let attributes = feature.get('attributes');
  83599. try {
  83600. let value = attributes[weightFeild];
  83601. feature.set('weight', value / maxValue);
  83602. } catch (e) {
  83603. that.errorCallback && that.errorCallback(e);
  83604. }
  83605. })
  83606. }
  83607. /**
  83608. * @private
  83609. * @function ol.supermap.WebMap.prototype.getMaxValue
  83610. * @description 获取当前字段对应的最大值,用于计算权重
  83611. * @param {array} features - feature 数组
  83612. * @param {string} weightField - 权重字段
  83613. */
  83614. getMaxValue(features, weightField) {
  83615. let values = [], that = this, attributes;
  83616. let field = weightField;
  83617. if (this.fieldMaxValue[field]) {
  83618. return;
  83619. }
  83620. features.forEach(function (feature) {
  83621. //收集当前权重字段对应的所有值
  83622. attributes = feature.get('attributes');
  83623. try {
  83624. values.push(parseFloat(attributes[field]));
  83625. } catch (e) {
  83626. that.errorCallback && that.errorCallback(e);
  83627. }
  83628. });
  83629. this.fieldMaxValue[field] = ArrayStatistic.getArrayStatistic(values, 'Maximum');
  83630. }
  83631. /**
  83632. * @private
  83633. * @function ol.supermap.WebMap.prototype.createUniqueLayer
  83634. * @description 获取当前字段对应的最大值,用于计算权重
  83635. * @param {array} layerInfo - 图层信息
  83636. * @param {array} features - 所有feature结合
  83637. */
  83638. createUniqueLayer(layerInfo, features) {
  83639. let styleSource = this.createUniqueSource(layerInfo, features);
  83640. let layer = new external_ol_layer_namespaceObject.Vector({
  83641. styleSource: styleSource,
  83642. source: new external_ol_source_namespaceObject.Vector({
  83643. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  83644. wrapX: false
  83645. })
  83646. });
  83647. layer.setStyle(feature => {
  83648. let styleSource = layer.get('styleSource');
  83649. let labelField = styleSource.themeField;
  83650. let label = feature.get('attributes')[labelField];
  83651. let styleGroup = styleSource.styleGroups.find(item => {
  83652. return item.value === label;
  83653. })
  83654. return styleGroup.olStyle;
  83655. });
  83656. return layer;
  83657. }
  83658. /**
  83659. * @private
  83660. * @function ol.supermap.WebMap.prototype.createUniqueSource
  83661. * @description 创建单值图层的source
  83662. * @param {layerInfo} parameters- 图层信息
  83663. * @param {array} features - feature 数组
  83664. * @returns {{map: *, style: *, isHoverAble: *, highlightStyle: *, themeField: *, styleGroups: Array}}
  83665. */
  83666. createUniqueSource(parameters, features) {
  83667. //找到合适的专题字段
  83668. let styleGroup = this.getUniqueStyleGroup(parameters, features);
  83669. return {
  83670. map: this.map, //必传参数 API居然不提示
  83671. style: parameters.style,
  83672. isHoverAble: parameters.isHoverAble,
  83673. highlightStyle: parameters.highlightStyle,
  83674. themeField: parameters.themeSetting.themeField,
  83675. styleGroups: styleGroup
  83676. };
  83677. }
  83678. /**
  83679. * @private
  83680. * @function ol.supermap.WebMap.prototype.getUniqueStyleGroup
  83681. * @description 获取单值专题图的styleGroup
  83682. * @param {object} parameters- 图层信息
  83683. * @param {array} features - feature 数组
  83684. * @returns {Array} 单值样式
  83685. */
  83686. getUniqueStyleGroup(parameters, features) {
  83687. // 找出所有的单值
  83688. let featureType = parameters.featureType,
  83689. style = parameters.style,
  83690. themeSetting = parameters.themeSetting;
  83691. let fieldName = themeSetting.themeField;
  83692. let names = [],
  83693. customSettings = themeSetting.customSettings;
  83694. for (let i in features) {
  83695. let attributes = features[i].get('attributes');
  83696. let name = attributes[fieldName];
  83697. let isSaved = false;
  83698. for (let j in names) {
  83699. if (names[j] === name) {
  83700. isSaved = true;
  83701. break;
  83702. }
  83703. }
  83704. if (!isSaved) {
  83705. names.push(name);
  83706. }
  83707. }
  83708. //生成styleGroup
  83709. let styleGroup = [];
  83710. names.forEach(function (name, index) {
  83711. //兼容之前自定义是用key,现在因为数据支持编辑,需要用属性值。
  83712. let key = this.webMapVersion === "1.0" ? index : name;
  83713. let custom = customSettings[key];
  83714. if(core_Util_Util.isString(custom)) {
  83715. //兼容之前自定义只存储一个color
  83716. custom = this.getCustomSetting(style, custom, featureType);
  83717. customSettings[key] = custom;
  83718. }
  83719. // 转化成 ol 样式
  83720. let olStyle, type = custom.type;
  83721. if(type === 'SYMBOL_POINT') {
  83722. olStyle = StyleUtils.getSymbolStyle(custom);
  83723. } else if(type === 'SVG_POINT') {
  83724. olStyle = StyleUtils.getSVGStyle(custom);
  83725. } else if(type === 'IMAGE_POINT') {
  83726. olStyle = StyleUtils.getImageStyle(custom);
  83727. } else {
  83728. olStyle = StyleUtils.toOpenLayersStyle(custom, featureType);
  83729. }
  83730. styleGroup.push({
  83731. olStyle: olStyle,
  83732. style: customSettings[key],
  83733. value: name
  83734. });
  83735. }, this);
  83736. return styleGroup;
  83737. }
  83738. /**
  83739. * 获取单值专题图自定义样式对象
  83740. * @param {*} style 图层上的样式
  83741. * @param {*} color 单值对应的颜色
  83742. * @param {*} featureType 要素类型
  83743. */
  83744. getCustomSetting(style, color, featureType) {
  83745. let newProps = {};
  83746. if (featureType === "LINE") {
  83747. newProps.strokeColor = color;
  83748. } else {
  83749. newProps.fillColor = color;
  83750. }
  83751. let customSetting = Object.assign(style, newProps)
  83752. return customSetting;
  83753. }
  83754. /**
  83755. * @private
  83756. * @function ol.supermap.WebMap.prototype.createRangeLayer
  83757. * @description 创建分段图层
  83758. * @param {object} layerInfo- 图层信息
  83759. * @param {array} features - 所有feature结合
  83760. * @returns {ol/layer/Vector} 单值图层
  83761. */
  83762. createRangeLayer(layerInfo, features) {
  83763. //这里获取styleGroup要用所以的feature
  83764. let styleSource = this.createRangeSource(layerInfo, features);
  83765. let layer = new external_ol_layer_namespaceObject.Vector({
  83766. styleSource: styleSource,
  83767. source: new external_ol_source_namespaceObject.Vector({
  83768. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  83769. wrapX: false
  83770. })
  83771. });
  83772. layer.setStyle(feature => {
  83773. let styleSource = layer.get('styleSource');
  83774. if (styleSource) {
  83775. let labelField = styleSource.themeField;
  83776. let value = Number(feature.get('attributes')[labelField.trim()]);
  83777. let styleGroups = styleSource.styleGroups;
  83778. for (let i = 0; i < styleGroups.length; i++) {
  83779. if (i === 0) {
  83780. if (value >= styleGroups[i].start && value <= styleGroups[i].end) {
  83781. return styleGroups[i].olStyle;
  83782. }
  83783. } else {
  83784. if (value > styleGroups[i].start && value <= styleGroups[i].end) {
  83785. return styleGroups[i].olStyle;
  83786. }
  83787. }
  83788. }
  83789. }
  83790. });
  83791. return layer;
  83792. }
  83793. /**
  83794. * @private
  83795. * @function ol.supermap.WebMap.prototype.createRangeSource
  83796. * @description 创建分段专题图的图层source
  83797. * @param {object} parameters- 图层信息
  83798. * @param {array} features - 所以的feature集合
  83799. * @returns {Object} 图层source
  83800. */
  83801. createRangeSource(parameters, features) {
  83802. //找到合适的专题字段
  83803. let styleGroup = this.getRangeStyleGroup(parameters, features);
  83804. if (styleGroup) {
  83805. return {
  83806. style: parameters.style,
  83807. themeField: parameters.themeSetting.themeField,
  83808. styleGroups: styleGroup
  83809. };
  83810. } else {
  83811. return false;
  83812. }
  83813. }
  83814. /**
  83815. * @private
  83816. * @function ol.supermap.WebMap.prototype.getRangeStyleGroup
  83817. * @description 获取分段专题图的styleGroup样式
  83818. * @param {object} parameters- 图层信息
  83819. * @param {array} features - 所以的feature集合
  83820. * @returns {Array} styleGroups
  83821. */
  83822. getRangeStyleGroup(parameters, features) {
  83823. // 找出分段值
  83824. let featureType = parameters.featureType,
  83825. themeSetting = parameters.themeSetting,
  83826. style = parameters.style;
  83827. let count = themeSetting.segmentCount,
  83828. method = themeSetting.segmentMethod,
  83829. colors = themeSetting.colors,
  83830. customSettings = themeSetting.customSettings,
  83831. fieldName = themeSetting.themeField;
  83832. let values = [],
  83833. attributes;
  83834. let segmentCount = count;
  83835. let segmentMethod = method;
  83836. let that = this;
  83837. features.forEach(function (feature) {
  83838. attributes = feature.get("attributes");
  83839. try {
  83840. if (attributes) {
  83841. //过滤掉非数值的数据
  83842. let value = attributes[fieldName.trim()];
  83843. if (value !== undefined && value !== null && core_Util_Util.isNumber(value)) {
  83844. values.push(parseFloat(value));
  83845. }
  83846. } else if (feature.get(fieldName) && core_Util_Util.isNumber(feature.get(fieldName))) {
  83847. if (feature.get(fieldName)) {
  83848. values.push(parseFloat(feature.get(fieldName)));
  83849. }
  83850. }
  83851. } catch (e) {
  83852. that.errorCallback && that.errorCallback(e);
  83853. }
  83854. });
  83855. let segements;
  83856. try {
  83857. segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount);
  83858. } catch (e) {
  83859. that.errorCallback && that.errorCallback(e);
  83860. }
  83861. if (segements) {
  83862. let itemNum = segmentCount;
  83863. if (attributes && segements[0] === segements[attributes.length - 1]) {
  83864. itemNum = 1;
  83865. segements.length = 2;
  83866. }
  83867. //保留两位有效数
  83868. for (let key in segements) {
  83869. let value = segements[key];
  83870. if (Number(key) === 0) {
  83871. // 最小的值下舍入,要用两个等于号。否则有些值判断不对
  83872. value = Math.floor(value * 100) / 100;
  83873. } else {
  83874. // 其余上舍入
  83875. value = Math.ceil(value * 100) / 100 + 0.1; // 加0.1 解决最大值没有样式问题
  83876. }
  83877. segements[key] = Number(value.toFixed(2));
  83878. }
  83879. //获取一定量的颜色
  83880. let curentColors = colors;
  83881. curentColors = ColorsPickerUtil.getGradientColors(curentColors, itemNum, 'RANGE');
  83882. for (let index = 0; index < itemNum; index++) {
  83883. if (index in customSettings) {
  83884. if (customSettings[index]["segment"]["start"]) {
  83885. segements[index] = customSettings[index]["segment"]["start"];
  83886. }
  83887. if (customSettings[index]["segment"]["end"]) {
  83888. segements[index + 1] = customSettings[index]["segment"]["end"];
  83889. }
  83890. }
  83891. }
  83892. //生成styleGroup
  83893. let styleGroups = [];
  83894. for (let i = 0; i < itemNum; i++) {
  83895. let color = curentColors[i];
  83896. if (i in customSettings) {
  83897. if (customSettings[i].color) {
  83898. color = customSettings[i].color;
  83899. }
  83900. }
  83901. if (featureType === "LINE") {
  83902. style.strokeColor = color;
  83903. } else {
  83904. style.fillColor = color;
  83905. }
  83906. // 转化成 ol 样式
  83907. let olStyle = StyleUtils.toOpenLayersStyle(style, featureType);
  83908. let start = segements[i];
  83909. let end = segements[i + 1];
  83910. styleGroups.push({
  83911. olStyle: olStyle,
  83912. color: color,
  83913. start: start,
  83914. end: end
  83915. });
  83916. }
  83917. return styleGroups;
  83918. } else {
  83919. return false;
  83920. }
  83921. }
  83922. /**
  83923. * @private
  83924. * @function ol.supermap.WebMap.prototype.createMarkerLayer
  83925. * @description 创建标注图层
  83926. * @param {array} features - 所以的feature集合
  83927. * @returns {ol/layer/Vector} 矢量图层
  83928. */
  83929. createMarkerLayer(features) {
  83930. features && this.setEachFeatureDefaultStyle(features);
  83931. return new external_ol_layer_namespaceObject.Vector({
  83932. source: new external_ol_source_namespaceObject.Vector({
  83933. features: features,
  83934. wrapX: false
  83935. })
  83936. });
  83937. }
  83938. /**
  83939. * @private
  83940. * @function ol.supermap.WebMap.prototype.createDataflowLayer
  83941. * @description 创建数据流图层
  83942. * @param {object} layerInfo- 图层信息
  83943. * @param {number} layerIndex - 图层的zindex
  83944. * @returns {ol/layer/Vector} 数据流图层
  83945. */
  83946. createDataflowLayer(layerInfo, layerIndex) {
  83947. let layerStyle = layerInfo.pointStyle, style;
  83948. //获取样式
  83949. style = StyleUtils.getOpenlayersStyle(layerStyle, layerInfo.featureType);
  83950. let source = new external_ol_source_namespaceObject.Vector({
  83951. wrapX: false
  83952. }), labelLayer, labelSource, pathLayer, pathSource;
  83953. let layer = new external_ol_layer_namespaceObject.Vector({
  83954. styleOL: style,
  83955. source: source
  83956. });
  83957. if (layerInfo.labelStyle && layerInfo.visible) {
  83958. //有标签图层
  83959. labelLayer = this.addLabelLayer(layerInfo);
  83960. //和编辑页面保持一致
  83961. labelLayer.setZIndex(1000);
  83962. labelSource = labelLayer.getSource();
  83963. }
  83964. const {visibleScale} = layerInfo;
  83965. if (layerInfo.lineStyle && layerInfo.visible) {
  83966. pathLayer = this.createVectorLayer({style: layerInfo.lineStyle, featureType: "LINE"});
  83967. pathSource = pathLayer.getSource();
  83968. pathLayer.setZIndex(layerIndex);
  83969. this.map.addLayer(pathLayer);
  83970. visibleScale && this.setVisibleScales(pathLayer, visibleScale);
  83971. // 挂载到layerInfo上,便于删除
  83972. layerInfo.pathLayer = pathLayer;
  83973. }
  83974. let featureCache = {}, labelFeatureCache = {}, pathFeatureCache = {}, that = this;
  83975. this.createDataflowService(layerInfo, function (featureCache, labelFeatureCache, pathFeatureCache) {
  83976. return function (feature) {
  83977. that.events.triggerEvent('updateDataflowFeature', {
  83978. feature: feature,
  83979. identifyField: layerInfo.identifyField,
  83980. layerID: layerInfo.layerID
  83981. });
  83982. if (layerInfo.filterCondition) {
  83983. //过滤条件
  83984. let condition = that.parseFilterCondition(layerInfo.filterCondition);
  83985. let sql = "select * from json where (" + condition + ")";
  83986. let filterResult = window.jsonsql.query(sql, {
  83987. attributes: feature.get('attributes')
  83988. });
  83989. if (filterResult && filterResult.length > 0) {
  83990. that.addDataflowFeature(feature, layerInfo.identifyField, {
  83991. dataflowSource: source,
  83992. featureCache: featureCache,
  83993. labelSource: labelSource,
  83994. labelFeatureCache: labelFeatureCache,
  83995. pathSource: pathSource,
  83996. pathFeatureCache: pathFeatureCache,
  83997. maxPointCount: layerInfo.maxPointCount
  83998. });
  83999. }
  84000. } else {
  84001. that.addDataflowFeature(feature, layerInfo.identifyField, {
  84002. dataflowSource: source,
  84003. featureCache: featureCache,
  84004. labelSource: labelSource,
  84005. labelFeatureCache: labelFeatureCache,
  84006. pathSource: pathSource,
  84007. pathFeatureCache: pathFeatureCache,
  84008. maxPointCount: layerInfo.maxPointCount
  84009. });
  84010. }
  84011. }
  84012. }(featureCache, labelFeatureCache, pathFeatureCache));
  84013. this.setFeatureStyle(layer, layerInfo.directionField, layerStyle.type);
  84014. return layer;
  84015. }
  84016. /**
  84017. * @private
  84018. * @function ol.supermap.WebMap.prototype.addDataflowFeature
  84019. * @description 添加数据流的feature
  84020. * @param {object} feature - 服务器更新的feature
  84021. * @param {string} identifyField - 标识feature的字段
  84022. * @param {object} options - 其他参数
  84023. */
  84024. addDataflowFeature(feature, identifyField, options) {
  84025. options.dataflowSource && this.addFeatureFromDataflowService(options.dataflowSource, feature, identifyField, options.featureCache);
  84026. options.labelSource && this.addFeatureFromDataflowService(options.labelSource, feature, identifyField, options.labelFeatureCache);
  84027. options.pathSource && this.addPathFeature(options.pathSource, feature, identifyField, options.pathFeatureCache, options.maxPointCount);
  84028. }
  84029. /**
  84030. * @private
  84031. * @function ol.supermap.WebMap.prototype.addPathFeature
  84032. * @description 添加数据流图层中轨迹线的feature
  84033. * @param {object} source - 轨迹线图层的source
  84034. * @param {object} feature - 轨迹线feature
  84035. * @param {string} identifyField - 标识feature的字段
  84036. * @param {object} featureCache - 存储feature
  84037. * @param {number} maxPointCount - 轨迹线最多点个数数量
  84038. */
  84039. addPathFeature(source, feature, identifyField, featureCache, maxPointCount) {
  84040. let coordinates = [];
  84041. var geoID = feature.get(identifyField);
  84042. if (featureCache[geoID]) {
  84043. //加过feautre
  84044. coordinates = featureCache[geoID].getGeometry().getCoordinates();
  84045. coordinates.push(feature.getGeometry().getCoordinates());
  84046. if (maxPointCount && coordinates.length > maxPointCount) {
  84047. coordinates.splice(0, coordinates.length - maxPointCount);
  84048. }
  84049. featureCache[geoID].getGeometry().setCoordinates(coordinates);
  84050. } else {
  84051. coordinates.push(feature.getGeometry().getCoordinates());
  84052. featureCache[geoID] = new (external_ol_Feature_default())({
  84053. geometry: new external_ol_geom_namespaceObject.LineString(coordinates)
  84054. });
  84055. source.addFeature(featureCache[geoID]);
  84056. }
  84057. }
  84058. /**
  84059. * @private
  84060. * @function ol.supermap.WebMap.prototype.setFeatureStyle
  84061. * @description 设置feature样式
  84062. * @param {object} layer - 图层对象
  84063. * @param {string} directionField - 方向字段
  84064. * @param {string} styleType - 样式的类型
  84065. */
  84066. setFeatureStyle(layer, directionField, styleType) {
  84067. let layerStyle = layer.get('styleOL');
  84068. layer.setStyle(feature => {
  84069. //有转向字段
  84070. let value, image;
  84071. if (directionField !== undefined && directionField !== "未设置" && directionField !== "None") {
  84072. value = feature.get('attributes')[directionField];
  84073. } else {
  84074. value = 0;
  84075. }
  84076. if (value > 360 || value < 0) {
  84077. return null;
  84078. }
  84079. if (styleType === "SYMBOL_POINT") {
  84080. image = layerStyle.getText();
  84081. } else {
  84082. image = layerStyle.getImage();
  84083. }
  84084. //默认用户使用的是角度,换算成弧度
  84085. let rotate = (Math.PI * value) / 180;
  84086. image && image.setRotation(rotate);
  84087. return layerStyle;
  84088. });
  84089. }
  84090. /**
  84091. * @private
  84092. * @function ol.supermap.WebMap.prototype.createDataflowHeatLayer
  84093. * @description 创建数据流服务的热力图图层
  84094. * @param {object} layerInfo - 图层参数
  84095. * @returns {ol/layer/Heatmap} 热力图图层对象
  84096. */
  84097. createDataflowHeatLayer(layerInfo) {
  84098. let source = this.createDataflowHeatSource(layerInfo);
  84099. let layerOptions = {
  84100. source: source
  84101. };
  84102. layerOptions.gradient = layerInfo.themeSetting.colors.slice();
  84103. layerOptions.radius = parseInt(layerInfo.themeSetting.radius);
  84104. if (layerInfo.themeSetting.customSettings) {
  84105. let customSettings = layerInfo.themeSetting.customSettings;
  84106. for (let i in customSettings) {
  84107. layerOptions.gradient[i] = customSettings[i];
  84108. }
  84109. }
  84110. return new external_ol_layer_namespaceObject.Heatmap(layerOptions);
  84111. }
  84112. /**
  84113. * @private
  84114. * @function ol.supermap.WebMap.prototype.createDataflowHeatSource
  84115. * @description 创建数据流服务的热力图的source
  84116. * @param {object} layerInfo - 图层参数
  84117. * @returns {ol/souce/Vector} 热力图source对象
  84118. */
  84119. createDataflowHeatSource(layerInfo) {
  84120. let that = this,
  84121. source = new external_ol_source_namespaceObject.Vector({
  84122. wrapX: false
  84123. });
  84124. let featureCache = {};
  84125. this.createDataflowService(layerInfo, function (featureCache) {
  84126. return function (feature) {
  84127. if (layerInfo.filterCondition) {
  84128. //过滤条件
  84129. let condition = that.parseFilterCondition(layerInfo.filterCondition);
  84130. let sql = "select * from json where (" + condition + ")";
  84131. let filterResult = window.jsonsql.query(sql, {
  84132. attributes: feature.get('attributes')
  84133. });
  84134. if (filterResult && filterResult.length > 0) {
  84135. that.addDataflowFeature(feature, layerInfo.identifyField, {
  84136. dataflowSource: source,
  84137. featureCache: featureCache
  84138. });
  84139. }
  84140. } else {
  84141. that.addDataflowFeature(feature, layerInfo.identifyField, {
  84142. dataflowSource: source,
  84143. featureCache: featureCache
  84144. });
  84145. }
  84146. // 权重字段恢复
  84147. if (layerInfo.themeSetting.weight) {
  84148. that.changeWeight(source.getFeatures(), layerInfo.themeSetting.weight);
  84149. }
  84150. }
  84151. }(featureCache));
  84152. return source;
  84153. }
  84154. /**
  84155. * @private
  84156. * @function ol.supermap.WebMap.prototype.addFeatureFromDataflowService
  84157. * @description 将feature添加到数据流图层
  84158. * @param {object} source - 图层对应的source
  84159. * @param {object} feature - 需要添加到图层的feature
  84160. * @param {object} identifyField - feature的标识字段
  84161. * @param {object} featureCache - 存储已添加到图层的feature对象
  84162. */
  84163. addFeatureFromDataflowService(source, feature, identifyField, featureCache) {
  84164. //判断是否有这个feature,存在feature就更新位置。
  84165. var geoID = feature.get(identifyField);
  84166. if (geoID !== undefined && featureCache[geoID]) {
  84167. /*if(that.addFeatureFinish) {
  84168. //feature全都加上图层,就缩放范围
  84169. MapManager.zoomToExtent(LayerUtil.getBoundsFromFeatures(source.getFeatures()));
  84170. that.addFeatureFinish = false;
  84171. }*/
  84172. featureCache[geoID].setGeometry(feature.getGeometry());
  84173. featureCache[geoID].setProperties(feature.getProperties());
  84174. source.changed();
  84175. } else {
  84176. source.addFeature(feature);
  84177. featureCache[geoID] = feature;
  84178. }
  84179. }
  84180. /**
  84181. * @private
  84182. * @function ol.supermap.WebMap.prototype.createDataflowService
  84183. * @description 将feature添加到数据流图层
  84184. * @param {object} layerInfo - 图层参数
  84185. * @param {object} callback - 回调函数
  84186. */
  84187. createDataflowService(layerInfo, callback) {
  84188. let that = this;
  84189. let dataflowService = new DataFlowService(layerInfo.wsUrl).initSubscribe();
  84190. dataflowService.on('messageSucceeded', function (e) {
  84191. let geojson = JSON.parse(e.value.data);
  84192. let feature = transformTools.readFeature(geojson, {
  84193. dataProjection: layerInfo.projection || "EPSG:4326",
  84194. featureProjection: that.baseProjection || 'EPSG:4326'
  84195. });
  84196. feature.setProperties({attributes: geojson.properties});
  84197. callback(feature);
  84198. });
  84199. layerInfo.dataflowService = dataflowService;
  84200. }
  84201. /**
  84202. * @private
  84203. * @function ol.supermap.WebMap.prototype.setEachFeatureDefaultStyle
  84204. * @description 为标注图层上的feature设置样式
  84205. * @param {array} features - 所以的feature集合
  84206. */
  84207. setEachFeatureDefaultStyle(features) {
  84208. let that = this;
  84209. features = (core_Util_Util.isArray(features) || features instanceof (external_ol_Collection_default())) ? features : [features];
  84210. features.forEach(function (feature) {
  84211. let geomType = feature.getGeometry().getType().toUpperCase();
  84212. // let styleType = geomType === "POINT" ? 'MARKER' : geomType;
  84213. let defaultStyle = feature.getProperties().useStyle;
  84214. if (defaultStyle) {
  84215. if (geomType === 'POINT' && defaultStyle.text) {
  84216. //说明是文字的feature类型
  84217. geomType = "TEXT";
  84218. }
  84219. let attributes = that.setFeatureInfo(feature);
  84220. feature.setProperties({
  84221. useStyle: defaultStyle,
  84222. attributes
  84223. });
  84224. //标注图层的feature上需要存一个layerId,为了之后样式应用到图层上使用
  84225. // feature.layerId = timeId;
  84226. if (geomType === 'POINT' && defaultStyle.src &&
  84227. defaultStyle.src.indexOf('http://') === -1 && defaultStyle.src.indexOf('https://') === -1) {
  84228. //说明地址不完整
  84229. defaultStyle.src = that.server + defaultStyle.src;
  84230. }
  84231. } else {
  84232. defaultStyle = StyleUtils.getMarkerDefaultStyle(geomType, that.server);
  84233. }
  84234. feature.setStyle(StyleUtils.toOpenLayersStyle(defaultStyle, geomType))
  84235. }, this)
  84236. }
  84237. /**
  84238. * @private
  84239. * @function ol.supermap.WebMap.prototype.setFeatureInfo
  84240. * @description 为feature设置属性
  84241. * @param {array} feature - 单个feature
  84242. * @returns {object} 属性
  84243. */
  84244. setFeatureInfo(feature) {
  84245. let attributes = feature.get('attributes'),
  84246. defaultAttr = {
  84247. dataViz_title: '',
  84248. dataViz_description: '',
  84249. dataViz_imgUrl: '',
  84250. dataViz_url: ''
  84251. },
  84252. newAttribute = Object.assign(defaultAttr, attributes);
  84253. let properties = feature.getProperties();
  84254. for (let key in newAttribute) {
  84255. if (properties[key]) {
  84256. newAttribute[key] = properties[key];
  84257. delete properties[key];
  84258. }
  84259. }
  84260. return newAttribute;
  84261. }
  84262. /**
  84263. * @private
  84264. * @function ol.supermap.WebMap.prototype.createRankSymbolLayer
  84265. * @description 创建等级符号图层
  84266. * @param {object} layerInfo - 图层信息
  84267. * @param {array} features - 添加到图层上的features
  84268. * @returns {ol/layer/Vector} 矢量图层
  84269. */
  84270. createRankSymbolLayer(layerInfo, features) {
  84271. let styleSource = this.createRankStyleSource(layerInfo, features, layerInfo.featureType);
  84272. let layer = new external_ol_layer_namespaceObject.Vector({
  84273. styleSource,
  84274. source: new external_ol_source_namespaceObject.Vector({
  84275. features: layerInfo.filterCondition ? this.getFiterFeatures(layerInfo.filterCondition, features) : features,
  84276. wrapX: false
  84277. }),
  84278. renderMode: 'image'
  84279. });
  84280. layer.setStyle(feature => {
  84281. let styleSource = layer.get('styleSource');
  84282. let themeField = styleSource.parameters.themeSetting.themeField;
  84283. let value = Number(feature.get('attributes')[themeField]);
  84284. let styleGroups = styleSource.styleGroups;
  84285. for (let i = 0, len = styleGroups.length; i < len; i++) {
  84286. if (value >= styleGroups[i].start && value < styleGroups[i].end) {
  84287. return styleSource.styleGroups[i].olStyle;
  84288. }
  84289. }
  84290. });
  84291. return layer;
  84292. }
  84293. /**
  84294. * @private
  84295. * @function ol.supermap.WebMap.prototype.createRankSymbolLayer
  84296. * @description 创建等级符号图层的source
  84297. * @param {object} parameters - 图层信息
  84298. * @param {array} features - 添加到图层上的features
  84299. * @param {string} featureType - feature的类型
  84300. * @returns {object} styleGroups
  84301. */
  84302. createRankStyleSource(parameters, features, featureType) {
  84303. let themeSetting = parameters.themeSetting,
  84304. themeField = themeSetting.themeField;
  84305. let styleGroups = this.getRankStyleGroup(themeField, features, parameters, featureType);
  84306. return styleGroups ? {parameters, styleGroups} : false
  84307. }
  84308. /**
  84309. * @private
  84310. * @function ol.supermap.WebMap.prototype.getRankStyleGroup
  84311. * @description 获取等级符号的style
  84312. * @param {string} themeField - 分段字段
  84313. * @param {array} features - 添加到图层上的features
  84314. * @param {object} parameters - 图层参数
  84315. * @param {string} featureType - feature的类型
  84316. * @returns {array} stylegroup
  84317. */
  84318. getRankStyleGroup(themeField, features, parameters, featureType) {
  84319. // 找出所有的单值
  84320. let values = [],
  84321. segements = [],
  84322. style = parameters.style,
  84323. themeSetting = parameters.themeSetting,
  84324. segmentMethod = themeSetting.segmentMethod || this.defaultParameters.themeSetting.segmentMethod,
  84325. segmentCount = themeSetting.segmentCount || this.defaultParameters.themeSetting.segmentCount,
  84326. customSettings = themeSetting.customSettings,
  84327. minR = parameters.themeSetting.minRadius,
  84328. maxR = parameters.themeSetting.maxRadius,
  84329. fillColor = style.fillColor,
  84330. colors = parameters.themeSetting.colors;
  84331. features.forEach(feature => {
  84332. let attributes = feature.get('attributes'),
  84333. value = attributes[themeField];
  84334. // 过滤掉空值和非数值
  84335. if (value == null || !core_Util_Util.isNumber(value)) {
  84336. return;
  84337. }
  84338. values.push(Number(value));
  84339. });
  84340. try {
  84341. segements = ArrayStatistic.getArraySegments(values, segmentMethod, segmentCount);
  84342. } catch (error) {
  84343. console.error(error);
  84344. }
  84345. // 处理自定义 分段
  84346. for (let i = 0; i < segmentCount; i++) {
  84347. if (i in customSettings) {
  84348. let startValue = customSettings[i]['segment']['start'],
  84349. endValue = customSettings[i]['segment']['end'];
  84350. startValue != null && (segements[i] = startValue);
  84351. endValue != null && (segements[i + 1] = endValue);
  84352. }
  84353. }
  84354. //生成styleGroup
  84355. let styleGroup = [];
  84356. if (segements && segements.length) {
  84357. let len = segements.length,
  84358. incrementR = (maxR - minR) / (len - 1), // 半径增量
  84359. start, end, radius = Number(((maxR + minR) / 2).toFixed(2));
  84360. // 获取颜色
  84361. let rangeColors = colors ? ColorsPickerUtil.getGradientColors(colors, len, 'RANGE') : [];
  84362. for (let j = 0; j < len - 1; j++) {
  84363. start = Number(segements[j].toFixed(2));
  84364. end = Number(segements[j + 1].toFixed(2));
  84365. // 这里特殊处理以下分段值相同的情况(即所有字段值相同)
  84366. radius = start === end ? radius : minR + Math.round(incrementR * j);
  84367. // 最后一个分段时将end+0.01,避免取不到最大值
  84368. end = j === len - 2 ? end + 0.01 : end;
  84369. // 处理自定义 半径
  84370. radius = customSettings[j] && customSettings[j].radius ? customSettings[j].radius : radius;
  84371. // 转化成 ol 样式
  84372. style.radius = radius;
  84373. style.fillColor = customSettings[j] && customSettings[j].color ? customSettings[j].color : rangeColors[j] || fillColor;
  84374. let olStyle = StyleUtils.getOpenlayersStyle(style, featureType, true);
  84375. styleGroup.push({olStyle: olStyle, radius, start, end, fillColor: style.fillColor});
  84376. }
  84377. return styleGroup;
  84378. } else {
  84379. return false;
  84380. }
  84381. }
  84382. /**
  84383. * @private
  84384. * @function ol.supermap.WebMap.prototype.checkUploadToRelationship
  84385. * @description 检查是否上传到关系型
  84386. * @param {String} fileId - 文件的id
  84387. * @returns {Promise<T | never>} 关系型文件一些参数
  84388. */
  84389. checkUploadToRelationship(fileId) {
  84390. let url = this.getRequestUrl(`${this.server}web/datas/${fileId}/datasets.json`);
  84391. return FetchRequest.get(url, null, {
  84392. withCredentials: this.withCredentials
  84393. }).then(function (response) {
  84394. return response.json()
  84395. }).then(function (result) {
  84396. return result;
  84397. });
  84398. }
  84399. /**
  84400. * @private
  84401. * @function ol.supermap.WebMap.prototype.getDatasources
  84402. * @description 获取关系型文件发布的数据服务中数据源的名称
  84403. * @param {String} url - 获取数据源信息的url
  84404. * @returns {Promise<T | never>} 数据源名称
  84405. */
  84406. getDatasources(url) {
  84407. let requestUrl = this.getRequestUrl(`${url}/data/datasources.json`);
  84408. return FetchRequest.get(requestUrl, null, {
  84409. withCredentials: this.withCredentials
  84410. }).then(function (response) {
  84411. return response.json()
  84412. }).then(function (datasource) {
  84413. let datasourceNames = datasource.datasourceNames;
  84414. return datasourceNames[0];
  84415. });
  84416. }
  84417. /**
  84418. * @private
  84419. * @function ol.supermap.WebMap.prototype.getDataService
  84420. * @description 获取上传的数据信息
  84421. * @param {String} fileId - 文件id
  84422. * @param {String} datasetName 数据服务的数据集名称
  84423. * @returns {Promise<T | never>} 数据的信息
  84424. */
  84425. getDataService(fileId, datasetName) {
  84426. let url = this.getRequestUrl(`${this.server}web/datas/${fileId}.json`);
  84427. return FetchRequest.get(url, null, {
  84428. withCredentials: this.withCredentials
  84429. }).then(function (response) {
  84430. return response.json()
  84431. }).then(function (result) {
  84432. result.fileId = fileId;
  84433. result.datasetName = datasetName;
  84434. return result;
  84435. });
  84436. }
  84437. /**
  84438. * @private
  84439. * @function ol.supermap.WebMap.prototype.getRootUrl
  84440. * @description 获取请求地址
  84441. * @param {string} url 请求的地址
  84442. * @param {boolean} 请求是否带上Credential.
  84443. * @returns {Promise<T | never>} 请求地址
  84444. */
  84445. getRequestUrl(url, excludeCreditial) {
  84446. url = excludeCreditial ? url : this.formatUrlWithCredential(url);
  84447. //如果传入进来的url带了代理则不需要处理
  84448. if (this.excludePortalProxyUrl) {
  84449. return;
  84450. }
  84451. return Util.isInTheSameDomain(url) ? url : `${this.getProxy()}${encodeURIComponent(url)}`;
  84452. }
  84453. /**
  84454. * 给url带上凭证密钥
  84455. * @param {*} url 地址
  84456. */
  84457. formatUrlWithCredential(url) {
  84458. if (this.credentialValue) {
  84459. //有token之类的配置项
  84460. url = url.indexOf("?") === -1 ? `${url}?${this.credentialKey}=${this.credentialValue}` :
  84461. `${url}&${this.credentialKey}=${this.credentialValue}`;
  84462. }
  84463. return url;
  84464. }
  84465. /**
  84466. * @private
  84467. * @function ol.supermap.WebMap.prototype.getProxy
  84468. * @description 获取代理地址
  84469. * @returns {Promise<T | never>} 代理地址
  84470. */
  84471. getProxy(type) {
  84472. if (!type) {
  84473. type = 'json';
  84474. }
  84475. return this.proxy || this.server + `apps/viewer/getUrlResource.${type}?url=`;
  84476. }
  84477. /**
  84478. * @private
  84479. * @function ol.supermap.WebMap.prototype.getTileLayerInfo
  84480. * @description 获取地图服务的信息
  84481. * @param {String} url 地图服务的url(没有地图名字)
  84482. * @returns {Promise<T | never>} 地图服务信息
  84483. */
  84484. getTileLayerInfo(url) {
  84485. let that = this, epsgCode = that.baseProjection.split('EPSG:')[1];
  84486. let requestUrl = that.getRequestUrl(`${url}/maps.json`);
  84487. return FetchRequest.get(requestUrl, null, {
  84488. withCredentials: this.withCredentials
  84489. }).then(function (response) {
  84490. return response.json()
  84491. }).then(function (mapInfo) {
  84492. let promises = [];
  84493. if (mapInfo) {
  84494. mapInfo.forEach(function (info) {
  84495. let mapUrl = that.getRequestUrl(`${info.path}.json?prjCoordSys=${encodeURI(JSON.stringify({epsgCode: epsgCode}))}`)
  84496. let promise = FetchRequest.get(mapUrl, null, {
  84497. withCredentials: that.withCredentials
  84498. }).then(function (response) {
  84499. return response.json()
  84500. }).then(function (restMapInfo) {
  84501. restMapInfo.url = info.path;
  84502. return restMapInfo
  84503. });
  84504. promises.push(promise);
  84505. });
  84506. }
  84507. return Promise.all(promises).then(function (allRestMaps) {
  84508. return allRestMaps
  84509. })
  84510. });
  84511. }
  84512. /**
  84513. * 通过wkt参数扩展支持多坐标系
  84514. *
  84515. * @param {String} wkt 字符串
  84516. * @param {string} crsCode epsg信息,如: "EPSG:4490"
  84517. *
  84518. * @returns {Boolean} 坐标系是否添加成功
  84519. */
  84520. addProjctionFromWKT(wkt, crsCode) {
  84521. if (typeof (wkt) !== 'string') {
  84522. //参数类型错误
  84523. return false;
  84524. } else {
  84525. if (wkt === "EPSG:4326" || wkt === "EPSG:3857") {
  84526. return true;
  84527. } else {
  84528. let epsgCode = crsCode || this.getEpsgInfoFromWKT(wkt);
  84529. if (epsgCode) {
  84530. lib.defs(epsgCode, wkt);
  84531. // 重新注册proj4到ol.proj,不然不会生效
  84532. if (external_ol_proj_proj4_namespaceObject && external_ol_proj_proj4_namespaceObject.register) {
  84533. external_ol_proj_proj4_namespaceObject.register(lib);
  84534. } else if (window.ol.proj && window.ol.proj.setProj4) {
  84535. window.ol.proj.setProj4(lib)
  84536. }
  84537. return true;
  84538. } else {
  84539. // 参数类型非wkt标准
  84540. return false;
  84541. }
  84542. }
  84543. }
  84544. }
  84545. /**
  84546. * 通过wkt参数获取坐标信息
  84547. *
  84548. * @param {String} wkt 字符串
  84549. * @returns {String} epsg 如:"EPSG:4326"
  84550. */
  84551. getEpsgInfoFromWKT(wkt) {
  84552. if (typeof (wkt) !== 'string') {
  84553. return false;
  84554. } else if (wkt.indexOf("EPSG") === 0) {
  84555. return wkt;
  84556. } else {
  84557. let lastAuthority = wkt.lastIndexOf("AUTHORITY") + 10,
  84558. endString = wkt.indexOf("]", lastAuthority) - 1;
  84559. if (lastAuthority > 0 && endString > 0) {
  84560. return `EPSG:${wkt.substring(lastAuthority, endString).split(",")[1].substr(1)}`;
  84561. } else {
  84562. return false;
  84563. }
  84564. }
  84565. }
  84566. /**
  84567. * @private
  84568. * @function ol.supermap.WebMap.prototype.createMigrationLayer
  84569. * @description 创建迁徙图
  84570. * @param {Object} layerInfo 图层信息
  84571. * @param {Array} features 要素数组
  84572. * @returns {ol/layer} 图层
  84573. */
  84574. createMigrationLayer(layerInfo, features) {
  84575. // 获取图层外包DOM
  84576. if (!window.EChartsLayer.prototype.getContainer) {
  84577. window.EChartsLayer.prototype.getContainer = function () {
  84578. return this.$container;
  84579. };
  84580. }
  84581. // 设置图层可见性
  84582. if (!window.EChartsLayer.prototype.setVisible) {
  84583. window.EChartsLayer.prototype.setVisible = function (visible) {
  84584. if (visible) {
  84585. let options = this.get('options');
  84586. if (options) {
  84587. this.setChartOptions(options);
  84588. this.unset('options');
  84589. }
  84590. } else {
  84591. let options = this.getChartOptions();
  84592. this.set('options', options);
  84593. this.clear();
  84594. this.setChartOptions({});
  84595. }
  84596. };
  84597. }
  84598. // 设置图层层级
  84599. if (!window.EChartsLayer.prototype.setZIndex) {
  84600. window.EChartsLayer.prototype.setZIndex = function (zIndex) {
  84601. let container = this.getContainer();
  84602. if (container) {
  84603. container.style.zIndex = zIndex;
  84604. }
  84605. };
  84606. }
  84607. /**
  84608. * 设置鼠标样式
  84609. * .cursor-default > div {
  84610. * cursor: default !important;
  84611. * }
  84612. */
  84613. if (!window.EChartsLayer.prototype.setCursor) {
  84614. window.EChartsLayer.prototype.setCursor = function (cursor = 'default') {
  84615. let container = this.getContainer();
  84616. if (container && cursor === 'default') {
  84617. container.classList.add('cursor-default');
  84618. }
  84619. }
  84620. }
  84621. let properties = core_Util_Util.getFeatureProperties(features);
  84622. let lineData = this.createLinesData(layerInfo, properties);
  84623. let pointData = this.createPointsData(lineData, layerInfo, properties);
  84624. let options = this.createOptions(layerInfo, lineData, pointData);
  84625. let layer = new window.EChartsLayer(options, {
  84626. // hideOnMoving: true,
  84627. // hideOnZooming: true
  84628. //以下三个参数,如果不按照这样设置,会造成不可见图层时,缩放还会出现图层
  84629. hideOnMoving: false,
  84630. hideOnZooming: false,
  84631. forcedPrecomposeRerender: true
  84632. });
  84633. layer.type = 'ECHARTS';
  84634. return layer;
  84635. }
  84636. /**
  84637. * @private
  84638. * @function ol.supermap.WebMap.prototype.createOptions
  84639. * @description 创建echarts的options
  84640. * @param {Object} layerInfo 图层信息
  84641. * @param {Array} lineData 线数据
  84642. * @param {Array} pointData 点数据
  84643. * @returns {Object} echarts参数
  84644. */
  84645. createOptions(layerInfo, lineData, pointData) {
  84646. let series;
  84647. let lineSeries = this.createLineSeries(layerInfo, lineData);
  84648. if (pointData && pointData.length) {
  84649. let pointSeries = this.createPointSeries(layerInfo, pointData);
  84650. series = lineSeries.concat(pointSeries);
  84651. } else {
  84652. series = lineSeries.slice();
  84653. }
  84654. let options = {
  84655. series
  84656. }
  84657. return options;
  84658. }
  84659. /**
  84660. * @private
  84661. * @function ol.supermap.WebMap.prototype.createLineSeries
  84662. * @description 创建线系列
  84663. * @param {Object} layerInfo 图层参数
  84664. * @param {Array} lineData 线数据
  84665. * @returns {Object} 线系列
  84666. */
  84667. createLineSeries(layerInfo, lineData) {
  84668. let lineSetting = layerInfo.lineSetting;
  84669. let animationSetting = layerInfo.animationSetting;
  84670. let linesSeries = [
  84671. // 轨迹线样式
  84672. {
  84673. name: 'line-series',
  84674. type: 'lines',
  84675. zlevel: 1,
  84676. silent: true,
  84677. effect: {
  84678. show: animationSetting.show,
  84679. constantSpeed: animationSetting.constantSpeed,
  84680. trailLength: 0,
  84681. symbol: animationSetting.symbol,
  84682. symbolSize: animationSetting.symbolSize
  84683. },
  84684. lineStyle: {
  84685. normal: {
  84686. color: lineSetting.color,
  84687. type: lineSetting.type,
  84688. width: lineSetting.width,
  84689. opacity: lineSetting.opacity,
  84690. curveness: lineSetting.curveness
  84691. }
  84692. },
  84693. data: lineData
  84694. }
  84695. ];
  84696. if (lineData.length > MAX_MIGRATION_ANIMATION_COUNT) {
  84697. // linesSeries[0].large = true;
  84698. // linesSeries[0].largeThreshold = 100;
  84699. linesSeries[0].blendMode = 'lighter';
  84700. }
  84701. return linesSeries;
  84702. }
  84703. /**
  84704. * @private
  84705. * @function ol.supermap.WebMap.prototype.createPointSeries
  84706. * @description 创建点系列
  84707. * @param {Object} layerInfo 图层参数
  84708. * @param {Array} pointData 点数据
  84709. * @returns {Object} 点系列
  84710. */
  84711. createPointSeries(layerInfo, pointData) {
  84712. let lineSetting = layerInfo.lineSetting;
  84713. let animationSetting = layerInfo.animationSetting;
  84714. let labelSetting = layerInfo.labelSetting;
  84715. let pointSeries = [{
  84716. name: 'point-series',
  84717. coordinateSystem: 'geo',
  84718. zlevel: 2,
  84719. silent: true,
  84720. label: {
  84721. normal: {
  84722. show: labelSetting.show,
  84723. position: 'right',
  84724. formatter: '{b}',
  84725. color: labelSetting.color,
  84726. fontFamily: labelSetting.fontFamily
  84727. }
  84728. },
  84729. itemStyle: {
  84730. normal: {
  84731. color: lineSetting.color || labelSetting.color
  84732. }
  84733. },
  84734. data: pointData
  84735. }]
  84736. if (animationSetting.show) {
  84737. // 开启动画
  84738. pointSeries[0].type = 'effectScatter';
  84739. pointSeries[0].rippleEffect = {
  84740. brushType: 'stroke'
  84741. }
  84742. } else {
  84743. // 关闭动画
  84744. pointSeries[0].type = 'scatter';
  84745. }
  84746. return pointSeries;
  84747. }
  84748. /**
  84749. * @private
  84750. * @function ol.supermap.WebMap.prototype.createPointsData
  84751. * @param {Array} lineData 线数据
  84752. * @param {Object} layerInfo 图层信息
  84753. * @param {Array} properties 属性
  84754. * @returns {Array} 点数据
  84755. */
  84756. createPointsData(lineData, layerInfo, properties) {
  84757. let data = [],
  84758. labelSetting = layerInfo.labelSetting;
  84759. // 标签隐藏则直接返回
  84760. if (!labelSetting.show || !lineData.length) {
  84761. return data;
  84762. }
  84763. let fromData = [], toData = [];
  84764. lineData.forEach((item, idx) => {
  84765. let coords = item.coords,
  84766. fromCoord = coords[0],
  84767. toCoord = coords[1],
  84768. fromProperty = properties[idx][labelSetting.from],
  84769. toProperty = properties[idx][labelSetting.to];
  84770. // 起始字段去重
  84771. let f = fromData.find(d => {
  84772. return d.value[0] === fromCoord[0] && d.value[1] === fromCoord[1]
  84773. });
  84774. !f && fromData.push({
  84775. name: fromProperty,
  84776. value: fromCoord
  84777. })
  84778. // 终点字段去重
  84779. let t = toData.find(d => {
  84780. return d.value[0] === toCoord[0] && d.value[1] === toCoord[1]
  84781. });
  84782. !t && toData.push({
  84783. name: toProperty,
  84784. value: toCoord
  84785. })
  84786. });
  84787. data = fromData.concat(toData);
  84788. return data;
  84789. }
  84790. /**
  84791. * @private
  84792. * @function ol.supermap.WebMap.prototype.createLinesData
  84793. * @param {Object} layerInfo 图层信息
  84794. * @param {Array} properties 属性
  84795. * @returns {Array} 线数据
  84796. */
  84797. createLinesData(layerInfo, properties) {
  84798. let data = [];
  84799. if (properties && properties.length) {
  84800. // 重新获取数据
  84801. let from = layerInfo.from,
  84802. to = layerInfo.to,
  84803. fromCoord, toCoord;
  84804. if (from.type === 'XY_FIELD' && from['xField'] && from['yField'] && to['xField'] && to['yField']) {
  84805. properties.forEach(property => {
  84806. let fromX = property[from['xField']],
  84807. fromY = property[from['yField']],
  84808. toX = property[to['xField']],
  84809. toY = property[to['yField']];
  84810. if (!fromX || !fromY || !toX || !toY) {
  84811. return;
  84812. }
  84813. fromCoord = [property[from['xField']], property[from['yField']]];
  84814. toCoord = [property[to['xField']], property[to['yField']]];
  84815. data.push({
  84816. coords: [fromCoord, toCoord]
  84817. })
  84818. });
  84819. } else if (from.type === 'PLACE_FIELD' && from['field'] && to['field']) {
  84820. const centerDatas = ProvinceCenter_namespaceObject.concat(MunicipalCenter_namespaceObject);
  84821. properties.forEach(property => {
  84822. let fromField = property[from['field']],
  84823. toField = property[to['field']];
  84824. fromCoord = centerDatas.find(item => {
  84825. return core_Util_Util.isMatchAdministrativeName(item.name, fromField);
  84826. })
  84827. toCoord = centerDatas.find(item => {
  84828. return core_Util_Util.isMatchAdministrativeName(item.name, toField);
  84829. })
  84830. if (!fromCoord || !toCoord) {
  84831. return;
  84832. }
  84833. data.push({
  84834. coords: [fromCoord.coord, toCoord.coord]
  84835. })
  84836. });
  84837. }
  84838. }
  84839. return data;
  84840. }
  84841. /**
  84842. * @private
  84843. * @function ol.supermap.WebMap.prototype.getService
  84844. * @description 获取当前数据发布的服务中的某种类型服务
  84845. * @param {Array} services 服务集合
  84846. * @param {String} type 服务类型,RESTDATA, RESTMAP
  84847. * @returns {Object} 服务
  84848. */
  84849. getService(services, type) {
  84850. let service = services.filter((info) => {
  84851. return info && info.serviceType === type;
  84852. });
  84853. return service[0];
  84854. }
  84855. /**
  84856. * @private
  84857. * @function ol.supermap.WebMap.prototype.isMvt
  84858. * @description 判断当前能否使用数据服务的mvt上图方式
  84859. * @param {String} serviceUrl 数据服务的地址
  84860. * @param {String} datasetName 数据服务的数据集名称
  84861. * @returns {Object} 数据服务的信息
  84862. */
  84863. isMvt(serviceUrl, datasetName) {
  84864. let that = this;
  84865. return this.getDatasetsInfo(serviceUrl, datasetName).then((info) => {
  84866. //判断是否和底图坐标系一直
  84867. if (info.epsgCode == that.baseProjection.split('EPSG:')[1]) {
  84868. return FetchRequest.get(that.getRequestUrl(`${info.url}/tilefeature.mvt`), null, {
  84869. withCredentials: that.withCredentials
  84870. }).then(function (response) {
  84871. return response.json()
  84872. }).then(function (result) {
  84873. info.isMvt = result.error && result.error.code === 400;
  84874. return info;
  84875. }).catch(() => {
  84876. return info;
  84877. });
  84878. }
  84879. return info;
  84880. })
  84881. }
  84882. /**
  84883. * @private
  84884. * @function ol.supermap.WebMap.prototype.getDatasetsInfo
  84885. * @description 获取数据集信息
  84886. * @param {String} serviceUrl 数据服务的地址
  84887. * @param {String} datasetName 数据服务的数据集名称
  84888. * @returns {Object} 数据服务的信息
  84889. */
  84890. getDatasetsInfo(serviceUrl, datasetName) {
  84891. let that = this;
  84892. return that.getDatasources(serviceUrl).then(function (datasourceName) {
  84893. //判断mvt服务是否可用
  84894. let url = `${serviceUrl}/data/datasources/${datasourceName}/datasets/${datasetName}.json`;
  84895. return FetchRequest.get(that.getRequestUrl(url), null, {
  84896. withCredentials: that.withCredentials
  84897. }).then(function (response) {
  84898. return response.json()
  84899. }).then(function (datasetsInfo) {
  84900. return {
  84901. epsgCode: datasetsInfo.datasetInfo.prjCoordSys.epsgCode,
  84902. bounds: datasetsInfo.datasetInfo.bounds,
  84903. url //返回的是原始url,没有代理。因为用于请求mvt
  84904. };
  84905. });
  84906. })
  84907. }
  84908. /**
  84909. * @private
  84910. * @function ol.supermap.WebMap.prototype.isRestMapMapboxStyle
  84911. * @description 仅判断是否为restmap mvt地图服务 rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true
  84912. * @param {Object} layerInfo webmap中的MapStylerLayer
  84913. * @returns {Boolean} 是否为restmap mvt地图服务
  84914. */
  84915. isRestMapMapboxStyle(layerInfo) {
  84916. const restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'
  84917. let dataSource = layerInfo.dataSource;
  84918. let layerType = layerInfo.layerType;
  84919. if (dataSource && dataSource.type === "EXTERNAL"
  84920. && dataSource.url.indexOf(restMapMVTStr) > -1
  84921. && (layerType === "MAPBOXSTYLE" || layerType === "VECTOR_TILE")) {
  84922. return true
  84923. }
  84924. return false
  84925. }
  84926. /**
  84927. * @private
  84928. * @function ol.supermap.WebMap.prototype.getMapboxStyleLayerInfo
  84929. * @description 获取mapboxstyle图层信息
  84930. * @param {layerInfo} layerInfo 图层信息
  84931. * @returns {Object} 图层信息
  84932. */
  84933. getMapboxStyleLayerInfo(mapInfo, layerInfo) {
  84934. let _this = this;
  84935. return new Promise((resolve, reject) => {
  84936. return _this.getMapLayerExtent(layerInfo).then(layer => {
  84937. return _this.getMapboxStyle(mapInfo, layer).then(styleLayer => {
  84938. Object.assign(layer, styleLayer);
  84939. resolve(layer)
  84940. }).catch(error => {
  84941. reject(error);
  84942. })
  84943. }).catch(error => {
  84944. reject(error);
  84945. })
  84946. })
  84947. }
  84948. /**
  84949. * @private
  84950. * @function ol.supermap.WebMap.prototype.getMapLayerExtent
  84951. * @description 获取mapboxstyle图层信息
  84952. * @param {Object} layerInfo 图层信息
  84953. * @returns {Object} 图层信息
  84954. */
  84955. getMapLayerExtent(layerInfo) {
  84956. const restMapMVTStr = '/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true&tileURLTemplate=ZXY'
  84957. let dataSource = layerInfo.dataSource;
  84958. let url = dataSource.url;
  84959. if (this.isRestMapMapboxStyle(layerInfo)) {
  84960. url = url.replace(restMapMVTStr, '')
  84961. }
  84962. url = this.getRequestUrl(url + '.json')
  84963. let credential = layerInfo.credential;
  84964. let credentialValue,keyfix;
  84965. //携带令牌(restmap用的首字母大写,但是这里要用小写)
  84966. if (credential) {
  84967. keyfix = Object.keys(credential)[0]
  84968. credentialValue = credential[keyfix];
  84969. url = `${url}?${keyfix}=${credentialValue}`;
  84970. }
  84971. return FetchRequest.get(url, null, {
  84972. withCredentials: this.withCredentials,
  84973. withoutFormatSuffix: true,
  84974. headers: {
  84975. 'Content-Type': 'application/json;chartset=uft-8'
  84976. }
  84977. }).then(function (response) {
  84978. return response.json();
  84979. }).then((result) => {
  84980. layerInfo.visibleScales = result.visibleScales;
  84981. layerInfo.coordUnit = result.coordUnit;
  84982. layerInfo.scale = result.scale;
  84983. layerInfo.epsgCode = result.prjCoordSys.epsgCode;
  84984. layerInfo.bounds = result.bounds;
  84985. return layerInfo;
  84986. }).catch(error => {
  84987. return error;
  84988. })
  84989. }
  84990. /**
  84991. * @private
  84992. * @function ol.supermap.WebMap.prototype.getMapboxStyle
  84993. * @description 获取mapboxstyle --- ipt中自定义底图请求mapboxstyle目前有两种url格式
  84994. * rest-map服务的Mapbox Style资源地址是这样的: .../iserver/services/map-Population/rest/maps/PopulationDistribution/tileFeature/vectorstyles.json?type=MapBox_GL&styleonly=true
  84995. * restjsr片服务的Mapbox Style资源地址是这样的:.../iserver/services/map-china400/restjsr/v1/vectortile/maps/China/style.json
  84996. * @param {Object} mapboxstyle图层信息
  84997. * @returns {Object} 图层信息
  84998. */
  84999. getMapboxStyle(mapInfo, layerInfo) {
  85000. let _this = this;
  85001. let url = layerInfo.url || layerInfo.dataSource.url;
  85002. let styleUrl = url;
  85003. if (styleUrl.indexOf('/restjsr/') > -1) {
  85004. styleUrl = `${styleUrl}/style.json`;
  85005. }
  85006. styleUrl = this.getRequestUrl(styleUrl)
  85007. let credential = layerInfo.credential;
  85008. //携带令牌(restmap用的首字母大写,但是这里要用小写)
  85009. let credentialValue, keyfix;
  85010. if (credential) {
  85011. keyfix = Object.keys(credential)[0]
  85012. credentialValue = credential[keyfix];
  85013. styleUrl = `${styleUrl}?${keyfix}=${credentialValue}`;
  85014. }
  85015. return FetchRequest.get(styleUrl, null, {
  85016. withCredentials: this.withCredentials,
  85017. withoutFormatSuffix: true,
  85018. headers: {
  85019. 'Content-Type': 'application/json;chartset=uft-8'
  85020. }
  85021. }).then(function (response) {
  85022. return response.json();
  85023. }).then(styles => {
  85024. _this._matchStyleObject(styles);
  85025. let bounds = layerInfo.bounds;
  85026. // 处理携带令牌的情况
  85027. if (credentialValue) {
  85028. styles.sprite = `${styles.sprite}?${keyfix}=${credentialValue}`;
  85029. let sources = styles.sources;
  85030. let sourcesNames = Object.keys(sources);
  85031. sourcesNames.forEach(function (sourceName) {
  85032. styles.sources[sourceName].tiles.forEach(function (tiles, i) {
  85033. styles.sources[sourceName].tiles[i] = `${tiles}?${keyfix}=${credentialValue}`
  85034. })
  85035. })
  85036. }
  85037. let newLayerInfo = {
  85038. url: url,
  85039. sourceType: 'VECTOR_TILE',
  85040. layerType: 'VECTOR_TILE',
  85041. styles: styles,
  85042. extent: bounds && [bounds.left, bounds.bottom, bounds.right, bounds.top],
  85043. bounds: layerInfo.bounds,
  85044. projection: "EPSG:" + layerInfo.epsgCode,
  85045. epsgCode: layerInfo.epsgCode,
  85046. name: layerInfo.name
  85047. }
  85048. Object.assign(layerInfo, newLayerInfo)
  85049. if (layerInfo.zIndex > 0) {
  85050. // 过滤styles 非底图mapboxstyle图层才需此处理
  85051. _this.modifyMapboxstyleLayer(mapInfo, layerInfo);
  85052. }
  85053. return layerInfo;
  85054. }).catch(error => {
  85055. return error;
  85056. })
  85057. }
  85058. /**
  85059. * @private
  85060. * @function ol.supermap.WebMap.prototype.modifyMapboxstyleLayer
  85061. * @description mapboxstyle图层:1. layer id重复问题 2.叠加图层背景色问题
  85062. * @param {Object} mapInfo 地图信息
  85063. * @param {Object} layerInfo 当前要添加到地图的图层
  85064. */
  85065. modifyMapboxstyleLayer(mapInfo, layerInfo) {
  85066. let that = this;
  85067. if (mapInfo.layers && mapInfo.layers.length === 0) {return;}
  85068. let curLayers = layerInfo.styles.layers;
  85069. if (!curLayers) {return;}
  85070. // 非底图,则移除"background"图层
  85071. curLayers = curLayers.filter(layer => layer.type !== "background");
  85072. layerInfo.styles.layers = curLayers;
  85073. // 处理mapboxstyle图层layer id重复的情况
  85074. let addedLayersArr = mapInfo.layers.filter(layer => layer.layerType === 'VECTOR_TILE' && layer.zIndex !== layerInfo.zIndex)
  85075. .map(addLayer => addLayer.styles && addLayer.styles.layers);
  85076. if (!addedLayersArr || addedLayersArr && addedLayersArr.length === 0) {return;}
  85077. addedLayersArr.forEach(layers => {
  85078. curLayers.forEach(curLayer => {
  85079. that.renameLayerId(layers, curLayer);
  85080. })
  85081. })
  85082. }
  85083. /**
  85084. * @private
  85085. * @function ol.supermap.WebMap.prototype.renameLayerId
  85086. * @description mapboxstyle图层 id重复的layer添加后缀编码 (n)[参考mapstudio]
  85087. * @param {mapboxgl.Layer[]} layers 已添加到地图的图层组
  85088. * @param {mapboxgl.Layer} curLayer 当前图层
  85089. */
  85090. renameLayerId(layers, curLayer) {
  85091. if (layers.find((l) => l.id === curLayer.id)) {
  85092. const result = curLayer.id.match(/(.+)\((\w)\)$/);
  85093. if (result) {
  85094. curLayer.id = `${result[1]}(${+result[2] + 1})`;
  85095. } else {
  85096. curLayer.id += '(1)';
  85097. }
  85098. if (layers.find((l) => l.id === curLayer.id)) {
  85099. this.renameLayerId(layers, curLayer);
  85100. }
  85101. }
  85102. }
  85103. /**
  85104. * @private
  85105. * @function mapboxgl.supermap.WebMap.prototype._matchStyleObject
  85106. * @description 恢复 style 为标准格式。
  85107. * @param {Object} style - mapbox 样式。
  85108. */
  85109. _matchStyleObject(style) {
  85110. let {sprite, glyphs} = style;
  85111. if (sprite && typeof sprite === 'object') {
  85112. style.sprite = Object.values(sprite)[0];
  85113. }
  85114. if (glyphs && typeof glyphs === 'object') {
  85115. style.glyphs = Object.values(glyphs)[0];
  85116. }
  85117. }
  85118. /**
  85119. * @private
  85120. * @function ol.supermap.WebMap.prototype.renameLayerId
  85121. * @description 判断url是否是iportal的代理地址
  85122. * @param {*} serviceUrl
  85123. */
  85124. isIportalProxyServiceUrl(serviceUrl) {
  85125. if (this.serviceProxy && this.serviceProxy.enable && serviceUrl) {
  85126. let proxyStr = '';
  85127. if (this.serviceProxy.proxyServerRootUrl) {
  85128. proxyStr = `${this.serviceProxy.proxyServerRootUrl}/`;
  85129. } else if (this.serviceProxy.rootUrlPostfix) {
  85130. proxyStr = `${this.serviceProxy.port}/${this.serviceProxy.rootUrlPostfix}/`;
  85131. } else if (!this.serviceProxy.rootUrlPostfix) {
  85132. proxyStr = `${this.serviceProxy.port}/`;
  85133. }
  85134. if (this.serviceProxy.port !== 80) {
  85135. return serviceUrl.indexOf(proxyStr) >= 0;
  85136. } else {
  85137. // 代理端口为80,url中不一定有端口,满足一种情况即可
  85138. return serviceUrl.indexOf(proxyStr) >= 0 || serviceUrl.indexOf(proxyStr.replace(':80', '')) >= 0;
  85139. }
  85140. } else {
  85141. return false
  85142. }
  85143. }
  85144. /**
  85145. * @private
  85146. * @function ol.supermap.WebMap.prototype.getStyleResolutions
  85147. * @description 创建图层分辨率
  85148. * @param {Object} bounds 图层上下左右范围
  85149. * @returns {Array} styleResolutions 样式分辨率
  85150. */
  85151. getStyleResolutions(bounds, minZoom = 0, maxZoom = 22) {
  85152. let styleResolutions = [];
  85153. const TILE_SIZE = 512
  85154. let temp = Math.abs(bounds.left - bounds.right) / TILE_SIZE;
  85155. for (let i = minZoom; i <= maxZoom; i++) {
  85156. if (i === 0) {
  85157. styleResolutions[i] = temp;
  85158. continue;
  85159. }
  85160. temp = temp / 2;
  85161. styleResolutions[i] = temp;
  85162. }
  85163. return styleResolutions;
  85164. }
  85165. /**
  85166. * @private
  85167. * @function ol.supermap.WebMap.prototype.createVisibleResolution
  85168. * @description 创建图层可视分辨率
  85169. * @param {Array} visibleScales 可视比例尺范围
  85170. * @param {Array} indexbounds
  85171. * @param {Object} bounds 图层上下左右范围
  85172. * @param {String} coordUnit
  85173. * @returns {Array} visibleResolution
  85174. */
  85175. createVisibleResolution(visibleScales, indexbounds, bounds, coordUnit) {
  85176. let visibleResolution = [];
  85177. // 1 设置了地图visibleScales的情况
  85178. if (visibleScales && visibleScales.length > 0) {
  85179. visibleResolution = visibleScales.map(scale => {
  85180. let value = 1 / scale;
  85181. let res = this.getResFromScale(value, coordUnit);
  85182. return res;
  85183. })
  85184. } else {
  85185. // 2 地图的bounds
  85186. let envelope = this.getEnvelope(indexbounds, bounds);
  85187. visibleResolution = this.getStyleResolutions(envelope);
  85188. }
  85189. return visibleResolution
  85190. }
  85191. /**
  85192. * @private
  85193. * @function ol.supermap.WebMap.prototype.createVisibleResolution
  85194. * @description 图层边界范围
  85195. * @param {Array} indexbounds
  85196. * @param {Object} bounds 图层上下左右范围
  85197. * @returns {Object} envelope
  85198. */
  85199. getEnvelope(indexbounds, bounds) {
  85200. let envelope = {};
  85201. if (indexbounds && indexbounds.length === 4) {
  85202. envelope.left = indexbounds[0];
  85203. envelope.bottom = indexbounds[1];
  85204. envelope.right = indexbounds[2];
  85205. envelope.top = indexbounds[3];
  85206. } else {
  85207. envelope = bounds;
  85208. }
  85209. return envelope
  85210. }
  85211. /**
  85212. * @private
  85213. * @function ol.supermap.WebMap.prototype.createMVTLayer
  85214. * @description 创建矢量瓦片图层
  85215. * @param {object} layerInfo - 图层信息
  85216. */
  85217. createMVTLayer(layerInfo) {
  85218. // let that = this;
  85219. let styles = layerInfo.styles;
  85220. const indexbounds = styles && styles.metadata && styles.metadata.indexbounds;
  85221. const visibleResolution = this.createVisibleResolution(layerInfo.visibleScales, indexbounds, layerInfo.bounds, layerInfo.coordUnit);
  85222. const envelope = this.getEnvelope(indexbounds, layerInfo.bounds);
  85223. const styleResolutions = this.getStyleResolutions(envelope);
  85224. // const origin = [envelope.left, envelope.top];
  85225. let withCredentials = this.isIportalProxyServiceUrl(styles.sprite);
  85226. // 创建MapBoxStyle样式
  85227. let mapboxStyles = new MapboxStyles({
  85228. style: styles,
  85229. source: styles.name,
  85230. resolutions: styleResolutions,
  85231. map: this.map,
  85232. withCredentials
  85233. });
  85234. return new Promise((resolve) => {
  85235. mapboxStyles.on('styleloaded', function () {
  85236. let minResolution = visibleResolution[visibleResolution.length - 1];
  85237. let maxResolution = visibleResolution[0];
  85238. let layer = new external_ol_layer_namespaceObject.VectorTile({
  85239. //设置避让参数
  85240. declutter: true,
  85241. source: new VectorTileSuperMapRest({
  85242. style: styles,
  85243. withCredentials,
  85244. projection: layerInfo.projection,
  85245. format: new (external_ol_format_MVT_default())({
  85246. featureClass: (external_ol_render_Feature_default())
  85247. }),
  85248. wrapX: false
  85249. }),
  85250. style: mapboxStyles.featureStyleFuntion,
  85251. visible: layerInfo.visible,
  85252. zIndex: layerInfo.zIndex,
  85253. opacity: layerInfo.opacity,
  85254. minResolution,
  85255. // The maximum resolution (exclusive) below which this layer will be visible.
  85256. maxResolution: maxResolution > 1 ? Math.ceil(maxResolution) : maxResolution * 1.1
  85257. });
  85258. resolve(layer);
  85259. })
  85260. })
  85261. }
  85262. /**
  85263. * @private
  85264. * @function ol.supermap.WebMap.prototype.isSameDomain
  85265. * @description 判断是否同域名(如果是域名,只判断后门两级域名是否相同,第一级忽略),如果是ip地址则需要完全相同。
  85266. * @param {*} url
  85267. */
  85268. isSameDomain(url) {
  85269. let documentUrlArray = url.split("://"), substring = documentUrlArray[1];
  85270. let domainIndex = substring.indexOf("/"), domain = substring.substring(0, domainIndex);
  85271. let documentUrl = document.location.toString();
  85272. let docUrlArray = documentUrl.split("://"), documentSubstring = docUrlArray[1];
  85273. let docuDomainIndex = documentSubstring.indexOf("/"), docDomain = documentSubstring.substring(0, docuDomainIndex);
  85274. if (domain.indexOf(':') > -1 || window.location.port !== "") {
  85275. //说明用的是ip地址,判断完整域名判断
  85276. return domain === docDomain;
  85277. } else {
  85278. let domainArray = domain.split('.'), docDomainArray = docDomain.split('.');
  85279. return domainArray[1] === docDomainArray[1] && domainArray[2] === docDomainArray[2];
  85280. }
  85281. }
  85282. /**
  85283. * @private
  85284. * @function ol.supermap.WebMap.prototype.isSupportWebp
  85285. * @description 判断是否支持webP
  85286. * @param {*} url 服务地址
  85287. * @param {*} token 服务token
  85288. * @returns {boolean}
  85289. */
  85290. isSupportWebp(url, token) {
  85291. // 还需要判断浏览器
  85292. let isIE = this.isIE();
  85293. if (isIE || (this.isFirefox() && this.getFirefoxVersion() < 65) ||
  85294. (this.isChrome() && this.getChromeVersion() < 32)) {
  85295. return false;
  85296. }
  85297. url = token ? `${url}/tileImage.webp?token=${token}` : `${url}/tileImage.webp`;
  85298. let isSameDomain = Util.isInTheSameDomain(url), excledeCreditial;
  85299. if (isSameDomain && !token) {
  85300. // online上服务域名一直,要用token值
  85301. excledeCreditial = false;
  85302. } else {
  85303. excledeCreditial = true;
  85304. }
  85305. url = this.getRequestUrl(url, excledeCreditial);
  85306. return FetchRequest.get(url, null, {
  85307. withCredentials: this.withCredentials,
  85308. withoutFormatSuffix: true
  85309. }).then(function (response) {
  85310. if (response.status !== 200) {
  85311. throw response.status;
  85312. }
  85313. return response;
  85314. }).then(() => {
  85315. return true;
  85316. }).catch(() => {
  85317. return false;
  85318. })
  85319. }
  85320. /**
  85321. * @private
  85322. * @function ol.supermap.WebMap.prototype.isIE
  85323. * @description 判断当前浏览器是否为IE
  85324. * @returns {boolean}
  85325. */
  85326. isIE() {
  85327. if (!!window.ActiveXObject || "ActiveXObject" in window) {
  85328. return true;
  85329. }
  85330. return false;
  85331. }
  85332. /**
  85333. * @private
  85334. * @function ol.supermap.WebMap.prototype.isFirefox
  85335. * @description 判断当前浏览器是否为 firefox
  85336. * @returns {boolean}
  85337. */
  85338. isFirefox() {
  85339. let userAgent = navigator.userAgent;
  85340. return userAgent.indexOf("Firefox") > -1;
  85341. }
  85342. /**
  85343. * @private
  85344. * @function ol.supermap.WebMap.prototype.isChrome
  85345. * @description 判断当前浏览器是否为谷歌
  85346. * @returns {boolean}
  85347. */
  85348. isChrome() {
  85349. let userAgent = navigator.userAgent;
  85350. return userAgent.indexOf("Chrome") > -1;
  85351. }
  85352. /**
  85353. * @private
  85354. * @function ol.supermap.WebMap.prototype.getFirefoxVersion
  85355. * @description 获取火狐浏览器的版本号
  85356. * @returns {Number}
  85357. */
  85358. getFirefoxVersion() {
  85359. let userAgent = navigator.userAgent.toLowerCase(),
  85360. version = userAgent.match(/firefox\/([\d.]+)/);
  85361. return +version[1];
  85362. }
  85363. /**
  85364. * @private
  85365. * @function ol.supermap.WebMap.prototype.getChromeVersion
  85366. * @description 获取谷歌浏览器版本号
  85367. * @returns {Number}
  85368. */
  85369. getChromeVersion() {
  85370. let userAgent = navigator.userAgent.toLowerCase(),
  85371. version = userAgent.match(/chrome\/([\d.]+)/);
  85372. return +version[1];
  85373. }
  85374. /**
  85375. * @private
  85376. * @function ol.supermap.WebMap.prototype.addGraticule
  85377. * @description 创建经纬网
  85378. * @param {object} mapInfo - 地图信息
  85379. */
  85380. addGraticule(mapInfo) {
  85381. if(this.isHaveGraticule) {
  85382. this.createGraticuleLayer(mapInfo.grid.graticule);
  85383. this.layerAdded++;
  85384. const lens = mapInfo.layers ? mapInfo.layers.length : 0;
  85385. this.sendMapToUser(lens);
  85386. }
  85387. }
  85388. /**
  85389. * @private
  85390. * @function ol.supermap.WebMap.prototype.createGraticuleLayer
  85391. * @description 创建经纬网图层
  85392. * @param {object} layerInfo - 图层信息
  85393. * @returns {ol/layer/Vector} 矢量图层
  85394. */
  85395. createGraticuleLayer(layerInfo) {
  85396. const { strokeColor, strokeWidth, lineDash, extent, visible, interval, lonLabelStyle, latLabelStyle } = layerInfo;
  85397. const epsgCode = this.baseProjection;
  85398. // 添加经纬网需要设置extent、worldExtent
  85399. let projection = new external_ol_proj_namespaceObject.get(epsgCode);
  85400. projection.setExtent(extent);
  85401. projection.setWorldExtent(external_ol_proj_namespaceObject.transformExtent(extent, epsgCode, 'EPSG:4326'));
  85402. let graticuleOptions = {
  85403. layerID: 'graticule_layer',
  85404. strokeStyle: new (external_ol_style_Stroke_default())({
  85405. color: strokeColor,
  85406. width: strokeWidth,
  85407. lineDash
  85408. }),
  85409. extent,
  85410. visible: visible,
  85411. intervals: interval,
  85412. showLabels: true,
  85413. zIndex: 9999,
  85414. wrapX: false,
  85415. targetSize: 0
  85416. };
  85417. lonLabelStyle && (graticuleOptions.lonLabelStyle = new (external_ol_style_Text_default())({
  85418. font: `${lonLabelStyle.fontSize} ${lonLabelStyle.fontFamily}`,
  85419. textBaseline: lonLabelStyle.textBaseline,
  85420. fill: new (external_ol_style_Fill_default())({
  85421. color: lonLabelStyle.fill
  85422. }),
  85423. stroke: new (external_ol_style_Stroke_default())({
  85424. color: lonLabelStyle.outlineColor,
  85425. width: lonLabelStyle.outlineWidth
  85426. })
  85427. }))
  85428. latLabelStyle && (graticuleOptions.latLabelStyle = new (external_ol_style_Text_default())({
  85429. font: `${latLabelStyle.fontSize} ${latLabelStyle.fontFamily}`,
  85430. textBaseline: latLabelStyle.textBaseline,
  85431. fill: new (external_ol_style_Fill_default())({
  85432. color: latLabelStyle.fill
  85433. }),
  85434. stroke: new (external_ol_style_Stroke_default())({
  85435. color: latLabelStyle.outlineColor,
  85436. width: latLabelStyle.outlineWidth
  85437. })
  85438. }))
  85439. const layer = new external_ol_layer_namespaceObject.Graticule(graticuleOptions);
  85440. this.map.addLayer(layer);
  85441. }
  85442. }
  85443. ;// CONCATENATED MODULE: ./src/openlayers/mapping/index.js
  85444. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85445. * This program are made available under the terms of the Apache License, Version 2.0
  85446. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85447. ;// CONCATENATED MODULE: ./src/openlayers/namespace.js
  85448. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85449. * This program are made available under the terms of the Apache License, Version 2.0
  85450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85451. /* control */
  85452. /* core */
  85453. /* mapping */
  85454. /* overlay */
  85455. /* service */
  85456. if (window && window.ol) {
  85457. let ol = window.ol;
  85458. ol.supermap = window.ol.supermap || {};
  85459. ol.supermap.control = window.ol.supermap.control || {};
  85460. // control
  85461. ol.supermap.control.ChangeTileVersion = ChangeTileVersion;
  85462. ol.supermap.control.Logo = Logo;
  85463. ol.supermap.control.ScaleLine = ScaleLine;
  85464. // core
  85465. ol.supermap.StyleUtils = StyleUtils;
  85466. ol.supermap.Util = core_Util_Util;
  85467. // mapping
  85468. ol.source.BaiduMap = BaiduMap;
  85469. ol.source.ImageSuperMapRest = ImageSuperMapRest;
  85470. ol.source.SuperMapCloud = SuperMapCloud;
  85471. ol.source.Tianditu = Tianditu;
  85472. ol.source.TileSuperMapRest = TileSuperMapRest;
  85473. ol.supermap.WebMap = WebMap;
  85474. // overlay
  85475. ol.style.CloverShape = CloverShape;
  85476. ol.Graphic = Graphic_Graphic;
  85477. ol.style.HitCloverShape = HitCloverShape;
  85478. ol.source.GeoFeature = GeoFeature;
  85479. ol.source.Theme = theme_Theme_Theme;
  85480. ol.supermap.ThemeFeature = ThemeFeature;
  85481. ol.supermap.MapboxStyles = MapboxStyles;
  85482. ol.supermap.VectorTileStyles = VectorTileStyles;
  85483. ol.source.DataFlow = DataFlow;
  85484. ol.source.Graph = Graph_Graph;
  85485. ol.source.Graphic = Graphic;
  85486. ol.source.HeatMap = HeatMap;
  85487. ol.source.Label = Label_Label;
  85488. ol.source.Mapv = Mapv;
  85489. ol.source.Range = Range;
  85490. ol.source.RankSymbol = RankSymbol_RankSymbol;
  85491. ol.source.Turf = Turf;
  85492. ol.source.Unique = Unique;
  85493. ol.source.VectorTileSuperMapRest = VectorTileSuperMapRest;
  85494. // service
  85495. ol.supermap.AddressMatchService = AddressMatchService;
  85496. ol.supermap.ChartService = ChartService;
  85497. ol.supermap.DataFlowService = DataFlowService;
  85498. ol.supermap.FeatureService = FeatureService;
  85499. ol.supermap.FieldService = FieldService;
  85500. ol.supermap.GridCellInfosService = GridCellInfosService;
  85501. ol.supermap.GeoprocessingService = GeoprocessingService;
  85502. ol.supermap.LayerInfoService = LayerInfoService;
  85503. ol.supermap.MapService = MapService;
  85504. ol.supermap.MeasureService = MeasureService;
  85505. ol.supermap.NetworkAnalyst3DService = NetworkAnalyst3DService;
  85506. ol.supermap.NetworkAnalystService = NetworkAnalystService;
  85507. ol.supermap.ProcessingService = ProcessingService;
  85508. ol.supermap.QueryService = QueryService_QueryService;
  85509. ol.supermap.ServiceBase = ServiceBase;
  85510. ol.supermap.SpatialAnalystService = SpatialAnalystService;
  85511. ol.supermap.ThemeService = ThemeService;
  85512. ol.supermap.TrafficTransferAnalystService = TrafficTransferAnalystService;
  85513. ol.supermap.WebPrintingJobService = WebPrintingJobService;
  85514. }
  85515. })();
  85516. (() => {
  85517. "use strict";
  85518. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  85519. * This program are made available under the terms of the Apache License, Version 2.0
  85520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  85521. })();
  85522. /******/ })()
  85523. ;