iclient-classic-es6.js 394 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538
  1. /*!
  2. *
  3. * iclient-classic.(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. /***/ 107:
  471. /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
  472. (function (global, factory) {
  473. true ? factory() :
  474. 0;
  475. }(this, (function () { 'use strict';
  476. /**
  477. * @this {Promise}
  478. */
  479. function finallyConstructor(callback) {
  480. var constructor = this.constructor;
  481. return this.then(
  482. function(value) {
  483. // @ts-ignore
  484. return constructor.resolve(callback()).then(function() {
  485. return value;
  486. });
  487. },
  488. function(reason) {
  489. // @ts-ignore
  490. return constructor.resolve(callback()).then(function() {
  491. // @ts-ignore
  492. return constructor.reject(reason);
  493. });
  494. }
  495. );
  496. }
  497. // Store setTimeout reference so promise-polyfill will be unaffected by
  498. // other code modifying setTimeout (like sinon.useFakeTimers())
  499. var setTimeoutFunc = setTimeout;
  500. function isArray(x) {
  501. return Boolean(x && typeof x.length !== 'undefined');
  502. }
  503. function noop() {}
  504. // Polyfill for Function.prototype.bind
  505. function bind(fn, thisArg) {
  506. return function() {
  507. fn.apply(thisArg, arguments);
  508. };
  509. }
  510. /**
  511. * @constructor
  512. * @param {Function} fn
  513. */
  514. function Promise(fn) {
  515. if (!(this instanceof Promise))
  516. throw new TypeError('Promises must be constructed via new');
  517. if (typeof fn !== 'function') throw new TypeError('not a function');
  518. /** @type {!number} */
  519. this._state = 0;
  520. /** @type {!boolean} */
  521. this._handled = false;
  522. /** @type {Promise|undefined} */
  523. this._value = undefined;
  524. /** @type {!Array<!Function>} */
  525. this._deferreds = [];
  526. doResolve(fn, this);
  527. }
  528. function handle(self, deferred) {
  529. while (self._state === 3) {
  530. self = self._value;
  531. }
  532. if (self._state === 0) {
  533. self._deferreds.push(deferred);
  534. return;
  535. }
  536. self._handled = true;
  537. Promise._immediateFn(function() {
  538. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  539. if (cb === null) {
  540. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  541. return;
  542. }
  543. var ret;
  544. try {
  545. ret = cb(self._value);
  546. } catch (e) {
  547. reject(deferred.promise, e);
  548. return;
  549. }
  550. resolve(deferred.promise, ret);
  551. });
  552. }
  553. function resolve(self, newValue) {
  554. try {
  555. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  556. if (newValue === self)
  557. throw new TypeError('A promise cannot be resolved with itself.');
  558. if (
  559. newValue &&
  560. (typeof newValue === 'object' || typeof newValue === 'function')
  561. ) {
  562. var then = newValue.then;
  563. if (newValue instanceof Promise) {
  564. self._state = 3;
  565. self._value = newValue;
  566. finale(self);
  567. return;
  568. } else if (typeof then === 'function') {
  569. doResolve(bind(then, newValue), self);
  570. return;
  571. }
  572. }
  573. self._state = 1;
  574. self._value = newValue;
  575. finale(self);
  576. } catch (e) {
  577. reject(self, e);
  578. }
  579. }
  580. function reject(self, newValue) {
  581. self._state = 2;
  582. self._value = newValue;
  583. finale(self);
  584. }
  585. function finale(self) {
  586. if (self._state === 2 && self._deferreds.length === 0) {
  587. Promise._immediateFn(function() {
  588. if (!self._handled) {
  589. Promise._unhandledRejectionFn(self._value);
  590. }
  591. });
  592. }
  593. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  594. handle(self, self._deferreds[i]);
  595. }
  596. self._deferreds = null;
  597. }
  598. /**
  599. * @constructor
  600. */
  601. function Handler(onFulfilled, onRejected, promise) {
  602. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  603. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  604. this.promise = promise;
  605. }
  606. /**
  607. * Take a potentially misbehaving resolver function and make sure
  608. * onFulfilled and onRejected are only called once.
  609. *
  610. * Makes no guarantees about asynchrony.
  611. */
  612. function doResolve(fn, self) {
  613. var done = false;
  614. try {
  615. fn(
  616. function(value) {
  617. if (done) return;
  618. done = true;
  619. resolve(self, value);
  620. },
  621. function(reason) {
  622. if (done) return;
  623. done = true;
  624. reject(self, reason);
  625. }
  626. );
  627. } catch (ex) {
  628. if (done) return;
  629. done = true;
  630. reject(self, ex);
  631. }
  632. }
  633. Promise.prototype['catch'] = function(onRejected) {
  634. return this.then(null, onRejected);
  635. };
  636. Promise.prototype.then = function(onFulfilled, onRejected) {
  637. // @ts-ignore
  638. var prom = new this.constructor(noop);
  639. handle(this, new Handler(onFulfilled, onRejected, prom));
  640. return prom;
  641. };
  642. Promise.prototype['finally'] = finallyConstructor;
  643. Promise.all = function(arr) {
  644. return new Promise(function(resolve, reject) {
  645. if (!isArray(arr)) {
  646. return reject(new TypeError('Promise.all accepts an array'));
  647. }
  648. var args = Array.prototype.slice.call(arr);
  649. if (args.length === 0) return resolve([]);
  650. var remaining = args.length;
  651. function res(i, val) {
  652. try {
  653. if (val && (typeof val === 'object' || typeof val === 'function')) {
  654. var then = val.then;
  655. if (typeof then === 'function') {
  656. then.call(
  657. val,
  658. function(val) {
  659. res(i, val);
  660. },
  661. reject
  662. );
  663. return;
  664. }
  665. }
  666. args[i] = val;
  667. if (--remaining === 0) {
  668. resolve(args);
  669. }
  670. } catch (ex) {
  671. reject(ex);
  672. }
  673. }
  674. for (var i = 0; i < args.length; i++) {
  675. res(i, args[i]);
  676. }
  677. });
  678. };
  679. Promise.resolve = function(value) {
  680. if (value && typeof value === 'object' && value.constructor === Promise) {
  681. return value;
  682. }
  683. return new Promise(function(resolve) {
  684. resolve(value);
  685. });
  686. };
  687. Promise.reject = function(value) {
  688. return new Promise(function(resolve, reject) {
  689. reject(value);
  690. });
  691. };
  692. Promise.race = function(arr) {
  693. return new Promise(function(resolve, reject) {
  694. if (!isArray(arr)) {
  695. return reject(new TypeError('Promise.race accepts an array'));
  696. }
  697. for (var i = 0, len = arr.length; i < len; i++) {
  698. Promise.resolve(arr[i]).then(resolve, reject);
  699. }
  700. });
  701. };
  702. // Use polyfill for setImmediate for performance gains
  703. Promise._immediateFn =
  704. // @ts-ignore
  705. (typeof setImmediate === 'function' &&
  706. function(fn) {
  707. // @ts-ignore
  708. setImmediate(fn);
  709. }) ||
  710. function(fn) {
  711. setTimeoutFunc(fn, 0);
  712. };
  713. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  714. if (typeof console !== 'undefined' && console) {
  715. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  716. }
  717. };
  718. /** @suppress {undefinedVars} */
  719. var globalNS = (function() {
  720. // the only reliable means to get the global object is
  721. // `Function('return this')()`
  722. // However, this causes CSP violations in Chrome apps.
  723. if (typeof self !== 'undefined') {
  724. return self;
  725. }
  726. if (typeof window !== 'undefined') {
  727. return window;
  728. }
  729. if (typeof __webpack_require__.g !== 'undefined') {
  730. return __webpack_require__.g;
  731. }
  732. throw new Error('unable to locate global object');
  733. })();
  734. if (!('Promise' in globalNS)) {
  735. globalNS['Promise'] = Promise;
  736. } else if (!globalNS.Promise.prototype['finally']) {
  737. globalNS.Promise.prototype['finally'] = finallyConstructor;
  738. }
  739. })));
  740. /***/ })
  741. /******/ });
  742. /************************************************************************/
  743. /******/ // The module cache
  744. /******/ var __webpack_module_cache__ = {};
  745. /******/
  746. /******/ // The require function
  747. /******/ function __webpack_require__(moduleId) {
  748. /******/ // Check if module is in cache
  749. /******/ if(__webpack_module_cache__[moduleId]) {
  750. /******/ return __webpack_module_cache__[moduleId].exports;
  751. /******/ }
  752. /******/ // Create a new module (and put it into the cache)
  753. /******/ var module = __webpack_module_cache__[moduleId] = {
  754. /******/ // no module.id needed
  755. /******/ // no module.loaded needed
  756. /******/ exports: {}
  757. /******/ };
  758. /******/
  759. /******/ // Execute the module function
  760. /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  761. /******/
  762. /******/ // Return the exports of the module
  763. /******/ return module.exports;
  764. /******/ }
  765. /******/
  766. /************************************************************************/
  767. /******/ /* webpack/runtime/compat get default export */
  768. /******/ (() => {
  769. /******/ // getDefaultExport function for compatibility with non-harmony modules
  770. /******/ __webpack_require__.n = (module) => {
  771. /******/ var getter = module && module.__esModule ?
  772. /******/ () => module['default'] :
  773. /******/ () => module;
  774. /******/ __webpack_require__.d(getter, { a: getter });
  775. /******/ return getter;
  776. /******/ };
  777. /******/ })();
  778. /******/
  779. /******/ /* webpack/runtime/define property getters */
  780. /******/ (() => {
  781. /******/ // define getter functions for harmony exports
  782. /******/ __webpack_require__.d = (exports, definition) => {
  783. /******/ for(var key in definition) {
  784. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  785. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  786. /******/ }
  787. /******/ }
  788. /******/ };
  789. /******/ })();
  790. /******/
  791. /******/ /* webpack/runtime/global */
  792. /******/ (() => {
  793. /******/ __webpack_require__.g = (function() {
  794. /******/ if (typeof globalThis === 'object') return globalThis;
  795. /******/ try {
  796. /******/ return this || new Function('return this')();
  797. /******/ } catch (e) {
  798. /******/ if (typeof window === 'object') return window;
  799. /******/ }
  800. /******/ })();
  801. /******/ })();
  802. /******/
  803. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  804. /******/ (() => {
  805. /******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
  806. /******/ })();
  807. /******/
  808. /************************************************************************/
  809. (() => {
  810. "use strict";
  811. // UNUSED EXPORTS: AddressMatchService, BuffersAnalystJobsParameter, ElasticSearch, GeoCodingParameter, GeoDecodingParameter, KernelDensityJobParameter, MapVLayer, MapVRenderer, MappingParameters, OutputSetting, OverlayGeoJobParameter, ProcessingService, SecurityManager, SingleObjectQueryJobsParameter, SummaryAttributesJobsParameter, SummaryMeshJobParameter, SummaryRegionJobParameter, SuperMap, TopologyValidatorJobsParameter
  812. ;// CONCATENATED MODULE: ./src/common/SuperMap.js
  813. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  814. * This program are made available under the terms of the Apache License, Version 2.0
  815. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  816. var SuperMap = window.SuperMap = window.SuperMap || {};
  817. SuperMap.Components = window.SuperMap.Components || {};
  818. ;// CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  819. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  820. * This program are made available under the terms of the Apache License, Version 2.0
  821. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  822. /**
  823. * @class SuperMap.Pixel
  824. * @category BaseTypes Geometry
  825. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  826. * @param {number} [x=0.0] - x 坐标。
  827. * @param {number} [y=0.0] - y 坐标。
  828. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  829. *
  830. * @example
  831. * //单独创建一个对象
  832. * var pixcel = new SuperMap.Pixel(100,50);
  833. *
  834. * //依据 size 创建
  835. * var size = new SuperMap.Size(21,25);
  836. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  837. */
  838. class Pixel {
  839. constructor(x, y, mode) {
  840. /**
  841. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  842. * @description x 坐标。
  843. */
  844. this.x = x ? parseFloat(x) : 0.0;
  845. /**
  846. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  847. * @description y 坐标。
  848. */
  849. this.y = y ? parseFloat(y) : 0.0;
  850. /**
  851. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  852. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  853. */
  854. this.mode = mode;
  855. this.CLASS_NAME = "SuperMap.Pixel";
  856. /**
  857. * @enum SuperMap.Pixel.Mode
  858. * @readonly
  859. * @description 模式。
  860. * @type {string}
  861. */
  862. SuperMap.Pixel.Mode = {
  863. /** 左上模式。*/
  864. LeftTop: "lefttop",
  865. /** 右上模式。 */
  866. RightTop: "righttop",
  867. /** 右下模式。 */
  868. RightBottom: "rightbottom",
  869. /** 左下模式。 */
  870. LeftBottom: "leftbottom"
  871. };
  872. }
  873. /**
  874. * @function SuperMap.Pixel.prototype.toString
  875. * @description 返回此对象的字符串形式。
  876. * @example
  877. *
  878. * var pixcel = new SuperMap.Pixel(100,50);
  879. * var str = pixcel.toString();
  880. *
  881. * @returns {string} 例如: "x=200.4,y=242.2"
  882. */
  883. toString() {
  884. return ("x=" + this.x + ",y=" + this.y);
  885. }
  886. /**
  887. * @function SuperMap.Pixel.prototype.clone
  888. * @description 克隆当前的 pixel 对象。
  889. * @example
  890. * var pixcel = new SuperMap.Pixel(100,50);
  891. * var pixcel2 = pixcel.clone();
  892. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  893. */
  894. clone() {
  895. return new Pixel(this.x, this.y, this.mode);
  896. }
  897. /**
  898. * @function SuperMap.Pixel.prototype.equals
  899. * @description 比较两 pixel 是否相等。
  900. * @example
  901. * var pixcel = new SuperMap.Pixel(100,50);
  902. * var pixcel2 = new SuperMap.Pixel(100,50);
  903. * var isEquals = pixcel.equals(pixcel2);
  904. *
  905. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  906. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  907. */
  908. equals(px) {
  909. var equals = false;
  910. if (px != null) {
  911. equals = ((this.x == px.x && this.y == px.y) ||
  912. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  913. }
  914. return equals;
  915. }
  916. /**
  917. * @function SuperMap.Pixel.prototype.distanceTo
  918. * @description 返回两个 pixel 的距离。
  919. * @example
  920. * var pixcel = new SuperMap.Pixel(100,50);
  921. * var pixcel2 = new SuperMap.Pixel(110,30);
  922. * var distance = pixcel.distanceTo(pixcel2);
  923. *
  924. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  925. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  926. */
  927. distanceTo(px) {
  928. return Math.sqrt(
  929. Math.pow(this.x - px.x, 2) +
  930. Math.pow(this.y - px.y, 2)
  931. );
  932. }
  933. /**
  934. * @function SuperMap.Pixel.prototype.add
  935. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  936. * @example
  937. * var pixcel = new SuperMap.Pixel(100,50);
  938. * //pixcel2是新的对象
  939. * var pixcel2 = pixcel.add(20,30);
  940. *
  941. * @param {number} x - 传入的 x 值。
  942. * @param {number} y - 传入的 y 值。
  943. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  944. */
  945. add(x, y) {
  946. if ((x == null) || (y == null)) {
  947. throw new TypeError('Pixel.add cannot receive null values');
  948. }
  949. return new Pixel(this.x + x, this.y + y);
  950. }
  951. /**
  952. * @function SuperMap.Pixel.prototype.offset
  953. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  954. * @example
  955. * var pixcel = new SuperMap.Pixel(100,50);
  956. * var pixcel2 = new SuperMap.Pixel(130,20);
  957. * //pixcel3 是新的对象
  958. * var pixcel3 = pixcel.offset(pixcel2);
  959. *
  960. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  961. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  962. */
  963. offset(px) {
  964. var newPx = this.clone();
  965. if (px) {
  966. newPx = this.add(px.x, px.y);
  967. }
  968. return newPx;
  969. }
  970. /**
  971. *
  972. * @function SuperMap.Pixel.prototype.destroy
  973. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  974. * @example
  975. * var pixcel = new SuperMap.Pixel(100,50);
  976. * pixcel.destroy();
  977. */
  978. destroy() {
  979. this.x = null;
  980. this.y = null;
  981. this.mode = null;
  982. }
  983. }
  984. SuperMap.Pixel = Pixel;
  985. ;// CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  986. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  987. * This program are made available under the terms of the Apache License, Version 2.0
  988. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  989. /**
  990. *@namespace SuperMap
  991. *@category BaseTypes Namespace
  992. */
  993. /**
  994. * @function SuperMap.inherit
  995. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  996. * @memberOf SuperMap
  997. * @param {Object} C - 继承的类。
  998. * @param {Object} P - 被继承的父类。
  999. */
  1000. SuperMap.inherit = function (C, P) {
  1001. var F = function () {
  1002. };
  1003. F.prototype = P.prototype;
  1004. C.prototype = new F;
  1005. var i, l, o;
  1006. for (i = 2, l = arguments.length; i < l; i++) {
  1007. o = arguments[i];
  1008. if (typeof o === "function") {
  1009. o = o.prototype;
  1010. }
  1011. SuperMap.Util.extend(C.prototype, o);
  1012. }
  1013. };
  1014. /**
  1015. * @function SuperMap.mixin
  1016. * @description 实现多重继承。
  1017. * @memberOf SuperMap
  1018. * @param {Class|Object} ...mixins - 继承的类。
  1019. */
  1020. SuperMap.mixin = function (...mixins) {
  1021. class Mix {
  1022. constructor(options) {
  1023. for (var index = 0; index < mixins.length; index++) {
  1024. copyProperties(this, new mixins[index](options));
  1025. }
  1026. }
  1027. }
  1028. for (var index = 0; index < mixins.length; index++) {
  1029. var mixin = mixins[index];
  1030. copyProperties(Mix, mixin);
  1031. copyProperties(Mix.prototype, mixin.prototype);
  1032. copyProperties(Mix.prototype, new mixin());
  1033. }
  1034. return Mix;
  1035. function copyProperties(target, source) {
  1036. var ownKeys = Object.getOwnPropertyNames(source);
  1037. if (Object.getOwnPropertySymbols) {
  1038. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  1039. }
  1040. for (var index = 0; index < ownKeys.length; index++) {
  1041. var key = ownKeys[index];
  1042. if (key !== "constructor"
  1043. && key !== "prototype"
  1044. && key !== "name" && key !== "length") {
  1045. let desc = Object.getOwnPropertyDescriptor(source, key);
  1046. if (window["ActiveXObject"]) {
  1047. Object.defineProperty(target, key, desc || {});
  1048. } else {
  1049. Object.defineProperty(target, key, desc);
  1050. }
  1051. }
  1052. }
  1053. }
  1054. };
  1055. /**
  1056. * @name String
  1057. * @namespace
  1058. * @memberOf SuperMap
  1059. * @category BaseTypes Util
  1060. * @description 字符串操作的一系列常用扩展函数。
  1061. */
  1062. var StringExt = SuperMap.String = {
  1063. /**
  1064. * @function SuperMap.String.startsWith
  1065. * @description 判断目标字符串是否以指定的子字符串开头。
  1066. * @param {string} str - 目标字符串。
  1067. * @param {string} sub - 查找的子字符串。
  1068. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  1069. */
  1070. startsWith: function (str, sub) {
  1071. return (str.indexOf(sub) == 0);
  1072. },
  1073. /**
  1074. * @function SuperMap.String.contains
  1075. * @description 判断目标字符串是否包含指定的子字符串。
  1076. * @param {string} str - 目标字符串。
  1077. * @param {string} sub - 查找的子字符串。
  1078. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  1079. */
  1080. contains: function (str, sub) {
  1081. return (str.indexOf(sub) != -1);
  1082. },
  1083. /**
  1084. * @function SuperMap.String.trim
  1085. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  1086. * @param {string} str - (可能)存在空白字符填塞的字符串。
  1087. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  1088. */
  1089. trim: function (str) {
  1090. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  1091. },
  1092. /**
  1093. * @function SuperMap.String.camelize
  1094. * @description 骆驼式("-")连字符的字符串处理。
  1095. * 例如:"chicken-head" becomes "chickenHead",
  1096. * "-chicken-head" becomes "ChickenHead"。
  1097. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  1098. * @returns {string}
  1099. */
  1100. camelize: function (str) {
  1101. var oStringList = str.split('-');
  1102. var camelizedString = oStringList[0];
  1103. for (var i = 1, len = oStringList.length; i < len; i++) {
  1104. var s = oStringList[i];
  1105. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  1106. }
  1107. return camelizedString;
  1108. },
  1109. /**
  1110. * @function SuperMap.String.format
  1111. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  1112. * @example
  1113. * 示例:
  1114. * (code)
  1115. * 1、template = "${value,getValue}";
  1116. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  1117. * args = [2,23,12,36,21];
  1118. * 返回值:36
  1119. * (end)
  1120. * 示例:
  1121. * (code)
  1122. * 2、template = "$${{value,getValue}}";
  1123. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  1124. * args = [2,23,12,36,21];
  1125. * 返回值:"${36}"
  1126. * (end)
  1127. * 示例:
  1128. * (code)
  1129. * 3、template = "${a,b}";
  1130. * context = {a: {b:"format"}};
  1131. * args = null;
  1132. * 返回值:"format"
  1133. * (end)
  1134. * 示例:
  1135. * (code)
  1136. * 3、template = "${a,b}";
  1137. * context = null;
  1138. * args = null;
  1139. * 返回值:"${a.b}"
  1140. * (end)
  1141. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  1142. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  1143. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  1144. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  1145. */
  1146. format: function (template, context, args) {
  1147. if (!context) {
  1148. context = window;
  1149. }
  1150. // Example matching:
  1151. // str = ${foo.bar}
  1152. // match = foo.bar
  1153. var replacer = function (str, match) {
  1154. var replacement;
  1155. // Loop through all subs. Example: ${a.b.c}
  1156. // 0 -> replacement = context[a];
  1157. // 1 -> replacement = context[a][b];
  1158. // 2 -> replacement = context[a][b][c];
  1159. var subs = match.split(/\.+/);
  1160. for (var i = 0; i < subs.length; i++) {
  1161. if (i == 0) {
  1162. replacement = context;
  1163. }
  1164. replacement = replacement[subs[i]];
  1165. }
  1166. if (typeof replacement === "function") {
  1167. replacement = args ?
  1168. replacement.apply(null, args) :
  1169. replacement();
  1170. }
  1171. // If replacement is undefined, return the string 'undefined'.
  1172. // This is a workaround for a bugs in browsers not properly
  1173. // dealing with non-participating groups in regular expressions:
  1174. // http://blog.stevenlevithan.com/archives/npcg-javascript
  1175. if (typeof replacement == 'undefined') {
  1176. return 'undefined';
  1177. } else {
  1178. return replacement;
  1179. }
  1180. };
  1181. return template.replace(SuperMap.String.tokenRegEx, replacer);
  1182. },
  1183. /**
  1184. * @member {RegExp} [SuperMap.String.tokenRegEx]
  1185. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  1186. * @example
  1187. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  1188. */
  1189. tokenRegEx: /\$\{([\w.]+?)\}/g,
  1190. /**
  1191. * @member {RegExp} [SuperMap.String.numberRegEx]
  1192. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  1193. */
  1194. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  1195. /**
  1196. * @function SuperMap.String.isNumeric
  1197. * @description 判断一个字符串是否只包含一个数值。
  1198. * @example
  1199. * (code)
  1200. * SuperMap.String.isNumeric("6.02e23") // true
  1201. * SuperMap.String.isNumeric("12 dozen") // false
  1202. * SuperMap.String.isNumeric("4") // true
  1203. * SuperMap.String.isNumeric(" 4 ") // false
  1204. * (end)
  1205. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  1206. */
  1207. isNumeric: function (value) {
  1208. return SuperMap.String.numberRegEx.test(value);
  1209. },
  1210. /**
  1211. * @function SuperMap.String.numericIf
  1212. * @description 把一个看似数值型的字符串转化为一个数值。
  1213. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  1214. */
  1215. numericIf: function (value) {
  1216. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  1217. }
  1218. };
  1219. /**
  1220. * @name Number
  1221. * @memberOf SuperMap
  1222. * @namespace
  1223. * @category BaseTypes Util
  1224. * @description 数值操作的一系列常用扩展函数。
  1225. */
  1226. var NumberExt = SuperMap.Number = {
  1227. /**
  1228. * @member {string} [SuperMap.Number.decimalSeparator='.']
  1229. * @description 格式化数字时默认的小数点分隔符。
  1230. * @constant
  1231. */
  1232. decimalSeparator: ".",
  1233. /**
  1234. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  1235. * @description 格式化数字时默认的千位分隔符。
  1236. * @constant
  1237. */
  1238. thousandsSeparator: ",",
  1239. /**
  1240. * @function SuperMap.Number.limitSigDigs
  1241. * @description 限制浮点数的有效数字位数。
  1242. * @param {number} num - 浮点数。
  1243. * @param {integer} sig - 有效位数。
  1244. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  1245. */
  1246. limitSigDigs: function (num, sig) {
  1247. var fig = 0;
  1248. if (sig > 0) {
  1249. fig = parseFloat(num.toPrecision(sig));
  1250. }
  1251. return fig;
  1252. },
  1253. /**
  1254. * @function SuperMap.Number.format
  1255. * @description 数字格式化输出。
  1256. * @param {number} num - 数字。
  1257. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  1258. * @param {string} [tsep=','] - 千位分隔符。
  1259. * @param {string} [dsep='.'] - 小数点分隔符。
  1260. * @returns {string} 数字格式化后的字符串。
  1261. */
  1262. format: function (num, dec, tsep, dsep) {
  1263. dec = (typeof dec != "undefined") ? dec : 0;
  1264. tsep = (typeof tsep != "undefined") ? tsep :
  1265. SuperMap.Number.thousandsSeparator;
  1266. dsep = (typeof dsep != "undefined") ? dsep :
  1267. SuperMap.Number.decimalSeparator;
  1268. if (dec != null) {
  1269. num = parseFloat(num.toFixed(dec));
  1270. }
  1271. var parts = num.toString().split(".");
  1272. if (parts.length === 1 && dec == null) {
  1273. // integer where we do not want to touch the decimals
  1274. dec = 0;
  1275. }
  1276. var integer = parts[0];
  1277. if (tsep) {
  1278. var thousands = /(-?[0-9]+)([0-9]{3})/;
  1279. while (thousands.test(integer)) {
  1280. integer = integer.replace(thousands, "$1" + tsep + "$2");
  1281. }
  1282. }
  1283. var str;
  1284. if (dec == 0) {
  1285. str = integer;
  1286. } else {
  1287. var rem = parts.length > 1 ? parts[1] : "0";
  1288. if (dec != null) {
  1289. rem = rem + new Array(dec - rem.length + 1).join("0");
  1290. }
  1291. str = integer + dsep + rem;
  1292. }
  1293. return str;
  1294. }
  1295. };
  1296. if (!Number.prototype.limitSigDigs) {
  1297. /**
  1298. * APIMethod: Number.limitSigDigs
  1299. * 限制浮点数的有效数字位数.
  1300. * @param {integer} sig -有效位数。
  1301. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  1302. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  1303. */
  1304. Number.prototype.limitSigDigs = function (sig) {
  1305. return NumberExt.limitSigDigs(this, sig);
  1306. };
  1307. }
  1308. /**
  1309. * @name Function
  1310. * @memberOf SuperMap
  1311. * @namespace
  1312. * @category BaseTypes Util
  1313. * @description 函数操作的一系列常用扩展函数。
  1314. */
  1315. var FunctionExt = SuperMap.Function = {
  1316. /**
  1317. * @function SuperMap.Function.bind
  1318. * @description 绑定函数到对象。方便创建 this 的作用域。
  1319. * @param {function} func - 输入函数。
  1320. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  1321. * @returns {function} object 参数作为 func 函数的 this 对象。
  1322. */
  1323. bind: function (func, object) {
  1324. // create a reference to all arguments past the second one
  1325. var args = Array.prototype.slice.apply(arguments, [2]);
  1326. return function () {
  1327. // Push on any additional arguments from the actual function call.
  1328. // These will come after those sent to the bind call.
  1329. var newArgs = args.concat(
  1330. Array.prototype.slice.apply(arguments, [0])
  1331. );
  1332. return func.apply(object, newArgs);
  1333. };
  1334. },
  1335. /**
  1336. * @function SuperMap.Function.bindAsEventListener
  1337. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  1338. * @param {function} func - 用于监听事件的函数。
  1339. * @param {Object} object - this 对象的引用。
  1340. * @returns {function}
  1341. */
  1342. bindAsEventListener: function (func, object) {
  1343. return function (event) {
  1344. return func.call(object, event || window.event);
  1345. };
  1346. },
  1347. /**
  1348. * @function SuperMap.Function.False
  1349. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  1350. * @example
  1351. * document.onclick = SuperMap.Function.False;
  1352. * @returns {boolean}
  1353. */
  1354. False: function () {
  1355. return false;
  1356. },
  1357. /**
  1358. * @function SuperMap.Function.True
  1359. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  1360. * @example
  1361. * document.onclick = SuperMap.Function.True;
  1362. * @returns {boolean}
  1363. */
  1364. True: function () {
  1365. return true;
  1366. },
  1367. /**
  1368. * @function SuperMap.Function.Void
  1369. * @description 可重用函数,仅仅返回 "undefined"。
  1370. * @returns {undefined}
  1371. */
  1372. Void: function () {
  1373. }
  1374. };
  1375. /**
  1376. * @name Array
  1377. * @memberOf SuperMap
  1378. * @namespace
  1379. * @category BaseTypes Util
  1380. * @description 数组操作的一系列常用扩展函数。
  1381. */
  1382. var ArrayExt = SuperMap.Array = {
  1383. /**
  1384. * @function SuperMap.Array.filter
  1385. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  1386. * @param {Array} array - 要过滤的数组。
  1387. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  1388. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  1389. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  1390. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  1391. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  1392. */
  1393. filter: function (array, callback, caller) {
  1394. var selected = [];
  1395. if (Array.prototype.filter) {
  1396. selected = array.filter(callback, caller);
  1397. } else {
  1398. var len = array.length;
  1399. if (typeof callback != "function") {
  1400. throw new TypeError();
  1401. }
  1402. for (var i = 0; i < len; i++) {
  1403. if (i in array) {
  1404. var val = array[i];
  1405. if (callback.call(caller, val, i, array)) {
  1406. selected.push(val);
  1407. }
  1408. }
  1409. }
  1410. }
  1411. return selected;
  1412. }
  1413. };
  1414. ;// CONCATENATED MODULE: ./src/common/commontypes/Util.js
  1415. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  1416. * This program are made available under the terms of the Apache License, Version 2.0
  1417. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1418. var Util = SuperMap.Util = SuperMap.Util || {};
  1419. /**
  1420. * @name Util
  1421. * @memberOf SuperMap
  1422. * @namespace
  1423. * @category BaseTypes Util
  1424. * @description common 工具类。
  1425. */
  1426. /**
  1427. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  1428. * @example
  1429. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  1430. * var size = new SuperMap.Size(100, 100);
  1431. * var obj = {};
  1432. * SuperMap.Util.extend(obj, size);
  1433. * @param {Object} [destination] - 目标对象。
  1434. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  1435. * @returns {Object} 目标对象。
  1436. */
  1437. SuperMap.Util.extend = function (destination, source) {
  1438. destination = destination || {};
  1439. if (source) {
  1440. for (var property in source) {
  1441. var value = source[property];
  1442. if (value !== undefined) {
  1443. destination[property] = value;
  1444. }
  1445. }
  1446. /**
  1447. * IE doesn't include the toString property when iterating over an object's
  1448. * properties with the for(property in object) syntax. Explicitly check if
  1449. * the source has its own toString property.
  1450. */
  1451. /*
  1452. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  1453. * prototype object" when calling hawOwnProperty if the source object
  1454. * is an instance of window.Event.
  1455. */
  1456. var sourceIsEvt = typeof window.Event === "function"
  1457. && source instanceof window.Event;
  1458. if (!sourceIsEvt
  1459. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  1460. destination.toString = source.toString;
  1461. }
  1462. }
  1463. return destination;
  1464. };
  1465. /**
  1466. * @description 对象拷贝。
  1467. * @param {Object} [des] - 目标对象。
  1468. * @param {Object} soc - 源对象。
  1469. */
  1470. SuperMap.Util.copy = function (des, soc) {
  1471. des = des || {};
  1472. var v;
  1473. if (soc) {
  1474. for (var p in des) {
  1475. v = soc[p];
  1476. if (typeof v !== 'undefined') {
  1477. des[p] = v;
  1478. }
  1479. }
  1480. }
  1481. };
  1482. /**
  1483. * @description 销毁对象,将其属性置空。
  1484. * @param {Object} [obj] - 目标对象。
  1485. */
  1486. SuperMap.Util.reset = function (obj) {
  1487. obj = obj || {};
  1488. for (var p in obj) {
  1489. if (obj.hasOwnProperty(p)) {
  1490. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  1491. for (var i in obj[p]) {
  1492. if (obj[p][i].destroy) {
  1493. obj[p][i].destroy();
  1494. }
  1495. }
  1496. obj[p].length = 0;
  1497. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  1498. if (obj[p].destroy) {
  1499. obj[p].destroy();
  1500. }
  1501. }
  1502. obj[p] = null;
  1503. }
  1504. }
  1505. };
  1506. /**
  1507. * @description 获取 HTML 元素数组。
  1508. * @returns {Array.<HTMLElement>} HTML 元素数组。
  1509. */
  1510. SuperMap.Util.getElement = function () {
  1511. var elements = [];
  1512. for (var i = 0, len = arguments.length; i < len; i++) {
  1513. var element = arguments[i];
  1514. if (typeof element === 'string') {
  1515. element = document.getElementById(element);
  1516. }
  1517. if (arguments.length === 1) {
  1518. return element;
  1519. }
  1520. elements.push(element);
  1521. }
  1522. return elements;
  1523. };
  1524. /**
  1525. * @description instance of 的跨浏览器实现。
  1526. * @param {Object} o - 对象。
  1527. * @returns {boolean} 是否是页面元素。
  1528. */
  1529. SuperMap.Util.isElement = function (o) {
  1530. return !!(o && o.nodeType === 1);
  1531. };
  1532. /**
  1533. * @description 判断一个对象是否是数组。
  1534. * @param {Object} a - 对象。
  1535. * @returns {boolean} 是否是数组。
  1536. */
  1537. SuperMap.Util.isArray = function (a) {
  1538. return (Object.prototype.toString.call(a) === '[object Array]');
  1539. };
  1540. /**
  1541. * @description 从数组中删除某一项。
  1542. * @param {Array} array - 数组。
  1543. * @param {Object} item - 数组中要删除的一项。
  1544. * @returns {Array} 执行删除操作后的数组。
  1545. */
  1546. SuperMap.Util.removeItem = function (array, item) {
  1547. for (var i = array.length - 1; i >= 0; i--) {
  1548. if (array[i] === item) {
  1549. array.splice(i, 1);
  1550. //break;more than once??
  1551. }
  1552. }
  1553. return array;
  1554. };
  1555. /**
  1556. * @description 获取某对象再数组中的索引值。
  1557. * @param {Array} array - 数组。
  1558. * @param {Object} obj - 对象。
  1559. * @returns {number} 某对象再数组中的索引值。
  1560. */
  1561. SuperMap.Util.indexOf = function (array, obj) {
  1562. if (array == null) {
  1563. return -1;
  1564. } else {
  1565. // use the build-in function if available.
  1566. if (typeof array.indexOf === "function") {
  1567. return array.indexOf(obj);
  1568. } else {
  1569. for (var i = 0, len = array.length; i < len; i++) {
  1570. if (array[i] === obj) {
  1571. return i;
  1572. }
  1573. }
  1574. return -1;
  1575. }
  1576. }
  1577. };
  1578. /**
  1579. * @description 修改某 DOM 元素的许多属性。
  1580. * @param {HTMLElement} element - 待修改的 DOM 元素。
  1581. * @param {string} [id] - DOM 元素的 ID。
  1582. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  1583. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  1584. * @param {string} [position] - DOM 元素的 position 属性。
  1585. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  1586. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  1587. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  1588. */
  1589. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  1590. border, overflow, opacity) {
  1591. if (id) {
  1592. element.id = id;
  1593. }
  1594. if (px) {
  1595. element.style.left = px.x + "px";
  1596. element.style.top = px.y + "px";
  1597. }
  1598. if (sz) {
  1599. element.style.width = sz.w + "px";
  1600. element.style.height = sz.h + "px";
  1601. }
  1602. if (position) {
  1603. element.style.position = position;
  1604. }
  1605. if (border) {
  1606. element.style.border = border;
  1607. }
  1608. if (overflow) {
  1609. element.style.overflow = overflow;
  1610. }
  1611. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  1612. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  1613. element.style.opacity = opacity;
  1614. } else if (parseFloat(opacity) === 1.0) {
  1615. element.style.filter = '';
  1616. element.style.opacity = '';
  1617. }
  1618. };
  1619. /**
  1620. * @description Takes an object and copies any properties that don't exist from
  1621. * another properties, by analogy with SuperMap.Util.extend() from
  1622. * Prototype.js.
  1623. *
  1624. * @param {Object} [to] - 目标对象。
  1625. * @param {Object} from - 源对象。Any properties of this object that
  1626. * are undefined in the to object will be set on the to object.
  1627. *
  1628. * @returns {Object} A reference to the to object. Note that the to argument is modified
  1629. * in place and returned by this function.
  1630. */
  1631. SuperMap.Util.applyDefaults = function (to, from) {
  1632. to = to || {};
  1633. /*
  1634. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  1635. * prototype object" when calling hawOwnProperty if the source object is an
  1636. * instance of window.Event.
  1637. */
  1638. var fromIsEvt = typeof window.Event === "function"
  1639. && from instanceof window.Event;
  1640. for (var key in from) {
  1641. if (to[key] === undefined ||
  1642. (!fromIsEvt && from.hasOwnProperty
  1643. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  1644. to[key] = from[key];
  1645. }
  1646. }
  1647. /**
  1648. * IE doesn't include the toString property when iterating over an object's
  1649. * properties with the for(property in object) syntax. Explicitly check if
  1650. * the source has its own toString property.
  1651. */
  1652. if (!fromIsEvt && from && from.hasOwnProperty
  1653. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  1654. to.toString = from.toString;
  1655. }
  1656. return to;
  1657. };
  1658. /**
  1659. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  1660. * @param {Object} params - 参数对象。
  1661. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  1662. */
  1663. SuperMap.Util.getParameterString = function (params) {
  1664. var paramsArray = [];
  1665. for (var key in params) {
  1666. var value = params[key];
  1667. if ((value != null) && (typeof value !== 'function')) {
  1668. var encodedValue;
  1669. if (Array.isArray(value) || value.toString() === '[object Object]') {
  1670. encodedValue = encodeURIComponent(JSON.stringify(value));
  1671. } else {
  1672. /* value is a string; simply encode */
  1673. encodedValue = encodeURIComponent(value);
  1674. }
  1675. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  1676. }
  1677. }
  1678. return paramsArray.join("&");
  1679. };
  1680. /**
  1681. * @description 给 URL 追加查询参数。
  1682. * @param {string} url - 待追加参数的 URL 字符串。
  1683. * @param {string} paramStr - 待追加的查询参数。
  1684. * @returns {string} 新的 URL。
  1685. */
  1686. SuperMap.Util.urlAppend = function (url, paramStr) {
  1687. var newUrl = url;
  1688. if (paramStr) {
  1689. if(paramStr.indexOf('?') === 0){
  1690. paramStr = paramStr.substring(1);
  1691. }
  1692. var parts = (url + " ").split(/[?&]/);
  1693. newUrl += (parts.pop() === " " ?
  1694. paramStr :
  1695. parts.length ? "&" + paramStr : "?" + paramStr);
  1696. }
  1697. return newUrl;
  1698. };
  1699. /**
  1700. * @description 给 URL 追加 path 参数。
  1701. * @param {string} url - 待追加参数的 URL 字符串。
  1702. * @param {string} paramStr - 待追加的path参数。
  1703. * @returns {string} 新的 URL。
  1704. */
  1705. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  1706. let newUrl = url;
  1707. if (!pathStr) {
  1708. return newUrl;
  1709. }
  1710. if (pathStr.indexOf('/') === 0) {
  1711. pathStr = pathStr.substring(1);
  1712. }
  1713. const parts = url.split('?');
  1714. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  1715. parts[0] += '/'
  1716. }
  1717. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  1718. return newUrl;
  1719. };
  1720. /**
  1721. * @description 为了避免浮点精度错误而保留的有效位数。
  1722. * @type {number}
  1723. * @default 14
  1724. */
  1725. SuperMap.Util.DEFAULT_PRECISION = 14;
  1726. /**
  1727. * @description 将字符串以接近的精度转换为数字。
  1728. * @param {string} number - 字符串。
  1729. * @param {number} [precision=14] - 精度。
  1730. * @returns {number} 数字。
  1731. */
  1732. SuperMap.Util.toFloat = function (number, precision) {
  1733. if (precision == null) {
  1734. precision = SuperMap.Util.DEFAULT_PRECISION;
  1735. }
  1736. if (typeof number !== "number") {
  1737. number = parseFloat(number);
  1738. }
  1739. return precision === 0 ? number :
  1740. parseFloat(number.toPrecision(precision));
  1741. };
  1742. /**
  1743. * @description 角度转弧度。
  1744. * @param {number} x - 角度。
  1745. * @returns {number} 弧度。
  1746. */
  1747. SuperMap.Util.rad = function (x) {
  1748. return x * Math.PI / 180;
  1749. };
  1750. /**
  1751. * @description 从 URL 字符串中解析出参数对象。
  1752. * @param {string} url - URL。
  1753. * @returns {Object} 解析出的参数对象。
  1754. */
  1755. SuperMap.Util.getParameters = function (url) {
  1756. // if no url specified, take it from the location bar
  1757. url = (url === null || url === undefined) ? window.location.href : url;
  1758. //parse out parameters portion of url string
  1759. var paramsString = "";
  1760. if (SuperMap.String.contains(url, '?')) {
  1761. var start = url.indexOf('?') + 1;
  1762. var end = SuperMap.String.contains(url, "#") ?
  1763. url.indexOf('#') : url.length;
  1764. paramsString = url.substring(start, end);
  1765. }
  1766. var parameters = {};
  1767. var pairs = paramsString.split(/[&;]/);
  1768. for (var i = 0, len = pairs.length; i < len; ++i) {
  1769. var keyValue = pairs[i].split('=');
  1770. if (keyValue[0]) {
  1771. var key = keyValue[0];
  1772. try {
  1773. key = decodeURIComponent(key);
  1774. } catch (err) {
  1775. key = unescape(key);
  1776. }
  1777. // being liberal by replacing "+" with " "
  1778. var value = (keyValue[1] || '').replace(/\+/g, " ");
  1779. try {
  1780. value = decodeURIComponent(value);
  1781. } catch (err) {
  1782. value = unescape(value);
  1783. }
  1784. // follow OGC convention of comma delimited values
  1785. value = value.split(",");
  1786. //if there's only one value, do not return as array
  1787. if (value.length == 1) {
  1788. value = value[0];
  1789. }
  1790. parameters[key] = value;
  1791. }
  1792. }
  1793. return parameters;
  1794. };
  1795. /**
  1796. * @description 不断递增计数变量,用于生成唯一 ID。
  1797. * @type {number}
  1798. * @default 0
  1799. */
  1800. SuperMap.Util.lastSeqID = 0;
  1801. /**
  1802. * @description 创建唯一 ID 值。
  1803. * @param {string} [prefix] - 前缀。
  1804. * @returns {string} 唯一的 ID 值。
  1805. */
  1806. SuperMap.Util.createUniqueID = function (prefix) {
  1807. if (prefix == null) {
  1808. prefix = "id_";
  1809. }
  1810. SuperMap.Util.lastSeqID += 1;
  1811. return prefix + SuperMap.Util.lastSeqID;
  1812. };
  1813. /**
  1814. * @memberOf SuperMap
  1815. * @description 每单位的英尺数。
  1816. * @type {Object}
  1817. * @constant
  1818. */
  1819. SuperMap.INCHES_PER_UNIT = {
  1820. 'inches': 1.0,
  1821. 'ft': 12.0,
  1822. 'mi': 63360.0,
  1823. 'm': 39.3701,
  1824. 'km': 39370.1,
  1825. 'dd': 4374754,
  1826. 'yd': 36
  1827. };
  1828. SuperMap.INCHES_PER_UNIT.in = SuperMap.INCHES_PER_UNIT.inches;
  1829. SuperMap.INCHES_PER_UNIT.degrees = SuperMap.INCHES_PER_UNIT.dd;
  1830. SuperMap.INCHES_PER_UNIT.nmi = 1852 * SuperMap.INCHES_PER_UNIT.m;
  1831. // Units from CS-Map
  1832. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  1833. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  1834. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  1835. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  1836. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  1837. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  1838. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  1839. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  1840. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  1841. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  1842. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  1843. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  1844. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  1845. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  1846. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  1847. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  1848. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  1849. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  1850. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  1851. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  1852. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  1853. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  1854. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  1855. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  1856. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  1857. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  1858. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  1859. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  1860. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  1861. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  1862. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  1863. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  1864. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  1865. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  1866. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  1867. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  1868. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  1869. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  1870. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  1871. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  1872. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  1873. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  1874. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  1875. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  1876. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  1877. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  1878. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  1879. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  1880. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  1881. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  1882. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  1883. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  1884. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  1885. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  1886. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  1887. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  1888. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  1889. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  1890. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  1891. });
  1892. //unit abbreviations supported by PROJ.4
  1893. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  1894. "mm": SuperMap.INCHES_PER_UNIT.Meter / 1000.0,
  1895. "cm": SuperMap.INCHES_PER_UNIT.Meter / 100.0,
  1896. "dm": SuperMap.INCHES_PER_UNIT.Meter * 100.0,
  1897. "km": SuperMap.INCHES_PER_UNIT.Meter * 1000.0,
  1898. "kmi": SuperMap.INCHES_PER_UNIT.nmi, //International Nautical Mile
  1899. "fath": SuperMap.INCHES_PER_UNIT.Fathom, //International Fathom
  1900. "ch": SuperMap.INCHES_PER_UNIT.IntnlChain, //International Chain
  1901. "link": SuperMap.INCHES_PER_UNIT.IntnlLink, //International Link
  1902. "us-in": SuperMap.INCHES_PER_UNIT.inches, //U.S. Surveyor's Inch
  1903. "us-ft": SuperMap.INCHES_PER_UNIT.Foot, //U.S. Surveyor's Foot
  1904. "us-yd": SuperMap.INCHES_PER_UNIT.Yard, //U.S. Surveyor's Yard
  1905. "us-ch": SuperMap.INCHES_PER_UNIT.GunterChain, //U.S. Surveyor's Chain
  1906. "us-mi": SuperMap.INCHES_PER_UNIT.Mile, //U.S. Surveyor's Statute Mile
  1907. "ind-yd": SuperMap.INCHES_PER_UNIT.IndianYd37, //Indian Yard
  1908. "ind-ft": SuperMap.INCHES_PER_UNIT.IndianFt37, //Indian Foot
  1909. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  1910. });
  1911. /**
  1912. * @memberOf SuperMap
  1913. * @member [SuperMap.DOTS_PER_INCH=96]
  1914. * @description 分辨率与比例尺之间转换的常量。
  1915. * @type {Object}
  1916. */
  1917. SuperMap.DOTS_PER_INCH = 96;
  1918. /**
  1919. * @param {number} scale - 比例尺。
  1920. * @returns {number} 返回正常的 scale 值。
  1921. */
  1922. SuperMap.Util.normalizeScale = function (scale) {
  1923. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  1924. return normScale;
  1925. };
  1926. /**
  1927. * @description 比例尺转分辨率。
  1928. * @param {number} scale - 比例尺。
  1929. * @param {string} [units='degrees'] - 比例尺单位。
  1930. * @returns {number} 分辨率。
  1931. */
  1932. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  1933. var resolution;
  1934. if (scale) {
  1935. if (units == null) {
  1936. units = "degrees";
  1937. }
  1938. var normScale = SuperMap.Util.normalizeScale(scale);
  1939. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  1940. * SuperMap.DOTS_PER_INCH);
  1941. }
  1942. return resolution;
  1943. };
  1944. /**
  1945. * @description 分辨率转比例尺。
  1946. * @param {number} resolution - 分辨率。
  1947. * @param {string} [units='degrees'] - 分辨率单位。
  1948. * @returns {number} 比例尺。
  1949. */
  1950. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  1951. if (units == null) {
  1952. units = "degrees";
  1953. }
  1954. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  1955. SuperMap.DOTS_PER_INCH;
  1956. return scale;
  1957. };
  1958. /**
  1959. * @memberOf SuperMap
  1960. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  1961. * @constant
  1962. */
  1963. SuperMap.IS_GECKO = (function () {
  1964. var ua = navigator.userAgent.toLowerCase();
  1965. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  1966. })();
  1967. /**
  1968. * @memberOf SuperMap
  1969. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  1970. * * "opera" -- Opera
  1971. * * "msie" -- Internet Explorer
  1972. * * "safari" -- Safari
  1973. * * "firefox" -- Firefox
  1974. * * "mozilla" -- Mozilla
  1975. * @constant
  1976. */
  1977. SuperMap.Browser = (function () {
  1978. var name = '', version = '', device = 'pc', uaMatch;
  1979. //以下进行测试
  1980. var ua = navigator.userAgent.toLowerCase();
  1981. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  1982. name = 'msie';
  1983. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  1984. } else if (ua.indexOf("chrome") > -1) {
  1985. name = 'chrome';
  1986. uaMatch = ua.match(/chrome\/([\d.]+)/);
  1987. } else if (ua.indexOf("firefox") > -1) {
  1988. name = 'firefox';
  1989. uaMatch = ua.match(/firefox\/([\d.]+)/);
  1990. } else if (ua.indexOf("opera") > -1) {
  1991. name = 'opera';
  1992. uaMatch = ua.match(/version\/([\d.]+)/);
  1993. } else if (ua.indexOf("safari") > -1) {
  1994. name = 'safari';
  1995. uaMatch = ua.match(/version\/([\d.]+)/);
  1996. }
  1997. version = uaMatch ? uaMatch[1] : '';
  1998. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  1999. device = 'apple';
  2000. } else if (ua.indexOf("android") > -1) {
  2001. uaMatch = ua.match(/version\/([\d.]+)/);
  2002. version = uaMatch ? uaMatch[1] : '';
  2003. device = 'android';
  2004. }
  2005. return {name: name, version: version, device: device};
  2006. })();
  2007. /**
  2008. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  2009. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  2010. */
  2011. SuperMap.Util.getBrowser = function () {
  2012. return SuperMap.Browser;
  2013. };
  2014. /**
  2015. * @description 浏览器是否支持 Canvas。
  2016. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  2017. */
  2018. SuperMap.Util.isSupportCanvas = (function () {
  2019. var checkRes = true, broz = SuperMap.Util.getBrowser();
  2020. if (document.createElement("canvas").getContext) {
  2021. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  2022. checkRes = false;
  2023. }
  2024. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  2025. checkRes = false;
  2026. }
  2027. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  2028. checkRes = false;
  2029. }
  2030. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  2031. checkRes = false;
  2032. }
  2033. } else {
  2034. checkRes = false;
  2035. }
  2036. return checkRes;
  2037. })();
  2038. /**
  2039. * @description 判断;浏览器是否支持 Canvas。
  2040. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  2041. */
  2042. SuperMap.Util.supportCanvas = function () {
  2043. return SuperMap.Util.isSupportCanvas;
  2044. };
  2045. //将服务端的地图单位转成SuperMap的地图单位
  2046. SuperMap.INCHES_PER_UNIT.degree = SuperMap.INCHES_PER_UNIT.dd;
  2047. SuperMap.INCHES_PER_UNIT.meter = SuperMap.INCHES_PER_UNIT.m;
  2048. SuperMap.INCHES_PER_UNIT.foot = SuperMap.INCHES_PER_UNIT.ft;
  2049. SuperMap.INCHES_PER_UNIT.inch = SuperMap.INCHES_PER_UNIT.inches;
  2050. SuperMap.INCHES_PER_UNIT.mile = SuperMap.INCHES_PER_UNIT.mi;
  2051. SuperMap.INCHES_PER_UNIT.kilometer = SuperMap.INCHES_PER_UNIT.km;
  2052. SuperMap.INCHES_PER_UNIT.yard = SuperMap.INCHES_PER_UNIT.yd;
  2053. /**
  2054. * @description 判断一个 URL 请求是否在当前域中。
  2055. * @param {string} url - URL 请求字符串。
  2056. * @returns {boolean} URL 请求是否在当前域中。
  2057. */
  2058. SuperMap.Util.isInTheSameDomain = function (url) {
  2059. if (!url) {
  2060. return true;
  2061. }
  2062. var index = url.indexOf("//");
  2063. var documentUrl = document.location.toString();
  2064. var documentIndex = documentUrl.indexOf("//");
  2065. if (index === -1) {
  2066. return true;
  2067. } else {
  2068. var protocol;
  2069. var substring = protocol = url.substring(0, index);
  2070. var documentSubString = documentUrl.substring(documentIndex + 2);
  2071. documentIndex = documentSubString.indexOf("/");
  2072. var documentPortIndex = documentSubString.indexOf(":");
  2073. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  2074. //var documentPort;
  2075. var documentprotocol = document.location.protocol;
  2076. if (documentPortIndex !== -1) {
  2077. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  2078. } else {
  2079. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  2080. }
  2081. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  2082. return false;
  2083. }
  2084. substring = url.substring(index + 2);
  2085. var portIndex = substring.indexOf(":");
  2086. index = substring.indexOf("/");
  2087. var domainWithPort = substring.substring(0, index);
  2088. var domain;
  2089. if (portIndex !== -1) {
  2090. domain = substring.substring(0, portIndex);
  2091. } else {
  2092. domain = substring.substring(0, index);
  2093. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  2094. }
  2095. var documentDomain = document.domain;
  2096. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  2097. return true;
  2098. }
  2099. }
  2100. return false;
  2101. };
  2102. /**
  2103. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  2104. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  2105. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  2106. * @param {number} scale - 地图初始化时默认的显示比例尺。
  2107. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  2108. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  2109. * @returns {number} 返回图层显示分辨率。
  2110. */
  2111. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  2112. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  2113. if (!viewBounds || !viewer || !scale) {
  2114. return;
  2115. }
  2116. var ratio = 10000,
  2117. rvbWidth = viewBounds.getWidth(),
  2118. rvbHeight = viewBounds.getHeight(),
  2119. rvWidth = viewer.w,
  2120. rvHeight = viewer.h;
  2121. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2122. datumAxis = datumAxis || 6378137;
  2123. coordUnit = coordUnit || "degrees";
  2124. var dpi;
  2125. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2126. let num1 = rvbWidth / rvWidth,
  2127. num2 = rvbHeight / rvHeight,
  2128. resolution = num1 > num2 ? num1 : num2;
  2129. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2130. } else {
  2131. let resolution = rvbWidth / rvWidth;
  2132. dpi = 0.0254 * ratio / resolution / scale / ratio;
  2133. }
  2134. return dpi;
  2135. };
  2136. /**
  2137. * @description 将对象转换成 JSON 字符串。
  2138. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  2139. * @returns {string} 返回转换后的 JSON 对象。
  2140. */
  2141. SuperMap.Util.toJSON = function (obj) {
  2142. var objInn = obj;
  2143. if (objInn == null) {
  2144. return null;
  2145. }
  2146. switch (objInn.constructor) {
  2147. case String:
  2148. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  2149. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  2150. objInn = objInn.replace(/\n/g, "\\n");
  2151. objInn = objInn.replace(/\r/g, "\\r");
  2152. objInn = objInn.replace("<", "&lt;");
  2153. objInn = objInn.replace(">", "&gt;");
  2154. objInn = objInn.replace(/%/g, "%25");
  2155. objInn = objInn.replace(/&/g, "%26");
  2156. return objInn;
  2157. case Array:
  2158. var arr = [];
  2159. for (var i = 0, len = objInn.length; i < len; i++) {
  2160. arr.push(SuperMap.Util.toJSON(objInn[i]));
  2161. }
  2162. return "[" + arr.join(",") + "]";
  2163. case Number:
  2164. return isFinite(objInn) ? String(objInn) : null;
  2165. case Boolean:
  2166. return String(objInn);
  2167. case Date:
  2168. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  2169. "'Year':" + objInn.getFullYear() + "," +
  2170. "'Month':" + (objInn.getMonth() + 1) + "," +
  2171. "'Day':" + objInn.getDate() + "," +
  2172. "'Hour':" + objInn.getHours() + "," +
  2173. "'Minute':" + objInn.getMinutes() + "," +
  2174. "'Second':" + objInn.getSeconds() + "," +
  2175. "'Millisecond':" + objInn.getMilliseconds() + "," +
  2176. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  2177. return dateStr;
  2178. default:
  2179. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  2180. return objInn.toJSON();
  2181. }
  2182. if (typeof objInn === "object") {
  2183. if (objInn.length) {
  2184. let arr = [];
  2185. for (let i = 0, len = objInn.length; i < len; i++) {
  2186. arr.push(SuperMap.Util.toJSON(objInn[i]));
  2187. }
  2188. return "[" + arr.join(",") + "]";
  2189. }
  2190. let arr = [];
  2191. for (let attr in objInn) {
  2192. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  2193. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  2194. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  2195. }
  2196. }
  2197. if (arr.length > 0) {
  2198. return "{" + arr.join(",") + "}";
  2199. } else {
  2200. return "{}";
  2201. }
  2202. }
  2203. return objInn.toString();
  2204. }
  2205. };
  2206. /**
  2207. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  2208. * @param {number} scale - 比例尺。
  2209. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  2210. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  2211. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  2212. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  2213. */
  2214. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  2215. var resolution = null,
  2216. ratio = 10000;
  2217. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2218. datumAxis = datumAxis || 6378137;
  2219. coordUnit = coordUnit || "";
  2220. if (scale > 0 && dpi > 0) {
  2221. scale = SuperMap.Util.normalizeScale(scale);
  2222. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2223. //scale = SuperMap.Util.normalizeScale(scale);
  2224. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2225. return resolution;
  2226. } else {
  2227. resolution = 0.0254 * ratio / dpi / scale / ratio;
  2228. return resolution;
  2229. }
  2230. }
  2231. return -1;
  2232. };
  2233. /**
  2234. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  2235. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  2236. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  2237. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  2238. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  2239. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  2240. */
  2241. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  2242. var scale = null,
  2243. ratio = 10000;
  2244. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2245. datumAxis = datumAxis || 6378137;
  2246. coordUnit = coordUnit || "";
  2247. if (resolution > 0 && dpi > 0) {
  2248. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2249. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2250. return scale;
  2251. } else {
  2252. scale = 0.0254 * ratio / dpi / resolution / ratio;
  2253. return scale;
  2254. }
  2255. }
  2256. return -1;
  2257. };
  2258. /**
  2259. * @description 转换查询结果。
  2260. * @param {Object} result - 查询结果。
  2261. * @returns {Object} 转换后的查询结果。
  2262. */
  2263. SuperMap.Util.transformResult = function (result) {
  2264. if (result.responseText && typeof result.responseText === "string") {
  2265. result = JSON.parse(result.responseText);
  2266. }
  2267. return result;
  2268. };
  2269. /**
  2270. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  2271. * @param {Object} [destination] - 拷贝目标。
  2272. * @param {Object} source - 源对象。
  2273. *
  2274. */
  2275. SuperMap.Util.copyAttributes = function (destination, source) {
  2276. destination = destination || {};
  2277. if (source) {
  2278. for (var property in source) {
  2279. var value = source[property];
  2280. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  2281. destination[property] = value;
  2282. }
  2283. }
  2284. }
  2285. return destination;
  2286. };
  2287. /**
  2288. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  2289. * @param {Object} [destination] - 目标对象。
  2290. * @param {Object} source - 源对象。
  2291. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  2292. *
  2293. */
  2294. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  2295. destination = destination || {};
  2296. if (source) {
  2297. for (var property in source) {
  2298. //去掉禁止拷贝的属性
  2299. var isInClip = false;
  2300. if (clip && clip.length) {
  2301. for (var i = 0, len = clip.length; i < len; i++) {
  2302. if (property === clip[i]) {
  2303. isInClip = true;
  2304. break;
  2305. }
  2306. }
  2307. }
  2308. if (isInClip === true) {
  2309. continue;
  2310. }
  2311. var value = source[property];
  2312. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  2313. destination[property] = value;
  2314. }
  2315. }
  2316. }
  2317. return destination;
  2318. };
  2319. /**
  2320. * @description 克隆一个 Object 对象
  2321. * @param {Object} obj - 需要克隆的对象。
  2322. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  2323. */
  2324. SuperMap.Util.cloneObject = function (obj) {
  2325. // Handle the 3 simple types, and null or undefined
  2326. if (null === obj || "object" !== typeof obj) {
  2327. return obj;
  2328. }
  2329. // Handle Date
  2330. if (obj instanceof Date) {
  2331. let copy = new Date();
  2332. copy.setTime(obj.getTime());
  2333. return copy;
  2334. }
  2335. // Handle Array
  2336. if (obj instanceof Array) {
  2337. let copy = obj.slice(0);
  2338. return copy;
  2339. }
  2340. // Handle Object
  2341. if (obj instanceof Object) {
  2342. let copy = {};
  2343. for (var attr in obj) {
  2344. if (obj.hasOwnProperty(attr)) {
  2345. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  2346. }
  2347. }
  2348. return copy;
  2349. }
  2350. throw new Error("Unable to copy obj! Its type isn't supported.");
  2351. };
  2352. /**
  2353. * @description 判断两条线段是不是有交点。
  2354. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  2355. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  2356. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  2357. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  2358. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  2359. */
  2360. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  2361. var intersectValue = null;
  2362. var k1;
  2363. var k2;
  2364. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  2365. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  2366. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  2367. //ab==0代表两条线断的斜率一样
  2368. if (ab != 0) {
  2369. k1 = b / ab;
  2370. k2 = a / ab;
  2371. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  2372. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  2373. } else {
  2374. intersectValue = "No Intersection";
  2375. }
  2376. } else {
  2377. if (b == 0 && a == 0) {
  2378. var maxy = Math.max(a1.y, a2.y);
  2379. var miny = Math.min(a1.y, a2.y);
  2380. var maxx = Math.max(a1.x, a2.x);
  2381. var minx = Math.min(a1.x, a2.x);
  2382. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  2383. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  2384. intersectValue = "Coincident";//重合
  2385. } else {
  2386. intersectValue = "Parallel";//平行
  2387. }
  2388. } else {
  2389. intersectValue = "Parallel";//平行
  2390. }
  2391. }
  2392. return intersectValue;
  2393. };
  2394. /**
  2395. * @description 获取文本外接矩形宽度与高度。
  2396. * @param {SuperMap.ThemeStyle} style - 文本样式。
  2397. * @param {string} text - 文本内容。
  2398. * @param {Object} element - DOM 元素。
  2399. * @returns {Object} 返回裁剪后的宽度,高度信息。
  2400. */
  2401. SuperMap.Util.getTextBounds = function (style, text, element) {
  2402. document.body.appendChild(element);
  2403. element.style.width = 'auto';
  2404. element.style.height = 'auto';
  2405. if (style.fontSize) {
  2406. element.style.fontSize = style.fontSize;
  2407. }
  2408. if (style.fontFamily) {
  2409. element.style.fontFamily = style.fontFamily;
  2410. }
  2411. if (style.fontWeight) {
  2412. element.style.fontWeight = style.fontWeight;
  2413. }
  2414. element.style.position = 'relative';
  2415. element.style.visibility = 'hidden';
  2416. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  2417. element.style.display = 'inline-block';
  2418. element.innerHTML = text;
  2419. var textWidth = element.clientWidth;
  2420. var textHeight = element.clientHeight;
  2421. document.body.removeChild(element);
  2422. return {
  2423. textWidth: textWidth,
  2424. textHeight: textHeight
  2425. };
  2426. };
  2427. ;// CONCATENATED MODULE: ./src/common/commontypes/Event.js
  2428. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2429. * This program are made available under the terms of the Apache License, Version 2.0
  2430. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2431. /**
  2432. * @name Event
  2433. * @memberOf SuperMap
  2434. * @namespace
  2435. * @description 事件处理函数.
  2436. */
  2437. var Event = SuperMap.Event = {
  2438. /**
  2439. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  2440. * @type {boolean}
  2441. * @default false
  2442. */
  2443. observers: false,
  2444. /**
  2445. * @description KEY_SPACE
  2446. * @type {number}
  2447. * @default 32
  2448. */
  2449. KEY_SPACE: 32,
  2450. /**
  2451. * @description KEY_BACKSPACE
  2452. * @type {number}
  2453. * @default 8
  2454. */
  2455. KEY_BACKSPACE: 8,
  2456. /**
  2457. * @description KEY_TAB
  2458. * @type {number}
  2459. * @default 9
  2460. */
  2461. KEY_TAB: 9,
  2462. /**
  2463. * @description KEY_RETURN
  2464. * @type {number}
  2465. * @default 13
  2466. */
  2467. KEY_RETURN: 13,
  2468. /**
  2469. * @description KEY_ESC
  2470. * @type {number}
  2471. * @default 27
  2472. */
  2473. KEY_ESC: 27,
  2474. /**
  2475. * @description KEY_LEFT
  2476. * @type {number}
  2477. * @default 37
  2478. */
  2479. KEY_LEFT: 37,
  2480. /**
  2481. * @description KEY_UP
  2482. * @type {number}
  2483. * @default 38
  2484. */
  2485. KEY_UP: 38,
  2486. /**
  2487. * @description KEY_RIGHT
  2488. * @type {number}
  2489. * @default 39
  2490. */
  2491. KEY_RIGHT: 39,
  2492. /**
  2493. * @description KEY_DOWN
  2494. * @type {number}
  2495. * @default 40
  2496. */
  2497. KEY_DOWN: 40,
  2498. /**
  2499. * @description KEY_DELETE
  2500. * @type {number}
  2501. * @default 46
  2502. */
  2503. KEY_DELETE: 46,
  2504. /**
  2505. * @description Cross browser event element detection.
  2506. * @param {Event} event - The event
  2507. * @returns {HTMLElement} The element that caused the event
  2508. */
  2509. element: function (event) {
  2510. return event.target || event.srcElement;
  2511. },
  2512. /**
  2513. * @description Determine whether event was caused by a single touch
  2514. * @param {Event} event - The event
  2515. * @returns {boolean}
  2516. */
  2517. isSingleTouch: function (event) {
  2518. return event.touches && event.touches.length === 1;
  2519. },
  2520. /**
  2521. * @description Determine whether event was caused by a multi touch
  2522. * @param {Event} event - The event
  2523. * @returns {boolean}
  2524. */
  2525. isMultiTouch: function (event) {
  2526. return event.touches && event.touches.length > 1;
  2527. },
  2528. /**
  2529. * @description Determine whether event was caused by a left click.
  2530. * @param {Event} event - The event
  2531. * @returns {boolean}
  2532. */
  2533. isLeftClick: function (event) {
  2534. return (((event.which) && (event.which === 1)) ||
  2535. ((event.button) && (event.button === 1)));
  2536. },
  2537. /**
  2538. * @description Determine whether event was caused by a right mouse click.
  2539. * @param {Event} event - The event
  2540. * @returns {boolean}
  2541. */
  2542. isRightClick: function (event) {
  2543. return (((event.which) && (event.which === 3)) ||
  2544. ((event.button) && (event.button === 2)));
  2545. },
  2546. /**
  2547. * @description Stops an event from propagating.
  2548. * @param {Event} event - The event
  2549. * @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
  2550. */
  2551. stop: function (event, allowDefault) {
  2552. if (!allowDefault) {
  2553. if (event.preventDefault) {
  2554. event.preventDefault();
  2555. } else {
  2556. event.returnValue = false;
  2557. }
  2558. }
  2559. if (event.stopPropagation) {
  2560. event.stopPropagation();
  2561. } else {
  2562. event.cancelBubble = true;
  2563. }
  2564. },
  2565. /**
  2566. * @param {Event} event - The event。
  2567. * @param {string} tagName - html 标签名。
  2568. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  2569. */
  2570. findElement: function (event, tagName) {
  2571. var element = SuperMap.Event.element(event);
  2572. while (element.parentNode && (!element.tagName ||
  2573. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  2574. element = element.parentNode;
  2575. }
  2576. return element;
  2577. },
  2578. /**
  2579. * @description 监听事件,注册事件处理方法。
  2580. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  2581. * @param {string} name - 监听事件的类别名称。
  2582. * @param {function} observer - 注册的事件处理方法。
  2583. * @param {boolean} [useCapture=false] - 是否捕获。
  2584. */
  2585. observe: function (elementParam, name, observer, useCapture) {
  2586. var element = Util.getElement(elementParam);
  2587. useCapture = useCapture || false;
  2588. if (name === 'keypress' &&
  2589. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  2590. || element.attachEvent)) {
  2591. name = 'keydown';
  2592. }
  2593. //if observers cache has not yet been created, create it
  2594. if (!this.observers) {
  2595. this.observers = {};
  2596. }
  2597. //if not already assigned, make a new unique cache ID
  2598. if (!element._eventCacheID) {
  2599. var idPrefix = "eventCacheID_";
  2600. if (element.id) {
  2601. idPrefix = element.id + "_" + idPrefix;
  2602. }
  2603. element._eventCacheID = Util.createUniqueID(idPrefix);
  2604. }
  2605. var cacheID = element._eventCacheID;
  2606. //if there is not yet a hash entry for this element, add one
  2607. if (!this.observers[cacheID]) {
  2608. this.observers[cacheID] = [];
  2609. }
  2610. //add a new observer to this element's list
  2611. this.observers[cacheID].push({
  2612. 'element': element,
  2613. 'name': name,
  2614. 'observer': observer,
  2615. 'useCapture': useCapture
  2616. });
  2617. //add the actual browser event listener
  2618. if (element.addEventListener) {
  2619. if(name === 'mousewheel'){
  2620. // https://www.chromestatus.com/features/6662647093133312
  2621. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  2622. } else {
  2623. element.addEventListener(name, observer, useCapture);
  2624. }
  2625. } else if (element.attachEvent) {
  2626. element.attachEvent('on' + name, observer);
  2627. }
  2628. },
  2629. /**
  2630. * @description Given the id of an element to stop observing, cycle through the
  2631. * element's cached observers, calling stopObserving on each one,
  2632. * skipping those entries which can no longer be removed.
  2633. *
  2634. * @param {(HTMLElement|string)} elementParam -
  2635. */
  2636. stopObservingElement: function (elementParam) {
  2637. var element = Util.getElement(elementParam);
  2638. var cacheID = element._eventCacheID;
  2639. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  2640. },
  2641. /**
  2642. * @param {Array.<Object>} elementObservers - Array of (element, name,
  2643. * observer, usecapture) objects,
  2644. * taken directly from hashtable
  2645. */
  2646. _removeElementObservers: function (elementObservers) {
  2647. if (elementObservers) {
  2648. for (var i = elementObservers.length - 1; i >= 0; i--) {
  2649. var entry = elementObservers[i];
  2650. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  2651. SuperMap.Event.stopObserving.apply(this, args);
  2652. }
  2653. }
  2654. },
  2655. /**
  2656. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  2657. * 保持一致才能确保事件移除成功。
  2658. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  2659. * @param {string} name - 需要移除的被监听事件名称。
  2660. * @param {function} observer - 需要移除的事件处理方法。
  2661. * @param {boolean} [useCapture=false] - 是否捕获。
  2662. * @returns {boolean} Whether or not the event observer was removed
  2663. */
  2664. stopObserving: function (elementParam, name, observer, useCapture) {
  2665. useCapture = useCapture || false;
  2666. var element = Util.getElement(elementParam);
  2667. var cacheID = element._eventCacheID;
  2668. if (name === 'keypress') {
  2669. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  2670. element.detachEvent) {
  2671. name = 'keydown';
  2672. }
  2673. }
  2674. // find element's entry in this.observers cache and remove it
  2675. var foundEntry = false;
  2676. var elementObservers = SuperMap.Event.observers[cacheID];
  2677. if (elementObservers) {
  2678. // find the specific event type in the element's list
  2679. var i = 0;
  2680. while (!foundEntry && i < elementObservers.length) {
  2681. var cacheEntry = elementObservers[i];
  2682. if ((cacheEntry.name === name) &&
  2683. (cacheEntry.observer === observer) &&
  2684. (cacheEntry.useCapture === useCapture)) {
  2685. elementObservers.splice(i, 1);
  2686. if (elementObservers.length == 0) {
  2687. delete SuperMap.Event.observers[cacheID];
  2688. }
  2689. foundEntry = true;
  2690. break;
  2691. }
  2692. i++;
  2693. }
  2694. }
  2695. //actually remove the event listener from browser
  2696. if (foundEntry) {
  2697. if (element.removeEventListener) {
  2698. element.removeEventListener(name, observer, useCapture);
  2699. } else if (element && element.detachEvent) {
  2700. element.detachEvent('on' + name, observer);
  2701. }
  2702. }
  2703. return foundEntry;
  2704. },
  2705. /**
  2706. * @description Cycle through all the element entries in the events cache and call
  2707. * stopObservingElement on each.
  2708. */
  2709. unloadCache: function () {
  2710. // check for SuperMap.Event before checking for observers, because
  2711. // SuperMap.Event may be undefined in IE if no map instance was
  2712. // created
  2713. if (SuperMap.Event && SuperMap.Event.observers) {
  2714. for (var cacheID in SuperMap.Event.observers) {
  2715. var elementObservers = SuperMap.Event.observers[cacheID];
  2716. SuperMap.Event._removeElementObservers.apply(this,
  2717. [elementObservers]);
  2718. }
  2719. SuperMap.Event.observers = false;
  2720. }
  2721. },
  2722. CLASS_NAME: "SuperMap.Event"
  2723. };
  2724. SuperMap.Event = Event;
  2725. /* prevent memory leaks in IE */
  2726. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  2727. ;// CONCATENATED MODULE: ./src/common/commontypes/Events.js
  2728. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  2729. * This program are made available under the terms of the Apache License, Version 2.0
  2730. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2731. /**
  2732. * @class SuperMap.Events
  2733. * @classdesc 事件类。
  2734. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  2735. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  2736. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  2737. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  2738. * @param {Object} options - 事件对象选项。
  2739. */
  2740. class Events {
  2741. constructor(object, element, eventTypes, fallThrough, options) {
  2742. /**
  2743. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  2744. * @description 支持的事件。
  2745. * @constant
  2746. * @default [
  2747. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  2748. "click", "dblclick", "rightclick", "dblrightclick","resize",
  2749. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  2750. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  2751. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  2752. ]
  2753. */
  2754. this.BROWSER_EVENTS = [
  2755. "mouseover", "mouseout",
  2756. "mousedown", "mouseup", "mousemove",
  2757. "click", "dblclick", "rightclick", "dblrightclick",
  2758. "resize", "focus", "blur",
  2759. "touchstart", "touchmove", "touchend",
  2760. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  2761. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  2762. "contextmenu"
  2763. ];
  2764. /**
  2765. * @member {Object} SuperMap.Events.prototype.listeners
  2766. * @description Hashtable of Array(function): events listener functions
  2767. */
  2768. this.listeners = {};
  2769. /**
  2770. * @member {Object} SuperMap.Events.prototype.object
  2771. * @description 发布应用程序事件的对象。
  2772. */
  2773. this.object = object;
  2774. /**
  2775. * @member {HTMLElement} SuperMap.Events.prototype.element
  2776. * @description 接受浏览器事件的 DOM 节点。
  2777. */
  2778. this.element = null;
  2779. /**
  2780. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  2781. * @description 支持的事件类型列表。
  2782. */
  2783. this.eventTypes = [];
  2784. /**
  2785. * @member {function} SuperMap.Events.prototype.eventHandler
  2786. * @description 绑定在元素上的事件处理器对象。
  2787. */
  2788. this.eventHandler = null;
  2789. /**
  2790. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  2791. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  2792. */
  2793. this.fallThrough = fallThrough;
  2794. /**
  2795. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  2796. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  2797. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  2798. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  2799. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  2800. * @example
  2801. * function named(evt) {
  2802. * this.xy = this.object.events.getMousePosition(evt);
  2803. * }
  2804. */
  2805. this.includeXY = false;
  2806. /**
  2807. * @member {Object} SuperMap.Events.prototype.extensions
  2808. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  2809. * @example
  2810. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  2811. *
  2812. * SuperMap.Events.foostart = SuperMap.Class({
  2813. * initialize: function(target) {
  2814. * this.target = target;
  2815. * this.target.register("click", this, this.doStuff, {extension: true});
  2816. * // only required if extension provides more than one event type
  2817. * this.target.extensions["foostart"] = true;
  2818. * this.target.extensions["fooend"] = true;
  2819. * },
  2820. * destroy: function() {
  2821. * var target = this.target;
  2822. * target.unregister("click", this, this.doStuff);
  2823. * delete this.target;
  2824. * // only required if extension provides more than one event type
  2825. * delete target.extensions["foostart"];
  2826. * delete target.extensions["fooend"];
  2827. * },
  2828. * doStuff: function(evt) {
  2829. * var propagate = true;
  2830. * if (SuperMap.Event.element(evt).className === "foo") {
  2831. * propagate = false;
  2832. * var target = this.target;
  2833. * target.triggerEvent("foostart");
  2834. * window.setTimeout(function() {
  2835. * target.triggerEvent("fooend");
  2836. * }, 1000);
  2837. * }
  2838. * return propagate;
  2839. * }
  2840. * });
  2841. * // only required if extension provides more than one event type
  2842. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  2843. */
  2844. this.extensions = {};
  2845. /**
  2846. * @member {Object} SuperMap.Events.prototype.extensionCount
  2847. */
  2848. this.extensionCount = {};
  2849. /**
  2850. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  2851. */
  2852. this.clearMouseListener = null;
  2853. Util.extend(this, options);
  2854. if (eventTypes != null) {
  2855. for (var i = 0, len = eventTypes.length; i < len; i++) {
  2856. this.addEventType(eventTypes[i]);
  2857. }
  2858. }
  2859. if (element != null) {
  2860. this.attachToElement(element);
  2861. }
  2862. this.CLASS_NAME = "SuperMap.Events";
  2863. }
  2864. /**
  2865. * @function SuperMap.Events.prototype.destroy
  2866. * @description 移除当前要素 element 上的所有事件监听和处理。
  2867. */
  2868. destroy() {
  2869. for (var e in this.extensions) {
  2870. if (typeof this.extensions[e] !== "boolean") {
  2871. this.extensions[e].destroy();
  2872. }
  2873. }
  2874. this.extensions = null;
  2875. if (this.element) {
  2876. Event.stopObservingElement(this.element);
  2877. if (this.element.hasScrollEvent) {
  2878. Event.stopObserving(
  2879. window, "scroll", this.clearMouseListener
  2880. );
  2881. }
  2882. }
  2883. this.element = null;
  2884. this.listeners = null;
  2885. this.object = null;
  2886. this.eventTypes = null;
  2887. this.fallThrough = null;
  2888. this.eventHandler = null;
  2889. }
  2890. /**
  2891. * @function SuperMap.Events.prototype.addEventType
  2892. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  2893. * @param {string} eventName - 事件名。
  2894. */
  2895. addEventType(eventName) {
  2896. if (!this.listeners[eventName]) {
  2897. this.eventTypes.push(eventName);
  2898. this.listeners[eventName] = [];
  2899. }
  2900. }
  2901. /**
  2902. * @function SuperMap.Events.prototype.attachToElement
  2903. * @description 给 DOM 元素绑定浏览器事件。
  2904. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  2905. */
  2906. attachToElement(element) {
  2907. if (this.element) {
  2908. Event.stopObservingElement(this.element);
  2909. } else {
  2910. // keep a bound copy of handleBrowserEvent() so that we can
  2911. // pass the same function to both Event.observe() and .stopObserving()
  2912. this.eventHandler = FunctionExt.bindAsEventListener(
  2913. this.handleBrowserEvent, this
  2914. );
  2915. // to be used with observe and stopObserving
  2916. this.clearMouseListener = FunctionExt.bind(
  2917. this.clearMouseCache, this
  2918. );
  2919. }
  2920. this.element = element;
  2921. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  2922. var eventType = this.BROWSER_EVENTS[i];
  2923. // every browser event has a corresponding application event
  2924. // (whether it's listened for or not).
  2925. this.addEventType(eventType);
  2926. // use Prototype to register the event cross-browser
  2927. Event.observe(element, eventType, this.eventHandler);
  2928. }
  2929. // disable dragstart in IE so that mousedown/move/up works normally
  2930. Event.observe(element, "dragstart", Event.stop);
  2931. }
  2932. /**
  2933. * @function SuperMap.Events.prototype.on
  2934. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  2935. * @example
  2936. * // 注册一个 "loadstart" 监听事件
  2937. * events.on({"loadstart": loadStartListener});
  2938. *
  2939. * // 同样注册一个 "loadstart" 监听事件
  2940. * events.register("loadstart", undefined, loadStartListener);
  2941. *
  2942. * // 同时为对象注册多个监听事件
  2943. * events.on({
  2944. * "loadstart": loadStartListener,
  2945. * "loadend": loadEndListener,
  2946. * scope: object
  2947. * });
  2948. *
  2949. * // 同时为对象注册多个监听事件,多次调用 register 方法
  2950. * events.register("loadstart", object, loadStartListener);
  2951. * events.register("loadend", object, loadEndListener);
  2952. *
  2953. *
  2954. * @param {Object} object - 添加监听的对象。
  2955. */
  2956. on(object) {
  2957. for (var type in object) {
  2958. if (type !== "scope" && object.hasOwnProperty(type)) {
  2959. this.register(type, object.scope, object[type]);
  2960. }
  2961. }
  2962. }
  2963. /**
  2964. * @function SuperMap.Events.prototype.register
  2965. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  2966. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  2967. * @param {string} type - 事件注册者的名字。
  2968. * @param {Object} [obj=this.object] - 对象绑定的回调。
  2969. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  2970. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  2971. */
  2972. register(type, obj, func, priority) {
  2973. if (type in Events && !this.extensions[type]) {
  2974. this.extensions[type] = new Events[type](this);
  2975. }
  2976. if ((func != null) &&
  2977. (Util.indexOf(this.eventTypes, type) !== -1)) {
  2978. if (obj == null) {
  2979. obj = this.object;
  2980. }
  2981. var listeners = this.listeners[type];
  2982. if (!listeners) {
  2983. listeners = [];
  2984. this.listeners[type] = listeners;
  2985. this.extensionCount[type] = 0;
  2986. }
  2987. var listener = {obj: obj, func: func};
  2988. if (priority) {
  2989. listeners.splice(this.extensionCount[type], 0, listener);
  2990. if (typeof priority === "object" && priority.extension) {
  2991. this.extensionCount[type]++;
  2992. }
  2993. } else {
  2994. listeners.push(listener);
  2995. }
  2996. }
  2997. }
  2998. /**
  2999. * @function SuperMap.Events.prototype.registerPriority
  3000. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  3001. * @param {string} type - 事件注册者的名字。
  3002. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  3003. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  3004. */
  3005. registerPriority(type, obj, func) {
  3006. this.register(type, obj, func, true);
  3007. }
  3008. /**
  3009. * @function SuperMap.Events.prototype.un
  3010. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  3011. * @example
  3012. * // 移除 "loadstart" 事件监听
  3013. * events.un({"loadstart": loadStartListener});
  3014. *
  3015. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  3016. * events.unregister("loadstart", undefined, loadStartListener);
  3017. *
  3018. * // 取消对象多个事件监听
  3019. * events.un({
  3020. * "loadstart": loadStartListener,
  3021. * "loadend": loadEndListener,
  3022. * scope: object
  3023. * });
  3024. *
  3025. * // 取消对象多个事件监听,多次调用unregister方法。
  3026. * events.unregister("loadstart", object, loadStartListener);
  3027. * events.unregister("loadend", object, loadEndListener);
  3028. *
  3029. * @param {Object} object - 移除监听的对象。
  3030. */
  3031. un(object) {
  3032. for (var type in object) {
  3033. if (type !== "scope" && object.hasOwnProperty(type)) {
  3034. this.unregister(type, object.scope, object[type]);
  3035. }
  3036. }
  3037. }
  3038. /**
  3039. * @function SuperMap.Events.prototype.unregister
  3040. * @description 取消注册。
  3041. * @param {string} type - 事件类型。
  3042. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  3043. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  3044. */
  3045. unregister(type, obj, func) {
  3046. if (obj == null) {
  3047. obj = this.object;
  3048. }
  3049. var listeners = this.listeners[type];
  3050. if (listeners != null) {
  3051. for (var i = 0, len = listeners.length; i < len; i++) {
  3052. if (listeners[i].obj === obj && listeners[i].func === func) {
  3053. listeners.splice(i, 1);
  3054. break;
  3055. }
  3056. }
  3057. }
  3058. }
  3059. /**
  3060. * @function SuperMap.Events.prototype.remove
  3061. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  3062. * @param {string} type - 事件类型。
  3063. */
  3064. remove(type) {
  3065. if (this.listeners[type] != null) {
  3066. this.listeners[type] = [];
  3067. }
  3068. }
  3069. /**
  3070. * @function SuperMap.Events.prototype.triggerEvent
  3071. * @description 触发一个特定的注册事件。
  3072. * @param {string} type - 触发事件类型。
  3073. * @param {Event} evt - 事件对象。
  3074. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  3075. */
  3076. triggerEvent(type, evt) {
  3077. var listeners = this.listeners[type];
  3078. // fast path
  3079. if (!listeners || listeners.length == 0) {
  3080. return undefined;
  3081. }
  3082. // prep evt object with object & div references
  3083. if (evt == null) {
  3084. evt = {};
  3085. }
  3086. evt.object = this.object;
  3087. evt.element = this.element;
  3088. if (!evt.type) {
  3089. evt.type = type;
  3090. }
  3091. // execute all callbacks registered for specified type
  3092. // get a clone of the listeners array to
  3093. // allow for splicing during callbacks
  3094. listeners = listeners.slice();
  3095. var continueChain;
  3096. for (var i = 0, len = listeners.length; i < len; i++) {
  3097. var callback = listeners[i];
  3098. // bind the context to callback.obj
  3099. continueChain = callback.func.apply(callback.obj, [evt]);
  3100. if ((continueChain != undefined) && (continueChain === false)) {
  3101. // if callback returns false, execute no more callbacks.
  3102. break;
  3103. }
  3104. }
  3105. // don't fall through to other DOM elements
  3106. if (!this.fallThrough) {
  3107. Event.stop(evt, true);
  3108. }
  3109. return continueChain;
  3110. }
  3111. /**
  3112. * @function SuperMap.Events.prototype.handleBrowserEvent
  3113. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  3114. * @param {Event} evt - 事件对象。
  3115. */
  3116. handleBrowserEvent(evt) {
  3117. var type = evt.type, listeners = this.listeners[type];
  3118. if (!listeners || listeners.length == 0) {
  3119. // noone's listening, bail out
  3120. return;
  3121. }
  3122. // add clientX & clientY to all events - corresponds to average x, y
  3123. var touches = evt.touches;
  3124. if (touches && touches[0]) {
  3125. var x = 0;
  3126. var y = 0;
  3127. var num = touches.length;
  3128. var touch;
  3129. for (var i = 0; i < num; ++i) {
  3130. touch = touches[i];
  3131. x += touch.clientX;
  3132. y += touch.clientY;
  3133. }
  3134. evt.clientX = x / num;
  3135. evt.clientY = y / num;
  3136. }
  3137. if (this.includeXY) {
  3138. evt.xy = this.getMousePosition(evt);
  3139. }
  3140. this.triggerEvent(type, evt);
  3141. }
  3142. /**
  3143. * @function SuperMap.Events.prototype.clearMouseCache
  3144. * @description 清除鼠标缓存。
  3145. */
  3146. clearMouseCache() {
  3147. this.element.scrolls = null;
  3148. this.element.lefttop = null;
  3149. var body = document.body;
  3150. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  3151. navigator.userAgent.match(/iPhone/i))) {
  3152. this.element.offsets = null;
  3153. }
  3154. }
  3155. /**
  3156. * @function SuperMap.Events.prototype.getMousePosition
  3157. * @param {Event} evt - 事件对象。
  3158. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  3159. */
  3160. getMousePosition(evt) {
  3161. if (!this.includeXY) {
  3162. this.clearMouseCache();
  3163. } else if (!this.element.hasScrollEvent) {
  3164. Event.observe(window, "scroll", this.clearMouseListener);
  3165. this.element.hasScrollEvent = true;
  3166. }
  3167. if (!this.element.scrolls) {
  3168. var viewportElement = Util.getViewportElement();
  3169. this.element.scrolls = [
  3170. viewportElement.scrollLeft,
  3171. viewportElement.scrollTop
  3172. ];
  3173. }
  3174. if (!this.element.lefttop) {
  3175. this.element.lefttop = [
  3176. (document.documentElement.clientLeft || 0),
  3177. (document.documentElement.clientTop || 0)
  3178. ];
  3179. }
  3180. if (!this.element.offsets) {
  3181. this.element.offsets = Util.pagePosition(this.element);
  3182. }
  3183. return new Pixel(
  3184. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  3185. - this.element.lefttop[0],
  3186. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  3187. - this.element.lefttop[1]
  3188. );
  3189. }
  3190. }
  3191. SuperMap.Events = Events;
  3192. SuperMap.Events.prototype.BROWSER_EVENTS = [
  3193. "mouseover", "mouseout",
  3194. "mousedown", "mouseup", "mousemove",
  3195. "click", "dblclick", "rightclick", "dblrightclick",
  3196. "resize", "focus", "blur",
  3197. "touchstart", "touchmove", "touchend",
  3198. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  3199. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  3200. "contextmenu"
  3201. ];
  3202. ;// CONCATENATED MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  3203. const external_function_try_return_elasticsearch_catch_e_return_namespaceObject = function(){try{return elasticsearch}catch(e){return {}}}();
  3204. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_namespaceObject);
  3205. ;// CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  3206. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3207. * This program are made available under the terms of the Apache License, Version 2.0
  3208. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3209. /**
  3210. * @class SuperMap.ElasticSearch
  3211. * @classdesc ElasticSearch服务类。
  3212. * @category ElasticSearch
  3213. * @param {string} url - ElasticSearch服务地址。
  3214. * @param {Object} options - 参数。
  3215. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  3216. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  3217. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  3218. * @param {Object} [options.geoFence] - 地理围栏。
  3219. */
  3220. class ElasticSearch {
  3221. constructor(url, options) {
  3222. options = options || {};
  3223. /**
  3224. * @member {string} SuperMap.ElasticSearch.prototype.url
  3225. * @description ElasticSearch服务地址
  3226. */
  3227. this.url = url;
  3228. /**
  3229. * @member {Object} SuperMap.ElasticSearch.prototype.client
  3230. * @description client ES客户端
  3231. */
  3232. this.client = new (external_function_try_return_elasticsearch_catch_e_return_default()).Client({
  3233. host: this.url
  3234. });
  3235. /**
  3236. * @deprecated
  3237. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  3238. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  3239. */
  3240. this.change = null;
  3241. /**
  3242. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  3243. * @description 是否开启地理围栏验证,默认为不开启。
  3244. */
  3245. this.openGeoFence = false;
  3246. /**
  3247. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  3248. * @description 数据超出地理围栏后执行的函数
  3249. */
  3250. this.outOfGeoFence = null;
  3251. /**
  3252. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  3253. * @description 地理围栏
  3254. * @example {
  3255. * radius: 1000,//单位是m
  3256. * center: [104.40, 30.43],
  3257. * unit: 'meter|degree'
  3258. * }
  3259. */
  3260. this.geoFence = null;
  3261. /*
  3262. * Constant: EVENT_TYPES
  3263. * {Array.<String>}
  3264. * 此类支持的事件类型。
  3265. *
  3266. */
  3267. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  3268. /**
  3269. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  3270. * @description 事件
  3271. */
  3272. this.events = new Events(this, null, this.EVENT_TYPES);
  3273. /**
  3274. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  3275. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  3276. * 相当于调用 SuperMap.Events.on(eventListeners)。
  3277. */
  3278. this.eventListeners = null;
  3279. Util.extend(this, options);
  3280. if (this.eventListeners instanceof Object) {
  3281. this.events.on(this.eventListeners);
  3282. }
  3283. }
  3284. /**
  3285. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  3286. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  3287. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  3288. */
  3289. setGeoFence(geoFence) {
  3290. this.geoFence = geoFence;
  3291. }
  3292. /**
  3293. * @function SuperMap.ElasticSearch.prototype.bulk
  3294. * @description 批量操作API,允许执行多个索引/删除操作。
  3295. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  3296. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  3297. * @param {Object} params - 参数。
  3298. * @param {function} callback - 回调函数。
  3299. */
  3300. bulk(params, callback) {
  3301. return this.client.bulk(params, callback);
  3302. }
  3303. /**
  3304. * @function SuperMap.ElasticSearch.prototype.clearScroll
  3305. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  3306. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  3307. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  3308. * @param {Object} params - 参数。
  3309. * @param {function} callback - 回调函数。
  3310. */
  3311. clearScroll(params, callback) {
  3312. return this.client.clearScroll(params, callback);
  3313. }
  3314. /**
  3315. * @function SuperMap.ElasticSearch.prototype.count
  3316. * @description 获取集群、索引、类型或查询的文档个数。
  3317. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  3318. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  3319. * @param {Object} params - 参数。
  3320. * @param {function} callback - 回调函数。
  3321. */
  3322. count(params, callback) {
  3323. return this.client.count(params, callback);
  3324. }
  3325. /**
  3326. * @function SuperMap.ElasticSearch.prototype.count
  3327. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  3328. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  3329. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  3330. * @param {Object} params - 参数。
  3331. * @param {function} callback - 回调函数。
  3332. */
  3333. create(params, callback) {
  3334. return this.client.create(params, callback);
  3335. }
  3336. /**
  3337. * @function SuperMap.ElasticSearch.prototype.delete
  3338. * @description 根据其ID从特定索引中删除键入的JSON文档。
  3339. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  3340. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  3341. * @param {Object} params - 参数。
  3342. * @param {function} callback - 回调函数。
  3343. */
  3344. delete(params, callback) {
  3345. return this.client.delete(params, callback);
  3346. }
  3347. /**
  3348. * @function SuperMap.ElasticSearch.prototype.delete
  3349. * @description 根据其ID从特定索引中删除键入的JSON文档。
  3350. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  3351. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  3352. * @param {Object} params - 参数。
  3353. * @param {function} callback - 回调函数。
  3354. */
  3355. deleteByQuery(params, callback) {
  3356. return this.client.deleteByQuery(params, callback);
  3357. }
  3358. /**
  3359. * @function SuperMap.ElasticSearch.prototype.delete
  3360. * @description 根据其ID删除脚本。</br>
  3361. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  3362. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  3363. * @param {Object} params - 参数。
  3364. * @param {function} callback - 回调函数。
  3365. */
  3366. deleteScript(params, callback) {
  3367. return this.client.deleteScript(params, callback);
  3368. }
  3369. /**
  3370. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  3371. * @description 根据其ID删除模板。</br>
  3372. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  3373. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3374. * @param {Object} params - 参数。
  3375. * @param {function} callback - 回调函数。
  3376. */
  3377. deleteTemplate(params, callback) {
  3378. return this.client.deleteTemplate(params, callback);
  3379. }
  3380. /**
  3381. * @function SuperMap.ElasticSearch.prototype.exists
  3382. * @description 检查给定文档是否存在。</br>
  3383. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  3384. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3385. * @param {Object} params - 参数。
  3386. * @param {function} callback - 回调函数。
  3387. */
  3388. exists(params, callback) {
  3389. return this.client.exists(params, callback);
  3390. }
  3391. /**
  3392. * @function SuperMap.ElasticSearch.prototype.existsSource
  3393. * @description 检查资源是否存在。</br>
  3394. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  3395. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3396. * @param {Object} params - 参数。
  3397. * @param {function} callback - 回调函数。
  3398. */
  3399. existsSource(params, callback) {
  3400. return this.client.existsSource(params, callback);
  3401. }
  3402. /**
  3403. * @function SuperMap.ElasticSearch.prototype.explain
  3404. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  3405. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  3406. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  3407. * @param {Object} params - 参数。
  3408. * @param {function} callback - 回调函数。
  3409. */
  3410. explain(params, callback) {
  3411. return this.client.explain(params, callback);
  3412. }
  3413. /**
  3414. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  3415. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  3416. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  3417. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  3418. * @param {Object} params - 参数。
  3419. * @param {function} callback - 回调函数。
  3420. */
  3421. fieldCaps(params, callback) {
  3422. return this.client.fieldCaps(params, callback);
  3423. }
  3424. /**
  3425. * @function SuperMap.ElasticSearch.prototype.get
  3426. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  3427. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  3428. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3429. * @param {Object} params - 参数。
  3430. * @param {function} callback - 回调函数。
  3431. */
  3432. get(params, callback) {
  3433. return this.client.get(params, callback);
  3434. }
  3435. /**
  3436. * @function SuperMap.ElasticSearch.prototype.getScript
  3437. * @description 获取脚本。</br>
  3438. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  3439. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  3440. * @param {Object} params - 参数。
  3441. * @param {function} callback - 回调函数。
  3442. */
  3443. getScript(params, callback) {
  3444. return this.client.getScript(params, callback);
  3445. }
  3446. /**
  3447. * @function SuperMap.ElasticSearch.prototype.getSource
  3448. * @description 通过索引,类型和ID获取文档的源。</br>
  3449. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  3450. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3451. * @param {Object} params - 参数。
  3452. * @param {function} callback - 回调函数。
  3453. */
  3454. getSource(params, callback) {
  3455. return this.client.getSource(params, callback);
  3456. }
  3457. /**
  3458. * @function SuperMap.ElasticSearch.prototype.getTemplate
  3459. * @description 获取模板。</br>
  3460. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  3461. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3462. * @param {Object} params - 参数。
  3463. * @param {function} callback - 回调函数。
  3464. */
  3465. getTemplate(params, callback) {
  3466. return this.client.getTemplate(params, callback);
  3467. }
  3468. /**
  3469. * @function SuperMap.ElasticSearch.prototype.index
  3470. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  3471. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  3472. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  3473. * @param {Object} params - 参数。
  3474. * @param {function} callback - 回调函数。
  3475. */
  3476. index(params, callback) {
  3477. return this.client.index(params, callback);
  3478. }
  3479. /**
  3480. * @function SuperMap.ElasticSearch.prototype.info
  3481. * @description 从当前集群获取基本信息。</br>
  3482. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  3483. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  3484. * @param {Object} params - 参数。
  3485. * @param {function} callback - 回调函数。
  3486. */
  3487. info(params, callback) {
  3488. return this.client.info(params, callback);
  3489. }
  3490. /**
  3491. * @function SuperMap.ElasticSearch.prototype.mget
  3492. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  3493. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  3494. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  3495. * @param {Object} params - 参数。
  3496. * @param {function} callback - 回调函数。
  3497. */
  3498. mget(params, callback) {
  3499. return this.client.mget(params, callback);
  3500. }
  3501. /**
  3502. * @function SuperMap.ElasticSearch.prototype.msearch
  3503. * @description 在同一请求中执行多个搜索请求。</br>
  3504. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  3505. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  3506. * @param {Object} params - 参数。
  3507. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  3508. * 回调参数:error,response。结果存储在response.responses中
  3509. */
  3510. msearch(params, callback) {
  3511. let me = this;
  3512. return me.client.msearch(params)
  3513. .then(function (resp) {
  3514. me._update(resp.responses, callback);
  3515. return resp;
  3516. }, function (err) {
  3517. callback(err);
  3518. me.events.triggerEvent('error', {error: err});
  3519. return err;
  3520. });
  3521. }
  3522. /**
  3523. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  3524. * @description 在同一请求中执行多个搜索模板请求。</br>
  3525. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  3526. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3527. * @param {Object} params - 参数。
  3528. * @param {function} callback - 回调函数。
  3529. */
  3530. msearchTemplate(params, callback) {
  3531. return this.client.msearchTemplate(params, callback);
  3532. }
  3533. /**
  3534. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  3535. * @description 多termvectors API允许一次获得多个termvectors。</br>
  3536. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  3537. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  3538. * @param {Object} params - 参数。
  3539. * @param {function} callback - 回调函数。
  3540. */
  3541. mtermvectors(params, callback) {
  3542. return this.client.mtermvectors(params, callback);
  3543. }
  3544. /**
  3545. * @function SuperMap.ElasticSearch.prototype.ping
  3546. * @description 测试连接。</br>
  3547. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  3548. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  3549. * @param {Object} params - 参数。
  3550. * @param {function} callback - 回调函数。
  3551. */
  3552. ping(params, callback) {
  3553. return this.client.ping(params, callback);
  3554. }
  3555. /**
  3556. * @function SuperMap.ElasticSearch.prototype.putScript
  3557. * @description 添加脚本。</br>
  3558. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  3559. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  3560. * @param {Object} params - 参数。
  3561. * @param {function} callback - 回调函数。
  3562. */
  3563. putScript(params, callback) {
  3564. return this.client.putScript(params, callback);
  3565. }
  3566. /**
  3567. * @function SuperMap.ElasticSearch.prototype.putTemplate
  3568. * @description 添加模板。</br>
  3569. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  3570. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3571. * @param {Object} params - 参数。
  3572. * @param {function} callback - 回调函数。
  3573. */
  3574. putTemplate(params, callback) {
  3575. return this.client.putTemplate(params, callback);
  3576. }
  3577. /**
  3578. * @function SuperMap.ElasticSearch.prototype.reindex
  3579. * @description 重新索引。</br>
  3580. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  3581. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  3582. * @param {Object} params - 参数。
  3583. * @param {function} callback - 回调函数。
  3584. */
  3585. reindex(params, callback) {
  3586. return this.client.reindex(params, callback);
  3587. }
  3588. /**
  3589. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  3590. * @description 重新索引。</br>
  3591. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  3592. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  3593. * @param {Object} params - 参数。
  3594. * @param {function} callback - 回调函数。
  3595. */
  3596. reindexRessrottle(params, callback) {
  3597. return this.client.reindexRessrottle(params, callback);
  3598. }
  3599. /**
  3600. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  3601. * @description 搜索模板。</br>
  3602. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  3603. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3604. * @param {Object} params - 参数。
  3605. * @param {function} callback - 回调函数。
  3606. */
  3607. renderSearchTemplate(params, callback) {
  3608. return this.client.renderSearchTemplate(params, callback);
  3609. }
  3610. /**
  3611. * @function SuperMap.ElasticSearch.prototype.scroll
  3612. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  3613. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  3614. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  3615. * @param {Object} params - 参数。
  3616. * @param {function} callback - 回调函数。
  3617. */
  3618. scroll(params, callback) {
  3619. return this.client.scroll(params, callback);
  3620. }
  3621. /**
  3622. * @function SuperMap.ElasticSearch.prototype.search
  3623. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  3624. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  3625. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  3626. * @param {Object} params - 参数。
  3627. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  3628. * 回调参数:error,response,结果存储在response.responses中
  3629. */
  3630. search(params, callback) {
  3631. let me = this;
  3632. return me.client.search(params)
  3633. .then(function (resp) {
  3634. me._update(resp.responses, callback);
  3635. return resp;
  3636. }, function (err) {
  3637. callback(err);
  3638. me.events.triggerEvent('error', {error: err});
  3639. return err;
  3640. });
  3641. }
  3642. /**
  3643. * @function SuperMap.ElasticSearch.prototype.searchShards
  3644. * @description 返回要执行搜索请求的索引和分片。
  3645. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  3646. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  3647. * @param {Object} params - 参数。
  3648. * @param {function} callback - 回调函数。
  3649. */
  3650. searchShards(params, callback) {
  3651. return this.client.searchShards(params, callback);
  3652. }
  3653. /**
  3654. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  3655. * @description 搜索模板。
  3656. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  3657. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  3658. * @param {Object} params - 参数。
  3659. * @param {function} callback - 回调函数。
  3660. */
  3661. searchTemplate(params, callback) {
  3662. return this.client.searchTemplate(params, callback);
  3663. }
  3664. /**
  3665. * @function SuperMap.ElasticSearch.prototype.suggest
  3666. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  3667. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  3668. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  3669. * @param {Object} params - 参数。
  3670. * @param {function} callback - 回调函数。
  3671. */
  3672. suggest(params, callback) {
  3673. return this.client.suggest(params, callback);
  3674. }
  3675. /**
  3676. * @function SuperMap.ElasticSearch.prototype.termvectors
  3677. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  3678. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  3679. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  3680. * @param {Object} params - 参数。
  3681. * @param {function} callback - 回调函数。
  3682. */
  3683. termvectors(params, callback) {
  3684. return this.client.termvectors(params, callback);
  3685. }
  3686. /**
  3687. * @function SuperMap.ElasticSearch.prototype.update
  3688. * @description 更新文档的部分。
  3689. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  3690. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  3691. * @param {Object} params - 参数。
  3692. * @param {function} callback - 回调函数。
  3693. */
  3694. update(params, callback) {
  3695. return this.client.update(params, callback);
  3696. }
  3697. /**
  3698. * @function SuperMap.ElasticSearch.prototype.update
  3699. * @description 通过查询API来更新文档。
  3700. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  3701. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  3702. * @param {Object} params - 参数。
  3703. * @param {function} callback - 回调函数。
  3704. */
  3705. updateByQuery(params, callback) {
  3706. return this.client.updateByQuery(params, callback);
  3707. }
  3708. _update(data, callback) {
  3709. let me = this;
  3710. if (!data) {
  3711. return;
  3712. }
  3713. me.data = data;
  3714. if (me.openGeoFence && me.geoFence) {
  3715. me._validateDatas(data);
  3716. }
  3717. me.events.triggerEvent('change', {data: me.data});
  3718. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  3719. if (me.change) {
  3720. me.change && me.change(data);
  3721. } else {
  3722. //加responses是为了保持跟原来es自身的数据结构一致
  3723. callback && callback(undefined, {responses: data});
  3724. }
  3725. }
  3726. _validateDatas(datas) {
  3727. if (!datas) {
  3728. return;
  3729. }
  3730. if (!(datas instanceof Array)) {
  3731. datas = [datas];
  3732. }
  3733. var i, len = datas.length;
  3734. for (i = 0; i < len; i++) {
  3735. this._validateData(datas[i]);
  3736. }
  3737. }
  3738. _validateData(data) {
  3739. let me = this;
  3740. data.hits.hits.map(function (source) {
  3741. let content = source._source;
  3742. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  3743. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  3744. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  3745. let contentX = content.x * meterUnit;
  3746. let contentY = content.y * meterUnit;
  3747. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  3748. let radius = me.geoFence.radius;
  3749. if (distance > radius) {
  3750. me.outOfGeoFence && me.outOfGeoFence(data);
  3751. me.events.triggerEvent('outOfGeoFence', {data: data});
  3752. }
  3753. return source;
  3754. });
  3755. }
  3756. _distance(x1, y1, x2, y2) {
  3757. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  3758. }
  3759. _getMeterPerMapUnit(mapUnit) {
  3760. let earchRadiusInMeters = 6378137;
  3761. let meterPerMapUnit;
  3762. if (mapUnit === 'meter') {
  3763. meterPerMapUnit = 1;
  3764. } else if (mapUnit === 'degree') {
  3765. // 每度表示多少米。
  3766. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  3767. }
  3768. return meterPerMapUnit;
  3769. }
  3770. }
  3771. SuperMap.ElasticSearch = ElasticSearch;
  3772. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  3773. var polyfill = __webpack_require__(107);
  3774. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  3775. var fetch = __webpack_require__(693);
  3776. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  3777. var fetch_jsonp = __webpack_require__(144);
  3778. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  3779. ;// CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  3780. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  3781. * This program are made available under the terms of the Apache License, Version 2.0
  3782. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3783. let FetchRequest_fetch = window.fetch;
  3784. var setFetch = function (newFetch) {
  3785. FetchRequest_fetch = newFetch;
  3786. }
  3787. /**
  3788. * @function SuperMap.setCORS
  3789. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  3790. * @param {boolean} cors - 是否允许跨域请求。
  3791. */
  3792. var setCORS = SuperMap.setCORS = function (cors) {
  3793. SuperMap.CORS = cors;
  3794. }
  3795. /**
  3796. * @function SuperMap.isCORS
  3797. * @description 是是否允许跨域请求。
  3798. * @returns {boolean} 是否允许跨域请求。
  3799. */
  3800. var isCORS = SuperMap.isCORS = function () {
  3801. if (SuperMap.CORS != undefined) {
  3802. return SuperMap.CORS;
  3803. }
  3804. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  3805. }
  3806. /**
  3807. * @function SuperMap.setRequestTimeout
  3808. * @description 设置请求超时时间。
  3809. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  3810. */
  3811. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  3812. return SuperMap.RequestTimeout = timeout;
  3813. }
  3814. /**
  3815. * @function SuperMap.getRequestTimeout
  3816. * @description 获取请求超时时间。
  3817. * @returns {number} 请求超时时间。
  3818. */
  3819. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  3820. return SuperMap.RequestTimeout || 45000;
  3821. }
  3822. var FetchRequest = SuperMap.FetchRequest = {
  3823. commit: function (method, url, params, options) {
  3824. method = method ? method.toUpperCase() : method;
  3825. switch (method) {
  3826. case 'GET':
  3827. return this.get(url, params, options);
  3828. case 'POST':
  3829. return this.post(url, params, options);
  3830. case 'PUT':
  3831. return this.put(url, params, options);
  3832. case 'DELETE':
  3833. return this.delete(url, params, options);
  3834. default:
  3835. return this.get(url, params, options);
  3836. }
  3837. },
  3838. supportDirectRequest: function (url, options) {
  3839. if (Util.isInTheSameDomain(url)) {
  3840. return true;
  3841. }
  3842. if (options.crossOrigin != undefined) {
  3843. return options.crossOrigin;
  3844. } else {
  3845. return isCORS() || options.proxy;
  3846. }
  3847. },
  3848. get: function (url, params, options) {
  3849. options = options || {};
  3850. var type = 'GET';
  3851. url = Util.urlAppend(url, this._getParameterString(params || {}));
  3852. url = this._processUrl(url, options);
  3853. if (!this.supportDirectRequest(url, options)) {
  3854. url = url.replace('.json', '.jsonp');
  3855. var config = {
  3856. url: url,
  3857. data: params
  3858. };
  3859. return SuperMap.Util.RequestJSONPPromise.GET(config);
  3860. }
  3861. if (!this.urlIsLong(url)) {
  3862. return this._fetch(url, params, options, type);
  3863. } else {
  3864. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  3865. }
  3866. },
  3867. delete: function (url, params, options) {
  3868. options = options || {};
  3869. var type = 'DELETE';
  3870. url = Util.urlAppend(url, this._getParameterString(params || {}));
  3871. url = this._processUrl(url, options);
  3872. if (!this.supportDirectRequest(url, options)) {
  3873. url = url.replace('.json', '.jsonp');
  3874. var config = {
  3875. url: url += "&_method=DELETE",
  3876. data: params
  3877. };
  3878. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  3879. }
  3880. if (this.urlIsLong(url)) {
  3881. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  3882. }
  3883. return this._fetch(url, params, options, type);
  3884. },
  3885. post: function (url, params, options) {
  3886. options = options || {};
  3887. if (!this.supportDirectRequest(url, options)) {
  3888. url = url.replace('.json', '.jsonp');
  3889. var config = {
  3890. url: url += "&_method=POST",
  3891. data: params
  3892. };
  3893. return SuperMap.Util.RequestJSONPPromise.POST(config);
  3894. }
  3895. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  3896. },
  3897. put: function (url, params, options) {
  3898. options = options || {};
  3899. url = this._processUrl(url, options);
  3900. if (!this.supportDirectRequest(url, options)) {
  3901. url = url.replace('.json', '.jsonp');
  3902. var config = {
  3903. url: url += "&_method=PUT",
  3904. data: params
  3905. };
  3906. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  3907. }
  3908. return this._fetch(url, params, options, 'PUT');
  3909. },
  3910. urlIsLong: function (url) {
  3911. //当前url的字节长度。
  3912. var totalLength = 0,
  3913. charCode = null;
  3914. for (var i = 0, len = url.length; i < len; i++) {
  3915. //转化为Unicode编码
  3916. charCode = url.charCodeAt(i);
  3917. if (charCode < 0x007f) {
  3918. totalLength++;
  3919. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  3920. totalLength += 2;
  3921. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  3922. totalLength += 3;
  3923. }
  3924. }
  3925. return totalLength < 2000 ? false : true;
  3926. },
  3927. _postSimulatie: function (type, url, params, options) {
  3928. var separator = url.indexOf('?') > -1 ? '&' : '?';
  3929. url += separator + '_method=' + type;
  3930. if (typeof params !== 'string') {
  3931. params = JSON.stringify(params);
  3932. }
  3933. return this.post(url, params, options);
  3934. },
  3935. _processUrl: function (url, options) {
  3936. if (this._isMVTRequest(url)) {
  3937. return url;
  3938. }
  3939. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  3940. if (url.indexOf('?') < 0) {
  3941. url += '.json';
  3942. } else {
  3943. var urlArrays = url.split('?');
  3944. if (urlArrays.length === 2) {
  3945. url = urlArrays[0] + '.json?' + urlArrays[1];
  3946. }
  3947. }
  3948. }
  3949. if (options && options.proxy) {
  3950. if (typeof options.proxy === 'function') {
  3951. url = options.proxy(url);
  3952. } else {
  3953. url = decodeURIComponent(url);
  3954. url = options.proxy + encodeURIComponent(url);
  3955. }
  3956. }
  3957. return url;
  3958. },
  3959. _fetch: function (url, params, options, type) {
  3960. options = options || {};
  3961. options.headers = options.headers || {};
  3962. if (!options.headers['Content-Type']) {
  3963. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  3964. }
  3965. if (options.timeout) {
  3966. return this._timeout(
  3967. options.timeout,
  3968. FetchRequest_fetch(url, {
  3969. method: type,
  3970. headers: options.headers,
  3971. body: type === 'PUT' || type === 'POST' ? params : undefined,
  3972. credentials: this._getWithCredentials(options),
  3973. mode: 'cors',
  3974. timeout: getRequestTimeout()
  3975. }).then(function (response) {
  3976. return response;
  3977. })
  3978. );
  3979. }
  3980. return FetchRequest_fetch(url, {
  3981. method: type,
  3982. body: type === 'PUT' || type === 'POST' ? params : undefined,
  3983. headers: options.headers,
  3984. credentials: this._getWithCredentials(options),
  3985. mode: 'cors',
  3986. timeout: getRequestTimeout()
  3987. }).then(function (response) {
  3988. return response;
  3989. });
  3990. },
  3991. _getWithCredentials: function (options) {
  3992. if (options.withCredentials === true) {
  3993. return 'include';
  3994. }
  3995. if (options.withCredentials === false) {
  3996. return 'omit';
  3997. }
  3998. return 'same-origin';
  3999. },
  4000. _fetchJsonp: function (url, options) {
  4001. options = options || {};
  4002. return fetch_jsonp_default()(url, {
  4003. method: 'GET',
  4004. timeout: options.timeout
  4005. }).then(function (response) {
  4006. return response;
  4007. });
  4008. },
  4009. _timeout: function (seconds, promise) {
  4010. return new Promise(function (resolve, reject) {
  4011. setTimeout(function () {
  4012. reject(new Error('timeout'));
  4013. }, seconds);
  4014. promise.then(resolve, reject);
  4015. });
  4016. },
  4017. _getParameterString: function (params) {
  4018. var paramsArray = [];
  4019. for (var key in params) {
  4020. var value = params[key];
  4021. if (value != null && typeof value !== 'function') {
  4022. var encodedValue;
  4023. if (Array.isArray(value) || value.toString() === '[object Object]') {
  4024. encodedValue = encodeURIComponent(JSON.stringify(value));
  4025. } else {
  4026. encodedValue = encodeURIComponent(value);
  4027. }
  4028. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  4029. }
  4030. }
  4031. return paramsArray.join('&');
  4032. },
  4033. _isMVTRequest: function (url) {
  4034. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  4035. }
  4036. }
  4037. SuperMap.Util.RequestJSONPPromise = {
  4038. limitLength: 1500,
  4039. queryKeys: [],
  4040. queryValues: [],
  4041. supermap_callbacks: {},
  4042. addQueryStrings: function (values) {
  4043. var me = this;
  4044. for (var key in values) {
  4045. me.queryKeys.push(key);
  4046. if (typeof values[key] !== 'string') {
  4047. values[key] = SuperMap.Util.toJSON(values[key]);
  4048. }
  4049. var tempValue = encodeURIComponent(values[key]);
  4050. me.queryValues.push(tempValue);
  4051. }
  4052. },
  4053. issue: function (config) {
  4054. var me = this,
  4055. uid = me.getUid(),
  4056. url = config.url,
  4057. splitQuestUrl = [];
  4058. var p = new Promise(function (resolve) {
  4059. me.supermap_callbacks[uid] = function (response) {
  4060. delete me.supermap_callbacks[uid];
  4061. resolve(response);
  4062. };
  4063. });
  4064. // me.addQueryStrings({
  4065. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  4066. // });
  4067. var sectionURL = url,
  4068. keysCount = 0; //此次sectionURL中有多少个key
  4069. var length = me.queryKeys ? me.queryKeys.length : 0;
  4070. for (var i = 0; i < length; i++) {
  4071. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  4072. //+2 for ("&"or"?")and"="
  4073. if (keysCount == 0) {
  4074. return false;
  4075. }
  4076. splitQuestUrl.push(sectionURL);
  4077. sectionURL = url;
  4078. keysCount = 0;
  4079. i--;
  4080. } else {
  4081. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  4082. var leftValue = me.queryValues[i];
  4083. while (leftValue.length > 0) {
  4084. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  4085. if (sectionURL.indexOf('?') > -1) {
  4086. sectionURL += '&';
  4087. } else {
  4088. sectionURL += '?';
  4089. }
  4090. var tempLeftValue = leftValue.substring(0, leftLength);
  4091. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  4092. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  4093. leftLength -= 1;
  4094. tempLeftValue = leftValue.substring(0, leftLength);
  4095. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  4096. leftLength -= 2;
  4097. tempLeftValue = leftValue.substring(0, leftLength);
  4098. }
  4099. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  4100. leftValue = leftValue.substring(leftLength);
  4101. if (tempLeftValue.length > 0) {
  4102. splitQuestUrl.push(sectionURL);
  4103. sectionURL = url;
  4104. keysCount = 0;
  4105. }
  4106. }
  4107. } else {
  4108. keysCount++;
  4109. if (sectionURL.indexOf('?') > -1) {
  4110. sectionURL += '&';
  4111. } else {
  4112. sectionURL += '?';
  4113. }
  4114. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  4115. }
  4116. }
  4117. }
  4118. splitQuestUrl.push(sectionURL);
  4119. me.send(
  4120. splitQuestUrl,
  4121. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  4122. config && config.proxy
  4123. );
  4124. return p;
  4125. },
  4126. getUid: function () {
  4127. var uid = new Date().getTime(),
  4128. random = Math.floor(Math.random() * 1e17);
  4129. return uid * 1000 + random;
  4130. },
  4131. send: function (splitQuestUrl, callback, proxy) {
  4132. var len = splitQuestUrl.length;
  4133. if (len > 0) {
  4134. var jsonpUserID = new Date().getTime();
  4135. for (var i = 0; i < len; i++) {
  4136. var url = splitQuestUrl[i];
  4137. if (url.indexOf('?') > -1) {
  4138. url += '&';
  4139. } else {
  4140. url += '?';
  4141. }
  4142. url += 'sectionCount=' + len;
  4143. url += '&sectionIndex=' + i;
  4144. url += '&jsonpUserID=' + jsonpUserID;
  4145. if (proxy) {
  4146. url = decodeURIComponent(url);
  4147. url = proxy + encodeURIComponent(url);
  4148. }
  4149. fetch_jsonp_default()(url, {
  4150. jsonpCallbackFunction: callback,
  4151. timeout: 30000
  4152. });
  4153. }
  4154. }
  4155. },
  4156. GET: function (config) {
  4157. var me = this;
  4158. me.queryKeys.length = 0;
  4159. me.queryValues.length = 0;
  4160. me.addQueryStrings(config.params);
  4161. return me.issue(config);
  4162. },
  4163. POST: function (config) {
  4164. var me = this;
  4165. me.queryKeys.length = 0;
  4166. me.queryValues.length = 0;
  4167. me.addQueryStrings({
  4168. requestEntity: config.data
  4169. });
  4170. return me.issue(config);
  4171. },
  4172. PUT: function (config) {
  4173. var me = this;
  4174. me.queryKeys.length = 0;
  4175. me.queryValues.length = 0;
  4176. me.addQueryStrings({
  4177. requestEntity: config.data
  4178. });
  4179. return me.issue(config);
  4180. },
  4181. DELETE: function (config) {
  4182. var me = this;
  4183. me.queryKeys.length = 0;
  4184. me.queryValues.length = 0;
  4185. me.addQueryStrings({
  4186. requestEntity: config.data
  4187. });
  4188. return me.issue(config);
  4189. }
  4190. };
  4191. ;// CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  4192. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4193. * This program are made available under the terms of the Apache License, Version 2.0
  4194. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4195. /**
  4196. * @name SecurityManager
  4197. * @memberOf SuperMap
  4198. * @namespace
  4199. * @category Security
  4200. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  4201. * > 使用说明:
  4202. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  4203. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  4204. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  4205. */
  4206. class SecurityManager {
  4207. /**
  4208. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  4209. * @function SuperMap.SecurityManager.generateToken
  4210. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4211. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  4212. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  4213. */
  4214. static generateToken(url, tokenParam) {
  4215. var serverInfo = this.servers[url];
  4216. if (!serverInfo) {
  4217. return;
  4218. }
  4219. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  4220. return response.text();
  4221. });
  4222. }
  4223. /**
  4224. * @description 注册安全服务器相关信息。
  4225. * @function SuperMap.SecurityManager.registerServers
  4226. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  4227. */
  4228. static registerServers(serverInfos) {
  4229. this.servers = this.servers || {};
  4230. if (!Util.isArray(serverInfos)) {
  4231. serverInfos = [serverInfos];
  4232. }
  4233. for (var i = 0; i < serverInfos.length; i++) {
  4234. var serverInfo = serverInfos[i];
  4235. this.servers[serverInfo.server] = serverInfo;
  4236. }
  4237. }
  4238. /**
  4239. * @description 服务请求都会自动带上这个 token。
  4240. * @function SuperMap.SecurityManager.registerToken
  4241. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  4242. * @param {string} token - token
  4243. */
  4244. static registerToken(url, token) {
  4245. this.tokens = this.tokens || {};
  4246. if (!url || !token) {
  4247. return;
  4248. }
  4249. var domain = this._getTokenStorageKey(url);
  4250. this.tokens[domain] = token;
  4251. }
  4252. /**
  4253. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  4254. * @function SuperMap.SecurityManager.registerKey
  4255. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  4256. * @param {string} key - key
  4257. */
  4258. static registerKey(ids, key) {
  4259. this.keys = this.keys || {};
  4260. if (!ids || ids.length < 1 || !key) {
  4261. return;
  4262. }
  4263. ids = (Util.isArray(ids)) ? ids : [ids];
  4264. for (var i = 0; i < ids.length; i++) {
  4265. var id = this._getUrlRestString(ids[0]) || ids[0];
  4266. this.keys[id] = key;
  4267. }
  4268. }
  4269. /**
  4270. * @description 获取服务器信息。
  4271. * @function SuperMap.SecurityManager.getServerInfo
  4272. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4273. * @returns {SuperMap.ServerInfo} 服务器信息。
  4274. */
  4275. static getServerInfo(url) {
  4276. this.servers = this.servers || {};
  4277. return this.servers[url];
  4278. }
  4279. /**
  4280. * @description 根据 Url 获取token。
  4281. * @function SuperMap.SecurityManager.getToken
  4282. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4283. * @returns {string} token
  4284. */
  4285. static getToken(url) {
  4286. if (!url) {
  4287. return;
  4288. }
  4289. this.tokens = this.tokens || {};
  4290. var domain = this._getTokenStorageKey(url);
  4291. return this.tokens[domain];
  4292. }
  4293. /**
  4294. * @description 根据 Url 获取 key。
  4295. * @function SuperMap.SecurityManager.getKey
  4296. * @param {string} id - id
  4297. * @returns {string} key
  4298. */
  4299. static getKey(id) {
  4300. this.keys = this.keys || {};
  4301. var key = this._getUrlRestString(id) || id;
  4302. return this.keys[key];
  4303. }
  4304. /**
  4305. * @description iServer 登录验证。
  4306. * @function SuperMap.SecurityManager.loginiServer
  4307. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4308. * @param {string} username - 用户名。
  4309. * @param {string} password - 密码。
  4310. * @param {boolean} [rememberme=false] - 是否记住。
  4311. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  4312. */
  4313. static loginiServer(url, username, password, rememberme) {
  4314. url = Util.urlPathAppend(url, 'services/security/login');
  4315. var loginInfo = {
  4316. username: username && username.toString(),
  4317. password: password && password.toString(),
  4318. rememberme: rememberme
  4319. };
  4320. loginInfo = JSON.stringify(loginInfo);
  4321. var requestOptions = {
  4322. headers: {
  4323. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4324. }
  4325. };
  4326. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  4327. return response.json();
  4328. });
  4329. }
  4330. /**
  4331. * @description iServer登出。
  4332. * @function SuperMap.SecurityManager.logoutiServer
  4333. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4334. * @returns {Promise} 是否登出成功。
  4335. */
  4336. static logoutiServer(url) {
  4337. url = Util.urlPathAppend(url, 'services/security/logout');
  4338. var requestOptions = {
  4339. headers: {
  4340. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4341. },
  4342. withoutFormatSuffix: true
  4343. };
  4344. return FetchRequest.get(url, "", requestOptions).then(function () {
  4345. return true;
  4346. }).catch(function () {
  4347. return false;
  4348. });
  4349. }
  4350. /**
  4351. * @description Online 登录验证。
  4352. * @function SuperMap.SecurityManager.loginOnline
  4353. * @param {string} callbackLocation - 跳转位置。
  4354. * @param {boolean} [newTab=true] - 是否新窗口打开。
  4355. */
  4356. static loginOnline(callbackLocation, newTab) {
  4357. var loginUrl = SecurityManager.SSO + "/login?service=" + callbackLocation;
  4358. this._open(loginUrl, newTab);
  4359. }
  4360. /**
  4361. * @description iPortal登录验证。
  4362. * @function SuperMap.SecurityManager.loginiPortal
  4363. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4364. * @param {string} username - 用户名。
  4365. * @param {string} password - 密码。
  4366. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  4367. */
  4368. static loginiPortal(url, username, password) {
  4369. url = Util.urlPathAppend(url, 'web/login');
  4370. var loginInfo = {
  4371. username: username && username.toString(),
  4372. password: password && password.toString()
  4373. };
  4374. loginInfo = JSON.stringify(loginInfo);
  4375. var requestOptions = {
  4376. headers: {
  4377. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4378. },
  4379. withCredentials: true
  4380. };
  4381. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  4382. return response.json();
  4383. });
  4384. }
  4385. /**
  4386. * @description iPortal 登出。
  4387. * @function SuperMap.SecurityManager.logoutiPortal
  4388. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4389. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  4390. */
  4391. static logoutiPortal(url) {
  4392. url = Util.urlPathAppend(url, 'services/security/logout');
  4393. var requestOptions = {
  4394. headers: {
  4395. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4396. },
  4397. withCredentials: true,
  4398. withoutFormatSuffix: true
  4399. };
  4400. return FetchRequest.get(url, "", requestOptions).then(function () {
  4401. return true;
  4402. }).catch(function () {
  4403. return false;
  4404. });
  4405. }
  4406. /**
  4407. * @description iManager 登录验证。
  4408. * @function SuperMap.SecurityManager.loginManager
  4409. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  4410. * @param {Object} [loginInfoParams] - iManager 登录参数。
  4411. * @param {string} loginInfoParams.userName - 用户名。
  4412. * @param {string} loginInfoParams.password - 密码。
  4413. * @param {Object} options
  4414. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  4415. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  4416. */
  4417. static loginManager(url, loginInfoParams, options) {
  4418. if (!Util.isInTheSameDomain(url)) {
  4419. var isNewTab = options ? options.isNewTab : true;
  4420. this._open(url, isNewTab);
  4421. return;
  4422. }
  4423. var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
  4424. var params = loginInfoParams || {};
  4425. var loginInfo = {
  4426. username: params.userName && params.userName.toString(),
  4427. password: params.password && params.password.toString()
  4428. };
  4429. loginInfo = JSON.stringify(loginInfo);
  4430. var requestOptions = {
  4431. headers: {
  4432. 'Accept': '*/*',
  4433. 'Content-Type': 'application/json'
  4434. }
  4435. };
  4436. var me = this;
  4437. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  4438. response.text().then(function (result) {
  4439. me.imanagerToken = result;
  4440. return result;
  4441. });
  4442. });
  4443. }
  4444. /**
  4445. * @description 清空全部验证信息。
  4446. * @function SuperMap.SecurityManager.destroyAllCredentials
  4447. */
  4448. static destroyAllCredentials() {
  4449. this.keys = null;
  4450. this.tokens = null;
  4451. this.servers = null;
  4452. }
  4453. /**
  4454. * @description 清空令牌信息。
  4455. * @function SuperMap.SecurityManager.destroyToken
  4456. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4457. */
  4458. static destroyToken(url) {
  4459. if (!url) {
  4460. return;
  4461. }
  4462. var domain = this._getTokenStorageKey(url);
  4463. this.tokens = this.tokens || {};
  4464. if (this.tokens[domain]) {
  4465. delete this.tokens[domain];
  4466. }
  4467. }
  4468. /**
  4469. * @description 清空服务授权码。
  4470. * @function SuperMap.SecurityManager.destroyKey
  4471. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4472. */
  4473. static destroyKey(url) {
  4474. if (!url) {
  4475. return;
  4476. }
  4477. this.keys = this.keys || {};
  4478. var key = this._getUrlRestString(url) || url;
  4479. if (this.keys[key]) {
  4480. delete this.keys[key];
  4481. }
  4482. }
  4483. static _open(url, newTab) {
  4484. newTab = (newTab != null) ? newTab : true;
  4485. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  4486. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  4487. var options =
  4488. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  4489. ",top=" + offsetY + ", left=" + offsetX +
  4490. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  4491. if (newTab) {
  4492. window.open(url, 'login');
  4493. } else {
  4494. window.open(url, 'login', options);
  4495. }
  4496. }
  4497. static _getTokenStorageKey(url) {
  4498. var patten = /(.*?):\/\/([^\/]+)/i;
  4499. var result = url.match(patten);
  4500. if (!result) {
  4501. return url;
  4502. }
  4503. return result[0];
  4504. }
  4505. static _getUrlRestString(url) {
  4506. if (!url) {
  4507. return url;
  4508. }
  4509. // var patten = /http:\/\/(.*\/rest)/i;
  4510. var patten = /(http|https):\/\/(.*\/rest)/i;
  4511. var result = url.match(patten);
  4512. if (!result) {
  4513. return url;
  4514. }
  4515. return result[0];
  4516. }
  4517. }
  4518. SecurityManager.INNER_WINDOW_WIDTH = 600;
  4519. SecurityManager.INNER_WINDOW_HEIGHT = 600;
  4520. SecurityManager.SSO = "https://sso.supermap.com";
  4521. SecurityManager.ONLINE = "https://www.supermapol.com";
  4522. SuperMap.SecurityManager = SecurityManager;
  4523. ;// CONCATENATED MODULE: ./src/common/REST.js
  4524. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  4525. * This program are made available under the terms of the Apache License, Version 2.0
  4526. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4527. /**
  4528. * @enum DataFormat
  4529. * @memberOf SuperMap
  4530. * @description 服务请求返回结果数据类型
  4531. * @type {string}
  4532. */
  4533. var DataFormat = SuperMap.DataFormat = {
  4534. /** GEOJSON */
  4535. GEOJSON: "GEOJSON",
  4536. /** ISERVER */
  4537. ISERVER: "ISERVER"
  4538. };
  4539. /**
  4540. * @enum ServerType
  4541. * @memberOf SuperMap
  4542. * @description 服务器类型
  4543. * @type {string}
  4544. */
  4545. var ServerType = SuperMap.ServerType = {
  4546. /** ISERVER */
  4547. ISERVER: "ISERVER",
  4548. /** IPORTAL */
  4549. IPORTAL: "IPORTAL",
  4550. /** ONLINE */
  4551. ONLINE: "ONLINE"
  4552. };
  4553. /**
  4554. * @enum GeometryType
  4555. * @memberOf SuperMap
  4556. * @description 几何对象枚举,定义了一系列几何对象类型。
  4557. * @type {string}
  4558. */
  4559. var GeometryType = SuperMap.GeometryType = {
  4560. /** LINE */
  4561. LINE: "LINE",
  4562. /** LINEM */
  4563. LINEM: "LINEM",
  4564. /** POINT */
  4565. POINT: "POINT",
  4566. /** REGION */
  4567. REGION: "REGION",
  4568. /** POINTEPS */
  4569. POINTEPS: "POINTEPS",
  4570. /** LINEEPS */
  4571. LINEEPS: "LINEEPS",
  4572. /** REGIONEPS */
  4573. REGIONEPS: "REGIONEPS",
  4574. /** ELLIPSE */
  4575. ELLIPSE: "ELLIPSE",
  4576. /** CIRCLE */
  4577. CIRCLE: "CIRCLE",
  4578. /** TEXT */
  4579. TEXT: "TEXT",
  4580. /** RECTANGLE */
  4581. RECTANGLE: "RECTANGLE",
  4582. /** UNKNOWN */
  4583. UNKNOWN: "UNKNOWN",
  4584. /** GEOCOMPOUND */
  4585. GEOCOMPOUND:"GEOCOMPOUND"
  4586. };
  4587. /**
  4588. * @enum QueryOption
  4589. * @memberOf SuperMap
  4590. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  4591. * @type {string}
  4592. */
  4593. var QueryOption = SuperMap.QueryOption = {
  4594. /** 属性 */
  4595. ATTRIBUTE: "ATTRIBUTE",
  4596. /** 属性和几何对象 */
  4597. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  4598. /** 几何对象 */
  4599. GEOMETRY: "GEOMETRY"
  4600. };
  4601. /**
  4602. * @enum JoinType
  4603. * @memberOf SuperMap
  4604. * @description 关联查询时的关联类型常量。
  4605. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  4606. * @type {string}
  4607. */
  4608. var JoinType = SuperMap.JoinType = {
  4609. /** INNERJOIN */
  4610. INNERJOIN: "INNERJOIN",
  4611. /** LEFTJOIN */
  4612. LEFTJOIN: "LEFTJOIN"
  4613. };
  4614. /**
  4615. * @enum SpatialQueryMode
  4616. * @memberOf SuperMap
  4617. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  4618. * @type {string}
  4619. */
  4620. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  4621. /** 包含空间查询模式 */
  4622. CONTAIN: "CONTAIN",
  4623. /** 交叉空间查询模式 */
  4624. CROSS: "CROSS",
  4625. /** 分离空间查询模式 */
  4626. DISJOINT: "DISJOINT",
  4627. /** 重合空间查询模式 */
  4628. IDENTITY: "IDENTITY",
  4629. /** 相交空间查询模式 */
  4630. INTERSECT: "INTERSECT",
  4631. /** 无空间查询 */
  4632. NONE: "NONE",
  4633. /** 叠加空间查询模式 */
  4634. OVERLAP: "OVERLAP",
  4635. /** 邻接空间查询模式 */
  4636. TOUCH: "TOUCH",
  4637. /** 被包含空间查询模式 */
  4638. WITHIN: "WITHIN"
  4639. };
  4640. /**
  4641. * @enum SpatialRelationType
  4642. * @memberOf SuperMap
  4643. * @description 数据集对象间的空间关系枚举。
  4644. * 该类定义了数据集对象间的空间关系类型常量。
  4645. * @type {string}
  4646. */
  4647. var SpatialRelationType = SuperMap.SpatialRelationType = {
  4648. /** 包含关系 */
  4649. CONTAIN: "CONTAIN",
  4650. /** 相交关系 */
  4651. INTERSECT: "INTERSECT",
  4652. /** 被包含关系 */
  4653. WITHIN: "WITHIN"
  4654. };
  4655. /**
  4656. * @enum MeasureMode
  4657. * @memberOf SuperMap
  4658. * @type {string}
  4659. * @description 量算模式枚举。
  4660. * 该类定义了两种测量模式:距离测量和面积测量。
  4661. */
  4662. var MeasureMode = SuperMap.MeasureMode = {
  4663. /** 距离测量 */
  4664. DISTANCE: "DISTANCE",
  4665. /** 面积测量 */
  4666. AREA: "AREA"
  4667. };
  4668. /**
  4669. * @enum Unit
  4670. * @memberOf SuperMap
  4671. * @description 距离单位枚举。
  4672. * 该类定义了一系列距离单位类型。
  4673. * @type {string}
  4674. */
  4675. var Unit = SuperMap.Unit = {
  4676. /** 米 */
  4677. METER: "METER",
  4678. /** 千米 */
  4679. KILOMETER: "KILOMETER",
  4680. /** 英里 */
  4681. MILE: "MILE",
  4682. /** 码 */
  4683. YARD: "YARD",
  4684. /** 度 */
  4685. DEGREE: "DEGREE",
  4686. /** 毫米 */
  4687. MILLIMETER: "MILLIMETER",
  4688. /** 厘米 */
  4689. CENTIMETER: "CENTIMETER",
  4690. /** 英寸 */
  4691. INCH: "INCH",
  4692. /** 分米 */
  4693. DECIMETER: "DECIMETER",
  4694. /** 英尺 */
  4695. FOOT: "FOOT",
  4696. /** 秒 */
  4697. SECOND: "SECOND",
  4698. /** 分 */
  4699. MINUTE: "MINUTE",
  4700. /** 弧度 */
  4701. RADIAN: "RADIAN"
  4702. };
  4703. /**
  4704. * @enum BufferRadiusUnit
  4705. * @memberOf SuperMap
  4706. * @description 缓冲区距离单位枚举。
  4707. * 该类定义了一系列缓冲距离单位类型。
  4708. * @type {string}
  4709. */
  4710. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  4711. /** 厘米 */
  4712. CENTIMETER: "CENTIMETER",
  4713. /** 分米 */
  4714. DECIMETER: "DECIMETER",
  4715. /** 英尺 */
  4716. FOOT: "FOOT",
  4717. /** 英寸 */
  4718. INCH: "INCH",
  4719. /** 千米 */
  4720. KILOMETER: "KILOMETER",
  4721. /** 米 */
  4722. METER: "METER",
  4723. /** 英里 */
  4724. MILE: "MILE",
  4725. /** 毫米 */
  4726. MILLIMETER: "MILLIMETER",
  4727. /** 码 */
  4728. YARD: "YARD"
  4729. }
  4730. /**
  4731. * @enum EngineType
  4732. * @memberOf SuperMap
  4733. * @description 数据源引擎类型枚举。
  4734. * @type {string}
  4735. */
  4736. var EngineType = SuperMap.EngineType = {
  4737. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  4738. IMAGEPLUGINS: "IMAGEPLUGINS",
  4739. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  4740. OGC: "OGC",
  4741. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  4742. ORACLEPLUS: "ORACLEPLUS",
  4743. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  4744. SDBPLUS: "SDBPLUS",
  4745. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  4746. SQLPLUS: "SQLPLUS",
  4747. /** UDB 引擎类型,文件引擎。 */
  4748. UDB: "UDB"
  4749. };
  4750. /**
  4751. * @enum ThemeGraphTextFormat
  4752. * @memberOf SuperMap
  4753. * @description 统计专题图文本显示格式枚举。
  4754. * @type {string}
  4755. */
  4756. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  4757. /** 标题。以各子项的标题来进行标注。 */
  4758. CAPTION: "CAPTION",
  4759. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  4760. CAPTION_PERCENT: "CAPTION_PERCENT",
  4761. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  4762. CAPTION_VALUE: "CAPTION_VALUE",
  4763. /** 百分数。以各子项所占的百分比来进行标注。 */
  4764. PERCENT: "PERCENT",
  4765. /** 实际数值。以各子项的真实数值来进行标注。 */
  4766. VALUE: "VALUE"
  4767. };
  4768. /**
  4769. * @enum ThemeGraphType
  4770. * @memberOf SuperMap
  4771. * @description 统计专题图类型枚举。
  4772. * @type {string}
  4773. */
  4774. var ThemeGraphType = SuperMap.ThemeGraphType = {
  4775. /** 面积图。 */
  4776. AREA: "AREA",
  4777. /** 柱状图。 */
  4778. BAR: "BAR",
  4779. /** 三维柱状图。 */
  4780. BAR3D: "BAR3D",
  4781. /** 折线图。 */
  4782. LINE: "LINE",
  4783. /** 饼图。 */
  4784. PIE: "PIE",
  4785. /** 三维饼图。 */
  4786. PIE3D: "PIE3D",
  4787. /** 点状图。 */
  4788. POINT: "POINT",
  4789. /** 环状图。 */
  4790. RING: "RING",
  4791. /** 玫瑰图。 */
  4792. ROSE: "ROSE",
  4793. /** 三维玫瑰图。 */
  4794. ROSE3D: "ROSE3D",
  4795. /** 堆叠柱状图。 */
  4796. STACK_BAR: "STACK_BAR",
  4797. /** 三维堆叠柱状图。 */
  4798. STACK_BAR3D: "STACK_BAR3D",
  4799. /** 阶梯图。 */
  4800. STEP: "STEP"
  4801. };
  4802. /**
  4803. * @enum GraphAxesTextDisplayMode
  4804. * @memberOf SuperMap
  4805. * @description 统计专题图坐标轴文本显示模式。
  4806. * @type {string}
  4807. */
  4808. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  4809. /** 显示全部文本。 */
  4810. ALL: "ALL",
  4811. /** 不显示。 */
  4812. NONE: "NONE",
  4813. /** 显示Y轴的文本。 */
  4814. YAXES: "YAXES"
  4815. };
  4816. /**
  4817. * @enum GraduatedMode
  4818. * @memberOf SuperMap
  4819. * @description 专题图分级模式枚举。
  4820. *
  4821. * @type {string}
  4822. */
  4823. var GraduatedMode = SuperMap.GraduatedMode = {
  4824. /** 常量分级模式。 */
  4825. CONSTANT: "CONSTANT",
  4826. /** 对数分级模式。 */
  4827. LOGARITHM: "LOGARITHM",
  4828. /** 平方根分级模式。 */
  4829. SQUAREROOT: "SQUAREROOT"
  4830. };
  4831. /**
  4832. * @enum RangeMode
  4833. * @memberOf SuperMap
  4834. * @description 范围分段专题图分段方式枚举。
  4835. * @type {string}
  4836. */
  4837. var RangeMode = SuperMap.RangeMode = {
  4838. /** 自定义分段法。 */
  4839. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  4840. /** 等距离分段法。 */
  4841. EQUALINTERVAL: "EQUALINTERVAL",
  4842. /** 对数分段法。 */
  4843. LOGARITHM: "LOGARITHM",
  4844. /** 等计数分段法。 */
  4845. QUANTILE: "QUANTILE",
  4846. /** 平方根分段法。 */
  4847. SQUAREROOT: "SQUAREROOT",
  4848. /** 标准差分段法。 */
  4849. STDDEVIATION: "STDDEVIATION"
  4850. };
  4851. /**
  4852. * @enum ThemeType
  4853. * @memberOf SuperMap
  4854. * @description 专题图类型枚举。
  4855. * @type {string}
  4856. */
  4857. var ThemeType = SuperMap.ThemeType = {
  4858. /** 点密度专题图。 */
  4859. DOTDENSITY: "DOTDENSITY",
  4860. /** 等级符号专题图。 */
  4861. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  4862. /** 统计专题图。 */
  4863. GRAPH: "GRAPH",
  4864. /** 标签专题图。 */
  4865. LABEL: "LABEL",
  4866. /** 分段专题图。 */
  4867. RANGE: "RANGE",
  4868. /** 単值专题图。 */
  4869. UNIQUE: "UNIQUE"
  4870. };
  4871. /**
  4872. * @enum ColorGradientType
  4873. * @memberOf SuperMap
  4874. * @description 渐变颜色枚举。
  4875. * @type {string}
  4876. */
  4877. var ColorGradientType = SuperMap.ColorGradientType = {
  4878. /** 黑白渐变色。 */
  4879. BLACK_WHITE: "BLACKWHITE",
  4880. /** 蓝黑渐变色。 */
  4881. BLUE_BLACK: "BLUEBLACK",
  4882. /** 蓝红渐变色。 */
  4883. BLUE_RED: "BLUERED",
  4884. /** 蓝白渐变色。 */
  4885. BLUE_WHITE: "BLUEWHITE",
  4886. /** 青黑渐变色。 */
  4887. CYAN_BLACK: "CYANBLACK",
  4888. /** 青蓝渐变色。 */
  4889. CYAN_BLUE: "CYANBLUE",
  4890. /** 青绿渐变色。 */
  4891. CYAN_GREEN: "CYANGREEN",
  4892. /** 青白渐变色。 */
  4893. CYAN_WHITE: "CYANWHITE",
  4894. /** 绿黑渐变色。 */
  4895. GREEN_BLACK: "GREENBLACK",
  4896. /** 绿蓝渐变色。 */
  4897. GREEN_BLUE: "GREENBLUE",
  4898. /** 绿橙紫渐变色。 */
  4899. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  4900. /** 绿红渐变色。 */
  4901. GREEN_RED: "GREENRED",
  4902. /** 蓝红渐变色。 */
  4903. GREEN_WHITE: "GREENWHITE",
  4904. /** 粉黑渐变色。 */
  4905. PINK_BLACK: "PINKBLACK",
  4906. /** 粉蓝渐变色。 */
  4907. PINK_BLUE: "PINKBLUE",
  4908. /** 粉红渐变色。 */
  4909. PINK_RED: "PINKRED",
  4910. /** 粉白渐变色。 */
  4911. PINK_WHITE: "PINKWHITE",
  4912. /** 彩虹色。 */
  4913. RAIN_BOW: "RAINBOW",
  4914. /** 红黑渐变色。 */
  4915. RED_BLACK: "REDBLACK",
  4916. /** 红白渐变色。 */
  4917. RED_WHITE: "REDWHITE",
  4918. /** 光谱渐变。 */
  4919. SPECTRUM: "SPECTRUM",
  4920. /** 地形渐变,用于三维显示效果较好。 */
  4921. TERRAIN: "TERRAIN",
  4922. /** 黄黑渐变色。 */
  4923. YELLOW_BLACK: "YELLOWBLACK",
  4924. /** 黄蓝渐变色。 */
  4925. YELLOW_BLUE: "YELLOWBLUE",
  4926. /** 黄绿渐变色。 */
  4927. YELLOW_GREEN: "YELLOWGREEN",
  4928. /** 黄红渐变色。 */
  4929. YELLOW_RED: "YELLOWRED",
  4930. /** 黄白渐变色。 */
  4931. YELLOW_WHITE: "YELLOWWHITE"
  4932. };
  4933. /**
  4934. * @enum TextAlignment
  4935. * @memberOf SuperMap
  4936. * @description 文本对齐枚举。
  4937. * @type {string}
  4938. */
  4939. var TextAlignment = SuperMap.TextAlignment = {
  4940. /** 左上角对齐。 */
  4941. TOPLEFT: "TOPLEFT",
  4942. /** 顶部居中对齐。 */
  4943. TOPCENTER: "TOPCENTER",
  4944. /** 右上角对齐。 */
  4945. TOPRIGHT: "TOPRIGHT",
  4946. /** 基准线左对齐。 */
  4947. BASELINELEFT: "BASELINELEFT",
  4948. /** 基准线居中对齐。 */
  4949. BASELINECENTER: "BASELINECENTER",
  4950. /** 基准线右对齐。 */
  4951. BASELINERIGHT: "BASELINERIGHT",
  4952. /** 左下角对齐。 */
  4953. BOTTOMLEFT: "BOTTOMLEFT",
  4954. /** 底部居中对齐。 */
  4955. BOTTOMCENTER: "BOTTOMCENTER",
  4956. /** 右下角对齐。 */
  4957. BOTTOMRIGHT: "BOTTOMRIGHT",
  4958. /** 左中对齐。 */
  4959. MIDDLELEFT: "MIDDLELEFT",
  4960. /** 中心对齐。 */
  4961. MIDDLECENTER: "MIDDLECENTER",
  4962. /** 右中对齐。 */
  4963. MIDDLERIGHT: "MIDDLERIGHT"
  4964. };
  4965. /**
  4966. * @enum FillGradientMode
  4967. * @memberOf SuperMap
  4968. * @description 渐变填充风格的渐变类型枚举。
  4969. * @type {string}
  4970. */
  4971. var FillGradientMode = SuperMap.FillGradientMode = {
  4972. /** 无渐变。 */
  4973. NONE: "NONE",
  4974. /** 线性渐变填充。 */
  4975. LINEAR: "LINEAR",
  4976. /** 辐射渐变填充。 */
  4977. RADIAL: "RADIAL",
  4978. /** 圆锥渐变填充。 */
  4979. CONICAL: "CONICAL",
  4980. /** 四角渐变填充。 */
  4981. SQUARE: "SQUARE"
  4982. };
  4983. /**
  4984. * @enum AlongLineDirection
  4985. * @memberOf SuperMap
  4986. * @description 标签沿线标注方向枚举。
  4987. * @type {string}
  4988. */
  4989. var AlongLineDirection = SuperMap.AlongLineDirection = {
  4990. /** 沿线的法线方向放置标签。 */
  4991. NORMAL: "ALONG_LINE_NORMAL",
  4992. /** 从下到上,从左到右放置。 */
  4993. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  4994. /** 从上到下,从左到右放置。 */
  4995. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  4996. /** 从下到上,从右到左放置。 */
  4997. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  4998. /** 从上到下,从右到左放置。 */
  4999. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  5000. };
  5001. /**
  5002. * @enum LabelBackShape
  5003. * @memberOf SuperMap
  5004. * @description 标签专题图中标签背景的形状枚举。
  5005. * @type {string}
  5006. */
  5007. var LabelBackShape = SuperMap.LabelBackShape = {
  5008. /** 菱形背景,即标签背景的形状为菱形。 */
  5009. DIAMOND: "DIAMOND",
  5010. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  5011. ELLIPSE: "ELLIPSE",
  5012. /** 符号背景,即标签背景的形状为设定的符号。 */
  5013. MARKER: "MARKER",
  5014. /** 空背景,即不使用任何形状作为标签的背景。 */
  5015. NONE: "NONE",
  5016. /** 矩形背景,即标签背景的形状为矩形。 */
  5017. RECT: "RECT",
  5018. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  5019. ROUNDRECT: "ROUNDRECT",
  5020. /** 三角形背景,即标签背景的形状为三角形。 */
  5021. TRIANGLE: "TRIANGLE"
  5022. };
  5023. /**
  5024. * @enum LabelOverLengthMode
  5025. * @memberOf SuperMap
  5026. * @description 标签专题图中超长标签的处理模式枚举。
  5027. * @type {string}
  5028. */
  5029. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  5030. /** 换行显示。 */
  5031. NEWLINE: "NEWLINE",
  5032. /** 对超长标签不进行处理。 */
  5033. NONE: "NONE",
  5034. /** 省略超出部分。 */
  5035. OMIT: "OMIT"
  5036. };
  5037. /**
  5038. * @enum DirectionType
  5039. * @memberOf SuperMap
  5040. * @description 网络分析中方向枚举。
  5041. * 在行驶引导子项中使用。
  5042. * @type {string}
  5043. */
  5044. var DirectionType = SuperMap.DirectionType = {
  5045. /** 东。 */
  5046. EAST: "EAST",
  5047. /** 无方向。 */
  5048. NONE: "NONE",
  5049. /** 北。 */
  5050. NORTH: "NORTH",
  5051. /** 南。 */
  5052. SOURTH: "SOURTH",
  5053. /** 西。 */
  5054. WEST: "WEST"
  5055. };
  5056. /**
  5057. * @enum SideType
  5058. * @memberOf SuperMap
  5059. * @description 行驶位置枚举。
  5060. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  5061. * @type {string}
  5062. */
  5063. var SideType = SuperMap.SideType = {
  5064. /** 路的左侧。 */
  5065. LEFT: "LEFT",
  5066. /** 在路上(即路的中间)。 */
  5067. MIDDLE: "MIDDLE",
  5068. /** 无效值。 */
  5069. NONE: "NONE",
  5070. /** 路的右侧。 */
  5071. RIGHT: "RIGHT"
  5072. };
  5073. /**
  5074. * @enum SupplyCenterType
  5075. * @memberOf SuperMap
  5076. * @description 资源供给中心类型枚举。
  5077. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  5078. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  5079. * @type {string}
  5080. */
  5081. var SupplyCenterType = SuperMap.SupplyCenterType = {
  5082. /** 固定中心点。 */
  5083. FIXEDCENTER: "FIXEDCENTER",
  5084. /** 非中心点。 */
  5085. NULL: "NULL",
  5086. /** 可选中心点。 */
  5087. OPTIONALCENTER: "OPTIONALCENTER"
  5088. };
  5089. /**
  5090. * @enum TurnType
  5091. * @memberOf SuperMap
  5092. * @description 转弯方向枚举。
  5093. * 用在行驶引导子项类中,表示转弯的方向。
  5094. * @type {string}
  5095. */
  5096. var TurnType = SuperMap.TurnType = {
  5097. /** 向前直行。 */
  5098. AHEAD: "AHEAD",
  5099. /** 掉头。 */
  5100. BACK: "BACK",
  5101. /** 终点,不拐弯。 */
  5102. END: "END",
  5103. /** 左转弯。 */
  5104. LEFT: "LEFT",
  5105. /** 无效值。 */
  5106. NONE: "NONE",
  5107. /** 右转弯。 */
  5108. RIGHT: "RIGHT"
  5109. };
  5110. /**
  5111. * @enum BufferEndType
  5112. * @memberOf SuperMap
  5113. * @description 缓冲区分析BufferEnd类型。
  5114. * @type {string}
  5115. */
  5116. var BufferEndType = SuperMap.BufferEndType = {
  5117. /** FLAT */
  5118. FLAT: "FLAT",
  5119. /** ROUND */
  5120. ROUND: "ROUND"
  5121. };
  5122. /**
  5123. * @enum OverlayOperationType
  5124. * @memberOf SuperMap
  5125. * @description 叠加分析类型枚举。
  5126. * @type {string}
  5127. */
  5128. var OverlayOperationType = SuperMap.OverlayOperationType = {
  5129. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  5130. CLIP: "CLIP",
  5131. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  5132. ERASE: "ERASE",
  5133. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  5134. IDENTITY: "IDENTITY",
  5135. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  5136. INTERSECT: "INTERSECT",
  5137. /** 对两个面数据集(几何对象)进行合并操作。 */
  5138. UNION: "UNION",
  5139. /** 对两个面数据集(几何对象)进行更新操作。 */
  5140. UPDATE: "UPDATE",
  5141. /** 对两个面数据集(几何对象)进行对称差操作。 */
  5142. XOR: "XOR"
  5143. };
  5144. /**
  5145. * @enum OutputType
  5146. * @memberOf SuperMap
  5147. * @description 分布式分析输出类型枚举。
  5148. * @type {string}
  5149. */
  5150. var OutputType = SuperMap.OutputType = {
  5151. /** INDEXEDHDFS */
  5152. INDEXEDHDFS: "INDEXEDHDFS",
  5153. /** UDB */
  5154. UDB: "UDB",
  5155. /** MONGODB */
  5156. MONGODB: "MONGODB",
  5157. /** PG */
  5158. PG: "PG"
  5159. };
  5160. /**
  5161. * @enum SmoothMethod
  5162. * @memberOf SuperMap
  5163. * @description 光滑方法枚举。
  5164. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  5165. * @type {string}
  5166. */
  5167. var SmoothMethod = SuperMap.SmoothMethod = {
  5168. /** B 样条法。 */
  5169. BSPLINE: "BSPLINE",
  5170. /** 磨角法。 */
  5171. POLISH: "POLISH"
  5172. };
  5173. /**
  5174. * @enum SurfaceAnalystMethod
  5175. * @memberOf SuperMap
  5176. * @description 表面分析方法枚举。
  5177. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  5178. * @type {string}
  5179. */
  5180. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  5181. /** 等值线提取。 */
  5182. ISOLINE: "ISOLINE",
  5183. /** 等值面提取。 */
  5184. ISOREGION: "ISOREGION"
  5185. };
  5186. /**
  5187. * @enum DataReturnMode
  5188. * @memberOf SuperMap
  5189. * @description 数据返回模式枚举。
  5190. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  5191. * @type {string}
  5192. */
  5193. var DataReturnMode = SuperMap.DataReturnMode = {
  5194. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  5195. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  5196. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  5197. DATASET_ONLY: "DATASET_ONLY",
  5198. /** 只返回记录集(RecordSet)。 */
  5199. RECORDSET_ONLY: "RECORDSET_ONLY"
  5200. };
  5201. /**
  5202. * @enum EditType
  5203. * @memberOf SuperMap
  5204. * @description 要素集更新模式枚举。
  5205. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  5206. * @type {string}
  5207. */
  5208. var EditType = SuperMap.EditType = {
  5209. /** 增加操作。 */
  5210. ADD: "add",
  5211. /** 修改操作。 */
  5212. UPDATE: "update",
  5213. /** 删除操作。 */
  5214. DELETE: "delete"
  5215. };
  5216. /**
  5217. * @enum TransferTactic
  5218. * @memberOf SuperMap
  5219. * @description 公交换乘策略枚举。
  5220. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  5221. * @type {string}
  5222. */
  5223. var TransferTactic = SuperMap.TransferTactic = {
  5224. /** 时间短。 */
  5225. LESS_TIME: "LESS_TIME",
  5226. /** 少换乘。 */
  5227. LESS_TRANSFER: "LESS_TRANSFER",
  5228. /** 少步行。 */
  5229. LESS_WALK: "LESS_WALK",
  5230. /** 距离最短。 */
  5231. MIN_DISTANCE: "MIN_DISTANCE"
  5232. };
  5233. /**
  5234. * @enum TransferPreference
  5235. * @memberOf SuperMap
  5236. * @description 公交换乘策略枚举。
  5237. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  5238. * @type {string}
  5239. */
  5240. var TransferPreference = SuperMap.TransferPreference = {
  5241. /** 公交汽车优先。 */
  5242. BUS: "BUS",
  5243. /** 地铁优先。 */
  5244. SUBWAY: "SUBWAY",
  5245. /** 不乘坐地铁。 */
  5246. NO_SUBWAY: "NO_SUBWAY",
  5247. /** 无乘车偏好。 */
  5248. NONE: "NONE"
  5249. };
  5250. /**
  5251. * @enum GridType
  5252. * @memberOf SuperMap
  5253. * @description 地图背景格网类型枚举。
  5254. * @type {string}
  5255. */
  5256. var GridType = SuperMap.GridType = {
  5257. /** 十字叉丝。 */
  5258. CROSS: "CROSS",
  5259. /** 网格线。 */
  5260. GRID: "GRID",
  5261. /** 点。 */
  5262. POINT: "POINT"
  5263. };
  5264. /**
  5265. * @enum ColorSpaceType
  5266. * @memberOf SuperMap
  5267. * @description 色彩空间枚举。
  5268. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  5269. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  5270. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  5271. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  5272. * @type {string}
  5273. */
  5274. var ColorSpaceType = SuperMap.ColorSpaceType = {
  5275. /** 该类型主要在印刷系统使用。 */
  5276. CMYK: "CMYK",
  5277. /** 该类型主要在显示系统中使用。 */
  5278. RGB: "RGB"
  5279. };
  5280. /**
  5281. * @enum LayerType
  5282. * @memberOf SuperMap
  5283. * @description 图层类型。
  5284. * @type {string}
  5285. */
  5286. var LayerType = SuperMap.LayerType = {
  5287. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  5288. UGC: "UGC",
  5289. /** WMS 图层。 */
  5290. WMS: "WMS",
  5291. /** WFS 图层。 */
  5292. WFS: "WFS",
  5293. /** 自定义图层。 */
  5294. CUSTOM: "CUSTOM"
  5295. };
  5296. /**
  5297. * @enum UGCLayerType
  5298. * @memberOf SuperMap
  5299. * @description UGC图层类型。
  5300. * @type {string}
  5301. */
  5302. var UGCLayerType = SuperMap.UGCLayerType = {
  5303. /** 专题图层。 */
  5304. THEME: "THEME",
  5305. /** 矢量图层。 */
  5306. VECTOR: "VECTOR",
  5307. /** 栅格图层。。 */
  5308. GRID: "GRID",
  5309. /** 影像图层。 */
  5310. IMAGE: "IMAGE"
  5311. };
  5312. /**
  5313. * @enum StatisticMode
  5314. * @memberOf SuperMap
  5315. * @description 字段统计方法类型。
  5316. * @type {string}
  5317. */
  5318. var StatisticMode = SuperMap.StatisticMode = {
  5319. /** 统计所选字段的平均值。 */
  5320. AVERAGE: "AVERAGE",
  5321. /** 统计所选字段的最大值。 */
  5322. MAX: "MAX",
  5323. /** 统计所选字段的最小值。 */
  5324. MIN: "MIN",
  5325. /** 统计所选字段的标准差 */
  5326. STDDEVIATION: "STDDEVIATION",
  5327. /** 统计所选字段的总和。 */
  5328. SUM: "SUM",
  5329. /** 统计所选字段的方差。 */
  5330. VARIANCE: "VARIANCE"
  5331. };
  5332. /**
  5333. * @enum PixelFormat
  5334. * @memberOf SuperMap
  5335. * @description 栅格与影像数据存储的像素格式枚举。
  5336. * @type {string}
  5337. */
  5338. var PixelFormat = SuperMap.PixelFormat = {
  5339. /** 每个像元用16个比特(即2个字节)表示。 */
  5340. BIT16: "BIT16",
  5341. /** 每个像元用32个比特(即4个字节)表示。 */
  5342. BIT32: "BIT32",
  5343. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  5344. BIT64: "BIT64",
  5345. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  5346. SINGLE: "SINGLE",
  5347. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  5348. DOUBLE: "DOUBLE",
  5349. /** 每个像元用1个比特表示。 */
  5350. UBIT1: "UBIT1",
  5351. /** 每个像元用4个比特来表示。 */
  5352. UBIT4: "UBIT4",
  5353. /** 每个像元用8个比特(即1个字节)来表示。 */
  5354. UBIT8: "UBIT8",
  5355. /** 每个像元用24个比特(即3个字节)来表示。 */
  5356. UBIT24: "UBIT24",
  5357. /** 每个像元用32个比特(即4个字节)来表示。 */
  5358. UBIT32: "UBIT32"
  5359. };
  5360. /**
  5361. * @enum SearchMode
  5362. * @memberOf SuperMap
  5363. * @description 内插时使用的样本点的查找方式枚举
  5364. * @type {string}
  5365. */
  5366. var SearchMode = SuperMap.SearchMode = {
  5367. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  5368. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  5369. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  5370. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  5371. /** 不进行查找,使用所有的输入点进行内插分析。 */
  5372. NONE: "NONE",
  5373. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  5374. QUADTREE: "QUADTREE"
  5375. };
  5376. /**
  5377. * @enum InterpolationAlgorithmType
  5378. * @memberOf SuperMap
  5379. * @description 插值分析的算法的类型
  5380. * @type {string}
  5381. */
  5382. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  5383. /** 普通克吕金插值法。 */
  5384. KRIGING: "KRIGING",
  5385. /** 简单克吕金插值法。 */
  5386. SimpleKriging: "SimpleKriging",
  5387. /** 泛克吕金插值法。 */
  5388. UniversalKriging: "UniversalKriging"
  5389. };
  5390. /**
  5391. * @enum VariogramMode
  5392. * @memberOf SuperMap
  5393. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  5394. * @type {string}
  5395. */
  5396. var VariogramMode = SuperMap.VariogramMode = {
  5397. /** 指数函数。 */
  5398. EXPONENTIAL: "EXPONENTIAL",
  5399. /** 高斯函数。 */
  5400. GAUSSIAN: "GAUSSIAN",
  5401. /** 球型函数。 */
  5402. SPHERICAL: "SPHERICAL"
  5403. };
  5404. /**
  5405. * @enum Exponent
  5406. * @memberOf SuperMap
  5407. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  5408. * @type {string}
  5409. */
  5410. var Exponent = SuperMap.Exponent = {
  5411. /** 阶数为1。 */
  5412. EXP1: "EXP1",
  5413. /** 阶数为2。 */
  5414. EXP2: "EXP2"
  5415. };
  5416. /**
  5417. * @enum ClientType
  5418. * @memberOf SuperMap
  5419. * @description token申请的客户端标识类型
  5420. * @type {string}
  5421. */
  5422. var ClientType = SuperMap.ClientType = {
  5423. /** 指定的 IP 地址。 */
  5424. IP: "IP",
  5425. /** 指定的 URL。 */
  5426. REFERER: "Referer",
  5427. /** 发送申请令牌请求的客户端 IP。 */
  5428. REQUESTIP: "RequestIP",
  5429. /** 不做任何验证。 */
  5430. NONE: "NONE",
  5431. /** SERVER。 */
  5432. SERVER: "SERVER",
  5433. /** WEB。 */
  5434. WEB: "WEB"
  5435. };
  5436. /**
  5437. * @enum ChartType
  5438. * @memberOf SuperMap
  5439. * @description 客户端专题图图表类型
  5440. * @type {string}
  5441. */
  5442. var ChartType = SuperMap.ChartType = {
  5443. /** 柱状图。 */
  5444. BAR: "Bar",
  5445. /** 三维柱状图。 */
  5446. BAR3D: "Bar3D",
  5447. /** 圆形图。 */
  5448. CIRCLE: "Circle",
  5449. /** 饼图。 */
  5450. PIE: "Pie",
  5451. /** 散点图。 */
  5452. POINT: "Point",
  5453. /** 折线图。 */
  5454. LINE: "Line",
  5455. /** 环状图。 */
  5456. RING: "Ring"
  5457. };
  5458. /**
  5459. * @enum ClipAnalystMode
  5460. * @memberOf SuperMap
  5461. * @description 裁剪分析模式
  5462. * @type {string}
  5463. */
  5464. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  5465. /** CLIP。 */
  5466. CLIP: "clip",
  5467. /** INTERSECT。 */
  5468. INTERSECT: "intersect"
  5469. };
  5470. /**
  5471. * @enum AnalystAreaUnit
  5472. * @memberOf SuperMap
  5473. * @description 分布式分析面积单位
  5474. * @type {string}
  5475. */
  5476. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  5477. /** 平方米。 */
  5478. "SQUAREMETER": "SquareMeter",
  5479. /** 平方千米。 */
  5480. "SQUAREKILOMETER": "SquareKiloMeter",
  5481. /** 公顷。 */
  5482. "HECTARE": "Hectare",
  5483. /** 公亩。 */
  5484. "ARE": "Are",
  5485. /** 英亩。 */
  5486. "ACRE": "Acre",
  5487. /** 平方英尺。 */
  5488. "SQUAREFOOT": "SquareFoot",
  5489. /** 平方码。 */
  5490. "SQUAREYARD": "SquareYard",
  5491. /** 平方英里。 */
  5492. "SQUAREMILE": "SquareMile"
  5493. };
  5494. /**
  5495. * @enum AnalystSizeUnit
  5496. * @memberOf SuperMap
  5497. * @description 分布式分析单位
  5498. * @type {string}
  5499. */
  5500. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  5501. /** 米。 */
  5502. "METER": "Meter",
  5503. /** 千米。 */
  5504. "KILOMETER": "Kilometer",
  5505. /** 码。 */
  5506. "YARD": "Yard",
  5507. /** 英尺。 */
  5508. "FOOT": "Foot",
  5509. /** 英里。 */
  5510. "MILE": "Mile"
  5511. };
  5512. /**
  5513. * @enum StatisticAnalystMode
  5514. * @memberOf SuperMap
  5515. * @description 分布式分析统计模式
  5516. * @type {string}
  5517. */
  5518. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  5519. /** 统计所选字段的最大值。 */
  5520. "MAX": "max",
  5521. /** 统计所选字段的最小值。 */
  5522. "MIN": "min",
  5523. /** 统计所选字段的平均值。 */
  5524. "AVERAGE": "average",
  5525. /** 统计所选字段的总和。 */
  5526. "SUM": "sum",
  5527. /** 统计所选字段的方差。 */
  5528. "VARIANCE": "variance",
  5529. /** 统计所选字段的标准差 */
  5530. "STDDEVIATION": "stdDeviation"
  5531. };
  5532. /**
  5533. * @enum SummaryType
  5534. * @memberOf SuperMap
  5535. * @description 分布式分析聚合类型
  5536. * @type {string}
  5537. */
  5538. var SummaryType = SuperMap.SummaryType = {
  5539. /** 格网聚合。 */
  5540. "SUMMARYMESH": "SUMMARYMESH",
  5541. /** 多边形聚合。 */
  5542. "SUMMARYREGION": "SUMMARYREGION"
  5543. };
  5544. /**
  5545. * @enum TopologyValidatorRule
  5546. * @memberOf SuperMap
  5547. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  5548. * @type {string}
  5549. */
  5550. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  5551. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  5552. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  5553. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  5554. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  5555. /** 面被面包含,用于对面数据进行拓扑检查。 */
  5556. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  5557. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  5558. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  5559. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  5560. LINENOOVERLAP: "LINENOOVERLAP",
  5561. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  5562. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  5563. /** 点不相同,用于对点数据进行拓扑检查。 */
  5564. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  5565. };
  5566. /**
  5567. * @enum AggregationType
  5568. * @memberOf SuperMap
  5569. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  5570. * @type {string}
  5571. */
  5572. var AggregationType = SuperMap.AggregationType = {
  5573. /** 格网聚合类型。 */
  5574. GEOHASH_GRID: "geohash_grid",
  5575. /** 过滤聚合类型。 */
  5576. FILTER: "filter"
  5577. };
  5578. /**
  5579. * @enum AggregationType
  5580. * @memberOf SuperMap
  5581. * @description 聚合查询中filter查询枚举类
  5582. * @type {string}
  5583. */
  5584. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  5585. /** 范围查询。 */
  5586. GEO_BOUNDING_BOX: "geo_bounding_box"
  5587. }
  5588. /**
  5589. * @enum GetFeatureMode
  5590. * @memberOf SuperMap
  5591. * @description feature 查询方式。
  5592. * @type {string}
  5593. */
  5594. var GetFeatureMode = SuperMap.GetFeatureMode = {
  5595. /** 通过范围查询来获取要素。 */
  5596. BOUNDS: "BOUNDS",
  5597. /** 通过几何对象的缓冲区来获取要素。 */
  5598. BUFFER: "BUFFER",
  5599. /** 通过 ID 来获取要素。 */
  5600. ID: "ID",
  5601. /** 通过空间查询模式来获取要素。 */
  5602. SPATIAL: "SPATIAL",
  5603. /** 通过 SQL 查询来获取要素。 */
  5604. SQL: 'SQL'
  5605. }
  5606. /**
  5607. * @enum RasterFunctionType
  5608. * @memberOf SuperMap
  5609. * @description 栅格分析方法。
  5610. * @type {string}
  5611. */
  5612. var RasterFunctionType = SuperMap.RasterFunctionType = {
  5613. /** 归一化植被指数。 */
  5614. NDVI: "NDVI",
  5615. /** 阴影面分析。 */
  5616. HILLSHADE: "HILLSHADE"
  5617. }
  5618. /**
  5619. * @enum ResourceType
  5620. * @memberOf SuperMap
  5621. * @description iportal资源类型。
  5622. * @version 10.0.1
  5623. * @type {string}
  5624. */
  5625. var ResourceType = SuperMap.ResourceType = {
  5626. /** 地图。 */
  5627. MAP: "MAP",
  5628. /** 服务。 */
  5629. SERVICE: "SERVICE",
  5630. /** 场景。 */
  5631. SCENE: "SCENE",
  5632. /** 数据。 */
  5633. DATA: "DATA",
  5634. /** 洞察。 */
  5635. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  5636. /** 大屏。 */
  5637. MAP_DASHBOARD: "MAP_DASHBOARD"
  5638. }
  5639. /**
  5640. * @enum OrderBy
  5641. * @memberOf SuperMap
  5642. * @description iportal资源排序字段。
  5643. * @version 10.0.1
  5644. * @type {string}
  5645. */
  5646. var OrderBy = SuperMap.OrderBy = {
  5647. /** 按更新时间排序 */
  5648. UPDATETIME: "UPDATETIME",
  5649. /** 按热度(可能是访问量、下载量)排序 */
  5650. HEATLEVEL: "HEATLEVEL",
  5651. /** 按相关性排序 */
  5652. RELEVANCE: "RELEVANCE"
  5653. }
  5654. /**
  5655. * @enum OrderType
  5656. * @memberOf SuperMap
  5657. * @description iportal资源升序还是降序过滤
  5658. * @version 10.0.1
  5659. * @type {string}
  5660. */
  5661. var OrderType = SuperMap.OrderType = {
  5662. /** 升序 */
  5663. ASC: "ASC",
  5664. /** 降序 */
  5665. DESC: "DESC"
  5666. }
  5667. /**
  5668. * @enum SearchType
  5669. * @memberOf SuperMap
  5670. * @description iportal资源查询的范围进行过滤
  5671. * @version 10.0.1
  5672. * @type {string}
  5673. */
  5674. var SearchType = SuperMap.SearchType = {
  5675. /** 公开资源。 */
  5676. PUBLIC: "PUBLIC",
  5677. /** 我的资源。 */
  5678. MY_RES: "MY_RES",
  5679. /** 我的群组资源。 */
  5680. MYGROUP_RES: "MYGROUP_RES",
  5681. /** 我的部门资源。 */
  5682. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  5683. /** 分享给我的资源。 */
  5684. SHARETOME_RES: "SHARETOME_RES"
  5685. }
  5686. /**
  5687. * @enum AggregationTypes
  5688. * @memberOf SuperMap
  5689. * @description iportal资源聚合查询的类型
  5690. * @version 10.0.1
  5691. * @type {string}
  5692. */
  5693. var AggregationTypes = SuperMap.AggregationTypes = {
  5694. /** 标签 */
  5695. TAG: "TAG",
  5696. /** 资源类型 */
  5697. TYPE: "TYPE"
  5698. }
  5699. /**
  5700. * @enum PermissionType
  5701. * @memberOf SuperMap
  5702. * @description iportal资源权限类型。
  5703. * @version 10.0.1
  5704. * @type {string}
  5705. */
  5706. var PermissionType = SuperMap.PermissionType = {
  5707. /** 可检索 */
  5708. SEARCH:"SEARCH",
  5709. /** 可查看 */
  5710. READ: "READ",
  5711. /** 可编辑 */
  5712. READWRITE: "READWRITE",
  5713. /** 可删除 */
  5714. DELETE: "DELETE",
  5715. /** 可下载,包括可读、可检索 */
  5716. DOWNLOAD:"DOWNLOAD"
  5717. }
  5718. /**
  5719. * @enum EntityType
  5720. * @memberOf SuperMap
  5721. * @description iportal资源实体类型。
  5722. * @version 10.0.1
  5723. * @type {string}
  5724. */
  5725. var EntityType = SuperMap.EntityType = {
  5726. /** 部门 */
  5727. DEPARTMENT: "DEPARTMENT",
  5728. /** 用户组 */
  5729. GROUP: "GROUP",
  5730. /** 群组 */
  5731. IPORTALGROUP: "IPORTALGROUP",
  5732. /** 角色 */
  5733. ROLE: "ROLE",
  5734. /** 用户 */
  5735. USER: "USER"
  5736. }
  5737. /**
  5738. * @enum DataItemType
  5739. * @memberOf SuperMap
  5740. * @description iportal数据类型。
  5741. * @version 10.0.1
  5742. * @type {string}
  5743. */
  5744. var DataItemType = SuperMap.DataItemType = {
  5745. /** 工作空间 sxwu, smwu, sxw, smw */
  5746. WORKSPACE: "WORKSPACE",
  5747. /** udb 数据源 */
  5748. UDB: "UDB",
  5749. /** shp空间数据 */
  5750. SHP: "SHP",
  5751. /** excel数据 */
  5752. EXCEL: "EXCEL",
  5753. /** csv数据 */
  5754. CSV: "CSV",
  5755. /** geojson数据。 */
  5756. GEOJSON: "GEOJSON",
  5757. /** smtiles */
  5758. SMTILES: "SMTILES",
  5759. /** svtiles */
  5760. SVTILES: "SVTILES",
  5761. /** mbtiles */
  5762. MBTILES: "MBTILES",
  5763. /** tpk */
  5764. TPK: "TPK",
  5765. /** ugc v5 */
  5766. UGCV5: "UGCV5",
  5767. /** UGCV5_MVT */
  5768. UGCV5_MVT: "UGCV5_MVT",
  5769. /** json数据 */
  5770. JSON: "JSON"
  5771. }
  5772. /**
  5773. * @enum WebExportFormatType
  5774. * @memberOf SuperMap
  5775. * @description Web 打印输出的格式。
  5776. * @version 10.0.1
  5777. * @type {string}
  5778. */
  5779. var WebExportFormatType = SuperMap.WebExportFormatType = {
  5780. /** png */
  5781. PNG: "PNG",
  5782. /** pdf */
  5783. PDF: "PDF"
  5784. }
  5785. /**
  5786. * @enum WebScaleOrientationType
  5787. * @memberOf SuperMap
  5788. * @description Web 比例尺的方位样式。
  5789. * @version 10.0.1
  5790. * @type {string}
  5791. */
  5792. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  5793. /** horizontal labels below */
  5794. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  5795. /** horizontal labels above */
  5796. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  5797. /** vertical labels left */
  5798. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  5799. /** vertical labels right */
  5800. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  5801. }
  5802. /**
  5803. * @enum WebScaleType
  5804. * @memberOf SuperMap
  5805. * @description Web 比例尺的样式。
  5806. * @version 10.0.1
  5807. * @type {string}
  5808. */
  5809. var WebScaleType = SuperMap.WebScaleType = {
  5810. /** line */
  5811. LINE: "LINE",
  5812. /** bar */
  5813. BAR: "BAR",
  5814. /** bar sub */
  5815. BAR_SUB: "BAR_SUB"
  5816. }
  5817. /**
  5818. * @enum WebScaleUnit
  5819. * @memberOf SuperMap
  5820. * @description Web 比例尺的单位制。
  5821. * @version 10.0.1
  5822. * @type {string}
  5823. */
  5824. var WebScaleUnit = SuperMap.WebScaleUnit = {
  5825. /** meter */
  5826. METER: "METER",
  5827. /** foot */
  5828. FOOT: "FOOT",
  5829. /** degrees */
  5830. DEGREES: "DEGREES"
  5831. }
  5832. ;// CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  5833. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5834. * This program are made available under the terms of the Apache License, Version 2.0
  5835. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5836. // eslint-disable-line no-unused-vars
  5837. /**
  5838. * @class SuperMap.DatasourceConnectionInfo
  5839. * @category iServer Data
  5840. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  5841. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  5842. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  5843. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  5844. * @category iServer Data
  5845. * @param {Object} options - 参数。
  5846. * @param {string} options.alias - 数据源别名。
  5847. * @param {string} options.dataBase - 数据源连接的数据库名。
  5848. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  5849. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  5850. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  5851. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  5852. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  5853. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  5854. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  5855. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  5856. * @param {string} [options.user] - 登录数据库的用户名。
  5857. */
  5858. class DatasourceConnectionInfo {
  5859. constructor(options) {
  5860. /**
  5861. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  5862. * @description 数据源别名。
  5863. */
  5864. this.alias = null;
  5865. /**
  5866. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  5867. * @description 数据源是否自动连接数据。
  5868. */
  5869. this.connect = null;
  5870. /**
  5871. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  5872. * @description 数据源连接的数据库名。
  5873. */
  5874. this.dataBase = null;
  5875. /**
  5876. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  5877. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  5878. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  5879. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  5880. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  5881. */
  5882. this.driver = null;
  5883. /**
  5884. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  5885. * @description 数据源连接的引擎类型。
  5886. */
  5887. this.engineType = null;
  5888. /**
  5889. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  5890. * @description 是否以独占方式打开数据源。
  5891. */
  5892. this.exclusive = null;
  5893. /**
  5894. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  5895. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  5896. */
  5897. this.OpenLinkTable = null;
  5898. /**
  5899. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  5900. * @description 登录数据源连接的数据库或文件的密码。
  5901. */
  5902. this.password = null;
  5903. /**
  5904. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  5905. * @description 是否以只读方式打开数据源。
  5906. */
  5907. this.readOnly = null;
  5908. /**
  5909. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  5910. * @description 数据库服务器名、文件名或服务地址。
  5911. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  5912. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  5913. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  5914. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  5915. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  5916. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  5917. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  5918. * 8.对于 SuperMapCould 数据源,为其服务地址。
  5919. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  5920. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  5921. */
  5922. this.server = null;
  5923. /**
  5924. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  5925. * @description 登录数据库的用户名。
  5926. */
  5927. this.user = null;
  5928. if (options) {
  5929. Util.extend(this, options);
  5930. }
  5931. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  5932. }
  5933. /**
  5934. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  5935. * @description 释放资源,将引用资源的属性置空。
  5936. */
  5937. destroy() {
  5938. var me = this;
  5939. me.alias = null;
  5940. me.connect = null;
  5941. me.dataBase = null;
  5942. me.driver = null;
  5943. me.engineType = null;
  5944. me.exclusive = null;
  5945. me.OpenLinkTable = null;
  5946. me.password = null;
  5947. me.readOnly = null;
  5948. me.server = null;
  5949. me.user = null;
  5950. }
  5951. }
  5952. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo;
  5953. ;// CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  5954. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  5955. * This program are made available under the terms of the Apache License, Version 2.0
  5956. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  5957. /**
  5958. * @class SuperMap.OutputSetting
  5959. * @category iServer ProcessingService
  5960. * @classdesc 分布式分析输出类型设置类。
  5961. * @param {Object} options - 参数。
  5962. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  5963. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  5964. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  5965. * @param {string} [options.outputPath] - 分析结果输出路径。
  5966. */
  5967. class OutputSetting {
  5968. constructor(options) {
  5969. /**
  5970. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  5971. * @description 分布式分析的输出类型。
  5972. */
  5973. this.type = OutputType.UDB;
  5974. /**
  5975. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  5976. * @description 分布式分析的输出结果数据集名称。
  5977. */
  5978. this.datasetName = "analystResult";
  5979. /**
  5980. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  5981. * @description 分布式分析的输出结果数据源连接信息。
  5982. */
  5983. this.datasourceInfo = null;
  5984. /**
  5985. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  5986. * @description 分布式分析的分析结果输出路径。
  5987. */
  5988. this.outputPath = "";
  5989. Util.extend(this, options);
  5990. this.CLASS_NAME = "SuperMap.OutputSetting";
  5991. }
  5992. /**
  5993. * @function SuperMap.OutputSetting.prototype.destroy
  5994. * @description 释放资源,将引用资源的属性置空。
  5995. */
  5996. destroy() {
  5997. var me = this;
  5998. me.type = null;
  5999. me.datasetName = null;
  6000. me.outputPath = null;
  6001. if (me.datasourceInfo instanceof DatasourceConnectionInfo) {
  6002. me.datasourceInfo.destroy();
  6003. me.datasourceInfo = null;
  6004. }
  6005. }
  6006. }
  6007. SuperMap.OutputSetting = OutputSetting;
  6008. ;// CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  6009. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6010. * This program are made available under the terms of the Apache License, Version 2.0
  6011. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6012. /**
  6013. * @class SuperMap.MappingParameters
  6014. * @category iServer ProcessingService
  6015. * @classdesc 分析后结果可视化的参数类。
  6016. * @param {Object} options - 参数。
  6017. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  6018. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  6019. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  6020. * @param {number} [options.rangeCount] - 专题图分段个数。
  6021. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  6022. */
  6023. class MappingParameters {
  6024. constructor(options) {
  6025. /**
  6026. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  6027. * @description 栅格分段专题图子项数组。
  6028. */
  6029. this.items = null;
  6030. /**
  6031. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  6032. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  6033. */
  6034. this.numericPrecision = 1;
  6035. /**
  6036. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  6037. * @description 专题图分段模式。
  6038. */
  6039. this.rangeMode = RangeMode.EQUALINTERVAL;
  6040. /**
  6041. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  6042. * @description 专题图分段个数。
  6043. */
  6044. this.rangeCount = "";
  6045. /**
  6046. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  6047. * @description 专题图颜色渐变模式。
  6048. */
  6049. this.colorGradientType = ColorGradientType.YELLOW_RED;
  6050. Util.extend(this, options);
  6051. this.CLASS_NAME = "SuperMap.MappingParameters";
  6052. }
  6053. /**
  6054. * @function SuperMap.MappingParameters.prototype.destroy
  6055. * @description 释放资源,将引用资源的属性置空。
  6056. */
  6057. destroy() {
  6058. var me = this;
  6059. if (me.items) {
  6060. if (me.items.length > 0) {
  6061. for (var item in me.items) {
  6062. me.items[item].destroy();
  6063. me.items[item] = null;
  6064. }
  6065. }
  6066. me.items = null;
  6067. }
  6068. me.numericPrecision = null;
  6069. me.rangeMode = null;
  6070. me.rangeCount = null;
  6071. me.colorGradientType = null;
  6072. }
  6073. }
  6074. SuperMap.MappingParameters = MappingParameters;
  6075. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  6076. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6077. * This program are made available under the terms of the Apache License, Version 2.0
  6078. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6079. /**
  6080. * @class SuperMap.KernelDensityJobParameter
  6081. * @category iServer ProcessingService DensityAnalyst
  6082. * @classdesc 密度分析任务参数类。
  6083. * @param {Object} options - 参数。
  6084. * @param {string} options.datasetName - 数据集名。
  6085. * @param {string} options.fields - 权重索引。
  6086. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  6087. * @param {number} [options.resolution=80] - 分辨率。
  6088. * @param {number} [options.method=0] - 分析方法。
  6089. * @param {number} [options.meshType=0] - 分析类型。
  6090. * @param {number} [options.radius=300] - 分析的影响半径。
  6091. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6092. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6093. */
  6094. class KernelDensityJobParameter {
  6095. constructor(options) {
  6096. if (!options) {
  6097. return;
  6098. }
  6099. /**
  6100. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  6101. * @description 数据集名。
  6102. */
  6103. this.datasetName = "";
  6104. /**
  6105. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  6106. * @description 分析范围。
  6107. */
  6108. this.query = "";
  6109. /**
  6110. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  6111. * @description 网格大小。
  6112. */
  6113. this.resolution = 80;
  6114. /**
  6115. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  6116. * @description 分析方法。
  6117. */
  6118. this.method = 0;
  6119. /**
  6120. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  6121. * @description 分析类型。
  6122. */
  6123. this.meshType = 0;
  6124. /**
  6125. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  6126. * @description 权重索引。
  6127. */
  6128. this.fields = "";
  6129. /**
  6130. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  6131. * @description 分析的影响半径。
  6132. */
  6133. this.radius = 300;
  6134. /**
  6135. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  6136. * @description 网格大小单位。
  6137. */
  6138. this.meshSizeUnit = AnalystSizeUnit.METER;
  6139. /**
  6140. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  6141. * @description 搜索半径单位。
  6142. */
  6143. this.radiusUnit = AnalystSizeUnit.METER;
  6144. /**
  6145. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  6146. * @description 面积单位。
  6147. */
  6148. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  6149. /**
  6150. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  6151. * @description 输出参数设置类
  6152. */
  6153. this.output = null;
  6154. /**
  6155. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  6156. * @description 分析后结果可视化的参数类。
  6157. */
  6158. this.mappingParameters = null;
  6159. Util.extend(this, options);
  6160. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  6161. }
  6162. /**
  6163. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  6164. * @description 释放资源,将引用资源的属性置空。
  6165. */
  6166. destroy() {
  6167. this.datasetName = null;
  6168. this.query = null;
  6169. this.resolution = null;
  6170. this.method = null;
  6171. this.radius = null;
  6172. this.meshType = null;
  6173. this.fields = null;
  6174. this.meshSizeUnit = null;
  6175. this.radiusUnit = null;
  6176. this.areaUnit = null;
  6177. if (this.output instanceof OutputSetting) {
  6178. this.output.destroy();
  6179. this.output = null;
  6180. }
  6181. if (this.mappingParameters instanceof MappingParameters) {
  6182. this.mappingParameters.destroy();
  6183. this.mappingParameters = null;
  6184. }
  6185. }
  6186. /**
  6187. * @function SuperMap.KernelDensityJobParameter.toObject
  6188. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  6189. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  6190. * @description 将密度分析任务参数对象转换为 JSON 对象。
  6191. * @returns JSON 对象。
  6192. */
  6193. static toObject(kernelDensityJobParameter, tempObj) {
  6194. for (var name in kernelDensityJobParameter) {
  6195. if (name === "datasetName") {
  6196. tempObj['input'] = tempObj['input'] || {};
  6197. tempObj['input'][name] = kernelDensityJobParameter[name];
  6198. continue;
  6199. }
  6200. if (name === "output") {
  6201. tempObj['output'] = tempObj['output'] || {};
  6202. tempObj['output'] = kernelDensityJobParameter[name];
  6203. continue;
  6204. }
  6205. tempObj['analyst'] = tempObj['analyst'] || {};
  6206. if (name === 'query' && kernelDensityJobParameter[name]) {
  6207. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  6208. } else {
  6209. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  6210. }
  6211. if (name === 'mappingParameters') {
  6212. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6213. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  6214. }
  6215. }
  6216. }
  6217. }
  6218. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter;
  6219. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  6220. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6221. * This program are made available under the terms of the Apache License, Version 2.0
  6222. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6223. /**
  6224. * @class SuperMap.SingleObjectQueryJobsParameter
  6225. * @category iServer ProcessingService Query
  6226. * @classdesc 单对象空间查询分析任务参数类。
  6227. * @param {Object} options - 参数。
  6228. * @param {string} options.datasetName - 数据集名。
  6229. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  6230. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  6231. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6232. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6233. */
  6234. class SingleObjectQueryJobsParameter {
  6235. constructor(options) {
  6236. if (!options) {
  6237. return;
  6238. }
  6239. /**
  6240. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  6241. * @description 数据集名。
  6242. */
  6243. this.datasetName = "";
  6244. /**
  6245. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  6246. * @description 查询对象所在的数据集名称。
  6247. */
  6248. this.datasetQuery = "";
  6249. /**
  6250. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  6251. * @description 查询对象所在的几何对象。
  6252. */
  6253. this.geometryQuery = "";
  6254. /**
  6255. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  6256. * @description 空间查询模式 。
  6257. */
  6258. this.mode = SpatialQueryMode.CONTAIN;
  6259. /**
  6260. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  6261. * @description 输出参数设置类。
  6262. */
  6263. this.output = null;
  6264. /**
  6265. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  6266. * @description 分析后结果可视化的参数类。
  6267. */
  6268. this.mappingParameters = null;
  6269. Util.extend(this, options);
  6270. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  6271. }
  6272. /**
  6273. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  6274. * @description 释放资源,将引用资源的属性置空。
  6275. */
  6276. destroy() {
  6277. this.datasetName = null;
  6278. this.datasetQuery = null;
  6279. this.geometryQuery = null;
  6280. this.mode = null;
  6281. if (this.output instanceof OutputSetting) {
  6282. this.output.destroy();
  6283. this.output = null;
  6284. }
  6285. if (this.mappingParameters instanceof MappingParameters){
  6286. this.mappingParameters.destroy();
  6287. this.mappingParameters = null;
  6288. }
  6289. }
  6290. /**
  6291. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  6292. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  6293. * @param {Object} tempObj - 目标对象。
  6294. * @description 生成单对象空间查询分析任务对象。
  6295. */
  6296. static toObject(singleObjectQueryJobsParameter, tempObj) {
  6297. for (var name in singleObjectQueryJobsParameter) {
  6298. if (name === "datasetName") {
  6299. tempObj['input'] = tempObj['input'] || {};
  6300. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  6301. continue;
  6302. }
  6303. if (name === "output"){
  6304. tempObj['output'] = tempObj['output'] || {};
  6305. tempObj['output'] = singleObjectQueryJobsParameter[name];
  6306. continue;
  6307. }
  6308. tempObj['analyst'] = tempObj['analyst'] || {};
  6309. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  6310. if(name === 'mappingParameters'){
  6311. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6312. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  6313. }
  6314. }
  6315. }
  6316. }
  6317. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter;
  6318. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  6319. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6320. * This program are made available under the terms of the Apache License, Version 2.0
  6321. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6322. /**
  6323. * @class SuperMap.SummaryAttributesJobsParameter
  6324. * @category iServer ProcessingService SummaryAttributes
  6325. * @classdesc 属性汇总分析任务参数类
  6326. * @param {Object} options - 参数。
  6327. * @param {string} options.datasetName - 数据集名。
  6328. * @param {string} options.groupField - 分组字段。
  6329. * @param {string} options.attributeField - 属性字段。
  6330. * @param {string} options.statisticModes - 统计模式。
  6331. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  6332. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6333. */
  6334. class SummaryAttributesJobsParameter {
  6335. constructor(options) {
  6336. if (!options) {
  6337. return;
  6338. }
  6339. /**
  6340. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  6341. * @description 汇总数据集名称。
  6342. */
  6343. this.datasetName = "";
  6344. /**
  6345. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  6346. * @description 分组字段。
  6347. */
  6348. this.groupField = "";
  6349. /**
  6350. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  6351. * @description 属性字段。
  6352. */
  6353. this.attributeField = "";
  6354. /**
  6355. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  6356. * @description 属性汇总统计模式。
  6357. */
  6358. this.statisticModes = "";
  6359. /**
  6360. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  6361. * @description 输出参数设置类。
  6362. */
  6363. this.output = null;
  6364. /**
  6365. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  6366. * @description 分析后结果可视化的参数类。
  6367. */
  6368. this.mappingParameters = null;
  6369. Util.extend(this, options);
  6370. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  6371. }
  6372. /**
  6373. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  6374. * @override
  6375. */
  6376. destroy() {
  6377. this.datasetName = null;
  6378. this.groupField = null;
  6379. this.attributeField = null;
  6380. this.statisticModes = null;
  6381. if (this.output instanceof OutputSetting) {
  6382. this.output.destroy();
  6383. this.output = null;
  6384. }
  6385. if (this.mappingParameters instanceof MappingParameters){
  6386. this.mappingParameters.destroy();
  6387. this.mappingParameters = null;
  6388. }
  6389. }
  6390. /**
  6391. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  6392. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  6393. * @param {Object} tempObj - 目标对象。
  6394. * @description 生成属性汇总分析任务对象。
  6395. */
  6396. static toObject(SummaryAttributesJobsParameter, tempObj) {
  6397. for (var name in SummaryAttributesJobsParameter) {
  6398. if (name === "datasetName") {
  6399. tempObj['input'] = tempObj['input'] || {};
  6400. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  6401. continue;
  6402. }
  6403. if (name === "output") {
  6404. tempObj['output'] = tempObj['output'] || {};
  6405. tempObj['output'] = SummaryAttributesJobsParameter[name];
  6406. continue;
  6407. }
  6408. tempObj['analyst'] = tempObj['analyst'] || {};
  6409. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  6410. if(name === 'mappingParameters'){
  6411. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6412. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  6413. }
  6414. }
  6415. }
  6416. }
  6417. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter;
  6418. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  6419. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6420. * This program are made available under the terms of the Apache License, Version 2.0
  6421. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6422. /**
  6423. * @class SuperMap.SummaryMeshJobParameter
  6424. * @category iServer ProcessingService AggregatePoints
  6425. * @classdesc 点聚合分析任务参数类。
  6426. * @param {Object} options - 参数。
  6427. * @param {string} options.datasetName - 数据集名。
  6428. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  6429. * @param {number} options.fields - 权重索引。
  6430. * @param {number} [options.resolution=100] - 分辨率。
  6431. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  6432. * @param {number} [options.meshType=0] - 分析类型。
  6433. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  6434. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6435. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6436. */
  6437. class SummaryMeshJobParameter {
  6438. constructor(options) {
  6439. if (!options) {
  6440. return;
  6441. }
  6442. /**
  6443. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  6444. * @description 数据集名。
  6445. */
  6446. this.datasetName = "";
  6447. /**
  6448. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  6449. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  6450. */
  6451. this.regionDataset = "";
  6452. /**
  6453. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  6454. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  6455. */
  6456. this.query = "";
  6457. /**
  6458. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  6459. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  6460. */
  6461. this.resolution = 100;
  6462. /**
  6463. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  6464. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  6465. */
  6466. this.meshType = 0;
  6467. /**
  6468. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  6469. * @description 统计模式。
  6470. */
  6471. this.statisticModes = StatisticAnalystMode.AVERAGE;
  6472. /**
  6473. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  6474. * @description 权重字段。
  6475. */
  6476. this.fields = "";
  6477. /**
  6478. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  6479. * @description 聚合类型。
  6480. */
  6481. this.type = SummaryType.SUMMARYMESH;
  6482. /**
  6483. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  6484. * @description 输出参数设置类。
  6485. */
  6486. this.output = null;
  6487. /**
  6488. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  6489. * @description 分析后结果可视化的参数类。
  6490. */
  6491. this.mappingParameters = null;
  6492. Util.extend(this, options);
  6493. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  6494. }
  6495. /**
  6496. * @function SuperMap.SummaryMeshJobParameter.destroy
  6497. * @override
  6498. */
  6499. destroy() {
  6500. this.datasetName = null;
  6501. this.query = null;
  6502. this.resolution = null;
  6503. this.statisticModes = null;
  6504. this.meshType = null;
  6505. this.fields = null;
  6506. this.regionDataset = null;
  6507. this.type = null;
  6508. if (this.output instanceof OutputSetting) {
  6509. this.output.destroy();
  6510. this.output = null;
  6511. }
  6512. if (this.mappingParameters instanceof MappingParameters){
  6513. this.mappingParameters.destroy();
  6514. this.mappingParameters = null;
  6515. }
  6516. }
  6517. /**
  6518. * @function SuperMap.SummaryMeshJobParameter.toObject
  6519. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  6520. * @param {Object} tempObj - 目标对象。
  6521. * @description 生成点聚合分析任务对象。
  6522. */
  6523. static toObject(summaryMeshJobParameter, tempObj) {
  6524. for (var name in summaryMeshJobParameter) {
  6525. if (name === "datasetName") {
  6526. tempObj['input'] = tempObj['input'] || {};
  6527. tempObj['input'][name] = summaryMeshJobParameter[name];
  6528. continue;
  6529. }
  6530. if (name === "type") {
  6531. tempObj['type'] = summaryMeshJobParameter[name];
  6532. continue;
  6533. }
  6534. if (name === "output") {
  6535. tempObj['output'] = tempObj['output'] || {};
  6536. tempObj['output'] = summaryMeshJobParameter[name];
  6537. continue;
  6538. }
  6539. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  6540. tempObj['analyst'] = tempObj['analyst'] || {};
  6541. if (name === 'query' && summaryMeshJobParameter[name]) {
  6542. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  6543. } else {
  6544. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  6545. }
  6546. if(name === 'mappingParameters'){
  6547. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6548. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  6549. }
  6550. }
  6551. }
  6552. function contains(arr, obj) {
  6553. var i = arr.length;
  6554. while (i--) {
  6555. if (arr[i] === obj) {
  6556. return true;
  6557. }
  6558. }
  6559. return false;
  6560. }
  6561. }
  6562. }
  6563. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter;
  6564. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  6565. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6566. * This program are made available under the terms of the Apache License, Version 2.0
  6567. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6568. /**
  6569. * @class SuperMap.SummaryRegionJobParameter
  6570. * @category iServer ProcessingService SummaryRegion
  6571. * @classdesc 区域汇总分析任务参数类。
  6572. * @param {Object} options - 参数。
  6573. * @param {string} options.datasetName - 数据集名。
  6574. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  6575. * @param {string} [options.standardFields] - 标准属性字段名称。
  6576. * @param {string} [options.weightedFields] - 权重字段名称。
  6577. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  6578. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  6579. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  6580. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  6581. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  6582. * @param {number} [options.resolution=100] - 网格大小。
  6583. * @param {number} [options.meshType=0] - 网格面汇总类型。
  6584. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  6585. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  6586. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6587. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6588. */
  6589. class SummaryRegionJobParameter {
  6590. constructor(options) {
  6591. if (!options) {
  6592. return;
  6593. }
  6594. /**
  6595. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  6596. * @description 数据集名。
  6597. */
  6598. this.datasetName = "";
  6599. /**
  6600. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  6601. * @description 汇总数据源(多边形汇总时用到的参数)。
  6602. */
  6603. this.regionDataset = "";
  6604. /**
  6605. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  6606. * @description 是否统计长度或面积。
  6607. */
  6608. this.sumShape = true;
  6609. /**
  6610. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  6611. * @description 分析范围。
  6612. */
  6613. this.query = "";
  6614. /**
  6615. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  6616. * @description 是否以标准属字段统计。
  6617. */
  6618. this.standardSummaryFields = false;
  6619. /**
  6620. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  6621. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  6622. */
  6623. this.standardFields = "";
  6624. /**
  6625. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  6626. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  6627. */
  6628. this.standardStatisticModes = "";
  6629. /**
  6630. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  6631. * @description 是否以权重字段统计。
  6632. */
  6633. this.weightedSummaryFields = false;
  6634. /**
  6635. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  6636. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  6637. */
  6638. this.weightedFields = "";
  6639. /**
  6640. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  6641. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  6642. */
  6643. this.weightedStatisticModes = "";
  6644. /**
  6645. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  6646. * @description 网格面汇总类型。
  6647. */
  6648. this.meshType = 0;
  6649. /**
  6650. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  6651. * @description 网格大小。
  6652. */
  6653. this.resolution = 100;
  6654. /**
  6655. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  6656. * @description 网格大小单位。
  6657. */
  6658. this.meshSizeUnit = AnalystSizeUnit.METER;
  6659. /**
  6660. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  6661. * @description 汇总类型。
  6662. */
  6663. this.type = SummaryType.SUMMARYMESH;
  6664. /**
  6665. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  6666. * @description 输出参数设置类
  6667. */
  6668. this.output = null;
  6669. /**
  6670. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  6671. * @description 分析后结果可视化的参数类。
  6672. */
  6673. this.mappingParameters = null;
  6674. Util.extend(this, options);
  6675. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  6676. }
  6677. /**
  6678. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  6679. * @description 释放资源,将引用资源的属性置空。
  6680. */
  6681. destroy() {
  6682. this.datasetName = null;
  6683. this.sumShape = null;
  6684. this.regionDataset = null;
  6685. this.query = null;
  6686. this.standardSummaryFields = null;
  6687. this.standardFields = null;
  6688. this.standardStatisticModes = null;
  6689. this.weightedSummaryFields = null;
  6690. this.weightedFields = null;
  6691. this.weightedStatisticModes = null;
  6692. this.meshType = null;
  6693. this.resolution = null;
  6694. this.meshSizeUnit = null;
  6695. this.type = null;
  6696. if (this.output instanceof OutputSetting) {
  6697. this.output.destroy();
  6698. this.output = null;
  6699. }
  6700. if (this.mappingParameters instanceof MappingParameters){
  6701. this.mappingParameters.destroy();
  6702. this.mappingParameters = null;
  6703. }
  6704. }
  6705. /**
  6706. * @function SuperMap.SummaryRegionJobParameter.toObject
  6707. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  6708. * @param {Object} tempObj - 目标对象。
  6709. * @description 生成区域汇总分析服务对象。
  6710. */
  6711. static toObject(summaryRegionJobParameter, tempObj) {
  6712. for (var name in summaryRegionJobParameter) {
  6713. if (name === "datasetName") {
  6714. tempObj['input'] = tempObj['input'] || {};
  6715. tempObj['input'][name] = summaryRegionJobParameter[name];
  6716. continue;
  6717. }
  6718. if (name === "type") {
  6719. tempObj['type'] = summaryRegionJobParameter[name];
  6720. continue;
  6721. }
  6722. if (name === "type") {
  6723. tempObj['type'] = summaryRegionJobParameter[name];
  6724. continue;
  6725. }
  6726. if (name === "output") {
  6727. tempObj['output'] = tempObj['output'] || {};
  6728. tempObj['output'] = summaryRegionJobParameter[name];
  6729. continue;
  6730. }
  6731. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  6732. tempObj['analyst'] = tempObj['analyst'] || {};
  6733. if (name === 'query' && summaryRegionJobParameter[name]) {
  6734. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  6735. } else {
  6736. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  6737. }
  6738. if(name === 'mappingParameters'){
  6739. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6740. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  6741. }
  6742. }
  6743. }
  6744. }
  6745. }
  6746. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter;
  6747. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  6748. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6749. * This program are made available under the terms of the Apache License, Version 2.0
  6750. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6751. /**
  6752. * @class SuperMap.OverlayGeoJobParameter
  6753. * @category iServer ProcessingService OverlayAnalyst
  6754. * @classdesc 叠加分析任务参数类。
  6755. * @param {Object} options - 参数。
  6756. * @param {string} options.datasetName - 数据集名。
  6757. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  6758. * @param {string} options.srcFields - 输入数据需要保留的字段。
  6759. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  6760. * @param {string} [options.mode] - 叠加分析模式。
  6761. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6762. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6763. */
  6764. class OverlayGeoJobParameter {
  6765. constructor(options) {
  6766. if (!options) {
  6767. return;
  6768. }
  6769. /**
  6770. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  6771. * @description 数据集名。
  6772. */
  6773. this.datasetName = "";
  6774. /**
  6775. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  6776. * @description 叠加对象所在的数据集名称。
  6777. */
  6778. this.datasetOverlay = "";
  6779. /**
  6780. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  6781. * @description 叠加分析模式。
  6782. */
  6783. this.mode = "";
  6784. /**
  6785. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  6786. * @description 输入数据需要保留的字段。
  6787. */
  6788. this.srcFields = "";
  6789. /**
  6790. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  6791. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  6792. */
  6793. this.overlayFields = "";
  6794. /**
  6795. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  6796. * @description 输出参数设置类。
  6797. */
  6798. this.output = null;
  6799. /**
  6800. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  6801. * @description 分析后结果可视化的参数类。
  6802. */
  6803. this.mappingParameters = null;
  6804. Util.extend(this, options);
  6805. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  6806. }
  6807. /**
  6808. * @function SuperMap.OverlayGeoJobParameter.destroy
  6809. * @override
  6810. */
  6811. destroy() {
  6812. this.datasetName = null;
  6813. this.datasetOverlay = null;
  6814. this.mode = null;
  6815. this.srcFields = null;
  6816. this.overlayFields = null;
  6817. if (this.output instanceof OutputSetting) {
  6818. this.output.destroy();
  6819. this.output = null;
  6820. }
  6821. if (this.mappingParameters instanceof MappingParameters) {
  6822. this.mappingParameters.destroy();
  6823. this.mappingParameters = null;
  6824. }
  6825. }
  6826. /**
  6827. * @function SuperMap.OverlayGeoJobParameter.toObject
  6828. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  6829. * @param {Object} tempObj - 目标对象。
  6830. * @description 生成点聚合分析任务对象。
  6831. */
  6832. static toObject(OverlayGeoJobParameter, tempObj) {
  6833. for (var name in OverlayGeoJobParameter) {
  6834. if (name == "datasetName") {
  6835. tempObj['input'] = tempObj['input'] || {};
  6836. tempObj['input'][name] = OverlayGeoJobParameter[name];
  6837. continue;
  6838. }
  6839. if (name === "output") {
  6840. tempObj['output'] = tempObj['output'] || {};
  6841. tempObj['output'] = OverlayGeoJobParameter[name];
  6842. continue;
  6843. }
  6844. tempObj['analyst'] = tempObj['analyst'] || {};
  6845. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  6846. if(name === 'mappingParameters'){
  6847. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6848. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  6849. }
  6850. }
  6851. }
  6852. }
  6853. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter;
  6854. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  6855. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6856. * This program are made available under the terms of the Apache License, Version 2.0
  6857. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6858. /**
  6859. * @class SuperMap.BuffersAnalystJobsParameter
  6860. * @category iServer ProcessingService BufferAnalyst
  6861. * @classdesc 缓冲区分析任务参数类。
  6862. * @param {Object} options - 参数。
  6863. * @param {string} options.datasetName - 数据集名。
  6864. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  6865. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  6866. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  6867. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  6868. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6869. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6870. */
  6871. class BuffersAnalystJobsParameter {
  6872. constructor(options) {
  6873. /**
  6874. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  6875. * @description 数据集名。
  6876. */
  6877. this.datasetName = '';
  6878. /**
  6879. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  6880. * @description 分析范围。
  6881. */
  6882. this.bounds = '';
  6883. /**
  6884. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  6885. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  6886. */
  6887. this.distance = '';
  6888. /**
  6889. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  6890. * @description 缓冲距离字段。
  6891. */
  6892. this.distanceField = '';
  6893. /**
  6894. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  6895. * @description 缓冲距离单位。
  6896. */
  6897. this.distanceUnit = AnalystSizeUnit.METER;
  6898. /**
  6899. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  6900. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  6901. */
  6902. this.dissolveField = '';
  6903. /**
  6904. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  6905. * @description 输出参数设置类。
  6906. */
  6907. this.output = null;
  6908. /**
  6909. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  6910. * @description 分析后结果可视化的参数类。
  6911. */
  6912. this.mappingParameters = null;
  6913. if (!options) {
  6914. return this;
  6915. }
  6916. Util.extend(this, options);
  6917. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  6918. }
  6919. /**
  6920. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  6921. * @description 释放资源,将引用资源的属性置空。
  6922. */
  6923. destroy() {
  6924. this.datasetName = null;
  6925. this.bounds = null;
  6926. this.distance = null;
  6927. this.distanceField = null;
  6928. this.distanceUnit = null;
  6929. this.dissolveField = null;
  6930. if (this.output instanceof OutputSetting) {
  6931. this.output.destroy();
  6932. this.output = null;
  6933. }
  6934. if (this.mappingParameters instanceof MappingParameters) {
  6935. this.mappingParameters.destroy();
  6936. this.mappingParameters = null;
  6937. }
  6938. }
  6939. /**
  6940. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  6941. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  6942. * @param {Object} tempObj - 目标对象。
  6943. * @description 生成缓冲区分析任务对象。
  6944. */
  6945. static toObject(BuffersAnalystJobsParameter, tempObj) {
  6946. for (var name in BuffersAnalystJobsParameter) {
  6947. if (name === 'datasetName') {
  6948. tempObj['input'] = tempObj['input'] || {};
  6949. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  6950. continue;
  6951. }
  6952. if (name === 'output') {
  6953. tempObj['output'] = tempObj['output'] || {};
  6954. tempObj['output'] = BuffersAnalystJobsParameter[name];
  6955. continue;
  6956. }
  6957. tempObj['analyst'] = tempObj['analyst'] || {};
  6958. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  6959. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  6960. } else {
  6961. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  6962. }
  6963. if (name === 'mappingParameters') {
  6964. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6965. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  6966. }
  6967. }
  6968. }
  6969. }
  6970. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter;
  6971. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  6972. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  6973. * This program are made available under the terms of the Apache License, Version 2.0
  6974. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6975. /**
  6976. * @class SuperMap.TopologyValidatorJobsParameter
  6977. * @category iServer ProcessingService TopologyValidator
  6978. * @classdesc 拓扑检查分析任务参数类。
  6979. * @param {Object} options - 必填参数。
  6980. * @param {string} options.datasetName - 数据集名。
  6981. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  6982. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  6983. * @param {string} [options.tolerance] - 容限。
  6984. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6985. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6986. */
  6987. class TopologyValidatorJobsParameter {
  6988. constructor(options) {
  6989. if (!options) {
  6990. return;
  6991. }
  6992. /**
  6993. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  6994. * @description 数据集名。
  6995. */
  6996. this.datasetName = "";
  6997. /**
  6998. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  6999. * @description 拓扑检查对象所在的数据集名称。
  7000. */
  7001. this.datasetTopology = "";
  7002. /**
  7003. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  7004. * @description 容限,指定的拓扑错误检查时使用的容限。
  7005. */
  7006. this.tolerance = "";
  7007. /**
  7008. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  7009. * @description 拓扑检查模式。
  7010. */
  7011. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  7012. /**
  7013. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  7014. * @description 输出参数设置类。
  7015. */
  7016. this.output = null;
  7017. /**
  7018. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  7019. * @description 分析后结果可视化的参数类。
  7020. */
  7021. this.mappingParameters = null;
  7022. Util.extend(this, options);
  7023. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  7024. }
  7025. /**
  7026. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  7027. * @description 释放资源,将引用资源的属性置空。
  7028. */
  7029. destroy() {
  7030. this.datasetName = null;
  7031. this.datasetTopology = null;
  7032. this.tolerance = null;
  7033. this.rule = null;
  7034. if (this.output instanceof OutputSetting) {
  7035. this.output.destroy();
  7036. this.output = null;
  7037. }
  7038. if (this.mappingParameters instanceof MappingParameters) {
  7039. this.mappingParameters.destroy();
  7040. this.mappingParameters = null;
  7041. }
  7042. }
  7043. /**
  7044. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  7045. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  7046. * @param {Object} tempObj - 目标对象。
  7047. * @description 生成拓扑检查分析任务对象。
  7048. */
  7049. static toObject(TopologyValidatorJobsParameter, tempObj) {
  7050. for (var name in TopologyValidatorJobsParameter) {
  7051. if (name === "datasetName") {
  7052. tempObj['input'] = tempObj['input'] || {};
  7053. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  7054. continue;
  7055. }
  7056. if (name === "output") {
  7057. tempObj['output'] = tempObj['output'] || {};
  7058. tempObj['output'] = TopologyValidatorJobsParameter[name];
  7059. continue;
  7060. }
  7061. tempObj['analyst'] = tempObj['analyst'] || {};
  7062. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  7063. if(name === 'mappingParameters'){
  7064. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7065. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  7066. }
  7067. }
  7068. }
  7069. }
  7070. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter;
  7071. ;// CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  7072. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7073. * This program are made available under the terms of the Apache License, Version 2.0
  7074. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7075. /**
  7076. * @class SuperMap.GeoCodingParameter
  7077. * @category iServer AddressMatch
  7078. * @classdesc 地理正向匹配参数类。
  7079. * @param {Object} options - 参数。
  7080. * @param {string} options.address - 地点关键词。
  7081. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  7082. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  7083. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  7084. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  7085. * @param {number} [options.maxReturn] - 最大返回结果数。
  7086. */
  7087. class GeoCodingParameter {
  7088. constructor(options) {
  7089. if (options.filters && typeof(options.filters) === 'string') {
  7090. options.filters = options.filters.split(',');
  7091. }
  7092. /**
  7093. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  7094. * @description 地点关键词。
  7095. */
  7096. this.address = null;
  7097. /**
  7098. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  7099. * @description 设置返回对象的起始索引值。
  7100. */
  7101. this.fromIndex = null;
  7102. /**
  7103. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  7104. * @description 设置返回对象的结束索引值。
  7105. */
  7106. this.toIndex = null;
  7107. /**
  7108. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  7109. * @description 过滤字段,限定查询区域。
  7110. */
  7111. this.filters = null;
  7112. /**
  7113. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  7114. * @description 查询结果的坐标系。
  7115. */
  7116. this.prjCoordSys = null;
  7117. /**
  7118. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  7119. * @description 最大返回结果数。
  7120. */
  7121. this.maxReturn = null;
  7122. Util.extend(this, options);
  7123. }
  7124. /**
  7125. * @function SuperMap.GeoCodingParameter.prototype.destroy
  7126. * @description 释放资源,将引用资源的属性置空。
  7127. */
  7128. destroy() {
  7129. this.address = null;
  7130. this.fromIndex = null;
  7131. this.toIndex = null;
  7132. this.filters = null;
  7133. this.prjCoordSys = null;
  7134. this.maxReturn = null;
  7135. }
  7136. }
  7137. SuperMap.GeoCodingParameter = GeoCodingParameter;
  7138. ;// CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  7139. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7140. * This program are made available under the terms of the Apache License, Version 2.0
  7141. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7142. /**
  7143. * @class SuperMap.GeoDecodingParameter
  7144. * @category iServer AddressMatch
  7145. * @classdesc 地理反向匹配参数类。
  7146. * @param {Object} options - 参数。
  7147. * @param {number} options.x - 查询位置的横坐标。
  7148. * @param {number} options.y - 查询位置的纵坐标。
  7149. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  7150. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  7151. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  7152. * @param {number} [options.maxReturn] - 最大返回结果数。
  7153. * @param {number} [options.geoDecodingRadius] - 查询半径。
  7154. */
  7155. class GeoDecodingParameter {
  7156. constructor(options) {
  7157. if (options.filters) {
  7158. options.filters = options.filters.split(',');
  7159. }
  7160. /**
  7161. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  7162. * @description 查询位置的横坐标。
  7163. */
  7164. this.x = null;
  7165. /**
  7166. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  7167. * @description 查询位置的纵坐标。
  7168. */
  7169. this.y = null;
  7170. /**
  7171. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  7172. * @description 设置返回对象的起始索引值。
  7173. */
  7174. this.fromIndex = null;
  7175. /**
  7176. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  7177. * @description 设置返回对象的结束索引值。
  7178. */
  7179. this.toIndex = null;
  7180. /**
  7181. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  7182. * @description 过滤字段,限定查询区域。
  7183. */
  7184. this.filters = null;
  7185. /**
  7186. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  7187. * @description 查询结果的坐标系。
  7188. */
  7189. this.prjCoordSys = null;
  7190. /**
  7191. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  7192. * @description 最大返回结果数。
  7193. */
  7194. this.maxReturn = null;
  7195. /**
  7196. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  7197. * @description 查询半径。
  7198. */
  7199. this.geoDecodingRadius = null;
  7200. Util.extend(this, options);
  7201. }
  7202. /**
  7203. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  7204. * @description 释放资源,将引用资源的属性置空。
  7205. */
  7206. destroy() {
  7207. this.x = null;
  7208. this.y = null;
  7209. this.fromIndex = null;
  7210. this.toIndex = null;
  7211. this.filters = null;
  7212. this.prjCoordSys = null;
  7213. this.maxReturn = null;
  7214. this.geoDecodingRadius = null;
  7215. }
  7216. }
  7217. SuperMap.GeoDecodingParameter = GeoDecodingParameter;
  7218. ;// CONCATENATED MODULE: ./src/classic/SuperMap.js
  7219. var SuperMap_SuperMap = window.SuperMap = window.SuperMap || {};
  7220. SuperMap_SuperMap.REST = SuperMap_SuperMap.REST || {};
  7221. ;// CONCATENATED MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  7222. const external_function_try_return_mapv_catch_e_return_namespaceObject = function(){try{return mapv}catch(e){return {}}}();
  7223. ;// CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  7224. var getMeterPerMapUnit = function(mapUnit) {
  7225. var earchRadiusInMeters = 6378137;
  7226. var meterPerMapUnit;
  7227. if (mapUnit === Unit.METER) {
  7228. meterPerMapUnit = 1;
  7229. } else if (mapUnit === Unit.DEGREE) {
  7230. // 每度表示多少米。
  7231. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  7232. } else if (mapUnit === Unit.KILOMETER) {
  7233. meterPerMapUnit = 1.0e-3;
  7234. } else if (mapUnit === Unit.INCH) {
  7235. meterPerMapUnit = 1 / 2.5399999918e-2;
  7236. } else if (mapUnit === Unit.FOOT) {
  7237. meterPerMapUnit = 0.3048;
  7238. } else {
  7239. return meterPerMapUnit;
  7240. }
  7241. return meterPerMapUnit;
  7242. };
  7243. function getWrapNum(x, includeMax = true, includeMin = true, range = [-180, 180]) {
  7244. var max = range[1],
  7245. min = range[0],
  7246. d = max - min;
  7247. if (x === max && includeMax) {
  7248. return x;
  7249. }
  7250. if (x === min && includeMin) {
  7251. return x;
  7252. }
  7253. var tmp = (((x - min) % d) + d) % d;
  7254. if (tmp === 0 && includeMax) {
  7255. return max;
  7256. }
  7257. return ((((x - min) % d) + d) % d) + min;
  7258. }
  7259. function conversionDegree(degrees) {
  7260. const degree = parseInt(degrees);
  7261. let fraction = parseInt((degrees - degree) * 60);
  7262. let second = parseInt(((degrees - degree) * 60 - fraction) * 60);
  7263. fraction = parseInt(fraction / 10) === 0 ? `0${fraction}` : fraction;
  7264. second = parseInt(second / 10) === 0 ? `0${second}` : second;
  7265. return `${degree}°${fraction}'${second}`;
  7266. }
  7267. ;// CONCATENATED MODULE: ./src/classic/overlay/mapv/MapVRenderer.js
  7268. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7269. * This program are made available under the terms of the Apache License, Version 2.0
  7270. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7271. /**
  7272. * @class MapVRenderer
  7273. * @classdesc MapV渲染器。
  7274. * @private
  7275. * @extends {mapv.baiduMapLayer}
  7276. * @param {SuperMap.Map} map - 待渲染的地图。
  7277. * @param {SuperMap.Layer.MapVLayer} layer - 待渲染的图层。
  7278. * @param {Mapv.DataSet} dataSet - 待渲染的数据集,数据所属坐标系要求与 map 保持一致。
  7279. * @param {Object} options - 渲染的参数。
  7280. */
  7281. var MapVBaseLayer = external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer ? external_function_try_return_mapv_catch_e_return_namespaceObject.baiduMapLayer.__proto__ : Function;
  7282. class MapVRenderer extends MapVBaseLayer {
  7283. constructor(map, layer, dataSet, options) {
  7284. super(map, dataSet, options);
  7285. if (!MapVBaseLayer) {
  7286. return this;
  7287. }
  7288. var self = this;
  7289. options = options || {};
  7290. self.init(options);
  7291. self.argCheck(options);
  7292. this.canvasLayer = layer;
  7293. this.clickEvent = this.clickEvent.bind(this);
  7294. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  7295. this.bindEvent();
  7296. }
  7297. /**
  7298. * @function MapvRenderer.prototype.clickEvent
  7299. * @description 点击事件。
  7300. * @param {Object} e - 触发对象。
  7301. */
  7302. clickEvent(e) {
  7303. var pixel = e.xy;
  7304. super.clickEvent(pixel, e);
  7305. }
  7306. /**
  7307. * @function MapvRenderer.prototype.mousemoveEvent
  7308. * @description 鼠标移动事件。
  7309. * @param {Object} e - 触发对象。
  7310. */
  7311. mousemoveEvent(e) {
  7312. var pixel = e.xy;
  7313. super.mousemoveEvent(pixel, e);
  7314. }
  7315. /**
  7316. * @function MapvRenderer.prototype.bindEvent
  7317. * @description 绑定鼠标移动和鼠标点击事件。
  7318. */
  7319. bindEvent() {
  7320. var map = this.map;
  7321. if (this.options.methods) {
  7322. if (this.options.methods.click) {
  7323. map.events.on({'click': this.clickEvent});
  7324. }
  7325. if (this.options.methods.mousemove) {
  7326. map.events.on({'mousemove': this.mousemoveEvent});
  7327. }
  7328. }
  7329. }
  7330. /**
  7331. * @function MapvRenderer.prototype.unbindEvent
  7332. * @description 解绑鼠标移动和鼠标滑动触发的事件。
  7333. */
  7334. unbindEvent() {
  7335. var map = this.map;
  7336. if (this.options.methods) {
  7337. if (this.options.methods.click) {
  7338. map.events.un({'click': this.clickEvent});
  7339. }
  7340. if (this.options.methods.mousemove) {
  7341. map.events.un({'mousemove': this.mousemoveEvent});
  7342. }
  7343. }
  7344. }
  7345. /**
  7346. * @function MapvRenderer.prototype.getContext
  7347. * @description 获取信息。
  7348. */
  7349. getContext() {
  7350. return this.canvasLayer && this.canvasLayer.canvasContext;
  7351. }
  7352. /**
  7353. * @function MapvRenderer.prototype.addData
  7354. * @description 追加数据
  7355. * @param {oject} data - 待添加的数据。
  7356. * @param {oject} options - 待添加的数据信息。
  7357. */
  7358. addData(data, options) {
  7359. var _data = data;
  7360. if (data && data.get) {
  7361. _data = data.get();
  7362. }
  7363. this.dataSet.add(_data);
  7364. this.update({options: options});
  7365. }
  7366. /**
  7367. * @function MapvRenderer.prototype.updateData
  7368. * @description 更新覆盖原数据。
  7369. * @param {oject} data - 待更新的数据。
  7370. * @param {oject} options - 待更新的数据信息。
  7371. */
  7372. setData(data, options) {
  7373. var _data = data;
  7374. if (data && data.get) {
  7375. _data = data.get();
  7376. }
  7377. this.dataSet = this.dataSet || new external_function_try_return_mapv_catch_e_return_namespaceObject.DataSet();
  7378. this.dataSet.set(_data);
  7379. this.update({options: options});
  7380. }
  7381. /**
  7382. * @function MapvRenderer.prototype.getData
  7383. * @description 获取数据。
  7384. */
  7385. getData() {
  7386. return this.dataSet;
  7387. }
  7388. /**
  7389. * @function MapvRenderer.prototype.removeData
  7390. * @description 删除符合过滤条件的数据。
  7391. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  7392. */
  7393. removeData(filter) {
  7394. if (!this.dataSet) {
  7395. return;
  7396. }
  7397. var newData = this.dataSet.get({
  7398. filter: function (data) {
  7399. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  7400. }
  7401. });
  7402. this.dataSet.set(newData);
  7403. this.update({options: null});
  7404. }
  7405. /**
  7406. * @function MapvRenderer.prototype.clearData
  7407. * @description 清除数据。
  7408. */
  7409. clearData() {
  7410. this.dataSet && this.dataSet.clear();
  7411. this.update({options: null});
  7412. }
  7413. /**
  7414. * @function MapvRenderer.prototype.render
  7415. * @description 着色。
  7416. * @param {number} time
  7417. */
  7418. render(time) {
  7419. this._canvasUpdate(time);
  7420. }
  7421. /**
  7422. * @function MapvRenderer.prototype.transferToMercator
  7423. * @description 墨卡托坐标为经纬度。
  7424. * @deprecated
  7425. */
  7426. transferToMercator() {
  7427. if (this.options.coordType && ["bd09mc", "coordinates_mercator"].indexOf(this.options.coordType) > -1) {
  7428. var data = this.dataSet.get();
  7429. data = this.dataSet.transferCoordinate(data, function (coordinates) {
  7430. var pixel = SuperMap_SuperMap.Projection.transform({
  7431. x: coordinates[0],
  7432. y: coordinates[1]
  7433. }, "EPSG:3857", "EPSG:4326");
  7434. return [pixel.x, pixel.y];
  7435. }, 'coordinates', 'coordinates');
  7436. this.dataSet._set(data);
  7437. }
  7438. }
  7439. _canvasUpdate(time) {
  7440. if (!this.canvasLayer) {
  7441. return;
  7442. }
  7443. var self = this;
  7444. var animationOptions = self.options.animation;
  7445. var context = this.getContext();
  7446. var map = this.map;
  7447. if (self.isEnabledTime()) {
  7448. if (time === undefined) {
  7449. this.clear(context);
  7450. return;
  7451. }
  7452. if (this.context === '2d') {
  7453. context.save();
  7454. context.globalCompositeOperation = 'destination-out';
  7455. context.fillStyle = 'rgba(0, 0, 0, .1)';
  7456. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  7457. context.restore();
  7458. }
  7459. } else {
  7460. this.clear(context);
  7461. }
  7462. if (this.context === '2d') {
  7463. for (var key in self.options) {
  7464. context[key] = self.options[key];
  7465. }
  7466. } else {
  7467. context.clear(context.COLOR_BUFFER_BIT);
  7468. }
  7469. if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
  7470. return;
  7471. }
  7472. var layer = self.canvasLayer;
  7473. var dataGetOptions = {
  7474. fromColumn: 'coordinates',
  7475. transferCoordinate: function (coordinate) {
  7476. // var coord = layer.transferToMapLatLng({lon: coordinate[0], lat: coordinate[1]});
  7477. var coord = {lon: coordinate[0], lat: coordinate[1]};
  7478. var worldPoint = map.getViewPortPxFromLonLat(coord);
  7479. return [worldPoint.x, worldPoint.y];
  7480. }
  7481. };
  7482. if (time !== undefined) {
  7483. dataGetOptions.filter = function (item) {
  7484. var trails = animationOptions.trails || 10;
  7485. return (time && item.time > (time - trails) && item.time < time);
  7486. }
  7487. }
  7488. var data = self.dataSet.get(dataGetOptions);
  7489. this.processData(data);
  7490. // 一个像素是多少米
  7491. var zoomUnit = map.getResolution() * getMeterPerMapUnit('DEGREE');
  7492. // // 兼容unit为'm'的情况
  7493. if (self.options.unit === 'm') {
  7494. if (self.options.size) {
  7495. self.options._size = self.options.size / zoomUnit;
  7496. }
  7497. if (self.options.width) {
  7498. self.options._width = self.options.width / zoomUnit;
  7499. }
  7500. if (self.options.height) {
  7501. self.options._height = self.options.height / zoomUnit;
  7502. }
  7503. } else {
  7504. self.options._size = self.options.size;
  7505. self.options._height = self.options.height;
  7506. self.options._width = self.options.width;
  7507. }
  7508. var worldPoint = map.getViewPortPxFromLonLat(layer.transferToMapLatLng({ lon: 0, lat: 0 }));
  7509. this.drawContext(context, data, self.options, worldPoint);
  7510. self.options.updateCallback && self.options.updateCallback(time);
  7511. }
  7512. init(options) {
  7513. var self = this;
  7514. self.options = options;
  7515. this.initDataRange(options);
  7516. this.context = self.options.context || '2d';
  7517. if (self.options.zIndex) {
  7518. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  7519. }
  7520. this.initAnimator();
  7521. }
  7522. /**
  7523. * @function MapvRenderer.prototype.addAnimatorEvent
  7524. * @description 添加动画事件。
  7525. */
  7526. addAnimatorEvent() {
  7527. this.map.events.on({'movestart': this.animatorMovestartEvent.bind(this)});
  7528. this.map.events.on({'moveend': this.animatorMoveendEvent.bind(this)});
  7529. }
  7530. /**
  7531. * @function MapvRenderer.prototype.clear
  7532. * @description 清除环境。
  7533. * @param {Object} context - 当前环境。
  7534. */
  7535. clear(context) {
  7536. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  7537. }
  7538. /**
  7539. * @function MapvRenderer.prototype.show
  7540. * @description 展示渲染效果。
  7541. */
  7542. show() {
  7543. this.map.addLayer(this.canvasLayer);
  7544. }
  7545. /**
  7546. * @function MapvRenderer.prototype.hide
  7547. * @description 隐藏渲染效果。
  7548. */
  7549. hide() {
  7550. this.map.removeLayer(this.canvasLayer);
  7551. }
  7552. /**
  7553. * @function MapvRenderer.prototype.draw
  7554. * @description 渲染绘制。
  7555. */
  7556. draw() {
  7557. this.canvasLayer.redraw();
  7558. }
  7559. }
  7560. ;// CONCATENATED MODULE: ./src/classic/overlay/MapVLayer.js
  7561. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7562. * This program are made available under the terms of the Apache License, Version 2.0
  7563. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7564. /**
  7565. * @class SuperMap.Layer.MapVLayer
  7566. * @category Visualization MapV
  7567. * @classdesc MapV 图层。
  7568. * @extends {SuperMap.Layer}
  7569. * @param {string} name - 图层名。
  7570. * @param {Object} options - 可选参数。
  7571. * @param {Mapv.DataSet} options.dataSet - mapv 的 dataSet 对象。
  7572. * @param {Object} options.options - mapv 绘图风格配置信息。
  7573. */
  7574. class MapVLayer extends SuperMap_SuperMap.Layer {
  7575. constructor(name, options) {
  7576. super(name, options);
  7577. /**
  7578. * @member {mapv.DataSet} SuperMap.Layer.MapVLayer.prototype.dataSet
  7579. * @description mapv dataset 对象。
  7580. */
  7581. this.dataSet = null;
  7582. /**
  7583. * @member {Object} SuperMap.Layer.MapVLayer.prototype.options
  7584. * @description mapv 绘图风格配置信息。
  7585. */
  7586. this.options = null;
  7587. /**
  7588. * @member {boolean} [SuperMap.Layer.MapVLayer.prototype.supported=false]
  7589. * @description 当前浏览器是否支持 canvas 绘制。决定了 MapV 图是否可用,内部判断使用。
  7590. */
  7591. this.supported = false;
  7592. /**
  7593. * @member {Canvas} SuperMap.Layer.MapVLayer.prototype.canvas
  7594. * @description MapV 图主绘制面板。
  7595. */
  7596. this.canvas = null;
  7597. /**
  7598. * @private
  7599. * @member {CanvasContext} SuperMap.Layer.MapVLayer.prototype.canvasContext
  7600. * @description MapV 图主绘制对象。
  7601. */
  7602. this.canvasContext = null;
  7603. if (options) {
  7604. SuperMap_SuperMap.Util.extend(this, options);
  7605. }
  7606. //MapV图要求使用canvas绘制,判断是否支持
  7607. this.canvas = document.createElement('canvas');
  7608. if (!this.canvas.getContext) {
  7609. return;
  7610. }
  7611. this.supported = true;
  7612. //构建绘图面板
  7613. this.canvas.style.position = 'absolute';
  7614. this.canvas.style.top = 0 + 'px';
  7615. this.canvas.style.left = 0 + 'px';
  7616. this.div.appendChild(this.canvas);
  7617. var context = (this.options && this.options.context) || '2d';
  7618. this.canvasContext = this.canvas.getContext(context);
  7619. var global$2 = typeof window === 'undefined' ? {} : window;
  7620. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  7621. if (context == '2d') {
  7622. this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  7623. }
  7624. this.attribution =
  7625. "© 2018 百度 <a href='https://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='https://iclient.supermap.io' " +
  7626. "style='color: #08c;text-decoration: none;'>SuperMap iClient</a></span>";
  7627. this.CLASS_NAME = 'SuperMap.Layer.MapVLayer';
  7628. }
  7629. /**
  7630. * @function SuperMap.Layer.MapVLayer.prototype.destroy
  7631. * @override
  7632. */
  7633. destroy() {
  7634. if (this.renderer && this.renderer.animator) {
  7635. this.renderer.animator.stop();
  7636. this.renderer.animator = null;
  7637. }
  7638. this.dataSet = null;
  7639. this.options = null;
  7640. this.renderer = null;
  7641. this.supported = null;
  7642. this.canvas = null;
  7643. this.canvasContext = null;
  7644. this.maxWidth = null;
  7645. this.maxHeight = null;
  7646. super.destroy();
  7647. }
  7648. /**
  7649. * @function SuperMap.Layer.MapVLayer.prototype.addData
  7650. * @description 追加数据。
  7651. * @param {mapv.DataSet} dataSet - mapv 数据集。
  7652. * @param {Object} options - mapv 绘图参数。
  7653. */
  7654. addData(dataSet, options) {
  7655. this.renderer && this.renderer.addData(dataSet, options);
  7656. }
  7657. /**
  7658. * @function SuperMap.Layer.MapVLayer.prototype.
  7659. * @description 设置数据。
  7660. * @param {mapv.DataSet} dataSet - mapv 数据集。
  7661. * @param {Object} options - mapv 绘图参数。
  7662. */
  7663. setData(dataSet, options) {
  7664. this.renderer && this.renderer.setData(dataSet, options);
  7665. }
  7666. /**
  7667. * @function SuperMap.Layer.MapVLayer.prototype.getData
  7668. * @description 获取数据。
  7669. * @returns {mapv.DataSet} - mapv 数据集。
  7670. */
  7671. getData() {
  7672. if (this.renderer) {
  7673. this.dataSet = this.renderer.getData();
  7674. }
  7675. return this.dataSet;
  7676. }
  7677. /**
  7678. * @function SuperMap.Layer.MapVLayer.prototype.removeData
  7679. * @description 删除符合过滤条件的数据。
  7680. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  7681. * @example
  7682. * filter=function(data){
  7683. * if(data.id=="1"){
  7684. * return true
  7685. * }
  7686. * return false;
  7687. * }
  7688. */
  7689. removeData(filter) {
  7690. this.renderer && this.renderer.removeData(filter);
  7691. }
  7692. /**
  7693. * @function SuperMap.Layer.MapVLayer.prototype.clearData
  7694. * @description 清除数据
  7695. */
  7696. clearData() {
  7697. this.renderer.clearData();
  7698. }
  7699. /**
  7700. * @function SuperMap.Layer.MapVLayer.prototype.setMap
  7701. * @description 图层已经添加到 Map 中。
  7702. * 如果当前浏览器支持 canvas,则开始渲染要素;如果不支持则移除图层。
  7703. * @param {SuperMap.Map} map - 需要绑定的 map 对象。
  7704. */
  7705. setMap(map) {
  7706. super.setMap(map);
  7707. this.renderer = new MapVRenderer(map, this, this.dataSet, this.options);
  7708. if (!this.supported) {
  7709. this.map.removeLayer(this);
  7710. } else {
  7711. this.redraw();
  7712. }
  7713. }
  7714. /**
  7715. * @function SuperMap.Layer.MapVLayer.prototype.moveTo
  7716. * @description 重置当前 MapV 图层的 div,再一次与 Map 控件保持一致。
  7717. * 修改当前显示范围,当平移或者缩放结束后开始重绘 MapV 图的渲染效果。
  7718. * @param {SuperMap.Bounds} bounds - 图层范围。
  7719. * @param {boolean} [zoomChanged] - 缩放级别是否改变。
  7720. * @param {boolean} [dragging] - 是否拖动。
  7721. */
  7722. moveTo(bounds, zoomChanged, dragging) {
  7723. super.moveTo(bounds, zoomChanged, dragging);
  7724. if (!this.supported) {
  7725. return;
  7726. }
  7727. this.zoomChanged = zoomChanged;
  7728. if (!dragging) {
  7729. this.div.style.visibility = 'hidden';
  7730. this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + 'px';
  7731. this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + 'px';
  7732. /*this.canvas.style.left = this.div.style.left;
  7733. this.canvas.style.top = this.div.style.top;*/
  7734. var size = this.map.getSize();
  7735. this.div.style.width = parseInt(size.w) + 'px';
  7736. this.div.style.height = parseInt(size.h) + 'px';
  7737. this.canvas.width = parseInt(size.w);
  7738. this.canvas.height = parseInt(size.h);
  7739. this.canvas.style.width = this.div.style.width;
  7740. this.canvas.style.height = this.div.style.height;
  7741. this.maxWidth = size.w;
  7742. this.maxHeight = size.h;
  7743. this.div.style.visibility = '';
  7744. if (!zoomChanged) {
  7745. this.renderer && this.renderer.render();
  7746. }
  7747. }
  7748. if (zoomChanged) {
  7749. this.renderer && this.renderer.render();
  7750. }
  7751. }
  7752. /**
  7753. * @function SuperMap.Layer.MapVLayer.prototype.transferToMapLatLng
  7754. * @description 将经纬度转成底图的投影坐标。
  7755. * @param {SuperMap.Lonlat} latLng - 经纬度坐标。
  7756. * @deprecated
  7757. */
  7758. transferToMapLatLng(latLng) {
  7759. var source = 'EPSG:4326',
  7760. dest = 'EPSG:4326';
  7761. var unit = this.map.getUnits() || 'degree';
  7762. if (['m', 'meter'].indexOf(unit.toLowerCase()) > -1) {
  7763. dest = 'EPSG:3857';
  7764. }
  7765. return new SuperMap_SuperMap.LonLat(latLng.lon, latLng.lat).transform(source, dest);
  7766. }
  7767. }
  7768. SuperMap_SuperMap.Layer.MapVLayer = MapVLayer;
  7769. ;// CONCATENATED MODULE: ./src/classic/overlay/mapv/index.js
  7770. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7771. * This program are made available under the terms of the Apache License, Version 2.0
  7772. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7773. ;// CONCATENATED MODULE: ./src/classic/overlay/index.js
  7774. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7775. * This program are made available under the terms of the Apache License, Version 2.0
  7776. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7777. ;// CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  7778. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7779. * This program are made available under the terms of the Apache License, Version 2.0
  7780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7781. /**
  7782. * @class SuperMap.Credential
  7783. * @category Security
  7784. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  7785. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  7786. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  7787. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  7788. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  7789. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  7790. * @example
  7791. * var pixcel = new SuperMap.Credential("valueString","token");
  7792. * pixcel.destroy();
  7793. */
  7794. class Credential {
  7795. constructor(value, name) {
  7796. /**
  7797. * @member {string} SuperMap.Bounds.prototype.value
  7798. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  7799. */
  7800. this.value = value ? value : "";
  7801. /**
  7802. * @member {string} [SuperMap.Bounds.prototype.name='token']
  7803. * @description 验证信息前缀,name=value 部分的 name 部分。
  7804. */
  7805. this.name = name ? name : "token";
  7806. this.CLASS_NAME = "SuperMap.Credential";
  7807. }
  7808. /**
  7809. * @function SuperMap.Credential.prototype.getUrlParameters
  7810. * @example
  7811. * var credential = new SuperMap.Credential("valueString","token");
  7812. * //这里 str = "token=valueString";
  7813. * var str = credential.getUrlParameters();
  7814. * @returns {string} 返回安全信息组成的 url 片段。
  7815. */
  7816. getUrlParameters() {
  7817. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  7818. return this.name + "=" + this.value;
  7819. }
  7820. /**
  7821. * @function SuperMap.Bounds.prototype.getValue
  7822. * @description 获取 value。
  7823. * @example
  7824. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  7825. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  7826. * var str = credential.getValue();
  7827. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  7828. */
  7829. getValue() {
  7830. return this.value;
  7831. }
  7832. /**
  7833. *
  7834. * @function SuperMap.Credential.prototype.destroy
  7835. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  7836. * @example
  7837. * var credential = new SuperMap.Credential("valueString","token");
  7838. * credential.destroy();
  7839. */
  7840. destroy() {
  7841. this.value = null;
  7842. this.name = null;
  7843. }
  7844. }
  7845. /**
  7846. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  7847. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  7848. * @constant
  7849. * @example
  7850. * 代码实例:
  7851. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  7852. * var value = "(以iServer为例,这里是申请的token值)";
  7853. * var name = "token";
  7854. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  7855. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  7856. *
  7857. */
  7858. Credential.CREDENTIAL = null;
  7859. SuperMap.Credential = Credential;
  7860. ;// CONCATENATED MODULE: ./src/common/format/Format.js
  7861. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7862. * This program are made available under the terms of the Apache License, Version 2.0
  7863. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7864. /**
  7865. * @class SuperMap.Format
  7866. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  7867. * @category BaseTypes Format
  7868. * @param {Object} options - 可选参数。
  7869. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  7870. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  7871. */
  7872. class Format {
  7873. constructor(options) {
  7874. /**
  7875. * @member {Object} SuperMap.Format.prototype.data
  7876. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  7877. */
  7878. this.data = null;
  7879. /**
  7880. * APIProperty: keepData
  7881. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  7882. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  7883. */
  7884. this.keepData = false;
  7885. Util.extend(this, options);
  7886. this.options = options;
  7887. this.CLASS_NAME = "SuperMap.Format";
  7888. }
  7889. /**
  7890. * @function SuperMap.Format.prototype.destroy
  7891. * @description 销毁该格式类,释放相关资源。
  7892. */
  7893. destroy() {
  7894. //用来销毁该格式类,释放相关资源
  7895. }
  7896. /**
  7897. * @function SuperMap.Format.prototype.read
  7898. * @description 来从字符串中读取数据。
  7899. * @param {string} data - 读取的数据。
  7900. */
  7901. read(data) { // eslint-disable-line no-unused-vars
  7902. //用来从字符串中读取数据
  7903. }
  7904. /**
  7905. * @function SuperMap.Format.prototype.write
  7906. * @description 将对象写成字符串。
  7907. * @param {Object} object - 可序列化的对象。
  7908. * @returns {string} 对象被写成字符串。
  7909. */
  7910. write(object) { // eslint-disable-line no-unused-vars
  7911. //用来写字符串
  7912. }
  7913. }
  7914. SuperMap.Format = SuperMap.Format || Format;
  7915. ;// CONCATENATED MODULE: ./src/common/format/JSON.js
  7916. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  7917. * This program are made available under the terms of the Apache License, Version 2.0
  7918. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7919. /**
  7920. * @class SuperMap.Format.JSON
  7921. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  7922. * @category BaseTypes Format
  7923. * @param {Object} [options] - 参数。
  7924. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  7925. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  7926. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  7927. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  7928. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  7929. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  7930. * @extends {SuperMap.Format}
  7931. */
  7932. class JSONFormat extends Format {
  7933. constructor(options) {
  7934. super(options);
  7935. /**
  7936. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  7937. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  7938. */
  7939. this.indent = " ";
  7940. /**
  7941. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  7942. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  7943. */
  7944. this.space = " ";
  7945. /**
  7946. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  7947. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  7948. */
  7949. this.newline = "\n";
  7950. /**
  7951. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  7952. * @description 用于格式化输出, 表示的是缩进级别。
  7953. */
  7954. this.level = 0;
  7955. /**
  7956. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  7957. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  7958. */
  7959. this.pretty = false;
  7960. /**
  7961. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  7962. * @description 判断浏览器是否原生支持 JSON 格式数据。
  7963. */
  7964. this.nativeJSON = (function () {
  7965. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  7966. })();
  7967. this.CLASS_NAME = "SuperMap.Format.JSON";
  7968. /**
  7969. * @member SuperMap.Format.JSON.prototype.serialize
  7970. * @description 提供一些类型对象转 JSON 字符串的方法。
  7971. */
  7972. this.serialize = {
  7973. /**
  7974. * @function SuperMap.Format.JSON.serialize.object
  7975. * @description 把对象转换为 JSON 字符串。
  7976. * @param {Object} object - 可序列化的对象。
  7977. * @returns {string} JSON 字符串。
  7978. */
  7979. 'object': function (object) {
  7980. // three special objects that we want to treat differently
  7981. if (object == null) {
  7982. return "null";
  7983. }
  7984. if (object.constructor === Date) {
  7985. return this.serialize.date.apply(this, [object]);
  7986. }
  7987. if (object.constructor === Array) {
  7988. return this.serialize.array.apply(this, [object]);
  7989. }
  7990. var pieces = ['{'];
  7991. this.level += 1;
  7992. var key, keyJSON, valueJSON;
  7993. var addComma = false;
  7994. for (key in object) {
  7995. if (object.hasOwnProperty(key)) {
  7996. // recursive calls need to allow for sub-classing
  7997. keyJSON = this.write.apply(this,
  7998. [key, this.pretty]);
  7999. valueJSON = this.write.apply(this,
  8000. [object[key], this.pretty]);
  8001. if (keyJSON != null && valueJSON != null) {
  8002. if (addComma) {
  8003. pieces.push(',');
  8004. }
  8005. pieces.push(this.writeNewline(), this.writeIndent(),
  8006. keyJSON, ':', this.writeSpace(), valueJSON);
  8007. addComma = true;
  8008. }
  8009. }
  8010. }
  8011. this.level -= 1;
  8012. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  8013. return pieces.join('');
  8014. },
  8015. /**
  8016. * @function SuperMap.Format.JSON.serialize.array
  8017. * @description 把数组转换成 JSON 字符串。
  8018. * @param {Array} array - 可序列化的数组。
  8019. * @returns {string} JSON 字符串。
  8020. */
  8021. 'array': function (array) {
  8022. var json;
  8023. var pieces = ['['];
  8024. this.level += 1;
  8025. for (var i = 0, len = array.length; i < len; ++i) {
  8026. // recursive calls need to allow for sub-classing
  8027. json = this.write.apply(this,
  8028. [array[i], this.pretty]);
  8029. if (json != null) {
  8030. if (i > 0) {
  8031. pieces.push(',');
  8032. }
  8033. pieces.push(this.writeNewline(), this.writeIndent(), json);
  8034. }
  8035. }
  8036. this.level -= 1;
  8037. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  8038. return pieces.join('');
  8039. },
  8040. /**
  8041. * @function SuperMap.Format.JSON.serialize.string
  8042. * @description 把字符串转换成 JSON 字符串。
  8043. * @param {string} string - 可序列化的字符串。
  8044. * @returns {string} JSON 字符串。
  8045. */
  8046. 'string': function (string) {
  8047. // If the string contains no control characters, no quote characters, and no
  8048. // backslash characters, then we can simply slap some quotes around it.
  8049. // Otherwise we must also replace the offending characters with safe
  8050. // sequences.
  8051. var m = {
  8052. '\b': '\\b',
  8053. '\t': '\\t',
  8054. '\n': '\\n',
  8055. '\f': '\\f',
  8056. '\r': '\\r',
  8057. '"': '\\"',
  8058. '\\': '\\\\'
  8059. };
  8060. /*eslint-disable no-control-regex*/
  8061. if (/["\\\x00-\x1f]/.test(string)) {
  8062. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  8063. var c = m[b];
  8064. if (c) {
  8065. return c;
  8066. }
  8067. c = b.charCodeAt();
  8068. return '\\u00' +
  8069. Math.floor(c / 16).toString(16) +
  8070. (c % 16).toString(16);
  8071. }) + '"';
  8072. }
  8073. return '"' + string + '"';
  8074. },
  8075. /**
  8076. * @function SuperMap.Format.JSON.serialize.number
  8077. * @description 把数字转换成 JSON 字符串。
  8078. * @param {number} number - 可序列化的数字。
  8079. * @returns {string} JSON 字符串。
  8080. */
  8081. 'number': function (number) {
  8082. return isFinite(number) ? String(number) : "null";
  8083. },
  8084. /**
  8085. * @function SuperMap.Format.JSON.serialize.boolean
  8086. * @description Transform a boolean into a JSON string.
  8087. * @param {boolean} bool - The boolean to be serialized.
  8088. * @returns {string} A JSON string representing the boolean.
  8089. */
  8090. 'boolean': function (bool) {
  8091. return String(bool);
  8092. },
  8093. /**
  8094. * @function SuperMap.Format.JSON.serialize.object
  8095. * @description 将日期对象转换成 JSON 字符串。
  8096. * @param {Date} date - 可序列化的日期对象。
  8097. * @returns {string} JSON 字符串。
  8098. */
  8099. 'date': function (date) {
  8100. function format(number) {
  8101. // Format integers to have at least two digits.
  8102. return (number < 10) ? '0' + number : number;
  8103. }
  8104. return '"' + date.getFullYear() + '-' +
  8105. format(date.getMonth() + 1) + '-' +
  8106. format(date.getDate()) + 'T' +
  8107. format(date.getHours()) + ':' +
  8108. format(date.getMinutes()) + ':' +
  8109. format(date.getSeconds()) + '"';
  8110. }
  8111. };
  8112. }
  8113. /**
  8114. * @function SuperMap.Format.JSON.prototype.read
  8115. * @description 将一个符合 JSON 结构的字符串进行解析。
  8116. * @param {string} json - 符合 JSON 结构的字符串。
  8117. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  8118. * @returns {Object} 对象,数组,字符串或数字。
  8119. */
  8120. read(json, filter) {
  8121. var object;
  8122. if (this.nativeJSON) {
  8123. try {
  8124. object = JSON.parse(json, filter);
  8125. } catch (e) {
  8126. // Fall through if the regexp test fails.
  8127. }
  8128. }
  8129. if (this.keepData) {
  8130. this.data = object;
  8131. }
  8132. return object;
  8133. }
  8134. /**
  8135. * @function SuperMap.Format.JSON.prototype.write
  8136. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  8137. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  8138. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8139. * @returns {string} 符合 JSON 格式的字符串。
  8140. *
  8141. */
  8142. write(value, pretty) {
  8143. this.pretty = !!pretty;
  8144. var json = null;
  8145. var type = typeof value;
  8146. if (this.serialize[type]) {
  8147. try {
  8148. json = (!this.pretty && this.nativeJSON) ?
  8149. JSON.stringify(value) :
  8150. this.serialize[type].apply(this, [value]);
  8151. } catch (err) {
  8152. //SuperMap.Console.error("Trouble serializing: " + err);
  8153. }
  8154. }
  8155. return json;
  8156. }
  8157. /**
  8158. * @function SuperMap.Format.JSON.prototype.writeIndent
  8159. * @description 根据缩进级别输出一个缩进字符串。
  8160. * @private
  8161. * @returns {string} 一个适当的缩进字符串。
  8162. */
  8163. writeIndent() {
  8164. var pieces = [];
  8165. if (this.pretty) {
  8166. for (var i = 0; i < this.level; ++i) {
  8167. pieces.push(this.indent);
  8168. }
  8169. }
  8170. return pieces.join('');
  8171. }
  8172. /**
  8173. * @function SuperMap.Format.JSON.prototype.writeNewline
  8174. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  8175. * @private
  8176. * @returns {string} 代表新的一行的字符串。
  8177. */
  8178. writeNewline() {
  8179. return (this.pretty) ? this.newline : '';
  8180. }
  8181. /**
  8182. * @function SuperMap.Format.JSON.prototype.writeSpace
  8183. * @private
  8184. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  8185. * @returns {string} 一个空格。
  8186. */
  8187. writeSpace() {
  8188. return (this.pretty) ? this.space : '';
  8189. }
  8190. }
  8191. SuperMap.Format.JSON = JSONFormat;
  8192. ;// CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  8193. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8194. * This program are made available under the terms of the Apache License, Version 2.0
  8195. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8196. /**
  8197. * @class SuperMap.CommonServiceBase
  8198. * @category iServer
  8199. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  8200. * @param {string} url - 服务地址。
  8201. * @param {Object} options - 参数。
  8202. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  8203. * @param {string} [options.proxy] - 服务代理地址。
  8204. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  8205. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  8206. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8207. * @param {Object} [options.headers] - 请求头。
  8208. */
  8209. class CommonServiceBase {
  8210. constructor(url, options) {
  8211. let me = this;
  8212. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  8213. this.events = null;
  8214. this.eventListeners = null;
  8215. this.url = null;
  8216. this.urls = null;
  8217. this.proxy = null;
  8218. this.serverType = null;
  8219. this.index = null;
  8220. this.length = null;
  8221. this.options = null;
  8222. this.totalTimes = null;
  8223. this.POLLING_TIMES = 3;
  8224. this._processSuccess = null;
  8225. this._processFailed = null;
  8226. this.isInTheSameDomain = null;
  8227. this.withCredentials = false;
  8228. if (Util.isArray(url)) {
  8229. me.urls = url;
  8230. me.length = url.length;
  8231. me.totalTimes = me.length;
  8232. if (me.length === 1) {
  8233. me.url = url[0];
  8234. } else {
  8235. me.index = parseInt(Math.random() * me.length);
  8236. me.url = url[me.index];
  8237. }
  8238. } else {
  8239. me.totalTimes = 1;
  8240. me.url = url;
  8241. }
  8242. if (Util.isArray(url) && !me.isServiceSupportPolling()) {
  8243. me.url = url[0];
  8244. me.totalTimes = 1;
  8245. }
  8246. me.serverType = me.serverType || ServerType.ISERVER;
  8247. options = options || {};
  8248. this.crossOrigin = options.crossOrigin;
  8249. this.headers = options.headers;
  8250. Util.extend(this, options);
  8251. me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
  8252. me.events = new Events(me, null, me.EVENT_TYPES, true);
  8253. if (me.eventListeners instanceof Object) {
  8254. me.events.on(me.eventListeners);
  8255. }
  8256. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  8257. }
  8258. /**
  8259. * @function SuperMap.CommonServiceBase.prototype.destroy
  8260. * @description 释放资源,将引用的资源属性置空。
  8261. */
  8262. destroy() {
  8263. let me = this;
  8264. if (Util.isArray(me.urls)) {
  8265. me.urls = null;
  8266. me.index = null;
  8267. me.length = null;
  8268. me.totalTimes = null;
  8269. }
  8270. me.url = null;
  8271. me.options = null;
  8272. me._processSuccess = null;
  8273. me._processFailed = null;
  8274. me.isInTheSameDomain = null;
  8275. me.EVENT_TYPES = null;
  8276. if (me.events) {
  8277. me.events.destroy();
  8278. me.events = null;
  8279. }
  8280. if (me.eventListeners) {
  8281. me.eventListeners = null;
  8282. }
  8283. }
  8284. /**
  8285. * @function SuperMap.CommonServiceBase.prototype.request
  8286. * @description: 该方法用于向服务发送请求。
  8287. * @param {Object} options - 参数。
  8288. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  8289. * @param {string} [options.url] - 发送请求的地址。
  8290. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  8291. * @param {string} [options.data] - 发送到服务器的数据。
  8292. * @param {function} options.success - 请求成功后的回调函数。
  8293. * @param {function} options.failure - 请求失败后的回调函数。
  8294. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  8295. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  8296. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  8297. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8298. * @param {Object} [options.headers] - 请求头。
  8299. */
  8300. request(options) {
  8301. let me = this;
  8302. options.url = options.url || me.url;
  8303. options.proxy = options.proxy || me.proxy;
  8304. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  8305. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  8306. options.headers = options.headers || me.headers;
  8307. options.isInTheSameDomain = me.isInTheSameDomain;
  8308. //为url添加安全认证信息片段
  8309. let credential = this.getCredential(options.url);
  8310. if (credential) {
  8311. options.url = Util.urlAppend(options.url, credential.getUrlParameters());
  8312. }
  8313. me.calculatePollingTimes();
  8314. me._processSuccess = options.success;
  8315. me._processFailed = options.failure;
  8316. options.scope = me;
  8317. options.success = me.getUrlCompleted;
  8318. options.failure = me.getUrlFailed;
  8319. me.options = options;
  8320. me._commit(me.options);
  8321. }
  8322. /**
  8323. * @function SuperMap.CommonServiceBase.prototype.getCredential
  8324. * @description 获取凭据信息
  8325. * @param {string} url - 服务地址。
  8326. * @returns {SuperMap.Credential} 凭据信息对象。
  8327. */
  8328. getCredential(url) {
  8329. let keyUrl = url,
  8330. credential, value;
  8331. switch (this.serverType) {
  8332. case ServerType.IPORTAL:
  8333. value = SecurityManager.getToken(keyUrl);
  8334. credential = value ? new Credential(value, "token") : null;
  8335. if (!credential) {
  8336. value = SecurityManager.getKey(keyUrl);
  8337. credential = value ? new Credential(value, "key") : null;
  8338. }
  8339. break;
  8340. case ServerType.ONLINE:
  8341. value = SecurityManager.getKey(keyUrl);
  8342. credential = value ? new Credential(value, "key") : null;
  8343. break;
  8344. default:
  8345. //iServer or others
  8346. value = SecurityManager.getToken(keyUrl);
  8347. credential = value ? new Credential(value, "token") : null;
  8348. break;
  8349. }
  8350. return credential;
  8351. }
  8352. /**
  8353. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  8354. * @description 请求成功后执行此方法。
  8355. * @param {Object} result - 服务器返回的结果对象。
  8356. */
  8357. getUrlCompleted(result) {
  8358. let me = this;
  8359. me._processSuccess(result);
  8360. }
  8361. /**
  8362. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  8363. * @description 请求失败后执行此方法。
  8364. * @param {Object} result - 服务器返回的结果对象。
  8365. */
  8366. getUrlFailed(result) {
  8367. let me = this;
  8368. if (me.totalTimes > 0) {
  8369. me.totalTimes--;
  8370. me.ajaxPolling();
  8371. } else {
  8372. me._processFailed(result);
  8373. }
  8374. }
  8375. /**
  8376. *
  8377. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  8378. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  8379. */
  8380. ajaxPolling() {
  8381. let me = this,
  8382. url = me.options.url,
  8383. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  8384. me.index = parseInt(Math.random() * me.length);
  8385. me.url = me.urls[me.index];
  8386. url = url.replace(re, re.exec(me.url)[0]);
  8387. me.options.url = url;
  8388. me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
  8389. me._commit(me.options);
  8390. }
  8391. /**
  8392. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  8393. * @description 计算剩余请求失败执行次数。
  8394. */
  8395. calculatePollingTimes() {
  8396. let me = this;
  8397. if (me.times) {
  8398. if (me.totalTimes > me.POLLING_TIMES) {
  8399. if (me.times > me.POLLING_TIMES) {
  8400. me.totalTimes = me.POLLING_TIMES;
  8401. } else {
  8402. me.totalTimes = me.times;
  8403. }
  8404. } else {
  8405. if (me.times < me.totalTimes) {
  8406. me.totalTimes = me.times;
  8407. }
  8408. }
  8409. } else {
  8410. if (me.totalTimes > me.POLLING_TIMES) {
  8411. me.totalTimes = me.POLLING_TIMES;
  8412. }
  8413. }
  8414. me.totalTimes--;
  8415. }
  8416. /**
  8417. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  8418. * @description 判断服务是否支持轮询。
  8419. */
  8420. isServiceSupportPolling() {
  8421. let me = this;
  8422. return !(
  8423. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  8424. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  8425. );
  8426. }
  8427. /**
  8428. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  8429. * @description 状态完成,执行此方法。
  8430. * @param {Object} result - 服务器返回的结果对象。
  8431. */
  8432. serviceProcessCompleted(result) {
  8433. result = Util.transformResult(result);
  8434. this.events.triggerEvent("processCompleted", {
  8435. result: result
  8436. });
  8437. }
  8438. /**
  8439. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  8440. * @description 状态失败,执行此方法。
  8441. * @param {Object} result - 服务器返回的结果对象。
  8442. */
  8443. serviceProcessFailed(result) {
  8444. result = Util.transformResult(result);
  8445. let error = result.error || result;
  8446. this.events.triggerEvent("processFailed", {
  8447. error: error
  8448. });
  8449. }
  8450. _commit(options) {
  8451. if (options.method === "POST" || options.method === "PUT") {
  8452. if (options.params) {
  8453. options.url = Util.urlAppend(options.url,
  8454. Util.getParameterString(options.params || {}));
  8455. }
  8456. options.params = options.data;
  8457. }
  8458. FetchRequest.commit(options.method, options.url, options.params, {
  8459. headers: options.headers,
  8460. withCredentials: options.withCredentials,
  8461. crossOrigin: options.crossOrigin,
  8462. timeout: options.async ? 0 : null,
  8463. proxy: options.proxy
  8464. }).then(function (response) {
  8465. if (response.text) {
  8466. return response.text();
  8467. }
  8468. if (response.json) {
  8469. return response.json();
  8470. }
  8471. return response;
  8472. }).then(function (text) {
  8473. var result = text;
  8474. if (typeof text === "string") {
  8475. result = new JSONFormat().read(text);
  8476. }
  8477. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  8478. if (result && result.error) {
  8479. result = {
  8480. error: result.error
  8481. };
  8482. } else {
  8483. result = {
  8484. error: result
  8485. };
  8486. }
  8487. }
  8488. if (result.error) {
  8489. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  8490. failure(result);
  8491. } else {
  8492. result.succeed = result.succeed == undefined ? true : result.succeed;
  8493. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  8494. success(result);
  8495. }
  8496. }).catch(function (e) {
  8497. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  8498. failure(e);
  8499. })
  8500. }
  8501. }
  8502. SuperMap.CommonServiceBase = CommonServiceBase;
  8503. /**
  8504. * 服务器请求回调函数
  8505. * @callback RequestCallback
  8506. * @example
  8507. * var requestCallback = function (serviceResult){
  8508. * console.log(serviceResult.result);
  8509. * }
  8510. * new QueryService(url).queryByBounds(param, requestCallback);
  8511. * @param {Object} serviceResult
  8512. * @param {Object} serviceResult.result 服务器返回结果。
  8513. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  8514. * @param {Object} serviceResult.type 事件类型。
  8515. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  8516. */
  8517. ;// CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  8518. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8519. * This program are made available under the terms of the Apache License, Version 2.0
  8520. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8521. /**
  8522. * @class SuperMap.AddressMatchService
  8523. * @category iServer AddressMatch
  8524. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  8525. * @param {string} url - 地址匹配服务地址。
  8526. * @param {Object} options - 参数。
  8527. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8528. * @param {Object} [options.headers] - 请求头。
  8529. */
  8530. class AddressMatchService_AddressMatchService extends CommonServiceBase {
  8531. constructor(url, options) {
  8532. super(url, options);
  8533. this.options = options || {};
  8534. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  8535. }
  8536. /**
  8537. * @function SuperMap.AddressMatchService.prototype.destroy
  8538. * @override
  8539. */
  8540. destroy() {
  8541. super.destroy();
  8542. }
  8543. /**
  8544. * @function SuperMap.AddressMatchService.prototype.code
  8545. * @param {string} url - 正向地址匹配服务地址。
  8546. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  8547. */
  8548. code(url, params) {
  8549. if (!(params instanceof GeoCodingParameter)) {
  8550. return;
  8551. }
  8552. this.processAsync(url, params);
  8553. }
  8554. /**
  8555. * @function SuperMap.AddressMatchService.prototype.decode
  8556. * @param {string} url - 反向地址匹配服务地址。
  8557. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  8558. */
  8559. decode(url, params) {
  8560. if (!(params instanceof GeoDecodingParameter)) {
  8561. return;
  8562. }
  8563. this.processAsync(url, params);
  8564. }
  8565. /**
  8566. * @function SuperMap.AddressMatchService.prototype.processAsync
  8567. * @description 负责将客户端的动态分段服务参数传递到服务端。
  8568. * @param {string} url - 服务地址。
  8569. * @param {Object} params - 参数。
  8570. */
  8571. processAsync(url, params) {
  8572. this.request({
  8573. method: 'GET',
  8574. url,
  8575. params,
  8576. scope: this,
  8577. success: this.serviceProcessCompleted,
  8578. failure: this.serviceProcessFailed
  8579. });
  8580. }
  8581. /**
  8582. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  8583. * @param {Object} result - 服务器返回的结果对象。
  8584. * @description 服务流程是否完成
  8585. */
  8586. serviceProcessCompleted(result) {
  8587. if (result.succeed) {
  8588. delete result.succeed;
  8589. }
  8590. super.serviceProcessCompleted(result);
  8591. }
  8592. /**
  8593. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  8594. * @param {Object} result - 服务器返回的结果对象。
  8595. * @description 服务流程是否失败
  8596. */
  8597. serviceProcessFailed(result) {
  8598. super.serviceProcessFailed(result);
  8599. }
  8600. }
  8601. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  8602. ;// CONCATENATED MODULE: ./src/classic/services/AddressMatchService.js
  8603. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8604. * This program are made available under the terms of the Apache License, Version 2.0
  8605. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8606. /**
  8607. * @class SuperMap.REST.AddressMatchService
  8608. * @category iServer AddressMatch
  8609. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  8610. * @extends {SuperMap.CommonServiceBase}
  8611. * @param {string} url - 服务地址。
  8612. * @param {Object} options - 参数。
  8613. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8614. * @param {Object} [options.headers] - 请求头。
  8615. */
  8616. class AddressMatchService extends CommonServiceBase {
  8617. constructor(url, options) {
  8618. super(url, options);
  8619. this.CLASS_NAME = "SuperMap.REST.AddressMatchService";
  8620. }
  8621. /**
  8622. * @function SuperMap.REST.AddressMatchService.prototype.code
  8623. * @description 正向匹配。
  8624. * @param {SuperMap.GeoCodingParameter} params - 正向匹配参数。
  8625. * @param {RequestCallback} callback - 回调函数。
  8626. */
  8627. code(params, callback) {
  8628. var me = this;
  8629. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  8630. headers: me.headers,
  8631. proxy: me.proxy,
  8632. withCredentials: me.withCredentials,
  8633. crossOrigin: me.crossOrigin,
  8634. serverType: me.serverType,
  8635. eventListeners: {
  8636. scope: me,
  8637. processCompleted: callback,
  8638. processFailed: callback
  8639. }
  8640. });
  8641. addressMatchService.code(me.url + '/geocoding', params);
  8642. }
  8643. /**
  8644. * @function SuperMap.REST.AddressMatchService.prototype.decode
  8645. * @description 反向匹配。
  8646. * @param {SuperMap.GeoDecodingParameter} params - 反向匹配参数。
  8647. * @param {RequestCallback} callback - 回调函数。
  8648. */
  8649. decode(params, callback) {
  8650. var me = this;
  8651. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  8652. headers: me.headers,
  8653. proxy: me.proxy,
  8654. withCredentials: me.withCredentials,
  8655. crossOrigin: me.crossOrigin,
  8656. serverType: me.serverType,
  8657. eventListeners: {
  8658. scope: me,
  8659. processCompleted: callback,
  8660. processFailed: callback
  8661. }
  8662. });
  8663. addressMatchService.decode(me.url + '/geodecoding', params);
  8664. }
  8665. }
  8666. SuperMap_SuperMap.REST.AddressMatchService = AddressMatchService;
  8667. ;// CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  8668. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8669. * This program are made available under the terms of the Apache License, Version 2.0
  8670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8671. /**
  8672. * @class SuperMap.ProcessingServiceBase
  8673. * @category iServer ProcessingService
  8674. * @classdesc 分布式分析服务基类
  8675. * @extends {SuperMap.CommonServiceBase}
  8676. * @param {string} url - 分布式分析服务地址。
  8677. * @param {Object} options - 参数。
  8678. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  8679. * @param {number} options.index - 服务访问地址在数组中的位置。
  8680. * @param {number} options.length - 服务访问地址数组长度。
  8681. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  8682. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  8683. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8684. * @param {Object} [options.headers] - 请求头。
  8685. */
  8686. class ProcessingServiceBase extends CommonServiceBase {
  8687. constructor(url, options) {
  8688. options = options || {};
  8689. /*
  8690. * Constant: EVENT_TYPES
  8691. * {Array.<string>}
  8692. * 此类支持的事件类型
  8693. * - *processCompleted* 创建成功后触发的事件。
  8694. * - *processFailed* 创建失败后触发的事件 。
  8695. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  8696. */
  8697. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  8698. super(url, options);
  8699. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  8700. }
  8701. /**
  8702. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  8703. * @override
  8704. */
  8705. destroy() {
  8706. super.destroy();
  8707. }
  8708. /**
  8709. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  8710. * @description 获取分布式分析任务。
  8711. * @param {string} url - 资源地址。
  8712. */
  8713. getJobs(url) {
  8714. var me = this;
  8715. FetchRequest.get(me._processUrl(url), null, {
  8716. proxy: me.proxy
  8717. }).then(function (response) {
  8718. return response.json();
  8719. }).then(function (result) {
  8720. me.events.triggerEvent("processCompleted", {
  8721. result: result
  8722. });
  8723. }).catch(function (e) {
  8724. me.eventListeners.processFailed({
  8725. error: e
  8726. });
  8727. });
  8728. }
  8729. /**
  8730. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  8731. * @description 添加分布式分析任务。
  8732. * @param {string} url - 资源根地址。
  8733. * @param {Object} params - 创建一个空间分析的请求参数。
  8734. * @param {string} paramType - 请求参数类型。
  8735. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  8736. */
  8737. addJob(url, params, paramType, seconds) {
  8738. var me = this,
  8739. parameterObject = null;
  8740. if (params && params instanceof paramType) {
  8741. parameterObject = new Object();
  8742. paramType.toObject(params, parameterObject);
  8743. }
  8744. let headers = Object.assign({
  8745. 'Content-Type': 'application/x-www-form-urlencoded'
  8746. }, me.headers || {})
  8747. var options = {
  8748. proxy: me.proxy,
  8749. headers,
  8750. withCredentials: me.withCredentials,
  8751. crossOrigin: me.crossOrigin,
  8752. isInTheSameDomain: me.isInTheSameDomain
  8753. };
  8754. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  8755. return response.json();
  8756. }).then(function (result) {
  8757. if (result.succeed) {
  8758. me.serviceProcessCompleted(result, seconds);
  8759. } else {
  8760. me.serviceProcessFailed(result);
  8761. }
  8762. }).catch(function (e) {
  8763. me.serviceProcessFailed({
  8764. error: e
  8765. });
  8766. });
  8767. }
  8768. serviceProcessCompleted(result, seconds) {
  8769. result = Util.transformResult(result);
  8770. seconds = seconds || 1000;
  8771. var me = this;
  8772. if (result) {
  8773. var id = setInterval(function () {
  8774. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  8775. _t: new Date().getTime()
  8776. })
  8777. .then(function (response) {
  8778. return response.json();
  8779. }).then(function (job) {
  8780. me.events.triggerEvent("processRunning", {
  8781. id: job.id,
  8782. state: job.state
  8783. });
  8784. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  8785. clearInterval(id);
  8786. me.events.triggerEvent("processFailed", {
  8787. error: job.state.errorMsg,
  8788. state: job.state.runState
  8789. });
  8790. }
  8791. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  8792. clearInterval(id);
  8793. me.events.triggerEvent("processCompleted", {
  8794. result: job
  8795. });
  8796. }
  8797. }).catch(function (e) {
  8798. clearInterval(id);
  8799. me.events.triggerEvent("processFailed", {
  8800. error: e
  8801. });
  8802. });
  8803. }, seconds);
  8804. }
  8805. }
  8806. serviceProcessFailed(result) {
  8807. super.serviceProcessFailed(result);
  8808. }
  8809. _processUrl(url) {
  8810. if (SecurityManager.getToken(url)) {
  8811. url = Util.urlAppend(url, 'token=' + SecurityManager.getToken(url));
  8812. }
  8813. return url;
  8814. }
  8815. }
  8816. SuperMap.ProcessingServiceBase = ProcessingServiceBase;
  8817. ;// CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  8818. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8819. * This program are made available under the terms of the Apache License, Version 2.0
  8820. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8821. /**
  8822. * @class SuperMap.KernelDensityJobsService
  8823. * @category iServer ProcessingService DensityAnalyst
  8824. * @classdesc 核密度分析服务类
  8825. * @extends {SuperMap.ProcessingServiceBase}
  8826. * @param {string} url -核密度分析服务地址。
  8827. * @param {Object} options - 交互服务时所需可选参数。
  8828. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8829. * @param {Object} [options.headers] - 请求头。
  8830. */
  8831. class KernelDensityJobsService extends ProcessingServiceBase {
  8832. constructor(url, options) {
  8833. super(url, options);
  8834. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
  8835. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  8836. }
  8837. /**
  8838. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  8839. * @override
  8840. */
  8841. destroy() {
  8842. super.destroy();
  8843. }
  8844. /**
  8845. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  8846. * @description 获取核密度分析任务
  8847. */
  8848. getKernelDensityJobs() {
  8849. super.getJobs(this.url);
  8850. }
  8851. /**
  8852. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  8853. * @description 获取指定id的核密度分析服务
  8854. * @param {string} id - 指定要获取数据的id
  8855. */
  8856. getKernelDensityJob(id) {
  8857. super.getJobs(Util.urlPathAppend(this.url, id));
  8858. }
  8859. /**
  8860. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  8861. * @description 新建核密度分析服务
  8862. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  8863. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  8864. */
  8865. addKernelDensityJob(params, seconds) {
  8866. super.addJob(this.url, params, KernelDensityJobParameter, seconds);
  8867. }
  8868. }
  8869. SuperMap.KernelDensityJobsService = KernelDensityJobsService;
  8870. ;// CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  8871. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8872. * This program are made available under the terms of the Apache License, Version 2.0
  8873. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8874. /**
  8875. * @class SuperMap.SingleObjectQueryJobsService
  8876. * @category iServer ProcessingService Query
  8877. * @classdesc 单对象查询分析服务类
  8878. * @extends {SuperMap.ProcessingServiceBase}
  8879. * @param {string} url - 单对象空间查询分析服务地址。
  8880. * @param {Object} options - 参数。
  8881. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8882. * @param {Object} [options.headers] - 请求头。
  8883. */
  8884. class SingleObjectQueryJobsService extends ProcessingServiceBase {
  8885. constructor(url, options) {
  8886. super(url, options);
  8887. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
  8888. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  8889. }
  8890. /**
  8891. *@override
  8892. */
  8893. destroy() {
  8894. super.destroy();
  8895. }
  8896. /**
  8897. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  8898. * @description 获取单对象空间查询分析所有任务
  8899. */
  8900. getQueryJobs() {
  8901. super.getJobs(this.url);
  8902. }
  8903. /**
  8904. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  8905. * @description 获取指定id的单对象空间查询分析服务
  8906. * @param {string} id - 指定要获取数据的id
  8907. */
  8908. getQueryJob(id) {
  8909. super.getJobs(Util.urlPathAppend(this.url, id));
  8910. }
  8911. /**
  8912. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  8913. * @description 新建单对象空间查询分析服务
  8914. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  8915. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  8916. */
  8917. addQueryJob(params, seconds) {
  8918. super.addJob(this.url, params, SingleObjectQueryJobsParameter, seconds);
  8919. }
  8920. }
  8921. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService;
  8922. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  8923. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8924. * This program are made available under the terms of the Apache License, Version 2.0
  8925. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8926. /**
  8927. * @class SuperMap.SummaryMeshJobsService
  8928. * @category iServer ProcessingService AggregatePoints
  8929. * @classdesc 点聚合分析任务类。
  8930. * @param {string} url -点聚合分析任务地址。
  8931. * @param {Object} options - 参数。
  8932. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  8933. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  8934. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  8935. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  8936. * @param {number} options.length - 服务访问地址数组长度。
  8937. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8938. * @param {Object} [options.headers] - 请求头。
  8939. */
  8940. class SummaryMeshJobsService extends ProcessingServiceBase {
  8941. constructor(url, options) {
  8942. super(url, options);
  8943. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  8944. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  8945. }
  8946. /**
  8947. * @override
  8948. */
  8949. destroy() {
  8950. super.destroy();
  8951. }
  8952. /**
  8953. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  8954. * @description 获取点聚合分析任务
  8955. */
  8956. getSummaryMeshJobs() {
  8957. super.getJobs(this.url);
  8958. }
  8959. /**
  8960. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  8961. * @description 获取指定ip的点聚合分析任务
  8962. * @param {string} id - 指定要获取数据的id
  8963. */
  8964. getSummaryMeshJob(id) {
  8965. super.getJobs(Util.urlPathAppend(this.url, id));
  8966. }
  8967. /**
  8968. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  8969. * @description 新建点聚合分析服务
  8970. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  8971. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  8972. */
  8973. addSummaryMeshJob(params, seconds) {
  8974. super.addJob(this.url, params, SummaryMeshJobParameter, seconds);
  8975. }
  8976. }
  8977. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService;
  8978. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  8979. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  8980. * This program are made available under the terms of the Apache License, Version 2.0
  8981. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8982. /**
  8983. * @class SuperMap.SummaryRegionJobsService
  8984. * @category iServer ProcessingService SummaryRegion
  8985. * @classdesc 区域汇总分析服务类
  8986. * @extends {SuperMap.ProcessingServiceBase}
  8987. * @param {string} url - 区域汇总分析服务地址。
  8988. * @param {Object} options - 参数。
  8989. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8990. * @param {Object} [options.headers] - 请求头。
  8991. */
  8992. class SummaryRegionJobsService extends ProcessingServiceBase {
  8993. constructor(url, options) {
  8994. super(url, options);
  8995. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  8996. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  8997. }
  8998. /**
  8999. *@override
  9000. */
  9001. destroy() {
  9002. super.destroy();
  9003. }
  9004. /**
  9005. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  9006. * @description 获取区域汇总分析任务集合。
  9007. */
  9008. getSummaryRegionJobs() {
  9009. super.getJobs(this.url);
  9010. }
  9011. /**
  9012. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  9013. * @description 获取指定id的区域汇总分析任务。
  9014. * @param {string} id -要获取区域汇总分析任务的id
  9015. */
  9016. getSummaryRegionJob(id) {
  9017. super.getJobs(Util.urlPathAppend(this.url, id));
  9018. }
  9019. /**
  9020. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  9021. * @description 新建区域汇总任务。
  9022. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  9023. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9024. */
  9025. addSummaryRegionJob(params, seconds) {
  9026. super.addJob(this.url, params, SummaryRegionJobParameter, seconds);
  9027. }
  9028. }
  9029. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService;
  9030. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.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. * @class SuperMap.VectorClipJobsParameter
  9036. * @category iServer ProcessingService VectorClip
  9037. * @classdesc 矢量裁剪分析任务参数类。
  9038. * @param {Object} options - 参数。
  9039. * @param {string} options.datasetName - 数据集名。
  9040. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  9041. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  9042. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  9043. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  9044. */
  9045. class VectorClipJobsParameter {
  9046. constructor(options) {
  9047. options = options || {};
  9048. /**
  9049. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  9050. * @description 数据集名。
  9051. */
  9052. this.datasetName = "";
  9053. /**
  9054. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  9055. * @description 裁剪对象数据集。
  9056. */
  9057. this.datasetVectorClip = "";
  9058. /**
  9059. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  9060. * @description 裁剪几何对象。
  9061. */
  9062. this.geometryClip = "";
  9063. /**
  9064. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  9065. * @description 裁剪分析模式 。
  9066. */
  9067. this.mode = ClipAnalystMode.CLIP;
  9068. /**
  9069. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  9070. * @description 输出参数设置类。
  9071. */
  9072. this.output = null;
  9073. /**
  9074. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  9075. * @description 分析后结果可视化的参数类。
  9076. */
  9077. this.mappingParameters = null;
  9078. Util.extend(this, options);
  9079. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  9080. }
  9081. /**
  9082. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  9083. * @description 释放资源,将引用资源的属性置空。
  9084. */
  9085. destroy() {
  9086. this.datasetName = null;
  9087. this.datasetVectorClip = null;
  9088. this.geometryClip = null;
  9089. this.mode = null;
  9090. if (this.output instanceof OutputSetting) {
  9091. this.output.destroy();
  9092. this.output = null;
  9093. }
  9094. if (this.mappingParameters instanceof MappingParameters) {
  9095. this.mappingParameters.destroy();
  9096. this.mappingParameters = null;
  9097. }
  9098. }
  9099. /**
  9100. * @function SuperMap.VectorClipJobsParameter.toObject
  9101. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  9102. * @param {Object} tempObj - 目标对象。
  9103. * @description 矢量裁剪分析任务对象。
  9104. */
  9105. static toObject(vectorClipJobsParameter, tempObj) {
  9106. for (var name in vectorClipJobsParameter) {
  9107. if (name === "datasetName") {
  9108. tempObj['input'] = tempObj['input'] || {};
  9109. tempObj['input'][name] = vectorClipJobsParameter[name];
  9110. continue;
  9111. }
  9112. if (name === "output"){
  9113. tempObj['output'] = tempObj['output'] || {};
  9114. tempObj['output'] = vectorClipJobsParameter[name];
  9115. continue;
  9116. }
  9117. tempObj['analyst'] = tempObj['analyst'] || {};
  9118. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  9119. if(name === 'mappingParameters'){
  9120. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  9121. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  9122. }
  9123. }
  9124. }
  9125. }
  9126. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter;
  9127. ;// CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  9128. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9129. * This program are made available under the terms of the Apache License, Version 2.0
  9130. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9131. /**
  9132. * @class SuperMap.VectorClipJobsService
  9133. * @category iServer ProcessingService VectorClip
  9134. * @classdesc 矢量裁剪分析服务类
  9135. * @extends {SuperMap.ProcessingServiceBase}
  9136. * @param {string} url -矢量裁剪分析服务地址。
  9137. * @param {Object} options - 交互服务时所需可选参数。
  9138. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9139. * @param {Object} [options.headers] - 请求头。
  9140. */
  9141. class VectorClipJobsService extends ProcessingServiceBase {
  9142. constructor(url, options) {
  9143. super(url, options);
  9144. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  9145. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  9146. }
  9147. /**
  9148. *@override
  9149. */
  9150. destroy() {
  9151. super.destroy();
  9152. }
  9153. /**
  9154. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  9155. * @description 获取矢量裁剪分析所有任务
  9156. */
  9157. getVectorClipJobs() {
  9158. super.getJobs(this.url);
  9159. }
  9160. /**
  9161. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  9162. * @description 获取指定id的矢量裁剪分析服务
  9163. * @param {string} id - 指定要获取数据的id
  9164. */
  9165. getVectorClipJob(id) {
  9166. super.getJobs(Util.urlPathAppend(this.url, id));
  9167. }
  9168. /**
  9169. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  9170. * @description 新建矢量裁剪分析服务
  9171. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  9172. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9173. */
  9174. addVectorClipJob(params, seconds) {
  9175. super.addJob(this.url, params, VectorClipJobsParameter, seconds);
  9176. }
  9177. }
  9178. SuperMap.VectorClipJobsService = VectorClipJobsService;
  9179. ;// CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  9180. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9181. * This program are made available under the terms of the Apache License, Version 2.0
  9182. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9183. /**
  9184. * @class SuperMap.OverlayGeoJobsService
  9185. * @category iServer ProcessingService OverlayAnalyst
  9186. * @classdesc 叠加分析任务类。
  9187. * @param {string} url - 叠加分析任务地址。
  9188. * @param {Object} options - 参数。
  9189. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  9190. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  9191. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  9192. * @param {number} options.index - 服务访问地址在数组中的位置。
  9193. * @param {number} options.length - 服务访问地址数组长度。
  9194. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9195. * @param {Object} [options.headers] - 请求头。
  9196. */
  9197. class OverlayGeoJobsService extends ProcessingServiceBase {
  9198. constructor(url, options) {
  9199. super(url, options);
  9200. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  9201. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  9202. }
  9203. /**
  9204. * @override
  9205. */
  9206. destroy() {
  9207. super.destroy();
  9208. }
  9209. /**
  9210. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  9211. * @description 获取叠加分析任务
  9212. */
  9213. getOverlayGeoJobs() {
  9214. super.getJobs(this.url);
  9215. }
  9216. /**
  9217. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  9218. * @description 获取指定id的叠加分析任务
  9219. * @param {string} id - 指定要获取数据的id
  9220. */
  9221. getOverlayGeoJob(id) {
  9222. super.getJobs(Util.urlPathAppend(this.url, id));
  9223. }
  9224. /**
  9225. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  9226. * @description 新建点叠加析服务
  9227. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  9228. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9229. */
  9230. addOverlayGeoJob(params, seconds) {
  9231. super.addJob(this.url, params, OverlayGeoJobParameter, seconds);
  9232. }
  9233. }
  9234. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService;
  9235. ;// CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  9236. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9237. * This program are made available under the terms of the Apache License, Version 2.0
  9238. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9239. /**
  9240. * @class SuperMap.BuffersAnalystJobsService
  9241. * @category iServer ProcessingService BufferAnalyst
  9242. * @classdesc 缓冲区分析服务类
  9243. * @extends {SuperMap.ProcessingServiceBase}
  9244. * @param {string} url - 服务地址。
  9245. * @param {Object} options - 参数。
  9246. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9247. * @param {Object} [options.headers] - 请求头。
  9248. */
  9249. class BuffersAnalystJobsService extends ProcessingServiceBase {
  9250. constructor(url, options) {
  9251. super(url, options);
  9252. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  9253. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  9254. }
  9255. /**
  9256. *@override
  9257. */
  9258. destroy() {
  9259. super.destroy();
  9260. }
  9261. /**
  9262. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  9263. * @description 获取缓冲区分析所有任务
  9264. */
  9265. getBuffersJobs() {
  9266. super.getJobs(this.url);
  9267. }
  9268. /**
  9269. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  9270. * @description 获取指定id的缓冲区分析服务
  9271. * @param {string} id - 指定要获取数据的id。
  9272. */
  9273. getBuffersJob(id) {
  9274. super.getJobs(Util.urlPathAppend(this.url, id));
  9275. }
  9276. /**
  9277. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  9278. * @description 新建缓冲区分析服务
  9279. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  9280. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9281. */
  9282. addBuffersJob(params, seconds) {
  9283. super.addJob(this.url, params, BuffersAnalystJobsParameter, seconds);
  9284. }
  9285. }
  9286. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService;
  9287. ;// CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  9288. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9289. * This program are made available under the terms of the Apache License, Version 2.0
  9290. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9291. /**
  9292. * @class SuperMap.TopologyValidatorJobsService
  9293. * @category iServer ProcessingService TopologyValidator
  9294. * @classdesc 拓扑检查分析服务类
  9295. * @extends {SuperMap.ProcessingServiceBase}
  9296. * @param {string} url - 拓扑检查分析服务地址。
  9297. * @param {Object} options - 参数。
  9298. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9299. * @param {Object} [options.headers] - 请求头。
  9300. */
  9301. class TopologyValidatorJobsService extends ProcessingServiceBase {
  9302. constructor(url, options) {
  9303. super(url, options);
  9304. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  9305. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  9306. }
  9307. /**
  9308. *@override
  9309. */
  9310. destroy() {
  9311. super.destroy();
  9312. }
  9313. /**
  9314. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  9315. * @description 获取拓扑检查分析所有任务
  9316. */
  9317. getTopologyValidatorJobs() {
  9318. super.getJobs(this.url);
  9319. }
  9320. /**
  9321. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  9322. * @description 获取指定id的拓扑检查分析服务
  9323. * @param {string} id - 指定要获取数据的id
  9324. */
  9325. getTopologyValidatorJob(id) {
  9326. super.getJobs( Util.urlPathAppend(this.url, id));
  9327. }
  9328. /**
  9329. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  9330. * @description 新建拓扑检查分析服务
  9331. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  9332. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9333. */
  9334. addTopologyValidatorJob(params, seconds) {
  9335. super.addJob(this.url, params, TopologyValidatorJobsParameter, seconds);
  9336. }
  9337. }
  9338. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService;
  9339. ;// CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  9340. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9341. * This program are made available under the terms of the Apache License, Version 2.0
  9342. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9343. /**
  9344. * @class SuperMap.SummaryAttributesJobsService
  9345. * @category iServer ProcessingService SummaryAttributes
  9346. * @classdesc 属性汇总分析服务类
  9347. * @extends {SuperMap.ProcessingServiceBase}
  9348. * @param {string} url - 汇总统计分析服务地址。
  9349. * @param {Object} options - 参数。
  9350. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9351. * @param {Object} [options.headers] - 请求头。
  9352. */
  9353. class SummaryAttributesJobsService extends ProcessingServiceBase {
  9354. constructor(url, options) {
  9355. super(url, options);
  9356. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  9357. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  9358. }
  9359. /**
  9360. *@override
  9361. */
  9362. destroy() {
  9363. super.destroy();
  9364. }
  9365. /**
  9366. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  9367. * @description 获取属性汇总分析所有任务
  9368. */
  9369. getSummaryAttributesJobs (){
  9370. super.getJobs(this.url);
  9371. }
  9372. /**
  9373. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  9374. * @description 获取指定id的属性汇总分析服务
  9375. * @param {string} id - 指定要获取数据的id
  9376. */
  9377. getSummaryAttributesJob(id) {
  9378. super.getJobs(Util.urlPathAppend(this.url, id));
  9379. }
  9380. /**
  9381. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  9382. * @description 新建属性汇总分析服务
  9383. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  9384. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9385. */
  9386. addSummaryAttributesJob(params, seconds) {
  9387. super.addJob(this.url, params, SummaryAttributesJobsParameter, seconds);
  9388. }
  9389. }
  9390. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService;
  9391. ;// CONCATENATED MODULE: ./src/classic/services/ProcessingService.js
  9392. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  9393. * This program are made available under the terms of the Apache License, Version 2.0
  9394. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9395. /**
  9396. * @class SuperMap.REST.ProcessingService
  9397. * @category iServer ProcessingService
  9398. * @classdesc 分布式分析相关服务类。
  9399. * @augments SuperMap.CommonServiceBase
  9400. * @example
  9401. * 用法:
  9402. * new SuperMap.REST.ProcessingService(url,options)
  9403. * .getKernelDensityJobs(function(result){
  9404. * //doSomething
  9405. * })
  9406. * @param {string} url - 分布式分析服务地址。
  9407. * @param {Object} options - 可选参数。
  9408. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9409. * @param {Object} [options.headers] - 请求头。
  9410. */
  9411. class ProcessingService extends CommonServiceBase {
  9412. constructor(url, options) {
  9413. super(url, options);
  9414. this.kernelDensityJobs = {};
  9415. this.summaryMeshJobs = {};
  9416. this.queryJobs = {};
  9417. this.summaryRegionJobs = {};
  9418. this.vectorClipJobs = {};
  9419. this.overlayGeoJobs = {};
  9420. this.buffersJobs = {};
  9421. this.topologyValidatorJobs = {};
  9422. this.summaryAttributesJobs = {};
  9423. }
  9424. /**
  9425. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJobs
  9426. * @description 获取密度分析的列表。
  9427. * @param {function} callback - 请求结果的回调函数。
  9428. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9429. */
  9430. getKernelDensityJobs(callback, resultFormat) {
  9431. var me = this,
  9432. format = me._processFormat(resultFormat);
  9433. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  9434. headers: me.headers,
  9435. proxy: me.proxy,
  9436. withCredentials: me.withCredentials,
  9437. crossOrigin:me.crossOrigin,
  9438. serverType: me.serverType,
  9439. eventListeners: {
  9440. scope: me,
  9441. processCompleted: callback,
  9442. processFailed: callback
  9443. },
  9444. format: format
  9445. });
  9446. kernelDensityJobsService.getKernelDensityJobs();
  9447. }
  9448. /**
  9449. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJob
  9450. * @description 获取某一个密度分析。
  9451. * @param {string} id - 空间分析的 id。
  9452. * @param {function} callback - 请求结果的回调函数。
  9453. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9454. */
  9455. getKernelDensityJob(id, callback, resultFormat) {
  9456. var me = this,
  9457. format = me._processFormat(resultFormat);
  9458. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  9459. headers: me.headers,
  9460. proxy: me.proxy,
  9461. withCredentials: me.withCredentials,
  9462. crossOrigin:me.crossOrigin,
  9463. serverType: me.serverType,
  9464. eventListeners: {
  9465. scope: me,
  9466. processCompleted: callback,
  9467. processFailed: callback
  9468. },
  9469. format: format
  9470. });
  9471. kernelDensityJobsService.getKernelDensityJob(id);
  9472. }
  9473. /**
  9474. * @function SuperMap.REST.ProcessingService.prototype.addKernelDensityJob
  9475. * @description 新建一个密度分析。
  9476. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  9477. * @param {function} callback - 请求结果的回调函数。
  9478. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9479. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9480. */
  9481. addKernelDensityJob(params, callback, seconds, resultFormat) {
  9482. var me = this, format = me._processFormat(resultFormat);
  9483. var kernelDensityJobsService = new KernelDensityJobsService(me.url, {
  9484. headers: me.headers,
  9485. proxy: me.proxy,
  9486. withCredentials: me.withCredentials,
  9487. crossOrigin:me.crossOrigin,
  9488. eventListeners: {
  9489. scope: me,
  9490. processCompleted: callback,
  9491. processFailed: callback,
  9492. processRunning(job) {
  9493. me.kernelDensityJobs[job.id] = job.state;
  9494. }
  9495. },
  9496. format: format
  9497. });
  9498. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  9499. }
  9500. /**
  9501. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJobState
  9502. * @description 获取密度分析的状态。
  9503. * @param {string} id - 密度分析的 id。
  9504. * @returns {Object} - 密度分析的状态。
  9505. */
  9506. getKernelDensityJobState(id) {
  9507. return this.kernelDensityJobs[id];
  9508. }
  9509. /**
  9510. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJobs
  9511. * @description 获取点聚合分析的列表。
  9512. * @param {function} callback - 请求结果的回调函数。
  9513. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9514. */
  9515. getSummaryMeshJobs(callback, resultFormat) {
  9516. var me = this,
  9517. format = me._processFormat(resultFormat);
  9518. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  9519. headers: me.headers,
  9520. proxy: me.proxy,
  9521. withCredentials: me.withCredentials,
  9522. crossOrigin:me.crossOrigin,
  9523. serverType: me.serverType,
  9524. eventListeners: {
  9525. scope: me,
  9526. processCompleted: callback,
  9527. processFailed: callback
  9528. },
  9529. format: format
  9530. });
  9531. summaryMeshJobsService.getSummaryMeshJobs();
  9532. }
  9533. /**
  9534. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJob
  9535. * @description 获取某一个点聚合分析。
  9536. * @param {string} id - 空间分析的 id。
  9537. * @param {function} callback - 请求结果的回调函数。
  9538. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9539. */
  9540. getSummaryMeshJob(id, callback, resultFormat) {
  9541. var me = this,
  9542. format = me._processFormat(resultFormat);
  9543. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  9544. headers: me.headers,
  9545. proxy: me.proxy,
  9546. withCredentials: me.withCredentials,
  9547. crossOrigin:me.crossOrigin,
  9548. serverType: me.serverType,
  9549. eventListeners: {
  9550. scope: me,
  9551. processCompleted: callback,
  9552. processFailed: callback
  9553. },
  9554. format: format
  9555. });
  9556. summaryMeshJobsService.getSummaryMeshJob(id);
  9557. }
  9558. /**
  9559. * @function SuperMap.REST.ProcessingService.prototype.addSummaryMeshJob
  9560. * @description 新建一个点聚合分析。
  9561. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  9562. * @param {function} callback - 请求结果的回调函数。
  9563. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9564. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9565. */
  9566. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  9567. var me = this, format = me._processFormat(resultFormat);
  9568. var summaryMeshJobsService = new SummaryMeshJobsService(me.url, {
  9569. headers: me.headers,
  9570. proxy: me.proxy,
  9571. withCredentials: me.withCredentials,
  9572. crossOrigin:me.crossOrigin,
  9573. eventListeners: {
  9574. scope: me,
  9575. processCompleted: callback,
  9576. processFailed: callback,
  9577. processRunning(job) {
  9578. me.summaryMeshJobs[job.id] = job.state;
  9579. }
  9580. },
  9581. format: format
  9582. });
  9583. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  9584. }
  9585. /**
  9586. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJobState
  9587. * @description 获取点聚合分析的状态。
  9588. * @param {string} id - 点聚合分析的 id。
  9589. * @returns {Object} 点聚合分析的状态。
  9590. */
  9591. getSummaryMeshJobState(id) {
  9592. return this.summaryMeshJobs[id];
  9593. }
  9594. /**
  9595. * @function SuperMap.REST.ProcessingService.prototype.getQueryJobs
  9596. * @description 获取单对象查询分析的列表。
  9597. * @param {function} callback - 请求结果的回调函数。
  9598. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9599. */
  9600. getQueryJobs(callback, resultFormat) {
  9601. var me = this,
  9602. format = me._processFormat(resultFormat);
  9603. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  9604. headers: me.headers,
  9605. proxy: me.proxy,
  9606. withCredentials: me.withCredentials,
  9607. crossOrigin:me.crossOrigin,
  9608. serverType: me.serverType,
  9609. eventListeners: {
  9610. scope: me,
  9611. processCompleted: callback,
  9612. processFailed: callback
  9613. },
  9614. format: format
  9615. });
  9616. singleObjectQueryJobsService.getQueryJobs();
  9617. }
  9618. /**
  9619. * @function SuperMap.REST.ProcessingService.prototype.getQueryJob
  9620. * @description 获取某一个单对象查询分析。
  9621. * @param {string} id - 空间分析的 id。
  9622. * @param {function} callback - 请求结果的回调函数。
  9623. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9624. */
  9625. getQueryJob(id, callback, resultFormat) {
  9626. var me = this,
  9627. format = me._processFormat(resultFormat);
  9628. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  9629. headers: me.headers,
  9630. proxy: me.proxy,
  9631. withCredentials: me.withCredentials,
  9632. crossOrigin:me.crossOrigin,
  9633. serverType: me.serverType,
  9634. eventListeners: {
  9635. scope: me,
  9636. processCompleted: callback,
  9637. processFailed: callback
  9638. },
  9639. format: format
  9640. });
  9641. singleObjectQueryJobsService.getQueryJob(id);
  9642. }
  9643. /**
  9644. * @function SuperMap.REST.ProcessingService.prototype.addQueryJob
  9645. * @description 新建一个单对象查询分析。
  9646. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  9647. * @param {function} callback - 请求结果的回调函数。
  9648. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9649. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9650. */
  9651. addQueryJob(params, callback, seconds, resultFormat) {
  9652. var me = this,
  9653. param = me._processParams(params),
  9654. format = me._processFormat(resultFormat);
  9655. var singleObjectQueryJobsService = new SingleObjectQueryJobsService(me.url, {
  9656. headers: me.headers,
  9657. proxy: me.proxy,
  9658. withCredentials: me.withCredentials,
  9659. crossOrigin:me.crossOrigin,
  9660. eventListeners: {
  9661. scope: me,
  9662. processCompleted: callback,
  9663. processFailed: callback,
  9664. processRunning(job) {
  9665. me.queryJobs[job.id] = job.state;
  9666. }
  9667. },
  9668. format: format
  9669. });
  9670. singleObjectQueryJobsService.addQueryJob(param, seconds);
  9671. }
  9672. /**
  9673. * @function SuperMap.REST.ProcessingService.prototype.getQueryJobState
  9674. * @description 获取单对象查询分析的状态。
  9675. * @param {string} id - 单对象查询分析的 id。
  9676. * @returns {Object} 单对象查询分析的状态
  9677. */
  9678. getQueryJobState(id) {
  9679. return this.queryJobs[id];
  9680. }
  9681. /**
  9682. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJobs
  9683. * @description 获取区域汇总分析的列表。
  9684. * @param {function} callback - 请求结果的回调函数。
  9685. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9686. */
  9687. getSummaryRegionJobs(callback, resultFormat) {
  9688. var me = this,
  9689. format = me._processFormat(resultFormat);
  9690. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  9691. proxy: me.proxy,
  9692. headers: me.headers,
  9693. withCredentials: me.withCredentials,
  9694. crossOrigin:me.crossOrigin,
  9695. serverType: me.serverType,
  9696. eventListeners: {
  9697. scope: me,
  9698. processCompleted: callback,
  9699. processFailed: callback
  9700. },
  9701. format: format
  9702. });
  9703. summaryRegionJobsService.getSummaryRegionJobs();
  9704. }
  9705. /**
  9706. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJob
  9707. * @description 获取某一个区域汇总分析。
  9708. * @param {string} id - 区域汇总分析的 id。
  9709. * @param {function} callback - 请求结果的回调函数。
  9710. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9711. */
  9712. getSummaryRegionJob(id, callback, resultFormat) {
  9713. var me = this,
  9714. format = me._processFormat(resultFormat);
  9715. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  9716. proxy: me.proxy,
  9717. withCredentials: me.withCredentials,
  9718. crossOrigin:me.crossOrigin,
  9719. headers: me.headers,
  9720. serverType: me.serverType,
  9721. eventListeners: {
  9722. scope: me,
  9723. processCompleted: callback,
  9724. processFailed: callback
  9725. },
  9726. format: format
  9727. });
  9728. summaryRegionJobsService.getSummaryRegionJob(id);
  9729. }
  9730. /**
  9731. * @function SuperMap.REST.ProcessingService.prototype.addSummaryRegionJob
  9732. * @description 新建一个区域汇总分析。
  9733. * @param {SuperMap.SummaryRegionJobParameter} params -创建一个区域汇总分析的请求参数。
  9734. * @param {function} callback - 请求结果的回调函数。
  9735. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9736. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9737. */
  9738. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  9739. var me = this, format = me._processFormat(resultFormat);
  9740. var summaryRegionJobsService = new SummaryRegionJobsService(me.url, {
  9741. proxy: me.proxy,
  9742. withCredentials: me.withCredentials,
  9743. crossOrigin:me.crossOrigin,
  9744. headers: me.headers,
  9745. eventListeners: {
  9746. scope: me,
  9747. processCompleted: callback,
  9748. processFailed: callback,
  9749. processRunning(job) {
  9750. me.summaryRegionJobs[job.id] = job.state;
  9751. }
  9752. },
  9753. format: format
  9754. });
  9755. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  9756. }
  9757. /**
  9758. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJobState
  9759. * @description 获取区域汇总分析的状态。
  9760. * @param {string} id - 区域汇总分析的 id。
  9761. * @returns {Object} 区域汇总分析的状态。
  9762. */
  9763. getSummaryRegionJobState(id) {
  9764. return this.summaryRegionJobs[id];
  9765. }
  9766. /**
  9767. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJobs
  9768. * @description 获取矢量裁剪分析的列表。
  9769. * @param {function} callback - 请求结果的回调函数。
  9770. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9771. */
  9772. getVectorClipJobs(callback, resultFormat) {
  9773. var me = this,
  9774. format = me._processFormat(resultFormat);
  9775. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  9776. proxy: me.proxy,
  9777. withCredentials: me.withCredentials,
  9778. crossOrigin:me.crossOrigin,
  9779. headers: me.headers,
  9780. serverType: me.serverType,
  9781. eventListeners: {
  9782. scope: me,
  9783. processCompleted: callback,
  9784. processFailed: callback
  9785. },
  9786. format: format
  9787. });
  9788. vectorClipJobsService.getVectorClipJobs();
  9789. }
  9790. /**
  9791. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJob
  9792. * @description 获取某一个矢量裁剪分析。
  9793. * @param {string} id - 空间分析的 id。
  9794. * @param {function} callback - 请求结果的回调函数。
  9795. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9796. */
  9797. getVectorClipJob(id, callback, resultFormat) {
  9798. var me = this,
  9799. format = me._processFormat(resultFormat);
  9800. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  9801. proxy: me.proxy,
  9802. withCredentials: me.withCredentials,
  9803. crossOrigin:me.crossOrigin,
  9804. headers: me.headers,
  9805. serverType: me.serverType,
  9806. eventListeners: {
  9807. scope: me,
  9808. processCompleted: callback,
  9809. processFailed: callback
  9810. },
  9811. format: format
  9812. });
  9813. vectorClipJobsService.getVectorClipJob(id);
  9814. }
  9815. /**
  9816. * @function SuperMap.REST.ProcessingService.prototype.addVectorClipJob
  9817. * @description 新建一个矢量裁剪分析。
  9818. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  9819. * @param {function} callback - 请求结果的回调函数。
  9820. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9821. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9822. */
  9823. addVectorClipJob(params, callback, seconds, resultFormat) {
  9824. var me = this,
  9825. param = me._processParams(params),
  9826. format = me._processFormat(resultFormat);
  9827. var vectorClipJobsService = new VectorClipJobsService(me.url, {
  9828. proxy: me.proxy,
  9829. withCredentials: me.withCredentials,
  9830. crossOrigin:me.crossOrigin,
  9831. headers: me.headers,
  9832. serverType: me.serverType,
  9833. eventListeners: {
  9834. scope: me,
  9835. processCompleted: callback,
  9836. processFailed: callback,
  9837. processRunning(job) {
  9838. me.vectorClipJobs[job.id] = job.state;
  9839. }
  9840. },
  9841. format: format
  9842. });
  9843. vectorClipJobsService.addVectorClipJob(param, seconds);
  9844. }
  9845. /**
  9846. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJobState
  9847. * @description 获取矢量裁剪分析的状态。
  9848. * @param {string} id - 矢量裁剪分析的 id。
  9849. * @returns {Object} 矢量裁剪分析的状态。
  9850. */
  9851. getVectorClipJobState(id) {
  9852. return this.vectorClipJobs[id];
  9853. }
  9854. /**
  9855. * @function SuperMap.REST.ProcessingService.prototype.getOverlayGeoJobs
  9856. * @description 获取叠加分析的列表。
  9857. * @param {function} callback - 请求结果的回调函数。
  9858. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9859. */
  9860. getOverlayGeoJobs(callback, resultFormat) {
  9861. var me = this,
  9862. format = me._processFormat(resultFormat);
  9863. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  9864. proxy: me.proxy,
  9865. withCredentials: me.withCredentials,
  9866. crossOrigin:me.crossOrigin,
  9867. headers: me.headers,
  9868. serverType: me.serverType,
  9869. eventListeners: {
  9870. scope: me,
  9871. processCompleted: callback,
  9872. processFailed: callback
  9873. },
  9874. format: format
  9875. });
  9876. overlayGeoJobsService.getOverlayGeoJobs();
  9877. }
  9878. /**
  9879. * @function SuperMap.REST.ProcessingService.prototype.getOverlayGeoJob
  9880. * @description 获取某一个叠加分析。
  9881. * @param {string} id - 空间分析的 id。
  9882. * @param {function} callback - 请求结果的回调函数。
  9883. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9884. */
  9885. getOverlayGeoJob(id, callback, resultFormat) {
  9886. var me = this,
  9887. format = me._processFormat(resultFormat);
  9888. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  9889. proxy: me.proxy,
  9890. withCredentials: me.withCredentials,
  9891. crossOrigin:me.crossOrigin,
  9892. headers: me.headers,
  9893. serverType: me.serverType,
  9894. eventListeners: {
  9895. scope: me,
  9896. processCompleted: callback,
  9897. processFailed: callback
  9898. },
  9899. format: format
  9900. });
  9901. overlayGeoJobsService.getOverlayGeoJob(id);
  9902. }
  9903. /**
  9904. * @function SuperMap.REST.ProcessingService.prototype.addOverlayGeoJob
  9905. * @description 新建一个叠加分析。
  9906. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  9907. * @param {function} callback - 请求结果的回调函数。
  9908. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9909. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9910. */
  9911. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  9912. var me = this,
  9913. format = me._processFormat(resultFormat);
  9914. var overlayGeoJobsService = new OverlayGeoJobsService(me.url, {
  9915. proxy: me.proxy,
  9916. withCredentials: me.withCredentials,
  9917. crossOrigin:me.crossOrigin,
  9918. headers: me.headers,
  9919. serverType: me.serverType,
  9920. eventListeners: {
  9921. scope: me,
  9922. processCompleted: callback,
  9923. processFailed: callback,
  9924. processRunning: function (job) {
  9925. me.overlayGeoJobs[job.id] = job.state;
  9926. }
  9927. },
  9928. format: format
  9929. });
  9930. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  9931. }
  9932. /**
  9933. * @function SuperMap.REST.ProcessingService.prototype.getoverlayGeoJobState
  9934. * @description 获取叠加分析的状态。
  9935. * @param {string} id - 叠加分析的 id。
  9936. * @returns {Object} 叠加分析的状态。
  9937. */
  9938. getoverlayGeoJobState(id) {
  9939. return this.overlayGeoJobs[id];
  9940. }
  9941. /**
  9942. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJobs
  9943. * @description 获取缓冲区分析的列表。
  9944. * @param {function} callback - 请求结果的回调函数。
  9945. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9946. */
  9947. getBuffersJobs(callback, resultFormat) {
  9948. var me = this,
  9949. format = me._processFormat(resultFormat);
  9950. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  9951. proxy: me.proxy,
  9952. withCredentials: me.withCredentials,
  9953. crossOrigin:me.crossOrigin,
  9954. headers: me.headers,
  9955. serverType: me.serverType,
  9956. eventListeners: {
  9957. scope: me,
  9958. processCompleted: callback,
  9959. processFailed: callback
  9960. },
  9961. format: format
  9962. });
  9963. buffersAnalystJobsService.getBuffersJobs();
  9964. }
  9965. /**
  9966. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJob
  9967. * @description 获取某一个缓冲区分析。
  9968. * @param {string} id - 空间分析的 id。
  9969. * @param {function} callback - 请求结果的回调函数。
  9970. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9971. */
  9972. getBuffersJob(id, callback, resultFormat) {
  9973. var me = this,
  9974. format = me._processFormat(resultFormat);
  9975. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  9976. proxy: me.proxy,
  9977. withCredentials: me.withCredentials,
  9978. crossOrigin:me.crossOrigin,
  9979. headers: me.headers,
  9980. serverType: me.serverType,
  9981. eventListeners: {
  9982. scope: me,
  9983. processCompleted: callback,
  9984. processFailed: callback
  9985. },
  9986. format: format
  9987. });
  9988. buffersAnalystJobsService.getBuffersJob(id);
  9989. }
  9990. /**
  9991. * @function SuperMap.REST.ProcessingService.prototype.addBuffersJob
  9992. * @description 新建一个缓冲区分析。
  9993. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  9994. * @param {function} callback - 请求结果的回调函数。
  9995. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9996. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9997. */
  9998. addBuffersJob(params, callback, seconds, resultFormat) {
  9999. var me = this,
  10000. format = me._processFormat(resultFormat);
  10001. var buffersAnalystJobsService = new BuffersAnalystJobsService(me.url, {
  10002. proxy: me.proxy,
  10003. withCredentials: me.withCredentials,
  10004. crossOrigin:me.crossOrigin,
  10005. headers: me.headers,
  10006. serverType: me.serverType,
  10007. eventListeners: {
  10008. scope: me,
  10009. processCompleted: callback,
  10010. processFailed: callback,
  10011. processRunning: function (job) {
  10012. me.buffersJobs[job.id] = job.state;
  10013. }
  10014. },
  10015. format: format
  10016. });
  10017. buffersAnalystJobsService.addBuffersJob(params, seconds);
  10018. }
  10019. /**
  10020. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJobState
  10021. * @description 获取缓冲区分析的状态。
  10022. * @param {string} id - 缓冲区分析的 id。
  10023. * @returns {Object} 缓冲区分析的状态。
  10024. */
  10025. getBuffersJobState(id) {
  10026. return this.buffersJobs[id];
  10027. }
  10028. /**
  10029. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJobs
  10030. * @description 获取拓扑检查分析的列表。
  10031. * @param {function} callback - 请求结果的回调函数。
  10032. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10033. */
  10034. getTopologyValidatorJobs(callback, resultFormat) {
  10035. var me = this,
  10036. format = me._processFormat(resultFormat);
  10037. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  10038. proxy: me.proxy,
  10039. withCredentials: me.withCredentials,
  10040. crossOrigin:me.crossOrigin,
  10041. headers: me.headers,
  10042. serverType: me.serverType,
  10043. eventListeners: {
  10044. scope: me,
  10045. processCompleted: callback,
  10046. processFailed: callback
  10047. },
  10048. format: format
  10049. });
  10050. topologyValidatorJobsService.getTopologyValidatorJobs();
  10051. }
  10052. /**
  10053. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJob
  10054. * @description 获取某一个拓扑检查分析。
  10055. * @param {string} id - 空间分析的 id。
  10056. * @param {function} callback - 请求结果的回调函数。
  10057. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10058. */
  10059. getTopologyValidatorJob(id, callback, resultFormat) {
  10060. var me = this,
  10061. format = me._processFormat(resultFormat);
  10062. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  10063. proxy: me.proxy,
  10064. withCredentials: me.withCredentials,
  10065. crossOrigin:me.crossOrigin,
  10066. headers: me.headers,
  10067. serverType: me.serverType,
  10068. eventListeners: {
  10069. scope: me,
  10070. processCompleted: callback,
  10071. processFailed: callback
  10072. },
  10073. format: format
  10074. });
  10075. topologyValidatorJobsService.getTopologyValidatorJob(id);
  10076. }
  10077. /**
  10078. * @function SuperMap.REST.ProcessingService.prototype.addTopologyValidatorJob
  10079. * @description 新建一个拓扑检查分析。
  10080. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  10081. * @param {function} callback - 请求结果的回调函数。
  10082. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10083. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10084. */
  10085. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  10086. var me = this,
  10087. format = me._processFormat(resultFormat);
  10088. var topologyValidatorJobsService = new TopologyValidatorJobsService(me.url, {
  10089. proxy: me.proxy,
  10090. withCredentials: me.withCredentials,
  10091. crossOrigin:me.crossOrigin,
  10092. headers: me.headers,
  10093. serverType: me.serverType,
  10094. eventListeners: {
  10095. scope: me,
  10096. processCompleted: callback,
  10097. processFailed: callback,
  10098. processRunning: function (job) {
  10099. me.topologyValidatorJobs[job.id] = job.state;
  10100. }
  10101. },
  10102. format: format
  10103. });
  10104. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  10105. }
  10106. /**
  10107. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJobState
  10108. * @description 获取拓扑检查分析的状态。
  10109. * @param {string} id - 拓扑检查分析的 id。
  10110. * @returns {Object} 拓扑检查分析的状态。
  10111. */
  10112. getTopologyValidatorJobState(id) {
  10113. return this.topologyValidatorJobs[id];
  10114. }
  10115. /**
  10116. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJobs
  10117. * @description 获取属性汇总分析的列表。
  10118. * @param {function} callback - 请求结果的回调函数。
  10119. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10120. */
  10121. getSummaryAttributesJobs(callback, resultFormat) {
  10122. var me = this,
  10123. format = me._processFormat(resultFormat);
  10124. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  10125. proxy: me.proxy,
  10126. withCredentials: me.withCredentials,
  10127. crossOrigin:me.crossOrigin,
  10128. headers: me.headers,
  10129. serverType: me.serverType,
  10130. eventListeners: {
  10131. scope: me,
  10132. processCompleted: callback,
  10133. processFailed: callback
  10134. },
  10135. format: format
  10136. });
  10137. summaryAttributesJobsService.getSummaryAttributesJobs();
  10138. }
  10139. /**
  10140. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJob
  10141. * @description 获取某一个属性汇总分析。
  10142. * @param {string} id - 空间分析的 id。
  10143. * @param {function} callback - 请求结果的回调函数。
  10144. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10145. */
  10146. getSummaryAttributesJob(id, callback, resultFormat) {
  10147. var me = this,
  10148. format = me._processFormat(resultFormat);
  10149. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  10150. proxy: me.proxy,
  10151. withCredentials: me.withCredentials,
  10152. crossOrigin:me.crossOrigin,
  10153. headers: me.headers,
  10154. serverType: me.serverType,
  10155. eventListeners: {
  10156. scope: me,
  10157. processCompleted: callback,
  10158. processFailed: callback
  10159. },
  10160. format: format
  10161. });
  10162. summaryAttributesJobsService.getSummaryAttributesJob(id);
  10163. }
  10164. /**
  10165. * @function SuperMap.REST.ProcessingService.prototype.addSummaryAttributesJob
  10166. * @description 新建一个属性汇总分析。
  10167. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  10168. * @param {function} callback - 请求结果的回调函数。
  10169. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10170. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10171. */
  10172. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  10173. var me = this,
  10174. format = me._processFormat(resultFormat);
  10175. var summaryAttributesJobsService = new SummaryAttributesJobsService(me.url, {
  10176. proxy: me.proxy,
  10177. withCredentials: me.withCredentials,
  10178. crossOrigin:me.crossOrigin,
  10179. headers: me.headers,
  10180. serverType: me.serverType,
  10181. eventListeners: {
  10182. scope: me,
  10183. processCompleted: callback,
  10184. processFailed: callback,
  10185. processRunning: function (job) {
  10186. me.summaryAttributesJobs[job.id] = job.state;
  10187. }
  10188. },
  10189. format: format
  10190. });
  10191. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  10192. }
  10193. /**
  10194. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJobState
  10195. * @description 获取属性汇总分析的状态。
  10196. * @param {string} id - 属性汇总分析的 id。
  10197. * @returns {Object} 属性汇总分析的状态。
  10198. */
  10199. getSummaryAttributesJobState(id) {
  10200. return this.summaryAttributesJobs[id];
  10201. }
  10202. _processFormat(resultFormat) {
  10203. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  10204. }
  10205. _processParams(params) {
  10206. if (!params) {
  10207. return {};
  10208. }
  10209. if (params.geometryQuery) {
  10210. params.geometryQuery = this._convertPatams(params.geometryQuery);
  10211. }
  10212. if (params.geometryClip) {
  10213. params.geometryClip = this._convertPatams(params.geometryClip);
  10214. }
  10215. return params;
  10216. }
  10217. _convertPatams(points) {
  10218. var geometryParam = {};
  10219. if (points.length < 1) {
  10220. geometryParam = "";
  10221. } else {
  10222. var results = [];
  10223. for (var i = 0; i < points.length; i++) {
  10224. var point = {};
  10225. point.x = points[i].x;
  10226. point.y = points[i].y;
  10227. results.push(point);
  10228. }
  10229. geometryParam.type = "REGION";
  10230. geometryParam.points = results;
  10231. }
  10232. return geometryParam;
  10233. }
  10234. }
  10235. SuperMap_SuperMap.REST.ProcessingService = ProcessingService;
  10236. ;// CONCATENATED MODULE: ./src/classic/services/index.js
  10237. /* Copyright© 2000 - 2021 SuperMap Software Co.Ltd. All rights reserved.
  10238. * This program are made available under the terms of the Apache License, Version 2.0
  10239. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10240. ;// CONCATENATED MODULE: ./src/classic/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. })();
  10245. /******/ })()
  10246. ;