iclient-classic-es6.js 414 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044
  1. /*!
  2. *
  3. * iclient-classic.(https://iclient.supermap.io)
  4. * Copyright© 2000 - 2020 SuperMap Software Co.Ltd
  5. * license: Apache-2.0
  6. * version: v10.1.0
  7. *
  8. */
  9. /******/ (function(modules) { // webpackBootstrap
  10. /******/ // The module cache
  11. /******/ var installedModules = {};
  12. /******/
  13. /******/ // The require function
  14. /******/ function __webpack_require__(moduleId) {
  15. /******/
  16. /******/ // Check if module is in cache
  17. /******/ if(installedModules[moduleId]) {
  18. /******/ return installedModules[moduleId].exports;
  19. /******/ }
  20. /******/ // Create a new module (and put it into the cache)
  21. /******/ var module = installedModules[moduleId] = {
  22. /******/ i: moduleId,
  23. /******/ l: false,
  24. /******/ exports: {}
  25. /******/ };
  26. /******/
  27. /******/ // Execute the module function
  28. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  29. /******/
  30. /******/ // Flag the module as loaded
  31. /******/ module.l = true;
  32. /******/
  33. /******/ // Return the exports of the module
  34. /******/ return module.exports;
  35. /******/ }
  36. /******/
  37. /******/
  38. /******/ // expose the modules object (__webpack_modules__)
  39. /******/ __webpack_require__.m = modules;
  40. /******/
  41. /******/ // expose the module cache
  42. /******/ __webpack_require__.c = installedModules;
  43. /******/
  44. /******/ // define getter function for harmony exports
  45. /******/ __webpack_require__.d = function(exports, name, getter) {
  46. /******/ if(!__webpack_require__.o(exports, name)) {
  47. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  48. /******/ }
  49. /******/ };
  50. /******/
  51. /******/ // define __esModule on exports
  52. /******/ __webpack_require__.r = function(exports) {
  53. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  54. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  55. /******/ }
  56. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  57. /******/ };
  58. /******/
  59. /******/ // create a fake namespace object
  60. /******/ // mode & 1: value is a module id, require it
  61. /******/ // mode & 2: merge all properties of value into the ns
  62. /******/ // mode & 4: return value when already ns object
  63. /******/ // mode & 8|1: behave like require
  64. /******/ __webpack_require__.t = function(value, mode) {
  65. /******/ if(mode & 1) value = __webpack_require__(value);
  66. /******/ if(mode & 8) return value;
  67. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  68. /******/ var ns = Object.create(null);
  69. /******/ __webpack_require__.r(ns);
  70. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  71. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  72. /******/ return ns;
  73. /******/ };
  74. /******/
  75. /******/ // getDefaultExport function for compatibility with non-harmony modules
  76. /******/ __webpack_require__.n = function(module) {
  77. /******/ var getter = module && module.__esModule ?
  78. /******/ function getDefault() { return module['default']; } :
  79. /******/ function getModuleExports() { return module; };
  80. /******/ __webpack_require__.d(getter, 'a', getter);
  81. /******/ return getter;
  82. /******/ };
  83. /******/
  84. /******/ // Object.prototype.hasOwnProperty.call
  85. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  86. /******/
  87. /******/ // __webpack_public_path__
  88. /******/ __webpack_require__.p = "";
  89. /******/
  90. /******/
  91. /******/ // Load entry module and return exports
  92. /******/ return __webpack_require__(__webpack_require__.s = 9);
  93. /******/ })
  94. /************************************************************************/
  95. /******/ ([
  96. /* 0 */
  97. /***/ (function(module, exports) {
  98. module.exports = function(){try{return mapv}catch(e){return {}}}();
  99. /***/ }),
  100. /* 1 */
  101. /***/ (function(module, exports) {
  102. var g;
  103. // This works in non-strict mode
  104. g = (function() {
  105. return this;
  106. })();
  107. try {
  108. // This works if eval is allowed (see CSP)
  109. g = g || new Function("return this")();
  110. } catch (e) {
  111. // This works if the window reference is available
  112. if (typeof window === "object") g = window;
  113. }
  114. // g can still be undefined, but nothing to do about it...
  115. // We return undefined, instead of nothing here, so it's
  116. // easier to handle this case. if(!global) { ...}
  117. module.exports = g;
  118. /***/ }),
  119. /* 2 */
  120. /***/ (function(module, exports, __webpack_require__) {
  121. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (global, factory) {
  122. if (true) {
  123. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [exports, module], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  124. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  125. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  126. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  127. } else { var mod; }
  128. })(this, function (exports, module) {
  129. 'use strict';
  130. var defaultOptions = {
  131. timeout: 5000,
  132. jsonpCallback: 'callback',
  133. jsonpCallbackFunction: null
  134. };
  135. function generateCallbackFunction() {
  136. return 'jsonp_' + Date.now() + '_' + Math.ceil(Math.random() * 100000);
  137. }
  138. function clearFunction(functionName) {
  139. // IE8 throws an exception when you try to delete a property on window
  140. // http://stackoverflow.com/a/1824228/751089
  141. try {
  142. delete window[functionName];
  143. } catch (e) {
  144. window[functionName] = undefined;
  145. }
  146. }
  147. function removeScript(scriptId) {
  148. var script = document.getElementById(scriptId);
  149. if (script) {
  150. document.getElementsByTagName('head')[0].removeChild(script);
  151. }
  152. }
  153. function fetchJsonp(_url) {
  154. var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
  155. // to avoid param reassign
  156. var url = _url;
  157. var timeout = options.timeout || defaultOptions.timeout;
  158. var jsonpCallback = options.jsonpCallback || defaultOptions.jsonpCallback;
  159. var timeoutId = undefined;
  160. return new Promise(function (resolve, reject) {
  161. var callbackFunction = options.jsonpCallbackFunction || generateCallbackFunction();
  162. var scriptId = jsonpCallback + '_' + callbackFunction;
  163. window[callbackFunction] = function (response) {
  164. resolve({
  165. ok: true,
  166. // keep consistent with fetch API
  167. json: function json() {
  168. return Promise.resolve(response);
  169. }
  170. });
  171. if (timeoutId) clearTimeout(timeoutId);
  172. removeScript(scriptId);
  173. clearFunction(callbackFunction);
  174. };
  175. // Check if the user set their own params, and if not add a ? to start a list of params
  176. url += url.indexOf('?') === -1 ? '?' : '&';
  177. var jsonpScript = document.createElement('script');
  178. jsonpScript.setAttribute('src', '' + url + jsonpCallback + '=' + callbackFunction);
  179. if (options.charset) {
  180. jsonpScript.setAttribute('charset', options.charset);
  181. }
  182. jsonpScript.id = scriptId;
  183. document.getElementsByTagName('head')[0].appendChild(jsonpScript);
  184. timeoutId = setTimeout(function () {
  185. reject(new Error('JSONP request to ' + _url + ' timed out'));
  186. clearFunction(callbackFunction);
  187. removeScript(scriptId);
  188. window[callbackFunction] = function () {
  189. clearFunction(callbackFunction);
  190. };
  191. }, timeout);
  192. // Caught if got 404/500
  193. jsonpScript.onerror = function () {
  194. reject(new Error('JSONP request to ' + _url + ' failed'));
  195. clearFunction(callbackFunction);
  196. removeScript(scriptId);
  197. if (timeoutId) clearTimeout(timeoutId);
  198. };
  199. });
  200. }
  201. // export as global function
  202. /*
  203. let local;
  204. if (typeof global !== 'undefined') {
  205. local = global;
  206. } else if (typeof self !== 'undefined') {
  207. local = self;
  208. } else {
  209. try {
  210. local = Function('return this')();
  211. } catch (e) {
  212. throw new Error('polyfill failed because global object is unavailable in this environment');
  213. }
  214. }
  215. local.fetchJsonp = fetchJsonp;
  216. */
  217. module.exports = fetchJsonp;
  218. });
  219. /***/ }),
  220. /* 3 */
  221. /***/ (function(module, exports) {
  222. module.exports = function(){try{return elasticsearch}catch(e){return {}}}();
  223. /***/ }),
  224. /* 4 */
  225. /***/ (function(module, exports, __webpack_require__) {
  226. /* WEBPACK VAR INJECTION */(function(setImmediate, global) {(function (global, factory) {
  227. true ? factory() :
  228. undefined;
  229. }(this, (function () { 'use strict';
  230. /**
  231. * @this {Promise}
  232. */
  233. function finallyConstructor(callback) {
  234. var constructor = this.constructor;
  235. return this.then(
  236. function(value) {
  237. // @ts-ignore
  238. return constructor.resolve(callback()).then(function() {
  239. return value;
  240. });
  241. },
  242. function(reason) {
  243. // @ts-ignore
  244. return constructor.resolve(callback()).then(function() {
  245. // @ts-ignore
  246. return constructor.reject(reason);
  247. });
  248. }
  249. );
  250. }
  251. // Store setTimeout reference so promise-polyfill will be unaffected by
  252. // other code modifying setTimeout (like sinon.useFakeTimers())
  253. var setTimeoutFunc = setTimeout;
  254. function isArray(x) {
  255. return Boolean(x && typeof x.length !== 'undefined');
  256. }
  257. function noop() {}
  258. // Polyfill for Function.prototype.bind
  259. function bind(fn, thisArg) {
  260. return function() {
  261. fn.apply(thisArg, arguments);
  262. };
  263. }
  264. /**
  265. * @constructor
  266. * @param {Function} fn
  267. */
  268. function Promise(fn) {
  269. if (!(this instanceof Promise))
  270. throw new TypeError('Promises must be constructed via new');
  271. if (typeof fn !== 'function') throw new TypeError('not a function');
  272. /** @type {!number} */
  273. this._state = 0;
  274. /** @type {!boolean} */
  275. this._handled = false;
  276. /** @type {Promise|undefined} */
  277. this._value = undefined;
  278. /** @type {!Array<!Function>} */
  279. this._deferreds = [];
  280. doResolve(fn, this);
  281. }
  282. function handle(self, deferred) {
  283. while (self._state === 3) {
  284. self = self._value;
  285. }
  286. if (self._state === 0) {
  287. self._deferreds.push(deferred);
  288. return;
  289. }
  290. self._handled = true;
  291. Promise._immediateFn(function() {
  292. var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;
  293. if (cb === null) {
  294. (self._state === 1 ? resolve : reject)(deferred.promise, self._value);
  295. return;
  296. }
  297. var ret;
  298. try {
  299. ret = cb(self._value);
  300. } catch (e) {
  301. reject(deferred.promise, e);
  302. return;
  303. }
  304. resolve(deferred.promise, ret);
  305. });
  306. }
  307. function resolve(self, newValue) {
  308. try {
  309. // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure
  310. if (newValue === self)
  311. throw new TypeError('A promise cannot be resolved with itself.');
  312. if (
  313. newValue &&
  314. (typeof newValue === 'object' || typeof newValue === 'function')
  315. ) {
  316. var then = newValue.then;
  317. if (newValue instanceof Promise) {
  318. self._state = 3;
  319. self._value = newValue;
  320. finale(self);
  321. return;
  322. } else if (typeof then === 'function') {
  323. doResolve(bind(then, newValue), self);
  324. return;
  325. }
  326. }
  327. self._state = 1;
  328. self._value = newValue;
  329. finale(self);
  330. } catch (e) {
  331. reject(self, e);
  332. }
  333. }
  334. function reject(self, newValue) {
  335. self._state = 2;
  336. self._value = newValue;
  337. finale(self);
  338. }
  339. function finale(self) {
  340. if (self._state === 2 && self._deferreds.length === 0) {
  341. Promise._immediateFn(function() {
  342. if (!self._handled) {
  343. Promise._unhandledRejectionFn(self._value);
  344. }
  345. });
  346. }
  347. for (var i = 0, len = self._deferreds.length; i < len; i++) {
  348. handle(self, self._deferreds[i]);
  349. }
  350. self._deferreds = null;
  351. }
  352. /**
  353. * @constructor
  354. */
  355. function Handler(onFulfilled, onRejected, promise) {
  356. this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
  357. this.onRejected = typeof onRejected === 'function' ? onRejected : null;
  358. this.promise = promise;
  359. }
  360. /**
  361. * Take a potentially misbehaving resolver function and make sure
  362. * onFulfilled and onRejected are only called once.
  363. *
  364. * Makes no guarantees about asynchrony.
  365. */
  366. function doResolve(fn, self) {
  367. var done = false;
  368. try {
  369. fn(
  370. function(value) {
  371. if (done) return;
  372. done = true;
  373. resolve(self, value);
  374. },
  375. function(reason) {
  376. if (done) return;
  377. done = true;
  378. reject(self, reason);
  379. }
  380. );
  381. } catch (ex) {
  382. if (done) return;
  383. done = true;
  384. reject(self, ex);
  385. }
  386. }
  387. Promise.prototype['catch'] = function(onRejected) {
  388. return this.then(null, onRejected);
  389. };
  390. Promise.prototype.then = function(onFulfilled, onRejected) {
  391. // @ts-ignore
  392. var prom = new this.constructor(noop);
  393. handle(this, new Handler(onFulfilled, onRejected, prom));
  394. return prom;
  395. };
  396. Promise.prototype['finally'] = finallyConstructor;
  397. Promise.all = function(arr) {
  398. return new Promise(function(resolve, reject) {
  399. if (!isArray(arr)) {
  400. return reject(new TypeError('Promise.all accepts an array'));
  401. }
  402. var args = Array.prototype.slice.call(arr);
  403. if (args.length === 0) return resolve([]);
  404. var remaining = args.length;
  405. function res(i, val) {
  406. try {
  407. if (val && (typeof val === 'object' || typeof val === 'function')) {
  408. var then = val.then;
  409. if (typeof then === 'function') {
  410. then.call(
  411. val,
  412. function(val) {
  413. res(i, val);
  414. },
  415. reject
  416. );
  417. return;
  418. }
  419. }
  420. args[i] = val;
  421. if (--remaining === 0) {
  422. resolve(args);
  423. }
  424. } catch (ex) {
  425. reject(ex);
  426. }
  427. }
  428. for (var i = 0; i < args.length; i++) {
  429. res(i, args[i]);
  430. }
  431. });
  432. };
  433. Promise.resolve = function(value) {
  434. if (value && typeof value === 'object' && value.constructor === Promise) {
  435. return value;
  436. }
  437. return new Promise(function(resolve) {
  438. resolve(value);
  439. });
  440. };
  441. Promise.reject = function(value) {
  442. return new Promise(function(resolve, reject) {
  443. reject(value);
  444. });
  445. };
  446. Promise.race = function(arr) {
  447. return new Promise(function(resolve, reject) {
  448. if (!isArray(arr)) {
  449. return reject(new TypeError('Promise.race accepts an array'));
  450. }
  451. for (var i = 0, len = arr.length; i < len; i++) {
  452. Promise.resolve(arr[i]).then(resolve, reject);
  453. }
  454. });
  455. };
  456. // Use polyfill for setImmediate for performance gains
  457. Promise._immediateFn =
  458. // @ts-ignore
  459. (typeof setImmediate === 'function' &&
  460. function(fn) {
  461. // @ts-ignore
  462. setImmediate(fn);
  463. }) ||
  464. function(fn) {
  465. setTimeoutFunc(fn, 0);
  466. };
  467. Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {
  468. if (typeof console !== 'undefined' && console) {
  469. console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console
  470. }
  471. };
  472. /** @suppress {undefinedVars} */
  473. var globalNS = (function() {
  474. // the only reliable means to get the global object is
  475. // `Function('return this')()`
  476. // However, this causes CSP violations in Chrome apps.
  477. if (typeof self !== 'undefined') {
  478. return self;
  479. }
  480. if (typeof window !== 'undefined') {
  481. return window;
  482. }
  483. if (typeof global !== 'undefined') {
  484. return global;
  485. }
  486. throw new Error('unable to locate global object');
  487. })();
  488. if (!('Promise' in globalNS)) {
  489. globalNS['Promise'] = Promise;
  490. } else if (!globalNS.Promise.prototype['finally']) {
  491. globalNS.Promise.prototype['finally'] = finallyConstructor;
  492. }
  493. })));
  494. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(5).setImmediate, __webpack_require__(1)))
  495. /***/ }),
  496. /* 5 */
  497. /***/ (function(module, exports, __webpack_require__) {
  498. /* WEBPACK VAR INJECTION */(function(global) {var scope = (typeof global !== "undefined" && global) ||
  499. (typeof self !== "undefined" && self) ||
  500. window;
  501. var apply = Function.prototype.apply;
  502. // DOM APIs, for completeness
  503. exports.setTimeout = function() {
  504. return new Timeout(apply.call(setTimeout, scope, arguments), clearTimeout);
  505. };
  506. exports.setInterval = function() {
  507. return new Timeout(apply.call(setInterval, scope, arguments), clearInterval);
  508. };
  509. exports.clearTimeout =
  510. exports.clearInterval = function(timeout) {
  511. if (timeout) {
  512. timeout.close();
  513. }
  514. };
  515. function Timeout(id, clearFn) {
  516. this._id = id;
  517. this._clearFn = clearFn;
  518. }
  519. Timeout.prototype.unref = Timeout.prototype.ref = function() {};
  520. Timeout.prototype.close = function() {
  521. this._clearFn.call(scope, this._id);
  522. };
  523. // Does not start the time, just sets up the members needed.
  524. exports.enroll = function(item, msecs) {
  525. clearTimeout(item._idleTimeoutId);
  526. item._idleTimeout = msecs;
  527. };
  528. exports.unenroll = function(item) {
  529. clearTimeout(item._idleTimeoutId);
  530. item._idleTimeout = -1;
  531. };
  532. exports._unrefActive = exports.active = function(item) {
  533. clearTimeout(item._idleTimeoutId);
  534. var msecs = item._idleTimeout;
  535. if (msecs >= 0) {
  536. item._idleTimeoutId = setTimeout(function onTimeout() {
  537. if (item._onTimeout)
  538. item._onTimeout();
  539. }, msecs);
  540. }
  541. };
  542. // setimmediate attaches itself to the global object
  543. __webpack_require__(6);
  544. // On some exotic environments, it's not clear which object `setimmediate` was
  545. // able to install onto. Search each possibility in the same order as the
  546. // `setimmediate` library.
  547. exports.setImmediate = (typeof self !== "undefined" && self.setImmediate) ||
  548. (typeof global !== "undefined" && global.setImmediate) ||
  549. (this && this.setImmediate);
  550. exports.clearImmediate = (typeof self !== "undefined" && self.clearImmediate) ||
  551. (typeof global !== "undefined" && global.clearImmediate) ||
  552. (this && this.clearImmediate);
  553. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1)))
  554. /***/ }),
  555. /* 6 */
  556. /***/ (function(module, exports, __webpack_require__) {
  557. /* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {
  558. "use strict";
  559. if (global.setImmediate) {
  560. return;
  561. }
  562. var nextHandle = 1; // Spec says greater than zero
  563. var tasksByHandle = {};
  564. var currentlyRunningATask = false;
  565. var doc = global.document;
  566. var registerImmediate;
  567. function setImmediate(callback) {
  568. // Callback can either be a function or a string
  569. if (typeof callback !== "function") {
  570. callback = new Function("" + callback);
  571. }
  572. // Copy function arguments
  573. var args = new Array(arguments.length - 1);
  574. for (var i = 0; i < args.length; i++) {
  575. args[i] = arguments[i + 1];
  576. }
  577. // Store and register the task
  578. var task = { callback: callback, args: args };
  579. tasksByHandle[nextHandle] = task;
  580. registerImmediate(nextHandle);
  581. return nextHandle++;
  582. }
  583. function clearImmediate(handle) {
  584. delete tasksByHandle[handle];
  585. }
  586. function run(task) {
  587. var callback = task.callback;
  588. var args = task.args;
  589. switch (args.length) {
  590. case 0:
  591. callback();
  592. break;
  593. case 1:
  594. callback(args[0]);
  595. break;
  596. case 2:
  597. callback(args[0], args[1]);
  598. break;
  599. case 3:
  600. callback(args[0], args[1], args[2]);
  601. break;
  602. default:
  603. callback.apply(undefined, args);
  604. break;
  605. }
  606. }
  607. function runIfPresent(handle) {
  608. // From the spec: "Wait until any invocations of this algorithm started before this one have completed."
  609. // So if we're currently running a task, we'll need to delay this invocation.
  610. if (currentlyRunningATask) {
  611. // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a
  612. // "too much recursion" error.
  613. setTimeout(runIfPresent, 0, handle);
  614. } else {
  615. var task = tasksByHandle[handle];
  616. if (task) {
  617. currentlyRunningATask = true;
  618. try {
  619. run(task);
  620. } finally {
  621. clearImmediate(handle);
  622. currentlyRunningATask = false;
  623. }
  624. }
  625. }
  626. }
  627. function installNextTickImplementation() {
  628. registerImmediate = function(handle) {
  629. process.nextTick(function () { runIfPresent(handle); });
  630. };
  631. }
  632. function canUsePostMessage() {
  633. // The test against `importScripts` prevents this implementation from being installed inside a web worker,
  634. // where `global.postMessage` means something completely different and can't be used for this purpose.
  635. if (global.postMessage && !global.importScripts) {
  636. var postMessageIsAsynchronous = true;
  637. var oldOnMessage = global.onmessage;
  638. global.onmessage = function() {
  639. postMessageIsAsynchronous = false;
  640. };
  641. global.postMessage("", "*");
  642. global.onmessage = oldOnMessage;
  643. return postMessageIsAsynchronous;
  644. }
  645. }
  646. function installPostMessageImplementation() {
  647. // Installs an event handler on `global` for the `message` event: see
  648. // * https://developer.mozilla.org/en/DOM/window.postMessage
  649. // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages
  650. var messagePrefix = "setImmediate$" + Math.random() + "$";
  651. var onGlobalMessage = function(event) {
  652. if (event.source === global &&
  653. typeof event.data === "string" &&
  654. event.data.indexOf(messagePrefix) === 0) {
  655. runIfPresent(+event.data.slice(messagePrefix.length));
  656. }
  657. };
  658. if (global.addEventListener) {
  659. global.addEventListener("message", onGlobalMessage, false);
  660. } else {
  661. global.attachEvent("onmessage", onGlobalMessage);
  662. }
  663. registerImmediate = function(handle) {
  664. global.postMessage(messagePrefix + handle, "*");
  665. };
  666. }
  667. function installMessageChannelImplementation() {
  668. var channel = new MessageChannel();
  669. channel.port1.onmessage = function(event) {
  670. var handle = event.data;
  671. runIfPresent(handle);
  672. };
  673. registerImmediate = function(handle) {
  674. channel.port2.postMessage(handle);
  675. };
  676. }
  677. function installReadyStateChangeImplementation() {
  678. var html = doc.documentElement;
  679. registerImmediate = function(handle) {
  680. // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted
  681. // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.
  682. var script = doc.createElement("script");
  683. script.onreadystatechange = function () {
  684. runIfPresent(handle);
  685. script.onreadystatechange = null;
  686. html.removeChild(script);
  687. script = null;
  688. };
  689. html.appendChild(script);
  690. };
  691. }
  692. function installSetTimeoutImplementation() {
  693. registerImmediate = function(handle) {
  694. setTimeout(runIfPresent, 0, handle);
  695. };
  696. }
  697. // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.
  698. var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);
  699. attachTo = attachTo && attachTo.setTimeout ? attachTo : global;
  700. // Don't get fooled by e.g. browserify environments.
  701. if ({}.toString.call(global.process) === "[object process]") {
  702. // For Node.js before 0.9
  703. installNextTickImplementation();
  704. } else if (canUsePostMessage()) {
  705. // For non-IE10 modern browsers
  706. installPostMessageImplementation();
  707. } else if (global.MessageChannel) {
  708. // For web workers, where supported
  709. installMessageChannelImplementation();
  710. } else if (doc && "onreadystatechange" in doc.createElement("script")) {
  711. // For IE 6–8
  712. installReadyStateChangeImplementation();
  713. } else {
  714. // For older browsers
  715. installSetTimeoutImplementation();
  716. }
  717. attachTo.setImmediate = setImmediate;
  718. attachTo.clearImmediate = clearImmediate;
  719. }(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
  720. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1), __webpack_require__(7)))
  721. /***/ }),
  722. /* 7 */
  723. /***/ (function(module, exports) {
  724. // shim for using process in browser
  725. var process = module.exports = {};
  726. // cached from whatever global is present so that test runners that stub it
  727. // don't break things. But we need to wrap it in a try catch in case it is
  728. // wrapped in strict mode code which doesn't define any globals. It's inside a
  729. // function because try/catches deoptimize in certain engines.
  730. var cachedSetTimeout;
  731. var cachedClearTimeout;
  732. function defaultSetTimout() {
  733. throw new Error('setTimeout has not been defined');
  734. }
  735. function defaultClearTimeout () {
  736. throw new Error('clearTimeout has not been defined');
  737. }
  738. (function () {
  739. try {
  740. if (typeof setTimeout === 'function') {
  741. cachedSetTimeout = setTimeout;
  742. } else {
  743. cachedSetTimeout = defaultSetTimout;
  744. }
  745. } catch (e) {
  746. cachedSetTimeout = defaultSetTimout;
  747. }
  748. try {
  749. if (typeof clearTimeout === 'function') {
  750. cachedClearTimeout = clearTimeout;
  751. } else {
  752. cachedClearTimeout = defaultClearTimeout;
  753. }
  754. } catch (e) {
  755. cachedClearTimeout = defaultClearTimeout;
  756. }
  757. } ())
  758. function runTimeout(fun) {
  759. if (cachedSetTimeout === setTimeout) {
  760. //normal enviroments in sane situations
  761. return setTimeout(fun, 0);
  762. }
  763. // if setTimeout wasn't available but was latter defined
  764. if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
  765. cachedSetTimeout = setTimeout;
  766. return setTimeout(fun, 0);
  767. }
  768. try {
  769. // when when somebody has screwed with setTimeout but no I.E. maddness
  770. return cachedSetTimeout(fun, 0);
  771. } catch(e){
  772. try {
  773. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  774. return cachedSetTimeout.call(null, fun, 0);
  775. } catch(e){
  776. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
  777. return cachedSetTimeout.call(this, fun, 0);
  778. }
  779. }
  780. }
  781. function runClearTimeout(marker) {
  782. if (cachedClearTimeout === clearTimeout) {
  783. //normal enviroments in sane situations
  784. return clearTimeout(marker);
  785. }
  786. // if clearTimeout wasn't available but was latter defined
  787. if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
  788. cachedClearTimeout = clearTimeout;
  789. return clearTimeout(marker);
  790. }
  791. try {
  792. // when when somebody has screwed with setTimeout but no I.E. maddness
  793. return cachedClearTimeout(marker);
  794. } catch (e){
  795. try {
  796. // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
  797. return cachedClearTimeout.call(null, marker);
  798. } catch (e){
  799. // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
  800. // Some versions of I.E. have different rules for clearTimeout vs setTimeout
  801. return cachedClearTimeout.call(this, marker);
  802. }
  803. }
  804. }
  805. var queue = [];
  806. var draining = false;
  807. var currentQueue;
  808. var queueIndex = -1;
  809. function cleanUpNextTick() {
  810. if (!draining || !currentQueue) {
  811. return;
  812. }
  813. draining = false;
  814. if (currentQueue.length) {
  815. queue = currentQueue.concat(queue);
  816. } else {
  817. queueIndex = -1;
  818. }
  819. if (queue.length) {
  820. drainQueue();
  821. }
  822. }
  823. function drainQueue() {
  824. if (draining) {
  825. return;
  826. }
  827. var timeout = runTimeout(cleanUpNextTick);
  828. draining = true;
  829. var len = queue.length;
  830. while(len) {
  831. currentQueue = queue;
  832. queue = [];
  833. while (++queueIndex < len) {
  834. if (currentQueue) {
  835. currentQueue[queueIndex].run();
  836. }
  837. }
  838. queueIndex = -1;
  839. len = queue.length;
  840. }
  841. currentQueue = null;
  842. draining = false;
  843. runClearTimeout(timeout);
  844. }
  845. process.nextTick = function (fun) {
  846. var args = new Array(arguments.length - 1);
  847. if (arguments.length > 1) {
  848. for (var i = 1; i < arguments.length; i++) {
  849. args[i - 1] = arguments[i];
  850. }
  851. }
  852. queue.push(new Item(fun, args));
  853. if (queue.length === 1 && !draining) {
  854. runTimeout(drainQueue);
  855. }
  856. };
  857. // v8 likes predictible objects
  858. function Item(fun, array) {
  859. this.fun = fun;
  860. this.array = array;
  861. }
  862. Item.prototype.run = function () {
  863. this.fun.apply(null, this.array);
  864. };
  865. process.title = 'browser';
  866. process.browser = true;
  867. process.env = {};
  868. process.argv = [];
  869. process.version = ''; // empty string to avoid regexp issues
  870. process.versions = {};
  871. function noop() {}
  872. process.on = noop;
  873. process.addListener = noop;
  874. process.once = noop;
  875. process.off = noop;
  876. process.removeListener = noop;
  877. process.removeAllListeners = noop;
  878. process.emit = noop;
  879. process.prependListener = noop;
  880. process.prependOnceListener = noop;
  881. process.listeners = function (name) { return [] }
  882. process.binding = function (name) {
  883. throw new Error('process.binding is not supported');
  884. };
  885. process.cwd = function () { return '/' };
  886. process.chdir = function (dir) {
  887. throw new Error('process.chdir is not supported');
  888. };
  889. process.umask = function() { return 0; };
  890. /***/ }),
  891. /* 8 */
  892. /***/ (function(module, exports, __webpack_require__) {
  893. (function(self) {
  894. 'use strict';
  895. // if __disableNativeFetch is set to true, the it will always polyfill fetch
  896. // with Ajax.
  897. if (!self.__disableNativeFetch && self.fetch) {
  898. return
  899. }
  900. function normalizeName(name) {
  901. if (typeof name !== 'string') {
  902. name = String(name)
  903. }
  904. if (/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(name)) {
  905. throw new TypeError('Invalid character in header field name')
  906. }
  907. return name.toLowerCase()
  908. }
  909. function normalizeValue(value) {
  910. if (typeof value !== 'string') {
  911. value = String(value)
  912. }
  913. return value
  914. }
  915. function Headers(headers) {
  916. this.map = {}
  917. if (headers instanceof Headers) {
  918. headers.forEach(function(value, name) {
  919. this.append(name, value)
  920. }, this)
  921. } else if (headers) {
  922. Object.getOwnPropertyNames(headers).forEach(function(name) {
  923. this.append(name, headers[name])
  924. }, this)
  925. }
  926. }
  927. Headers.prototype.append = function(name, value) {
  928. name = normalizeName(name)
  929. value = normalizeValue(value)
  930. var list = this.map[name]
  931. if (!list) {
  932. list = []
  933. this.map[name] = list
  934. }
  935. list.push(value)
  936. }
  937. Headers.prototype['delete'] = function(name) {
  938. delete this.map[normalizeName(name)]
  939. }
  940. Headers.prototype.get = function(name) {
  941. var values = this.map[normalizeName(name)]
  942. return values ? values[0] : null
  943. }
  944. Headers.prototype.getAll = function(name) {
  945. return this.map[normalizeName(name)] || []
  946. }
  947. Headers.prototype.has = function(name) {
  948. return this.map.hasOwnProperty(normalizeName(name))
  949. }
  950. Headers.prototype.set = function(name, value) {
  951. this.map[normalizeName(name)] = [normalizeValue(value)]
  952. }
  953. Headers.prototype.forEach = function(callback, thisArg) {
  954. Object.getOwnPropertyNames(this.map).forEach(function(name) {
  955. this.map[name].forEach(function(value) {
  956. callback.call(thisArg, value, name, this)
  957. }, this)
  958. }, this)
  959. }
  960. function consumed(body) {
  961. if (body.bodyUsed) {
  962. return Promise.reject(new TypeError('Already read'))
  963. }
  964. body.bodyUsed = true
  965. }
  966. function fileReaderReady(reader) {
  967. return new Promise(function(resolve, reject) {
  968. reader.onload = function() {
  969. resolve(reader.result)
  970. }
  971. reader.onerror = function() {
  972. reject(reader.error)
  973. }
  974. })
  975. }
  976. function readBlobAsArrayBuffer(blob) {
  977. var reader = new FileReader()
  978. reader.readAsArrayBuffer(blob)
  979. return fileReaderReady(reader)
  980. }
  981. function readBlobAsText(blob, options) {
  982. var reader = new FileReader()
  983. var contentType = options.headers.map['content-type'] ? options.headers.map['content-type'].toString() : ''
  984. var regex = /charset\=[0-9a-zA-Z\-\_]*;?/
  985. var _charset = blob.type.match(regex) || contentType.match(regex)
  986. var args = [blob]
  987. if(_charset) {
  988. args.push(_charset[0].replace(/^charset\=/, '').replace(/;$/, ''))
  989. }
  990. reader.readAsText.apply(reader, args)
  991. return fileReaderReady(reader)
  992. }
  993. var support = {
  994. blob: 'FileReader' in self && 'Blob' in self && (function() {
  995. try {
  996. new Blob();
  997. return true
  998. } catch(e) {
  999. return false
  1000. }
  1001. })(),
  1002. formData: 'FormData' in self,
  1003. arrayBuffer: 'ArrayBuffer' in self
  1004. }
  1005. function Body() {
  1006. this.bodyUsed = false
  1007. this._initBody = function(body, options) {
  1008. this._bodyInit = body
  1009. if (typeof body === 'string') {
  1010. this._bodyText = body
  1011. } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
  1012. this._bodyBlob = body
  1013. this._options = options
  1014. } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
  1015. this._bodyFormData = body
  1016. } else if (!body) {
  1017. this._bodyText = ''
  1018. } else if (support.arrayBuffer && ArrayBuffer.prototype.isPrototypeOf(body)) {
  1019. // Only support ArrayBuffers for POST method.
  1020. // Receiving ArrayBuffers happens via Blobs, instead.
  1021. } else {
  1022. throw new Error('unsupported BodyInit type')
  1023. }
  1024. }
  1025. if (support.blob) {
  1026. this.blob = function() {
  1027. var rejected = consumed(this)
  1028. if (rejected) {
  1029. return rejected
  1030. }
  1031. if (this._bodyBlob) {
  1032. return Promise.resolve(this._bodyBlob)
  1033. } else if (this._bodyFormData) {
  1034. throw new Error('could not read FormData body as blob')
  1035. } else {
  1036. return Promise.resolve(new Blob([this._bodyText]))
  1037. }
  1038. }
  1039. this.arrayBuffer = function() {
  1040. return this.blob().then(readBlobAsArrayBuffer)
  1041. }
  1042. this.text = function() {
  1043. var rejected = consumed(this)
  1044. if (rejected) {
  1045. return rejected
  1046. }
  1047. if (this._bodyBlob) {
  1048. return readBlobAsText(this._bodyBlob, this._options)
  1049. } else if (this._bodyFormData) {
  1050. throw new Error('could not read FormData body as text')
  1051. } else {
  1052. return Promise.resolve(this._bodyText)
  1053. }
  1054. }
  1055. } else {
  1056. this.text = function() {
  1057. var rejected = consumed(this)
  1058. return rejected ? rejected : Promise.resolve(this._bodyText)
  1059. }
  1060. }
  1061. if (support.formData) {
  1062. this.formData = function() {
  1063. return this.text().then(decode)
  1064. }
  1065. }
  1066. this.json = function() {
  1067. return this.text().then(JSON.parse)
  1068. }
  1069. return this
  1070. }
  1071. // HTTP methods whose capitalization should be normalized
  1072. var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT']
  1073. function normalizeMethod(method) {
  1074. var upcased = method.toUpperCase()
  1075. return (methods.indexOf(upcased) > -1) ? upcased : method
  1076. }
  1077. function Request(input, options) {
  1078. options = options || {}
  1079. var body = options.body
  1080. if (Request.prototype.isPrototypeOf(input)) {
  1081. if (input.bodyUsed) {
  1082. throw new TypeError('Already read')
  1083. }
  1084. this.url = input.url
  1085. this.credentials = input.credentials
  1086. if (!options.headers) {
  1087. this.headers = new Headers(input.headers)
  1088. }
  1089. this.method = input.method
  1090. this.mode = input.mode
  1091. if (!body) {
  1092. body = input._bodyInit
  1093. input.bodyUsed = true
  1094. }
  1095. } else {
  1096. this.url = input
  1097. }
  1098. this.credentials = options.credentials || this.credentials || 'omit'
  1099. if (options.headers || !this.headers) {
  1100. this.headers = new Headers(options.headers)
  1101. }
  1102. this.method = normalizeMethod(options.method || this.method || 'GET')
  1103. this.mode = options.mode || this.mode || null
  1104. this.referrer = null
  1105. if ((this.method === 'GET' || this.method === 'HEAD') && body) {
  1106. throw new TypeError('Body not allowed for GET or HEAD requests')
  1107. }
  1108. this._initBody(body, options)
  1109. }
  1110. Request.prototype.clone = function() {
  1111. return new Request(this)
  1112. }
  1113. function decode(body) {
  1114. var form = new FormData()
  1115. body.trim().split('&').forEach(function(bytes) {
  1116. if (bytes) {
  1117. var split = bytes.split('=')
  1118. var name = split.shift().replace(/\+/g, ' ')
  1119. var value = split.join('=').replace(/\+/g, ' ')
  1120. form.append(decodeURIComponent(name), decodeURIComponent(value))
  1121. }
  1122. })
  1123. return form
  1124. }
  1125. function headers(xhr) {
  1126. var head = new Headers()
  1127. var pairs = xhr.getAllResponseHeaders().trim().split('\n')
  1128. pairs.forEach(function(header) {
  1129. var split = header.trim().split(':')
  1130. var key = split.shift().trim()
  1131. var value = split.join(':').trim()
  1132. head.append(key, value)
  1133. })
  1134. return head
  1135. }
  1136. Body.call(Request.prototype)
  1137. function Response(bodyInit, options) {
  1138. if (!options) {
  1139. options = {}
  1140. }
  1141. this._initBody(bodyInit, options)
  1142. this.type = 'default'
  1143. this.status = options.status
  1144. this.ok = this.status >= 200 && this.status < 300
  1145. this.statusText = options.statusText
  1146. this.headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers)
  1147. this.url = options.url || ''
  1148. }
  1149. Body.call(Response.prototype)
  1150. Response.prototype.clone = function() {
  1151. return new Response(this._bodyInit, {
  1152. status: this.status,
  1153. statusText: this.statusText,
  1154. headers: new Headers(this.headers),
  1155. url: this.url
  1156. })
  1157. }
  1158. Response.error = function() {
  1159. var response = new Response(null, {status: 0, statusText: ''})
  1160. response.type = 'error'
  1161. return response
  1162. }
  1163. var redirectStatuses = [301, 302, 303, 307, 308]
  1164. Response.redirect = function(url, status) {
  1165. if (redirectStatuses.indexOf(status) === -1) {
  1166. throw new RangeError('Invalid status code')
  1167. }
  1168. return new Response(null, {status: status, headers: {location: url}})
  1169. }
  1170. self.Headers = Headers;
  1171. self.Request = Request;
  1172. self.Response = Response;
  1173. self.fetch = function(input, init) {
  1174. return new Promise(function(resolve, reject) {
  1175. var request
  1176. if (Request.prototype.isPrototypeOf(input) && !init) {
  1177. request = input
  1178. } else {
  1179. request = new Request(input, init)
  1180. }
  1181. var xhr = new XMLHttpRequest()
  1182. function responseURL() {
  1183. if ('responseURL' in xhr) {
  1184. return xhr.responseURL
  1185. }
  1186. // Avoid security warnings on getResponseHeader when not allowed by CORS
  1187. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  1188. return xhr.getResponseHeader('X-Request-URL')
  1189. }
  1190. return;
  1191. }
  1192. var __onLoadHandled = false;
  1193. function onload() {
  1194. if (xhr.readyState !== 4) {
  1195. return
  1196. }
  1197. var status = (xhr.status === 1223) ? 204 : xhr.status
  1198. if (status < 100 || status > 599) {
  1199. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1200. reject(new TypeError('Network request failed'))
  1201. return
  1202. }
  1203. var options = {
  1204. status: status,
  1205. statusText: xhr.statusText,
  1206. headers: headers(xhr),
  1207. url: responseURL()
  1208. }
  1209. var body = 'response' in xhr ? xhr.response : xhr.responseText;
  1210. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1211. resolve(new Response(body, options))
  1212. }
  1213. xhr.onreadystatechange = onload;
  1214. xhr.onload = onload;
  1215. xhr.onerror = function() {
  1216. if (__onLoadHandled) { return; } else { __onLoadHandled = true; }
  1217. reject(new TypeError('Network request failed'))
  1218. }
  1219. xhr.open(request.method, request.url, true)
  1220. // `withCredentials` should be setted after calling `.open` in IE10
  1221. // http://stackoverflow.com/a/19667959/1219343
  1222. try {
  1223. if (request.credentials === 'include') {
  1224. if ('withCredentials' in xhr) {
  1225. xhr.withCredentials = true;
  1226. } else {
  1227. console && console.warn && console.warn('withCredentials is not supported, you can ignore this warning');
  1228. }
  1229. }
  1230. } catch (e) {
  1231. console && console.warn && console.warn('set withCredentials error:' + e);
  1232. }
  1233. if ('responseType' in xhr && support.blob) {
  1234. xhr.responseType = 'blob'
  1235. }
  1236. request.headers.forEach(function(value, name) {
  1237. xhr.setRequestHeader(name, value)
  1238. })
  1239. xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit)
  1240. })
  1241. }
  1242. self.fetch.polyfill = true
  1243. // Support CommonJS
  1244. if ( true && module.exports) {
  1245. module.exports = self.fetch;
  1246. }
  1247. })(typeof self !== 'undefined' ? self : this);
  1248. /***/ }),
  1249. /* 9 */
  1250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1251. "use strict";
  1252. // ESM COMPAT FLAG
  1253. __webpack_require__.r(__webpack_exports__);
  1254. // EXPORTS
  1255. __webpack_require__.d(__webpack_exports__, "ElasticSearch", function() { return /* reexport */ ElasticSearch_ElasticSearch; });
  1256. __webpack_require__.d(__webpack_exports__, "SecurityManager", function() { return /* reexport */ SecurityManager_SecurityManager; });
  1257. __webpack_require__.d(__webpack_exports__, "KernelDensityJobParameter", function() { return /* reexport */ KernelDensityJobParameter_KernelDensityJobParameter; });
  1258. __webpack_require__.d(__webpack_exports__, "SingleObjectQueryJobsParameter", function() { return /* reexport */ SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter; });
  1259. __webpack_require__.d(__webpack_exports__, "SummaryAttributesJobsParameter", function() { return /* reexport */ SummaryAttributesJobsParameter_SummaryAttributesJobsParameter; });
  1260. __webpack_require__.d(__webpack_exports__, "SummaryMeshJobParameter", function() { return /* reexport */ SummaryMeshJobParameter_SummaryMeshJobParameter; });
  1261. __webpack_require__.d(__webpack_exports__, "SummaryRegionJobParameter", function() { return /* reexport */ SummaryRegionJobParameter_SummaryRegionJobParameter; });
  1262. __webpack_require__.d(__webpack_exports__, "OverlayGeoJobParameter", function() { return /* reexport */ OverlayGeoJobParameter_OverlayGeoJobParameter; });
  1263. __webpack_require__.d(__webpack_exports__, "BuffersAnalystJobsParameter", function() { return /* reexport */ BuffersAnalystJobsParameter_BuffersAnalystJobsParameter; });
  1264. __webpack_require__.d(__webpack_exports__, "TopologyValidatorJobsParameter", function() { return /* reexport */ TopologyValidatorJobsParameter_TopologyValidatorJobsParameter; });
  1265. __webpack_require__.d(__webpack_exports__, "OutputSetting", function() { return /* reexport */ OutputSetting_OutputSetting; });
  1266. __webpack_require__.d(__webpack_exports__, "MappingParameters", function() { return /* reexport */ MappingParameters_MappingParameters; });
  1267. __webpack_require__.d(__webpack_exports__, "GeoCodingParameter", function() { return /* reexport */ GeoCodingParameter_GeoCodingParameter; });
  1268. __webpack_require__.d(__webpack_exports__, "GeoDecodingParameter", function() { return /* reexport */ GeoDecodingParameter_GeoDecodingParameter; });
  1269. __webpack_require__.d(__webpack_exports__, "MapVLayer", function() { return /* reexport */ MapVLayer_MapVLayer; });
  1270. __webpack_require__.d(__webpack_exports__, "MapVRenderer", function() { return /* reexport */ MapVRenderer_MapVRenderer; });
  1271. __webpack_require__.d(__webpack_exports__, "AddressMatchService", function() { return /* reexport */ services_AddressMatchService_AddressMatchService; });
  1272. __webpack_require__.d(__webpack_exports__, "ProcessingService", function() { return /* reexport */ ProcessingService_ProcessingService; });
  1273. __webpack_require__.d(__webpack_exports__, "SuperMap", function() { return /* reexport */ SuperMap_SuperMap; });
  1274. // CONCATENATED MODULE: ./src/common/SuperMap.js
  1275. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  1276. * This program are made available under the terms of the Apache License, Version 2.0
  1277. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1278. var SuperMap = window.SuperMap = window.SuperMap || {};
  1279. SuperMap.Components = window.SuperMap.Components || {};
  1280. // CONCATENATED MODULE: ./src/common/commontypes/Pixel.js
  1281. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  1282. * This program are made available under the terms of the Apache License, Version 2.0
  1283. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1284. /**
  1285. * @class SuperMap.Pixel
  1286. * @category BaseTypes Geometry
  1287. * @classdesc 此类用 x,y 坐标描绘屏幕坐标(像素点)。
  1288. * @param {number} [x=0.0] - x 坐标。
  1289. * @param {number} [y=0.0] - y 坐标。
  1290. * @param {SuperMap.Pixel.Mode} [mode=SuperMap.Pixel.Mode.LeftTop] - 坐标模式。
  1291. *
  1292. * @example
  1293. * //单独创建一个对象
  1294. * var pixcel = new SuperMap.Pixel(100,50);
  1295. *
  1296. * //依据 size 创建
  1297. * var size = new SuperMap.Size(21,25);
  1298. * var offset = new SuperMap.Pixel(-(size.w/2), -size.h);
  1299. */
  1300. class Pixel_Pixel {
  1301. constructor(x, y, mode) {
  1302. /**
  1303. * @member {number} [SuperMap.Pixel.prototype.x=0.0]
  1304. * @description x 坐标。
  1305. */
  1306. this.x = x ? parseFloat(x) : 0.0;
  1307. /**
  1308. * @member {number} [SuperMap.Pixel.prototype.y=0.0]
  1309. * @description y 坐标。
  1310. */
  1311. this.y = y ? parseFloat(y) : 0.0;
  1312. /**
  1313. * @member {SuperMap.Pixel.Mode} [SuperMap.Pixel.prototype.mode=SuperMap.Pixel.Mode.LeftTop]
  1314. * @description 坐标模式,有左上、右上、右下、左下这几种模式,分别表示相对于左上角、右上角、右下角、左下角的坐标。
  1315. */
  1316. this.mode = mode;
  1317. this.CLASS_NAME = "SuperMap.Pixel";
  1318. /**
  1319. * @enum SuperMap.Pixel.Mode
  1320. * @readonly
  1321. * @description 模式。
  1322. * @type {string}
  1323. */
  1324. SuperMap.Pixel.Mode = {
  1325. /** 左上模式。*/
  1326. LeftTop: "lefttop",
  1327. /** 右上模式。 */
  1328. RightTop: "righttop",
  1329. /** 右下模式。 */
  1330. RightBottom: "rightbottom",
  1331. /** 左下模式。 */
  1332. LeftBottom: "leftbottom"
  1333. };
  1334. }
  1335. /**
  1336. * @function SuperMap.Pixel.prototype.toString
  1337. * @description 返回此对象的字符串形式。
  1338. * @example
  1339. *
  1340. * var pixcel = new SuperMap.Pixel(100,50);
  1341. * var str = pixcel.toString();
  1342. *
  1343. * @returns {string} 例如: "x=200.4,y=242.2"
  1344. */
  1345. toString() {
  1346. return ("x=" + this.x + ",y=" + this.y);
  1347. }
  1348. /**
  1349. * @function SuperMap.Pixel.prototype.clone
  1350. * @description 克隆当前的 pixel 对象。
  1351. * @example
  1352. * var pixcel = new SuperMap.Pixel(100,50);
  1353. * var pixcel2 = pixcel.clone();
  1354. * @returns {SuperMap.Pixel} 返回一个新的与当前 pixel 对象有相同 x、y 坐标的 pixel 对象。
  1355. */
  1356. clone() {
  1357. return new Pixel_Pixel(this.x, this.y, this.mode);
  1358. }
  1359. /**
  1360. * @function SuperMap.Pixel.prototype.equals
  1361. * @description 比较两 pixel 是否相等。
  1362. * @example
  1363. * var pixcel = new SuperMap.Pixel(100,50);
  1364. * var pixcel2 = new SuperMap.Pixel(100,50);
  1365. * var isEquals = pixcel.equals(pixcel2);
  1366. *
  1367. * @param {SuperMap.Pixel} px - 用于比较相等的 pixel 对象。
  1368. * @returns {boolean} 如果传入的像素点和当前像素点相同返回 true,如果不同或传入参数为 NULL 则返回 false。
  1369. */
  1370. equals(px) {
  1371. var equals = false;
  1372. if (px != null) {
  1373. equals = ((this.x == px.x && this.y == px.y) ||
  1374. (isNaN(this.x) && isNaN(this.y) && isNaN(px.x) && isNaN(px.y)));
  1375. }
  1376. return equals;
  1377. }
  1378. /**
  1379. * @function SuperMap.Pixel.prototype.distanceTo
  1380. * @description 返回两个 pixel 的距离。
  1381. * @example
  1382. * var pixcel = new SuperMap.Pixel(100,50);
  1383. * var pixcel2 = new SuperMap.Pixel(110,30);
  1384. * var distance = pixcel.distanceTo(pixcel2);
  1385. *
  1386. * @param {SuperMap.Pixel} px - 用于计算的一个 pixel。
  1387. * @returns {float} 作为参数传入的像素与当前像素点的距离。
  1388. */
  1389. distanceTo(px) {
  1390. return Math.sqrt(
  1391. Math.pow(this.x - px.x, 2) +
  1392. Math.pow(this.y - px.y, 2)
  1393. );
  1394. }
  1395. /**
  1396. * @function SuperMap.Pixel.prototype.add
  1397. * @description 在原来像素坐标基础上,x 值加上传入的 x 参数,y 值加上传入的 y 参数。
  1398. * @example
  1399. * var pixcel = new SuperMap.Pixel(100,50);
  1400. * //pixcel2是新的对象
  1401. * var pixcel2 = pixcel.add(20,30);
  1402. *
  1403. * @param {number} x - 传入的 x 值。
  1404. * @param {number} y - 传入的 y 值。
  1405. * @returns {SuperMap.Pixel} 返回一个新的 pixel 对象,该 pixel 是由当前的 pixel 与传入的 x,y 相加得到。
  1406. */
  1407. add(x, y) {
  1408. if ((x == null) || (y == null)) {
  1409. throw new TypeError('Pixel.add cannot receive null values');
  1410. }
  1411. return new Pixel_Pixel(this.x + x, this.y + y);
  1412. }
  1413. /**
  1414. * @function SuperMap.Pixel.prototype.offset
  1415. * @description 通过传入的 {@link SuperMap.Pixel} 参数对原屏幕坐标进行偏移。
  1416. * @example
  1417. * var pixcel = new SuperMap.Pixel(100,50);
  1418. * var pixcel2 = new SuperMap.Pixel(130,20);
  1419. * //pixcel3 是新的对象
  1420. * var pixcel3 = pixcel.offset(pixcel2);
  1421. *
  1422. * @param {SuperMap.Pixel} px - 传入的 <SuperMap.Pixel> 对象。
  1423. * @returns {SuperMap.Pixel} 返回一个新的 pixel,该 pixel 是由当前的 pixel 对象的 x,y 值与传入的 Pixel 对象的 x,y 值相加得到。
  1424. */
  1425. offset(px) {
  1426. var newPx = this.clone();
  1427. if (px) {
  1428. newPx = this.add(px.x, px.y);
  1429. }
  1430. return newPx;
  1431. }
  1432. /**
  1433. *
  1434. * @function SuperMap.Pixel.prototype.destroy
  1435. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  1436. * @example
  1437. * var pixcel = new SuperMap.Pixel(100,50);
  1438. * pixcel.destroy();
  1439. */
  1440. destroy() {
  1441. this.x = null;
  1442. this.y = null;
  1443. this.mode = null;
  1444. }
  1445. }
  1446. SuperMap.Pixel = Pixel_Pixel;
  1447. // CONCATENATED MODULE: ./src/common/commontypes/BaseTypes.js
  1448. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  1449. * This program are made available under the terms of the Apache License, Version 2.0
  1450. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1451. /**
  1452. *@namespace SuperMap
  1453. *@category BaseTypes Namespace
  1454. */
  1455. /**
  1456. * @function SuperMap.inherit
  1457. * @description 除了 C 和 P 两个必要参数外,可以传递任意数量的对象,这些对象都将继承C。
  1458. * @memberOf SuperMap
  1459. * @param {Object} C - 继承的类。
  1460. * @param {Object} P - 被继承的父类。
  1461. */
  1462. SuperMap.inherit = function (C, P) {
  1463. var F = function () {
  1464. };
  1465. F.prototype = P.prototype;
  1466. C.prototype = new F;
  1467. var i, l, o;
  1468. for (i = 2, l = arguments.length; i < l; i++) {
  1469. o = arguments[i];
  1470. if (typeof o === "function") {
  1471. o = o.prototype;
  1472. }
  1473. SuperMap.Util.extend(C.prototype, o);
  1474. }
  1475. };
  1476. /**
  1477. * @function SuperMap.mixin
  1478. * @description 实现多重继承。
  1479. * @memberOf SuperMap
  1480. * @param {Class|Object} ...mixins - 继承的类。
  1481. */
  1482. SuperMap.mixin = function (...mixins) {
  1483. class Mix {
  1484. constructor(options) {
  1485. for (var index = 0; index < mixins.length; index++) {
  1486. copyProperties(this, new mixins[index](options));
  1487. }
  1488. }
  1489. }
  1490. for (var index = 0; index < mixins.length; index++) {
  1491. var mixin = mixins[index];
  1492. copyProperties(Mix, mixin);
  1493. copyProperties(Mix.prototype, mixin.prototype);
  1494. copyProperties(Mix.prototype, new mixin());
  1495. }
  1496. return Mix;
  1497. function copyProperties(target, source) {
  1498. var ownKeys = Object.getOwnPropertyNames(source);
  1499. if (Object.getOwnPropertySymbols) {
  1500. ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source));
  1501. }
  1502. for (var index = 0; index < ownKeys.length; index++) {
  1503. var key = ownKeys[index];
  1504. if (key !== "constructor"
  1505. && key !== "prototype"
  1506. && key !== "name" && key !== "length") {
  1507. let desc = Object.getOwnPropertyDescriptor(source, key);
  1508. if (window["ActiveXObject"]) {
  1509. Object.defineProperty(target, key, desc || {});
  1510. } else {
  1511. Object.defineProperty(target, key, desc);
  1512. }
  1513. }
  1514. }
  1515. }
  1516. };
  1517. /**
  1518. * @name String
  1519. * @namespace
  1520. * @memberOf SuperMap
  1521. * @category BaseTypes Util
  1522. * @description 字符串操作的一系列常用扩展函数。
  1523. */
  1524. var StringExt = SuperMap.String = {
  1525. /**
  1526. * @function SuperMap.String.startsWith
  1527. * @description 判断目标字符串是否以指定的子字符串开头。
  1528. * @param {string} str - 目标字符串。
  1529. * @param {string} sub - 查找的子字符串。
  1530. * @returns {boolean} 目标字符串以指定的子字符串开头,则返回 true;否则返回 false。
  1531. */
  1532. startsWith: function (str, sub) {
  1533. return (str.indexOf(sub) == 0);
  1534. },
  1535. /**
  1536. * @function SuperMap.String.contains
  1537. * @description 判断目标字符串是否包含指定的子字符串。
  1538. * @param {string} str - 目标字符串。
  1539. * @param {string} sub - 查找的子字符串。
  1540. * @returns {boolean} 目标字符串中包含指定的子字符串,则返回 true;否则返回 false。
  1541. */
  1542. contains: function (str, sub) {
  1543. return (str.indexOf(sub) != -1);
  1544. },
  1545. /**
  1546. * @function SuperMap.String.trim
  1547. * @description 删除一个字符串的开头和结尾处的所有空白字符。
  1548. * @param {string} str - (可能)存在空白字符填塞的字符串。
  1549. * @returns {string} 删除开头和结尾处空白字符后的字符串。
  1550. */
  1551. trim: function (str) {
  1552. return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
  1553. },
  1554. /**
  1555. * @function SuperMap.String.camelize
  1556. * @description 骆驼式("-")连字符的字符串处理。
  1557. * 例如:"chicken-head" becomes "chickenHead",
  1558. * "-chicken-head" becomes "ChickenHead"。
  1559. * @param {string} str - 要处理的字符串,原始内容不应被修改。
  1560. * @returns {string}
  1561. */
  1562. camelize: function (str) {
  1563. var oStringList = str.split('-');
  1564. var camelizedString = oStringList[0];
  1565. for (var i = 1, len = oStringList.length; i < len; i++) {
  1566. var s = oStringList[i];
  1567. camelizedString += s.charAt(0).toUpperCase() + s.substring(1);
  1568. }
  1569. return camelizedString;
  1570. },
  1571. /**
  1572. * @function SuperMap.String.format
  1573. * @description 提供带 ${token} 标记的字符串, 返回 context 对象属性中指定标记的属性值。
  1574. * @example
  1575. * 示例:
  1576. * (code)
  1577. * 1、template = "${value,getValue}";
  1578. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  1579. * args = [2,23,12,36,21];
  1580. * 返回值:36
  1581. * (end)
  1582. * 示例:
  1583. * (code)
  1584. * 2、template = "$${{value,getValue}}";
  1585. * context = {value: {getValue:function(){return Math.max.apply(null,argument);}}};
  1586. * args = [2,23,12,36,21];
  1587. * 返回值:"${36}"
  1588. * (end)
  1589. * 示例:
  1590. * (code)
  1591. * 3、template = "${a,b}";
  1592. * context = {a: {b:"format"}};
  1593. * args = null;
  1594. * 返回值:"format"
  1595. * (end)
  1596. * 示例:
  1597. * (code)
  1598. * 3、template = "${a,b}";
  1599. * context = null;
  1600. * args = null;
  1601. * 返回值:"${a.b}"
  1602. * (end)
  1603. * @param {string} template - 带标记的字符串将要被替换。参数 template 格式为"${token}",此处的 token 标记会替换为 context["token"] 属性的值。
  1604. * @param {Object} [context=window] - 带有属性的可选对象的属性用于匹配格式化字符串中的标记。如果该参数为空,将使用 window 对象。
  1605. * @param {Array} [args] - 可选参数传递给在 context 对象上找到的函数。
  1606. * @returns {string} 从 context 对象属性中替换字符串标记位的字符串。
  1607. */
  1608. format: function (template, context, args) {
  1609. if (!context) {
  1610. context = window;
  1611. }
  1612. // Example matching:
  1613. // str = ${foo.bar}
  1614. // match = foo.bar
  1615. var replacer = function (str, match) {
  1616. var replacement;
  1617. // Loop through all subs. Example: ${a.b.c}
  1618. // 0 -> replacement = context[a];
  1619. // 1 -> replacement = context[a][b];
  1620. // 2 -> replacement = context[a][b][c];
  1621. var subs = match.split(/\.+/);
  1622. for (var i = 0; i < subs.length; i++) {
  1623. if (i == 0) {
  1624. replacement = context;
  1625. }
  1626. replacement = replacement[subs[i]];
  1627. }
  1628. if (typeof replacement === "function") {
  1629. replacement = args ?
  1630. replacement.apply(null, args) :
  1631. replacement();
  1632. }
  1633. // If replacement is undefined, return the string 'undefined'.
  1634. // This is a workaround for a bugs in browsers not properly
  1635. // dealing with non-participating groups in regular expressions:
  1636. // http://blog.stevenlevithan.com/archives/npcg-javascript
  1637. if (typeof replacement == 'undefined') {
  1638. return 'undefined';
  1639. } else {
  1640. return replacement;
  1641. }
  1642. };
  1643. return template.replace(SuperMap.String.tokenRegEx, replacer);
  1644. },
  1645. /**
  1646. * @member {RegExp} [SuperMap.String.tokenRegEx]
  1647. * @description 寻找带 token 的字符串,默认为 tokenRegEx=/\$\{([\w.]+?)\}/g。
  1648. * @example
  1649. * Examples: ${a}, ${a.b.c}, ${a-b}, ${5}
  1650. */
  1651. tokenRegEx: /\$\{([\w.]+?)\}/g,
  1652. /**
  1653. * @member {RegExp} [SuperMap.String.numberRegEx]
  1654. * @description 判断一个字符串是否只包含一个数值,默认为 numberRegEx=/^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/。
  1655. */
  1656. numberRegEx: /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/,
  1657. /**
  1658. * @function SuperMap.String.isNumeric
  1659. * @description 判断一个字符串是否只包含一个数值。
  1660. * @example
  1661. * (code)
  1662. * SuperMap.String.isNumeric("6.02e23") // true
  1663. * SuperMap.String.isNumeric("12 dozen") // false
  1664. * SuperMap.String.isNumeric("4") // true
  1665. * SuperMap.String.isNumeric(" 4 ") // false
  1666. * (end)
  1667. * @returns {boolean} 字符串包含唯一的数值,返回 true;否则返回 false。
  1668. */
  1669. isNumeric: function (value) {
  1670. return SuperMap.String.numberRegEx.test(value);
  1671. },
  1672. /**
  1673. * @function SuperMap.String.numericIf
  1674. * @description 把一个看似数值型的字符串转化为一个数值。
  1675. * @returns {(number|string)} 如果能转换为数值则返回数值,否则返回字符串本身。
  1676. */
  1677. numericIf: function (value) {
  1678. return SuperMap.String.isNumeric(value) ? parseFloat(value) : value;
  1679. }
  1680. };
  1681. /**
  1682. * @name Number
  1683. * @memberOf SuperMap
  1684. * @namespace
  1685. * @category BaseTypes Util
  1686. * @description 数值操作的一系列常用扩展函数。
  1687. */
  1688. var NumberExt = SuperMap.Number = {
  1689. /**
  1690. * @member {string} [SuperMap.Number.decimalSeparator='.']
  1691. * @description 格式化数字时默认的小数点分隔符。
  1692. * @constant
  1693. */
  1694. decimalSeparator: ".",
  1695. /**
  1696. * @member {string} [SuperMap.Number.thousandsSeparator=',']
  1697. * @description 格式化数字时默认的千位分隔符。
  1698. * @constant
  1699. */
  1700. thousandsSeparator: ",",
  1701. /**
  1702. * @function SuperMap.Number.limitSigDigs
  1703. * @description 限制浮点数的有效数字位数。
  1704. * @param {number} num - 浮点数。
  1705. * @param {integer} sig - 有效位数。
  1706. * @returns {number} 将数字四舍五入到指定数量的有效位数。
  1707. */
  1708. limitSigDigs: function (num, sig) {
  1709. var fig = 0;
  1710. if (sig > 0) {
  1711. fig = parseFloat(num.toPrecision(sig));
  1712. }
  1713. return fig;
  1714. },
  1715. /**
  1716. * @function SuperMap.Number.format
  1717. * @description 数字格式化输出。
  1718. * @param {number} num - 数字。
  1719. * @param {integer} [dec=0] - 数字的小数部分四舍五入到指定的位数。设置为 null 值时小数部分不变。
  1720. * @param {string} [tsep=','] - 千位分隔符。
  1721. * @param {string} [dsep='.'] - 小数点分隔符。
  1722. * @returns {string} 数字格式化后的字符串。
  1723. */
  1724. format: function (num, dec, tsep, dsep) {
  1725. dec = (typeof dec != "undefined") ? dec : 0;
  1726. tsep = (typeof tsep != "undefined") ? tsep :
  1727. SuperMap.Number.thousandsSeparator;
  1728. dsep = (typeof dsep != "undefined") ? dsep :
  1729. SuperMap.Number.decimalSeparator;
  1730. if (dec != null) {
  1731. num = parseFloat(num.toFixed(dec));
  1732. }
  1733. var parts = num.toString().split(".");
  1734. if (parts.length === 1 && dec == null) {
  1735. // integer where we do not want to touch the decimals
  1736. dec = 0;
  1737. }
  1738. var integer = parts[0];
  1739. if (tsep) {
  1740. var thousands = /(-?[0-9]+)([0-9]{3})/;
  1741. while (thousands.test(integer)) {
  1742. integer = integer.replace(thousands, "$1" + tsep + "$2");
  1743. }
  1744. }
  1745. var str;
  1746. if (dec == 0) {
  1747. str = integer;
  1748. } else {
  1749. var rem = parts.length > 1 ? parts[1] : "0";
  1750. if (dec != null) {
  1751. rem = rem + new Array(dec - rem.length + 1).join("0");
  1752. }
  1753. str = integer + dsep + rem;
  1754. }
  1755. return str;
  1756. }
  1757. };
  1758. if (!Number.prototype.limitSigDigs) {
  1759. /**
  1760. * APIMethod: Number.limitSigDigs
  1761. * 限制浮点数的有效数字位数.
  1762. * @param {integer} sig -有效位数。
  1763. * @returns {integer} 将数字四舍五入到指定数量的有效位数。
  1764. * 如果传入值 为 null、0、或者是负数, 返回值 0。
  1765. */
  1766. Number.prototype.limitSigDigs = function (sig) {
  1767. return NumberExt.limitSigDigs(this, sig);
  1768. };
  1769. }
  1770. /**
  1771. * @name Function
  1772. * @memberOf SuperMap
  1773. * @namespace
  1774. * @category BaseTypes Util
  1775. * @description 函数操作的一系列常用扩展函数。
  1776. */
  1777. var FunctionExt = SuperMap.Function = {
  1778. /**
  1779. * @function SuperMap.Function.bind
  1780. * @description 绑定函数到对象。方便创建 this 的作用域。
  1781. * @param {function} func - 输入函数。
  1782. * @param {Object} object - 对象绑定到输入函数(作为输入函数的 this 对象)。
  1783. * @returns {function} object 参数作为 func 函数的 this 对象。
  1784. */
  1785. bind: function (func, object) {
  1786. // create a reference to all arguments past the second one
  1787. var args = Array.prototype.slice.apply(arguments, [2]);
  1788. return function () {
  1789. // Push on any additional arguments from the actual function call.
  1790. // These will come after those sent to the bind call.
  1791. var newArgs = args.concat(
  1792. Array.prototype.slice.apply(arguments, [0])
  1793. );
  1794. return func.apply(object, newArgs);
  1795. };
  1796. },
  1797. /**
  1798. * @function SuperMap.Function.bindAsEventListener
  1799. * @description 绑定函数到对象,在调用该函数时配置并使用事件对象作为第一个参数。
  1800. * @param {function} func - 用于监听事件的函数。
  1801. * @param {Object} object - this 对象的引用。
  1802. * @returns {function}
  1803. */
  1804. bindAsEventListener: function (func, object) {
  1805. return function (event) {
  1806. return func.call(object, event || window.event);
  1807. };
  1808. },
  1809. /**
  1810. * @function SuperMap.Function.False
  1811. * @description 该函数仅仅返回 false。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  1812. * @example
  1813. * document.onclick = SuperMap.Function.False;
  1814. * @returns {boolean}
  1815. */
  1816. False: function () {
  1817. return false;
  1818. },
  1819. /**
  1820. * @function SuperMap.Function.True
  1821. * @description 该函数仅仅返回 true。该函数主要是避免在 IE8 以下浏览中 DOM 事件句柄的匿名函数问题。
  1822. * @example
  1823. * document.onclick = SuperMap.Function.True;
  1824. * @returns {boolean}
  1825. */
  1826. True: function () {
  1827. return true;
  1828. },
  1829. /**
  1830. * @function SuperMap.Function.Void
  1831. * @description 可重用函数,仅仅返回 "undefined"。
  1832. * @returns {undefined}
  1833. */
  1834. Void: function () {
  1835. }
  1836. };
  1837. /**
  1838. * @name Array
  1839. * @memberOf SuperMap
  1840. * @namespace
  1841. * @category BaseTypes Util
  1842. * @description 数组操作的一系列常用扩展函数。
  1843. */
  1844. var ArrayExt = SuperMap.Array = {
  1845. /**
  1846. * @function SuperMap.Array.filter
  1847. * @description 过滤数组,提供了 ECMA-262 标准中 Array.prototype.filter 函数的扩展。详见:{@link http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array/filter}
  1848. * @param {Array} array - 要过滤的数组。
  1849. * @param {function} callback - 数组中的每一个元素调用该函数。</br>
  1850. * 如果函数的返回值为 true,该元素将包含在返回的数组中。该函数有三个参数: 数组中的元素,元素的索引,数组自身。</br>
  1851. * 如果设置了可选参数 caller,在调用 callback 时,使用可选参数 caller 设置为 callback 的参数。</br>
  1852. * @param {Object} [caller] - 在调用 callback 时,使用参数 caller 设置为 callback 的参数。
  1853. * @returns {Array} callback 函数返回 true 时的元素将作为返回数组中的元素。
  1854. */
  1855. filter: function (array, callback, caller) {
  1856. var selected = [];
  1857. if (Array.prototype.filter) {
  1858. selected = array.filter(callback, caller);
  1859. } else {
  1860. var len = array.length;
  1861. if (typeof callback != "function") {
  1862. throw new TypeError();
  1863. }
  1864. for (var i = 0; i < len; i++) {
  1865. if (i in array) {
  1866. var val = array[i];
  1867. if (callback.call(caller, val, i, array)) {
  1868. selected.push(val);
  1869. }
  1870. }
  1871. }
  1872. }
  1873. return selected;
  1874. }
  1875. };
  1876. // CONCATENATED MODULE: ./src/common/commontypes/Util.js
  1877. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  1878. * This program are made available under the terms of the Apache License, Version 2.0
  1879. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  1880. var Util = SuperMap.Util = SuperMap.Util || {};
  1881. /**
  1882. * @name Util
  1883. * @memberOf SuperMap
  1884. * @namespace
  1885. * @category BaseTypes Util
  1886. * @description common 工具类。
  1887. */
  1888. /**
  1889. * @description 复制源对象的所有属性到目标对象上,源对象上的没有定义的属性在目标对象上也不会被设置。
  1890. * @example
  1891. * 要复制 SuperMap.Size 对象的所有属性到自定义对象上,使用方法如下:
  1892. * var size = new SuperMap.Size(100, 100);
  1893. * var obj = {};
  1894. * SuperMap.Util.extend(obj, size);
  1895. * @param {Object} [destination] - 目标对象。
  1896. * @param {Object} source - 源对象,其属性将被设置到目标对象上。
  1897. * @returns {Object} 目标对象。
  1898. */
  1899. SuperMap.Util.extend = function (destination, source) {
  1900. destination = destination || {};
  1901. if (source) {
  1902. for (var property in source) {
  1903. var value = source[property];
  1904. if (value !== undefined) {
  1905. destination[property] = value;
  1906. }
  1907. }
  1908. /**
  1909. * IE doesn't include the toString property when iterating over an object's
  1910. * properties with the for(property in object) syntax. Explicitly check if
  1911. * the source has its own toString property.
  1912. */
  1913. /*
  1914. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  1915. * prototype object" when calling hawOwnProperty if the source object
  1916. * is an instance of window.Event.
  1917. */
  1918. var sourceIsEvt = typeof window.Event === "function"
  1919. && source instanceof window.Event;
  1920. if (!sourceIsEvt
  1921. && source.hasOwnProperty && source.hasOwnProperty("toString")) {
  1922. destination.toString = source.toString;
  1923. }
  1924. }
  1925. return destination;
  1926. };
  1927. /**
  1928. * @description 对象拷贝。
  1929. * @param {Object} [des] - 目标对象。
  1930. * @param {Object} soc - 源对象。
  1931. */
  1932. SuperMap.Util.copy = function (des, soc) {
  1933. des = des || {};
  1934. var v;
  1935. if (soc) {
  1936. for (var p in des) {
  1937. v = soc[p];
  1938. if (typeof v !== 'undefined') {
  1939. des[p] = v;
  1940. }
  1941. }
  1942. }
  1943. };
  1944. /**
  1945. * @description 销毁对象,将其属性置空。
  1946. * @param {Object} [obj] - 目标对象。
  1947. */
  1948. SuperMap.Util.reset = function (obj) {
  1949. obj = obj || {};
  1950. for (var p in obj) {
  1951. if (obj.hasOwnProperty(p)) {
  1952. if (typeof obj[p] === "object" && obj[p] instanceof Array) {
  1953. for (var i in obj[p]) {
  1954. if (obj[p][i].destroy) {
  1955. obj[p][i].destroy();
  1956. }
  1957. }
  1958. obj[p].length = 0;
  1959. } else if (typeof obj[p] === "object" && obj[p] instanceof Object) {
  1960. if (obj[p].destroy) {
  1961. obj[p].destroy();
  1962. }
  1963. }
  1964. obj[p] = null;
  1965. }
  1966. }
  1967. };
  1968. /**
  1969. * @description 获取 HTML 元素数组。
  1970. * @returns {Array.<HTMLElement>} HTML 元素数组。
  1971. */
  1972. SuperMap.Util.getElement = function () {
  1973. var elements = [];
  1974. for (var i = 0, len = arguments.length; i < len; i++) {
  1975. var element = arguments[i];
  1976. if (typeof element === 'string') {
  1977. element = document.getElementById(element);
  1978. }
  1979. if (arguments.length === 1) {
  1980. return element;
  1981. }
  1982. elements.push(element);
  1983. }
  1984. return elements;
  1985. };
  1986. /**
  1987. * @description instance of 的跨浏览器实现。
  1988. * @param {Object} o - 对象。
  1989. * @returns {boolean} 是否是页面元素。
  1990. */
  1991. SuperMap.Util.isElement = function (o) {
  1992. return !!(o && o.nodeType === 1);
  1993. };
  1994. /**
  1995. * @description 判断一个对象是否是数组。
  1996. * @param {Object} a - 对象。
  1997. * @returns {boolean} 是否是数组。
  1998. */
  1999. SuperMap.Util.isArray = function (a) {
  2000. return (Object.prototype.toString.call(a) === '[object Array]');
  2001. };
  2002. /**
  2003. * @description 从数组中删除某一项。
  2004. * @param {Array} array - 数组。
  2005. * @param {Object} item - 数组中要删除的一项。
  2006. * @returns {Array} 执行删除操作后的数组。
  2007. */
  2008. SuperMap.Util.removeItem = function (array, item) {
  2009. for (var i = array.length - 1; i >= 0; i--) {
  2010. if (array[i] === item) {
  2011. array.splice(i, 1);
  2012. //break;more than once??
  2013. }
  2014. }
  2015. return array;
  2016. };
  2017. /**
  2018. * @description 获取某对象再数组中的索引值。
  2019. * @param {Array} array - 数组。
  2020. * @param {Object} obj - 对象。
  2021. * @returns {number} 某对象再数组中的索引值。
  2022. */
  2023. SuperMap.Util.indexOf = function (array, obj) {
  2024. if (array == null) {
  2025. return -1;
  2026. } else {
  2027. // use the build-in function if available.
  2028. if (typeof array.indexOf === "function") {
  2029. return array.indexOf(obj);
  2030. } else {
  2031. for (var i = 0, len = array.length; i < len; i++) {
  2032. if (array[i] === obj) {
  2033. return i;
  2034. }
  2035. }
  2036. return -1;
  2037. }
  2038. }
  2039. };
  2040. /**
  2041. * @description 修改某 DOM 元素的许多属性。
  2042. * @param {HTMLElement} element - 待修改的 DOM 元素。
  2043. * @param {string} [id] - DOM 元素的 ID。
  2044. * @param {SuperMap.Pixel} [px] - 包含 DOM 元素的 style 属性的 left 和 top 属性。
  2045. * @param {SuperMap.Size} [sz] - 包含 DOM 元素的 width 和 height 属性。
  2046. * @param {string} [position] - DOM 元素的 position 属性。
  2047. * @param {string} [border] - DOM 元素的 style 属性的 border 属性。
  2048. * @param {string} [overflow] - DOM 元素的 style 属性的 overflow 属性。
  2049. * @param {number} [opacity] - 不透明度值。取值范围为(0.0 - 1.0)。
  2050. */
  2051. SuperMap.Util.modifyDOMElement = function (element, id, px, sz, position,
  2052. border, overflow, opacity) {
  2053. if (id) {
  2054. element.id = id;
  2055. }
  2056. if (px) {
  2057. element.style.left = px.x + "px";
  2058. element.style.top = px.y + "px";
  2059. }
  2060. if (sz) {
  2061. element.style.width = sz.w + "px";
  2062. element.style.height = sz.h + "px";
  2063. }
  2064. if (position) {
  2065. element.style.position = position;
  2066. }
  2067. if (border) {
  2068. element.style.border = border;
  2069. }
  2070. if (overflow) {
  2071. element.style.overflow = overflow;
  2072. }
  2073. if (parseFloat(opacity) >= 0.0 && parseFloat(opacity) < 1.0) {
  2074. element.style.filter = 'alpha(opacity=' + (opacity * 100) + ')';
  2075. element.style.opacity = opacity;
  2076. } else if (parseFloat(opacity) === 1.0) {
  2077. element.style.filter = '';
  2078. element.style.opacity = '';
  2079. }
  2080. };
  2081. /**
  2082. * @description Takes an object and copies any properties that don't exist from
  2083. * another properties, by analogy with SuperMap.Util.extend() from
  2084. * Prototype.js.
  2085. *
  2086. * @param {Object} [to] - 目标对象。
  2087. * @param {Object} from - 源对象。Any properties of this object that
  2088. * are undefined in the to object will be set on the to object.
  2089. *
  2090. * @returns {Object} A reference to the to object. Note that the to argument is modified
  2091. * in place and returned by this function.
  2092. */
  2093. SuperMap.Util.applyDefaults = function (to, from) {
  2094. to = to || {};
  2095. /*
  2096. * FF/Windows < 2.0.0.13 reports "Illegal operation on WrappedNative
  2097. * prototype object" when calling hawOwnProperty if the source object is an
  2098. * instance of window.Event.
  2099. */
  2100. var fromIsEvt = typeof window.Event === "function"
  2101. && from instanceof window.Event;
  2102. for (var key in from) {
  2103. if (to[key] === undefined ||
  2104. (!fromIsEvt && from.hasOwnProperty
  2105. && from.hasOwnProperty(key) && !to.hasOwnProperty(key))) {
  2106. to[key] = from[key];
  2107. }
  2108. }
  2109. /**
  2110. * IE doesn't include the toString property when iterating over an object's
  2111. * properties with the for(property in object) syntax. Explicitly check if
  2112. * the source has its own toString property.
  2113. */
  2114. if (!fromIsEvt && from && from.hasOwnProperty
  2115. && from.hasOwnProperty('toString') && !to.hasOwnProperty('toString')) {
  2116. to.toString = from.toString;
  2117. }
  2118. return to;
  2119. };
  2120. /**
  2121. * @description 将参数对象转换为 HTTP 的 GET 请求中的参数字符串。例如:"key1=value1&key2=value2&key3=value3"。
  2122. * @param {Object} params - 参数对象。
  2123. * @returns {string} HTTP 的 GET 请求中的参数字符串。
  2124. */
  2125. SuperMap.Util.getParameterString = function (params) {
  2126. var paramsArray = [];
  2127. for (var key in params) {
  2128. var value = params[key];
  2129. if ((value != null) && (typeof value !== 'function')) {
  2130. var encodedValue;
  2131. if (Array.isArray(value) || value.toString() === '[object Object]') {
  2132. encodedValue = encodeURIComponent(JSON.stringify(value));
  2133. } else {
  2134. /* value is a string; simply encode */
  2135. encodedValue = encodeURIComponent(value);
  2136. }
  2137. paramsArray.push(encodeURIComponent(key) + "=" + encodedValue);
  2138. }
  2139. }
  2140. return paramsArray.join("&");
  2141. };
  2142. /**
  2143. * @description 给 URL 追加查询参数。
  2144. * @param {string} url - 待追加参数的 URL 字符串。
  2145. * @param {string} paramStr - 待追加的查询参数。
  2146. * @returns {string} 新的 URL。
  2147. */
  2148. SuperMap.Util.urlAppend = function (url, paramStr) {
  2149. var newUrl = url;
  2150. if (paramStr) {
  2151. if(paramStr.indexOf('?') === 0){
  2152. paramStr = paramStr.substring(1);
  2153. }
  2154. var parts = (url + " ").split(/[?&]/);
  2155. newUrl += (parts.pop() === " " ?
  2156. paramStr :
  2157. parts.length ? "&" + paramStr : "?" + paramStr);
  2158. }
  2159. return newUrl;
  2160. };
  2161. /**
  2162. * @description 给 URL 追加 path 参数。
  2163. * @param {string} url - 待追加参数的 URL 字符串。
  2164. * @param {string} paramStr - 待追加的path参数。
  2165. * @returns {string} 新的 URL。
  2166. */
  2167. SuperMap.Util.urlPathAppend = function (url, pathStr) {
  2168. let newUrl = url;
  2169. if (!pathStr) {
  2170. return newUrl;
  2171. }
  2172. if (pathStr.indexOf('/') === 0) {
  2173. pathStr = pathStr.substring(1);
  2174. }
  2175. const parts = url.split('?');
  2176. if(parts[0].indexOf('/', parts[0].length - 1) < 0){
  2177. parts[0] += '/'
  2178. }
  2179. newUrl = `${parts[0]}${pathStr}${parts.length > 1 ? `?${parts[1]}` : ''}`;
  2180. return newUrl;
  2181. };
  2182. /**
  2183. * @description 为了避免浮点精度错误而保留的有效位数。
  2184. * @type {number}
  2185. * @default 14
  2186. */
  2187. SuperMap.Util.DEFAULT_PRECISION = 14;
  2188. /**
  2189. * @description 将字符串以接近的精度转换为数字。
  2190. * @param {string} number - 字符串。
  2191. * @param {number} [precision=14] - 精度。
  2192. * @returns {number} 数字。
  2193. */
  2194. SuperMap.Util.toFloat = function (number, precision) {
  2195. if (precision == null) {
  2196. precision = SuperMap.Util.DEFAULT_PRECISION;
  2197. }
  2198. if (typeof number !== "number") {
  2199. number = parseFloat(number);
  2200. }
  2201. return precision === 0 ? number :
  2202. parseFloat(number.toPrecision(precision));
  2203. };
  2204. /**
  2205. * @description 角度转弧度。
  2206. * @param {number} x - 角度。
  2207. * @returns {number} 弧度。
  2208. */
  2209. SuperMap.Util.rad = function (x) {
  2210. return x * Math.PI / 180;
  2211. };
  2212. /**
  2213. * @description 从 URL 字符串中解析出参数对象。
  2214. * @param {string} url - URL。
  2215. * @returns {Object} 解析出的参数对象。
  2216. */
  2217. SuperMap.Util.getParameters = function (url) {
  2218. // if no url specified, take it from the location bar
  2219. url = (url === null || url === undefined) ? window.location.href : url;
  2220. //parse out parameters portion of url string
  2221. var paramsString = "";
  2222. if (SuperMap.String.contains(url, '?')) {
  2223. var start = url.indexOf('?') + 1;
  2224. var end = SuperMap.String.contains(url, "#") ?
  2225. url.indexOf('#') : url.length;
  2226. paramsString = url.substring(start, end);
  2227. }
  2228. var parameters = {};
  2229. var pairs = paramsString.split(/[&;]/);
  2230. for (var i = 0, len = pairs.length; i < len; ++i) {
  2231. var keyValue = pairs[i].split('=');
  2232. if (keyValue[0]) {
  2233. var key = keyValue[0];
  2234. try {
  2235. key = decodeURIComponent(key);
  2236. } catch (err) {
  2237. key = unescape(key);
  2238. }
  2239. // being liberal by replacing "+" with " "
  2240. var value = (keyValue[1] || '').replace(/\+/g, " ");
  2241. try {
  2242. value = decodeURIComponent(value);
  2243. } catch (err) {
  2244. value = unescape(value);
  2245. }
  2246. // follow OGC convention of comma delimited values
  2247. value = value.split(",");
  2248. //if there's only one value, do not return as array
  2249. if (value.length == 1) {
  2250. value = value[0];
  2251. }
  2252. parameters[key] = value;
  2253. }
  2254. }
  2255. return parameters;
  2256. };
  2257. /**
  2258. * @description 不断递增计数变量,用于生成唯一 ID。
  2259. * @type {number}
  2260. * @default 0
  2261. */
  2262. SuperMap.Util.lastSeqID = 0;
  2263. /**
  2264. * @description 创建唯一 ID 值。
  2265. * @param {string} [prefix] - 前缀。
  2266. * @returns {string} 唯一的 ID 值。
  2267. */
  2268. SuperMap.Util.createUniqueID = function (prefix) {
  2269. if (prefix == null) {
  2270. prefix = "id_";
  2271. }
  2272. SuperMap.Util.lastSeqID += 1;
  2273. return prefix + SuperMap.Util.lastSeqID;
  2274. };
  2275. /**
  2276. * @memberOf SuperMap
  2277. * @description 每单位的英尺数。
  2278. * @type {Object}
  2279. * @constant
  2280. */
  2281. SuperMap.INCHES_PER_UNIT = {
  2282. 'inches': 1.0,
  2283. 'ft': 12.0,
  2284. 'mi': 63360.0,
  2285. 'm': 39.3701,
  2286. 'km': 39370.1,
  2287. 'dd': 4374754,
  2288. 'yd': 36
  2289. };
  2290. SuperMap.INCHES_PER_UNIT["in"] = SuperMap.INCHES_PER_UNIT.inches;
  2291. SuperMap.INCHES_PER_UNIT["degrees"] = SuperMap.INCHES_PER_UNIT.dd;
  2292. SuperMap.INCHES_PER_UNIT["nmi"] = 1852 * SuperMap.INCHES_PER_UNIT.m;
  2293. // Units from CS-Map
  2294. SuperMap.METERS_PER_INCH = 0.02540005080010160020;
  2295. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  2296. "Inch": SuperMap.INCHES_PER_UNIT.inches,
  2297. "Meter": 1.0 / SuperMap.METERS_PER_INCH, //EPSG:9001
  2298. "Foot": 0.30480060960121920243 / SuperMap.METERS_PER_INCH, //EPSG:9003
  2299. "IFoot": 0.30480000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9002
  2300. "ClarkeFoot": 0.3047972651151 / SuperMap.METERS_PER_INCH, //EPSG:9005
  2301. "SearsFoot": 0.30479947153867624624 / SuperMap.METERS_PER_INCH, //EPSG:9041
  2302. "GoldCoastFoot": 0.30479971018150881758 / SuperMap.METERS_PER_INCH, //EPSG:9094
  2303. "IInch": 0.02540000000000000000 / SuperMap.METERS_PER_INCH,
  2304. "MicroInch": 0.00002540000000000000 / SuperMap.METERS_PER_INCH,
  2305. "Mil": 0.00000002540000000000 / SuperMap.METERS_PER_INCH,
  2306. "Centimeter": 0.01000000000000000000 / SuperMap.METERS_PER_INCH,
  2307. "Kilometer": 1000.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9036
  2308. "Yard": 0.91440182880365760731 / SuperMap.METERS_PER_INCH,
  2309. "SearsYard": 0.914398414616029 / SuperMap.METERS_PER_INCH, //EPSG:9040
  2310. "IndianYard": 0.91439853074444079983 / SuperMap.METERS_PER_INCH, //EPSG:9084
  2311. "IndianYd37": 0.91439523 / SuperMap.METERS_PER_INCH, //EPSG:9085
  2312. "IndianYd62": 0.9143988 / SuperMap.METERS_PER_INCH, //EPSG:9086
  2313. "IndianYd75": 0.9143985 / SuperMap.METERS_PER_INCH, //EPSG:9087
  2314. "IndianFoot": 0.30479951 / SuperMap.METERS_PER_INCH, //EPSG:9080
  2315. "IndianFt37": 0.30479841 / SuperMap.METERS_PER_INCH, //EPSG:9081
  2316. "IndianFt62": 0.3047996 / SuperMap.METERS_PER_INCH, //EPSG:9082
  2317. "IndianFt75": 0.3047995 / SuperMap.METERS_PER_INCH, //EPSG:9083
  2318. "Mile": 1609.34721869443738887477 / SuperMap.METERS_PER_INCH,
  2319. "IYard": 0.91440000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9096
  2320. "IMile": 1609.34400000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9093
  2321. "NautM": 1852.00000000000000000000 / SuperMap.METERS_PER_INCH, //EPSG:9030
  2322. "Lat-66": 110943.316488932731 / SuperMap.METERS_PER_INCH,
  2323. "Lat-83": 110946.25736872234125 / SuperMap.METERS_PER_INCH,
  2324. "Decimeter": 0.10000000000000000000 / SuperMap.METERS_PER_INCH,
  2325. "Millimeter": 0.00100000000000000000 / SuperMap.METERS_PER_INCH,
  2326. "Dekameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  2327. "Decameter": 10.00000000000000000000 / SuperMap.METERS_PER_INCH,
  2328. "Hectometer": 100.00000000000000000000 / SuperMap.METERS_PER_INCH,
  2329. "GermanMeter": 1.0000135965 / SuperMap.METERS_PER_INCH, //EPSG:9031
  2330. "CaGrid": 0.999738 / SuperMap.METERS_PER_INCH,
  2331. "ClarkeChain": 20.1166194976 / SuperMap.METERS_PER_INCH, //EPSG:9038
  2332. "GunterChain": 20.11684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9033
  2333. "BenoitChain": 20.116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9062
  2334. "SearsChain": 20.11676512155 / SuperMap.METERS_PER_INCH, //EPSG:9042
  2335. "ClarkeLink": 0.201166194976 / SuperMap.METERS_PER_INCH, //EPSG:9039
  2336. "GunterLink": 0.2011684023368047 / SuperMap.METERS_PER_INCH, //EPSG:9034
  2337. "BenoitLink": 0.20116782494375872 / SuperMap.METERS_PER_INCH, //EPSG:9063
  2338. "SearsLink": 0.2011676512155 / SuperMap.METERS_PER_INCH, //EPSG:9043
  2339. "Rod": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  2340. "IntnlChain": 20.1168 / SuperMap.METERS_PER_INCH, //EPSG:9097
  2341. "IntnlLink": 0.201168 / SuperMap.METERS_PER_INCH, //EPSG:9098
  2342. "Perch": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  2343. "Pole": 5.02921005842012 / SuperMap.METERS_PER_INCH,
  2344. "Furlong": 201.1684023368046 / SuperMap.METERS_PER_INCH,
  2345. "Rood": 3.778266898 / SuperMap.METERS_PER_INCH,
  2346. "CapeFoot": 0.3047972615 / SuperMap.METERS_PER_INCH,
  2347. "Brealey": 375.00000000000000000000 / SuperMap.METERS_PER_INCH,
  2348. "ModAmFt": 0.304812252984505969011938 / SuperMap.METERS_PER_INCH,
  2349. "Fathom": 1.8288 / SuperMap.METERS_PER_INCH,
  2350. "NautM-UK": 1853.184 / SuperMap.METERS_PER_INCH,
  2351. "50kilometers": 50000.0 / SuperMap.METERS_PER_INCH,
  2352. "150kilometers": 150000.0 / SuperMap.METERS_PER_INCH
  2353. });
  2354. //unit abbreviations supported by PROJ.4
  2355. SuperMap.Util.extend(SuperMap.INCHES_PER_UNIT, {
  2356. "mm": SuperMap.INCHES_PER_UNIT["Meter"] / 1000.0,
  2357. "cm": SuperMap.INCHES_PER_UNIT["Meter"] / 100.0,
  2358. "dm": SuperMap.INCHES_PER_UNIT["Meter"] * 100.0,
  2359. "km": SuperMap.INCHES_PER_UNIT["Meter"] * 1000.0,
  2360. "kmi": SuperMap.INCHES_PER_UNIT["nmi"], //International Nautical Mile
  2361. "fath": SuperMap.INCHES_PER_UNIT["Fathom"], //International Fathom
  2362. "ch": SuperMap.INCHES_PER_UNIT["IntnlChain"], //International Chain
  2363. "link": SuperMap.INCHES_PER_UNIT["IntnlLink"], //International Link
  2364. "us-in": SuperMap.INCHES_PER_UNIT["inches"], //U.S. Surveyor's Inch
  2365. "us-ft": SuperMap.INCHES_PER_UNIT["Foot"], //U.S. Surveyor's Foot
  2366. "us-yd": SuperMap.INCHES_PER_UNIT["Yard"], //U.S. Surveyor's Yard
  2367. "us-ch": SuperMap.INCHES_PER_UNIT["GunterChain"], //U.S. Surveyor's Chain
  2368. "us-mi": SuperMap.INCHES_PER_UNIT["Mile"], //U.S. Surveyor's Statute Mile
  2369. "ind-yd": SuperMap.INCHES_PER_UNIT["IndianYd37"], //Indian Yard
  2370. "ind-ft": SuperMap.INCHES_PER_UNIT["IndianFt37"], //Indian Foot
  2371. "ind-ch": 20.11669506 / SuperMap.METERS_PER_INCH //Indian Chain
  2372. });
  2373. /**
  2374. * @memberOf SuperMap
  2375. * @member [SuperMap.DOTS_PER_INCH=96]
  2376. * @description 分辨率与比例尺之间转换的常量。
  2377. * @type {Object}
  2378. */
  2379. SuperMap.DOTS_PER_INCH = 96;
  2380. /**
  2381. * @param {number} scale - 比例尺。
  2382. * @returns {number} 返回正常的 scale 值。
  2383. */
  2384. SuperMap.Util.normalizeScale = function (scale) {
  2385. var normScale = (scale > 1.0) ? (1.0 / scale) : scale;
  2386. return normScale;
  2387. };
  2388. /**
  2389. * @description 比例尺转分辨率。
  2390. * @param {number} scale - 比例尺。
  2391. * @param {string} [units='degrees'] - 比例尺单位。
  2392. * @returns {number} 分辨率。
  2393. */
  2394. SuperMap.Util.getResolutionFromScale = function (scale, units) {
  2395. var resolution;
  2396. if (scale) {
  2397. if (units == null) {
  2398. units = "degrees";
  2399. }
  2400. var normScale = SuperMap.Util.normalizeScale(scale);
  2401. resolution = 1 / (normScale * SuperMap.INCHES_PER_UNIT[units]
  2402. * SuperMap.DOTS_PER_INCH);
  2403. }
  2404. return resolution;
  2405. };
  2406. /**
  2407. * @description 分辨率转比例尺。
  2408. * @param {number} resolution - 分辨率。
  2409. * @param {string} [units='degrees'] - 分辨率单位。
  2410. * @returns {number} 比例尺。
  2411. */
  2412. SuperMap.Util.getScaleFromResolution = function (resolution, units) {
  2413. if (units == null) {
  2414. units = "degrees";
  2415. }
  2416. var scale = resolution * SuperMap.INCHES_PER_UNIT[units] *
  2417. SuperMap.DOTS_PER_INCH;
  2418. return scale;
  2419. };
  2420. /**
  2421. * @memberOf SuperMap
  2422. * @description 如果 userAgent 捕获到浏览器使用的是 Gecko 引擎则返回 true。
  2423. * @constant
  2424. */
  2425. SuperMap.IS_GECKO = (function () {
  2426. var ua = navigator.userAgent.toLowerCase();
  2427. return ua.indexOf("webkit") === -1 && ua.indexOf("gecko") !== -1;
  2428. })();
  2429. /**
  2430. * @memberOf SuperMap
  2431. * @description 浏览器名称,依赖于 userAgent 属性,BROWSER_NAME 可以是空,或者以下浏览器:
  2432. * * "opera" -- Opera
  2433. * * "msie" -- Internet Explorer
  2434. * * "safari" -- Safari
  2435. * * "firefox" -- Firefox
  2436. * * "mozilla" -- Mozilla
  2437. * @constant
  2438. */
  2439. SuperMap.Browser = (function () {
  2440. var name = '', version = '', device = 'pc', uaMatch;
  2441. //以下进行测试
  2442. var ua = navigator.userAgent.toLowerCase();
  2443. if (ua.indexOf("msie") > -1 || (ua.indexOf("trident") > -1 && ua.indexOf("rv") > -1)) {
  2444. name = 'msie';
  2445. uaMatch = ua.match(/msie ([\d.]+)/) || ua.match(/rv:([\d.]+)/);
  2446. } else if (ua.indexOf("chrome") > -1) {
  2447. name = 'chrome';
  2448. uaMatch = ua.match(/chrome\/([\d.]+)/);
  2449. } else if (ua.indexOf("firefox") > -1) {
  2450. name = 'firefox';
  2451. uaMatch = ua.match(/firefox\/([\d.]+)/);
  2452. } else if (ua.indexOf("opera") > -1) {
  2453. name = 'opera';
  2454. uaMatch = ua.match(/version\/([\d.]+)/);
  2455. } else if (ua.indexOf("safari") > -1) {
  2456. name = 'safari';
  2457. uaMatch = ua.match(/version\/([\d.]+)/);
  2458. }
  2459. version = uaMatch ? uaMatch[1] : '';
  2460. if (ua.indexOf("ipad") > -1 || ua.indexOf("ipod") > -1 || ua.indexOf("iphone") > -1) {
  2461. device = 'apple';
  2462. } else if (ua.indexOf("android") > -1) {
  2463. uaMatch = ua.match(/version\/([\d.]+)/);
  2464. version = uaMatch ? uaMatch[1] : '';
  2465. device = 'android';
  2466. }
  2467. return {name: name, version: version, device: device};
  2468. })();
  2469. /**
  2470. * @description 获取浏览器相关信息。支持的浏览器包括:Opera,Internet Explorer,Safari,Firefox。
  2471. * @returns {Object} 获取浏览器名称、版本、设备名称。对应的属性分别为 name, version, device。
  2472. */
  2473. SuperMap.Util.getBrowser = function () {
  2474. return SuperMap.Browser;
  2475. };
  2476. /**
  2477. * @description 浏览器是否支持 Canvas。
  2478. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas。
  2479. */
  2480. SuperMap.Util.isSupportCanvas = (function () {
  2481. var checkRes = true, broz = SuperMap.Util.getBrowser();
  2482. if (document.createElement("canvas").getContext) {
  2483. if (broz.name === 'firefox' && parseFloat(broz.version) < 5) {
  2484. checkRes = false;
  2485. }
  2486. if (broz.name === 'safari' && parseFloat(broz.version) < 4) {
  2487. checkRes = false;
  2488. }
  2489. if (broz.name === 'opera' && parseFloat(broz.version) < 10) {
  2490. checkRes = false;
  2491. }
  2492. if (broz.name === 'msie' && parseFloat(broz.version) < 9) {
  2493. checkRes = false;
  2494. }
  2495. } else {
  2496. checkRes = false;
  2497. }
  2498. return checkRes;
  2499. })();
  2500. /**
  2501. * @description 判断;浏览器是否支持 Canvas。
  2502. * @returns {boolean} 获取当前浏览器是否支持 HTML5 Canvas 。
  2503. */
  2504. SuperMap.Util.supportCanvas = function () {
  2505. return SuperMap.Util.isSupportCanvas;
  2506. };
  2507. //将服务端的地图单位转成SuperMap的地图单位
  2508. SuperMap.INCHES_PER_UNIT["degree"] = SuperMap.INCHES_PER_UNIT.dd;
  2509. SuperMap.INCHES_PER_UNIT["meter"] = SuperMap.INCHES_PER_UNIT.m;
  2510. SuperMap.INCHES_PER_UNIT["foot"] = SuperMap.INCHES_PER_UNIT.ft;
  2511. SuperMap.INCHES_PER_UNIT["inch"] = SuperMap.INCHES_PER_UNIT.inches;
  2512. SuperMap.INCHES_PER_UNIT["mile"] = SuperMap.INCHES_PER_UNIT.mi;
  2513. SuperMap.INCHES_PER_UNIT["kilometer"] = SuperMap.INCHES_PER_UNIT.km;
  2514. SuperMap.INCHES_PER_UNIT["yard"] = SuperMap.INCHES_PER_UNIT.yd;
  2515. /**
  2516. * @description 判断一个 URL 请求是否在当前域中。
  2517. * @param {string} url - URL 请求字符串。
  2518. * @returns {boolean} URL 请求是否在当前域中。
  2519. */
  2520. SuperMap.Util.isInTheSameDomain = function (url) {
  2521. if (!url) {
  2522. return true;
  2523. }
  2524. var index = url.indexOf("//");
  2525. var documentUrl = document.location.toString();
  2526. var documentIndex = documentUrl.indexOf("//");
  2527. if (index === -1) {
  2528. return true;
  2529. } else {
  2530. var protocol;
  2531. var substring = protocol = url.substring(0, index);
  2532. var documentSubString = documentUrl.substring(documentIndex + 2);
  2533. documentIndex = documentSubString.indexOf("/");
  2534. var documentPortIndex = documentSubString.indexOf(":");
  2535. var documentDomainWithPort = documentSubString.substring(0, documentIndex);
  2536. //var documentPort;
  2537. var documentprotocol = document.location.protocol;
  2538. if (documentPortIndex !== -1) {
  2539. // documentPort = +documentSubString.substring(documentPortIndex, documentIndex);
  2540. } else {
  2541. documentDomainWithPort += ':' + (documentprotocol.toLowerCase() === 'http:' ? 80 : 443);
  2542. }
  2543. if (documentprotocol.toLowerCase() !== substring.toLowerCase()) {
  2544. return false;
  2545. }
  2546. substring = url.substring(index + 2);
  2547. var portIndex = substring.indexOf(":");
  2548. index = substring.indexOf("/");
  2549. var domainWithPort = substring.substring(0, index);
  2550. var domain;
  2551. if (portIndex !== -1) {
  2552. domain = substring.substring(0, portIndex);
  2553. } else {
  2554. domain = substring.substring(0, index);
  2555. domainWithPort += ':' + (protocol.toLowerCase() === 'http:' ? 80 : 443);
  2556. }
  2557. var documentDomain = document.domain;
  2558. if (domain === documentDomain && domainWithPort === documentDomainWithPort) {
  2559. return true;
  2560. }
  2561. }
  2562. return false;
  2563. };
  2564. /**
  2565. * @description 计算 iServer 服务的 REST 图层的显示分辨率,需要从 iServer 的 REST 图层表述中获取 viewBounds、viewer、scale、coordUnit、datumAxis 五个参数,来进行计算。
  2566. * @param {SuperMap.Bounds} viewBounds - 地图的参照可视范围,即地图初始化时默认的地图显示范围。
  2567. * @param {SuperMap.Size} viewer - 地图初始化时默认的地图图片的尺寸。
  2568. * @param {number} scale - 地图初始化时默认的显示比例尺。
  2569. * @param {string} [coordUnit='degrees'] - 投影坐标系统的地图单位。
  2570. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则系统默认为 WGS84 参考系的椭球体长半轴 6378137。
  2571. * @returns {number} 返回图层显示分辨率。
  2572. */
  2573. SuperMap.Util.calculateDpi = function (viewBounds, viewer, scale, coordUnit, datumAxis) {
  2574. //10000 是 0.1毫米与米的转换。DPI的计算公式:Viewer / DPI * 0.0254 * 10000 = ViewBounds * scale ,公式中的10000是为了提高计算结果的精度,以下出现的ratio皆为如此。
  2575. if (!viewBounds || !viewer || !scale) {
  2576. return;
  2577. }
  2578. var ratio = 10000,
  2579. rvbWidth = viewBounds.getWidth(),
  2580. rvbHeight = viewBounds.getHeight(),
  2581. rvWidth = viewer.w,
  2582. rvHeight = viewer.h;
  2583. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2584. datumAxis = datumAxis || 6378137;
  2585. coordUnit = coordUnit || "degrees";
  2586. var dpi;
  2587. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2588. let num1 = rvbWidth / rvWidth,
  2589. num2 = rvbHeight / rvHeight,
  2590. resolution = num1 > num2 ? num1 : num2;
  2591. dpi = 0.0254 * ratio / resolution / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2592. } else {
  2593. let resolution = rvbWidth / rvWidth;
  2594. dpi = 0.0254 * ratio / resolution / scale / ratio;
  2595. }
  2596. return dpi;
  2597. };
  2598. /**
  2599. * @description 将对象转换成 JSON 字符串。
  2600. * @param {Object} obj - 要转换成 JSON 的 Object 对象。
  2601. * @returns {string} 返回转换后的 JSON 对象。
  2602. */
  2603. SuperMap.Util.toJSON = function (obj) {
  2604. var objInn = obj;
  2605. if (objInn == null) {
  2606. return null;
  2607. }
  2608. switch (objInn.constructor) {
  2609. case String:
  2610. //s = "'" + str.replace(/(["\\])/g, "\\$1") + "'"; string含有单引号出错
  2611. objInn = '"' + objInn.replace(/(["\\])/g, '\\$1') + '"';
  2612. objInn = objInn.replace(/\n/g, "\\n");
  2613. objInn = objInn.replace(/\r/g, "\\r");
  2614. objInn = objInn.replace("<", "&lt;");
  2615. objInn = objInn.replace(">", "&gt;");
  2616. objInn = objInn.replace(/%/g, "%25");
  2617. objInn = objInn.replace(/&/g, "%26");
  2618. return objInn;
  2619. case Array:
  2620. var arr = [];
  2621. for (var i = 0, len = objInn.length; i < len; i++) {
  2622. arr.push(SuperMap.Util.toJSON(objInn[i]));
  2623. }
  2624. return "[" + arr.join(",") + "]";
  2625. case Number:
  2626. return isFinite(objInn) ? String(objInn) : null;
  2627. case Boolean:
  2628. return String(objInn);
  2629. case Date:
  2630. var dateStr = "{" + "'__type':\"System.DateTime\"," +
  2631. "'Year':" + objInn.getFullYear() + "," +
  2632. "'Month':" + (objInn.getMonth() + 1) + "," +
  2633. "'Day':" + objInn.getDate() + "," +
  2634. "'Hour':" + objInn.getHours() + "," +
  2635. "'Minute':" + objInn.getMinutes() + "," +
  2636. "'Second':" + objInn.getSeconds() + "," +
  2637. "'Millisecond':" + objInn.getMilliseconds() + "," +
  2638. "'TimezoneOffset':" + objInn.getTimezoneOffset() + "}";
  2639. return dateStr;
  2640. default:
  2641. if (objInn["toJSON"] != null && typeof objInn["toJSON"] === "function") {
  2642. return objInn.toJSON();
  2643. }
  2644. if (typeof objInn === "object") {
  2645. if (objInn.length) {
  2646. let arr = [];
  2647. for (let i = 0, len = objInn.length; i < len; i++) {
  2648. arr.push(SuperMap.Util.toJSON(objInn[i]));
  2649. }
  2650. return "[" + arr.join(",") + "]";
  2651. }
  2652. let arr = [];
  2653. for (let attr in objInn) {
  2654. //为解决SuperMap.Geometry类型头json时堆栈溢出的问题,attr == "parent"时不进行json转换
  2655. if (typeof objInn[attr] !== "function" && attr !== "CLASS_NAME" && attr !== "parent") {
  2656. arr.push("'" + attr + "':" + SuperMap.Util.toJSON(objInn[attr]));
  2657. }
  2658. }
  2659. if (arr.length > 0) {
  2660. return "{" + arr.join(",") + "}";
  2661. } else {
  2662. return "{}";
  2663. }
  2664. }
  2665. return objInn.toString();
  2666. }
  2667. };
  2668. /**
  2669. * @description 根据比例尺和 dpi 计算屏幕分辨率。
  2670. * @param {number} scale - 比例尺。
  2671. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  2672. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  2673. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  2674. * @returns {number} 返回当前比例尺下的屏幕分辨率。
  2675. */
  2676. SuperMap.Util.getResolutionFromScaleDpi = function (scale, dpi, coordUnit, datumAxis) {
  2677. var resolution = null,
  2678. ratio = 10000;
  2679. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2680. datumAxis = datumAxis || 6378137;
  2681. coordUnit = coordUnit || "";
  2682. if (scale > 0 && dpi > 0) {
  2683. scale = SuperMap.Util.normalizeScale(scale);
  2684. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2685. //scale = SuperMap.Util.normalizeScale(scale);
  2686. resolution = 0.0254 * ratio / dpi / scale / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2687. return resolution;
  2688. } else {
  2689. resolution = 0.0254 * ratio / dpi / scale / ratio;
  2690. return resolution;
  2691. }
  2692. }
  2693. return -1;
  2694. };
  2695. /**
  2696. * @description 根据 resolution、dpi、coordUnit 和 datumAxis 计算比例尺。
  2697. * @param {number} resolution - 用于计算比例尺的地图分辨率。
  2698. * @param {number} dpi - 图像分辨率,表示每英寸内的像素个数。
  2699. * @param {string} [coordUnit] - 投影坐标系统的地图单位。
  2700. * @param {number} [datumAxis=6378137] - 地理坐标系统椭球体长半轴。用户自定义地图的 Options 时,若未指定该参数的值,则 DPI 默认按照 WGS84 参考系的椭球体长半轴 6378137 来计算。
  2701. * @returns {number} 返回当前屏幕分辨率下的比例尺。
  2702. */
  2703. SuperMap.Util.getScaleFromResolutionDpi = function (resolution, dpi, coordUnit, datumAxis) {
  2704. var scale = null,
  2705. ratio = 10000;
  2706. //用户自定义地图的Options时,若未指定该参数的值,则系统默认为6378137米,即WGS84参考系的椭球体长半轴。
  2707. datumAxis = datumAxis || 6378137;
  2708. coordUnit = coordUnit || "";
  2709. if (resolution > 0 && dpi > 0) {
  2710. if (coordUnit.toLowerCase() === "degree" || coordUnit.toLowerCase() === "degrees" || coordUnit.toLowerCase() === "dd") {
  2711. scale = 0.0254 * ratio / dpi / resolution / ((Math.PI * 2 * datumAxis) / 360) / ratio;
  2712. return scale;
  2713. } else {
  2714. scale = 0.0254 * ratio / dpi / resolution / ratio;
  2715. return scale;
  2716. }
  2717. }
  2718. return -1;
  2719. };
  2720. /**
  2721. * @description 转换查询结果。
  2722. * @param {Object} result - 查询结果。
  2723. * @returns {Object} 转换后的查询结果。
  2724. */
  2725. SuperMap.Util.transformResult = function (result) {
  2726. if (result.responseText && typeof result.responseText === "string") {
  2727. result = JSON.parse(result.responseText);
  2728. }
  2729. return result;
  2730. };
  2731. /**
  2732. * @description 属性拷贝,不拷贝方法类名(CLASS_NAME)等。
  2733. * @param {Object} [destination] - 拷贝目标。
  2734. * @param {Object} source - 源对象。
  2735. *
  2736. */
  2737. SuperMap.Util.copyAttributes = function (destination, source) {
  2738. destination = destination || {};
  2739. if (source) {
  2740. for (var property in source) {
  2741. var value = source[property];
  2742. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  2743. destination[property] = value;
  2744. }
  2745. }
  2746. }
  2747. return destination;
  2748. };
  2749. /**
  2750. * @description 将源对象上的属性拷贝到目标对象上。(不拷贝 CLASS_NAME 和方法)
  2751. * @param {Object} [destination] - 目标对象。
  2752. * @param {Object} source - 源对象。
  2753. * @param {Array.<string>} clip - 源对象中禁止拷贝到目标对象的属性,目的是防止目标对象上不可修改的属性被篡改。
  2754. *
  2755. */
  2756. SuperMap.Util.copyAttributesWithClip = function (destination, source, clip) {
  2757. destination = destination || {};
  2758. if (source) {
  2759. for (var property in source) {
  2760. //去掉禁止拷贝的属性
  2761. var isInClip = false;
  2762. if (clip && clip.length) {
  2763. for (var i = 0, len = clip.length; i < len; i++) {
  2764. if (property === clip[i]) {
  2765. isInClip = true;
  2766. break;
  2767. }
  2768. }
  2769. }
  2770. if (isInClip === true) {
  2771. continue;
  2772. }
  2773. var value = source[property];
  2774. if (value !== undefined && property !== "CLASS_NAME" && typeof value !== "function") {
  2775. destination[property] = value;
  2776. }
  2777. }
  2778. }
  2779. return destination;
  2780. };
  2781. /**
  2782. * @description 克隆一个 Object 对象
  2783. * @param {Object} obj - 需要克隆的对象。
  2784. * @returns {Object} 返回对象的拷贝对象,注意是新的对象,不是指向。
  2785. */
  2786. SuperMap.Util.cloneObject = function (obj) {
  2787. // Handle the 3 simple types, and null or undefined
  2788. if (null === obj || "object" !== typeof obj) {
  2789. return obj;
  2790. }
  2791. // Handle Date
  2792. if (obj instanceof Date) {
  2793. let copy = new Date();
  2794. copy.setTime(obj.getTime());
  2795. return copy;
  2796. }
  2797. // Handle Array
  2798. if (obj instanceof Array) {
  2799. let copy = obj.slice(0);
  2800. return copy;
  2801. }
  2802. // Handle Object
  2803. if (obj instanceof Object) {
  2804. let copy = {};
  2805. for (var attr in obj) {
  2806. if (obj.hasOwnProperty(attr)) {
  2807. copy[attr] = SuperMap.Util.cloneObject(obj[attr]);
  2808. }
  2809. }
  2810. return copy;
  2811. }
  2812. throw new Error("Unable to copy obj! Its type isn't supported.");
  2813. };
  2814. /**
  2815. * @description 判断两条线段是不是有交点。
  2816. * @param {SuperMap.Geometry.Point} a1 - 第一条线段的起始节点。
  2817. * @param {SuperMap.Geometry.Point} a2 - 第一条线段的结束节点。
  2818. * @param {SuperMap.Geometry.Point} b1 - 第二条线段的起始节点。
  2819. * @param {SuperMap.Geometry.Point} b2 - 第二条线段的结束节点。
  2820. * @returns {Object} 如果相交返回交点,如果不相交返回两条线段的位置关系。
  2821. */
  2822. SuperMap.Util.lineIntersection = function (a1, a2, b1, b2) {
  2823. var intersectValue = null;
  2824. var k1;
  2825. var k2;
  2826. var b = (b2.x - b1.x) * (a1.y - b1.y) - (b2.y - b1.y) * (a1.x - b1.x);
  2827. var a = (a2.x - a1.x) * (a1.y - b1.y) - (a2.y - a1.y) * (a1.x - b1.x);
  2828. var ab = (b2.y - b1.y) * (a2.x - a1.x) - (b2.x - b1.x) * (a2.y - a1.y);
  2829. //ab==0代表两条线断的斜率一样
  2830. if (ab != 0) {
  2831. k1 = b / ab;
  2832. k2 = a / ab;
  2833. if (k1 >= 0 && k2 <= 1 && k1 <= 1 && k2 >= 0) {
  2834. intersectValue = new SuperMap.Geometry.Point(a1.x + k1 * (a2.x - a1.x), a1.y + k1 * (a2.y - a1.y));
  2835. } else {
  2836. intersectValue = "No Intersection";
  2837. }
  2838. } else {
  2839. if (b == 0 && a == 0) {
  2840. var maxy = Math.max(a1.y, a2.y);
  2841. var miny = Math.min(a1.y, a2.y);
  2842. var maxx = Math.max(a1.x, a2.x);
  2843. var minx = Math.min(a1.x, a2.x);
  2844. if (((b1.y >= miny && b1.y <= maxy) || (b2.y >= miny && b2.y <= maxy)) &&
  2845. (b1.x >= minx && b1.x <= maxx) || (b2.x >= minx && b2.x <= maxx)) {
  2846. intersectValue = "Coincident";//重合
  2847. } else {
  2848. intersectValue = "Parallel";//平行
  2849. }
  2850. } else {
  2851. intersectValue = "Parallel";//平行
  2852. }
  2853. }
  2854. return intersectValue;
  2855. };
  2856. /**
  2857. * @description 获取文本外接矩形宽度与高度。
  2858. * @param {SuperMap.ThemeStyle} style - 文本样式。
  2859. * @param {string} text - 文本内容。
  2860. * @param {Object} element - DOM 元素。
  2861. * @returns {Object} 返回裁剪后的宽度,高度信息。
  2862. */
  2863. SuperMap.Util.getTextBounds = function (style, text, element) {
  2864. document.body.appendChild(element);
  2865. element.style.width = 'auto';
  2866. element.style.height = 'auto';
  2867. if (style.fontSize) {
  2868. element.style.fontSize = style.fontSize;
  2869. }
  2870. if (style.fontFamily) {
  2871. element.style.fontFamily = style.fontFamily;
  2872. }
  2873. if (style.fontWeight) {
  2874. element.style.fontWeight = style.fontWeight;
  2875. }
  2876. element.style.position = 'relative';
  2877. element.style.visibility = 'hidden';
  2878. //fix 在某些情况下,element内的文本变成竖起排列,导致宽度计算不正确的bug
  2879. element.style.display = 'inline-block';
  2880. element.innerHTML = text;
  2881. var textWidth = element.clientWidth;
  2882. var textHeight = element.clientHeight;
  2883. document.body.removeChild(element);
  2884. return {
  2885. textWidth: textWidth,
  2886. textHeight: textHeight
  2887. };
  2888. };
  2889. // CONCATENATED MODULE: ./src/common/commontypes/Event.js
  2890. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  2891. * This program are made available under the terms of the Apache License, Version 2.0
  2892. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  2893. /**
  2894. * @name Event
  2895. * @memberOf SuperMap
  2896. * @namespace
  2897. * @description 事件处理函数.
  2898. */
  2899. var Event = SuperMap.Event = {
  2900. /**
  2901. * @description A hash table cache of the event observers. Keyed by element._eventCacheID
  2902. * @type {boolean}
  2903. * @default false
  2904. */
  2905. observers: false,
  2906. /**
  2907. * @description KEY_SPACE
  2908. * @type {number}
  2909. * @default 32
  2910. */
  2911. KEY_SPACE: 32,
  2912. /**
  2913. * @description KEY_BACKSPACE
  2914. * @type {number}
  2915. * @default 8
  2916. */
  2917. KEY_BACKSPACE: 8,
  2918. /**
  2919. * @description KEY_TAB
  2920. * @type {number}
  2921. * @default 9
  2922. */
  2923. KEY_TAB: 9,
  2924. /**
  2925. * @description KEY_RETURN
  2926. * @type {number}
  2927. * @default 13
  2928. */
  2929. KEY_RETURN: 13,
  2930. /**
  2931. * @description KEY_ESC
  2932. * @type {number}
  2933. * @default 27
  2934. */
  2935. KEY_ESC: 27,
  2936. /**
  2937. * @description KEY_LEFT
  2938. * @type {number}
  2939. * @default 37
  2940. */
  2941. KEY_LEFT: 37,
  2942. /**
  2943. * @description KEY_UP
  2944. * @type {number}
  2945. * @default 38
  2946. */
  2947. KEY_UP: 38,
  2948. /**
  2949. * @description KEY_RIGHT
  2950. * @type {number}
  2951. * @default 39
  2952. */
  2953. KEY_RIGHT: 39,
  2954. /**
  2955. * @description KEY_DOWN
  2956. * @type {number}
  2957. * @default 40
  2958. */
  2959. KEY_DOWN: 40,
  2960. /**
  2961. * @description KEY_DELETE
  2962. * @type {number}
  2963. * @default 46
  2964. */
  2965. KEY_DELETE: 46,
  2966. /**
  2967. * @description Cross browser event element detection.
  2968. * @param {Event} event - The event
  2969. * @returns {HTMLElement} The element that caused the event
  2970. */
  2971. element: function (event) {
  2972. return event.target || event.srcElement;
  2973. },
  2974. /**
  2975. * @description Determine whether event was caused by a single touch
  2976. * @param {Event} event - The event
  2977. * @returns {boolean}
  2978. */
  2979. isSingleTouch: function (event) {
  2980. return event.touches && event.touches.length === 1;
  2981. },
  2982. /**
  2983. * @description Determine whether event was caused by a multi touch
  2984. * @param {Event} event - The event
  2985. * @returns {boolean}
  2986. */
  2987. isMultiTouch: function (event) {
  2988. return event.touches && event.touches.length > 1;
  2989. },
  2990. /**
  2991. * @description Determine whether event was caused by a left click.
  2992. * @param {Event} event - The event
  2993. * @returns {boolean}
  2994. */
  2995. isLeftClick: function (event) {
  2996. return (((event.which) && (event.which === 1)) ||
  2997. ((event.button) && (event.button === 1)));
  2998. },
  2999. /**
  3000. * @description Determine whether event was caused by a right mouse click.
  3001. * @param {Event} event - The event
  3002. * @returns {boolean}
  3003. */
  3004. isRightClick: function (event) {
  3005. return (((event.which) && (event.which === 3)) ||
  3006. ((event.button) && (event.button === 2)));
  3007. },
  3008. /**
  3009. * @description Stops an event from propagating.
  3010. * @param {Event} event - The event
  3011. * @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
  3012. */
  3013. stop: function (event, allowDefault) {
  3014. if (!allowDefault) {
  3015. if (event.preventDefault) {
  3016. event.preventDefault();
  3017. } else {
  3018. event.returnValue = false;
  3019. }
  3020. }
  3021. if (event.stopPropagation) {
  3022. event.stopPropagation();
  3023. } else {
  3024. event.cancelBubble = true;
  3025. }
  3026. },
  3027. /**
  3028. * @param {Event} event - The event。
  3029. * @param {string} tagName - html 标签名。
  3030. * @returns {HTMLElement} The first node with the given tagName, starting from the node the event was triggered on and traversing the DOM upwards
  3031. */
  3032. findElement: function (event, tagName) {
  3033. var element = SuperMap.Event.element(event);
  3034. while (element.parentNode && (!element.tagName ||
  3035. (element.tagName.toUpperCase() != tagName.toUpperCase()))) {
  3036. element = element.parentNode;
  3037. }
  3038. return element;
  3039. },
  3040. /**
  3041. * @description 监听事件,注册事件处理方法。
  3042. * @param {(HTMLElement|string)} elementParam - 待监听的 DOM 对象或者其 ID 标识。
  3043. * @param {string} name - 监听事件的类别名称。
  3044. * @param {function} observer - 注册的事件处理方法。
  3045. * @param {boolean} [useCapture=false] - 是否捕获。
  3046. */
  3047. observe: function (elementParam, name, observer, useCapture) {
  3048. var element = Util.getElement(elementParam);
  3049. useCapture = useCapture || false;
  3050. if (name === 'keypress' &&
  3051. (navigator.appVersion.match(/Konqueror|Safari|KHTML/)
  3052. || element.attachEvent)) {
  3053. name = 'keydown';
  3054. }
  3055. //if observers cache has not yet been created, create it
  3056. if (!this.observers) {
  3057. this.observers = {};
  3058. }
  3059. //if not already assigned, make a new unique cache ID
  3060. if (!element._eventCacheID) {
  3061. var idPrefix = "eventCacheID_";
  3062. if (element.id) {
  3063. idPrefix = element.id + "_" + idPrefix;
  3064. }
  3065. element._eventCacheID = Util.createUniqueID(idPrefix);
  3066. }
  3067. var cacheID = element._eventCacheID;
  3068. //if there is not yet a hash entry for this element, add one
  3069. if (!this.observers[cacheID]) {
  3070. this.observers[cacheID] = [];
  3071. }
  3072. //add a new observer to this element's list
  3073. this.observers[cacheID].push({
  3074. 'element': element,
  3075. 'name': name,
  3076. 'observer': observer,
  3077. 'useCapture': useCapture
  3078. });
  3079. //add the actual browser event listener
  3080. if (element.addEventListener) {
  3081. if(name === 'mousewheel'){
  3082. // https://www.chromestatus.com/features/6662647093133312
  3083. element.addEventListener(name, observer, {useCapture: useCapture, passive: false} );
  3084. } else {
  3085. element.addEventListener(name, observer, useCapture);
  3086. }
  3087. } else if (element.attachEvent) {
  3088. element.attachEvent('on' + name, observer);
  3089. }
  3090. },
  3091. /**
  3092. * @description Given the id of an element to stop observing, cycle through the
  3093. * element's cached observers, calling stopObserving on each one,
  3094. * skipping those entries which can no longer be removed.
  3095. *
  3096. * @param {(HTMLElement|string)} elementParam -
  3097. */
  3098. stopObservingElement: function (elementParam) {
  3099. var element = Util.getElement(elementParam);
  3100. var cacheID = element._eventCacheID;
  3101. this._removeElementObservers(SuperMap.Event.observers[cacheID]);
  3102. },
  3103. /**
  3104. * @param {Array.<Object>} elementObservers - Array of (element, name,
  3105. * observer, usecapture) objects,
  3106. * taken directly from hashtable
  3107. */
  3108. _removeElementObservers: function (elementObservers) {
  3109. if (elementObservers) {
  3110. for (var i = elementObservers.length - 1; i >= 0; i--) {
  3111. var entry = elementObservers[i];
  3112. var args = new Array(entry.element, entry.name, entry.observer, entry.useCapture);
  3113. SuperMap.Event.stopObserving.apply(this, args);
  3114. }
  3115. }
  3116. },
  3117. /**
  3118. * @description 移除事件监听和注册的事件处理方法。注意:事件的移除和监听相对应,移除时的各属性信息必须监听时
  3119. * 保持一致才能确保事件移除成功。
  3120. * @param {(HTMLElement|string)} elementParam - 被监听的 DOM 元素或者其 ID。
  3121. * @param {string} name - 需要移除的被监听事件名称。
  3122. * @param {function} observer - 需要移除的事件处理方法。
  3123. * @param {boolean} [useCapture=false] - 是否捕获。
  3124. * @returns {boolean} Whether or not the event observer was removed
  3125. */
  3126. stopObserving: function (elementParam, name, observer, useCapture) {
  3127. useCapture = useCapture || false;
  3128. var element = Util.getElement(elementParam);
  3129. var cacheID = element._eventCacheID;
  3130. if (name === 'keypress') {
  3131. if (navigator.appVersion.match(/Konqueror|Safari|KHTML/) ||
  3132. element.detachEvent) {
  3133. name = 'keydown';
  3134. }
  3135. }
  3136. // find element's entry in this.observers cache and remove it
  3137. var foundEntry = false;
  3138. var elementObservers = SuperMap.Event.observers[cacheID];
  3139. if (elementObservers) {
  3140. // find the specific event type in the element's list
  3141. var i = 0;
  3142. while (!foundEntry && i < elementObservers.length) {
  3143. var cacheEntry = elementObservers[i];
  3144. if ((cacheEntry.name === name) &&
  3145. (cacheEntry.observer === observer) &&
  3146. (cacheEntry.useCapture === useCapture)) {
  3147. elementObservers.splice(i, 1);
  3148. if (elementObservers.length == 0) {
  3149. delete SuperMap.Event.observers[cacheID];
  3150. }
  3151. foundEntry = true;
  3152. break;
  3153. }
  3154. i++;
  3155. }
  3156. }
  3157. //actually remove the event listener from browser
  3158. if (foundEntry) {
  3159. if (element.removeEventListener) {
  3160. element.removeEventListener(name, observer, useCapture);
  3161. } else if (element && element.detachEvent) {
  3162. element.detachEvent('on' + name, observer);
  3163. }
  3164. }
  3165. return foundEntry;
  3166. },
  3167. /**
  3168. * @description Cycle through all the element entries in the events cache and call
  3169. * stopObservingElement on each.
  3170. */
  3171. unloadCache: function () {
  3172. // check for SuperMap.Event before checking for observers, because
  3173. // SuperMap.Event may be undefined in IE if no map instance was
  3174. // created
  3175. if (SuperMap.Event && SuperMap.Event.observers) {
  3176. for (var cacheID in SuperMap.Event.observers) {
  3177. var elementObservers = SuperMap.Event.observers[cacheID];
  3178. SuperMap.Event._removeElementObservers.apply(this,
  3179. [elementObservers]);
  3180. }
  3181. SuperMap.Event.observers = false;
  3182. }
  3183. },
  3184. CLASS_NAME: "SuperMap.Event"
  3185. };
  3186. SuperMap.Event = Event;
  3187. /* prevent memory leaks in IE */
  3188. SuperMap.Event.observe(window, 'unload', SuperMap.Event.unloadCache, false);
  3189. // CONCATENATED MODULE: ./src/common/commontypes/Events.js
  3190. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  3191. * This program are made available under the terms of the Apache License, Version 2.0
  3192. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3193. /**
  3194. * @class SuperMap.Events
  3195. * @classdesc 事件类。
  3196. * @param {Object} object - 当前事件对象被添加到的 JS 对象。
  3197. * @param {HTMLElement} element - 响应浏览器事件的 DOM 元素。
  3198. * @param {Array.<string>} eventTypes - 自定义应用事件的数组。
  3199. * @param {boolean} [fallThrough=false] - 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  3200. * @param {Object} options - 事件对象选项。
  3201. */
  3202. class Events_Events {
  3203. constructor(object, element, eventTypes, fallThrough, options) {
  3204. /**
  3205. * @member {Array.<string>} SuperMap.Events.prototype.BROWSER_EVENTS
  3206. * @description 支持的事件。
  3207. * @constant
  3208. * @default [
  3209. "mouseover", "mouseout","mousedown", "mouseup", "mousemove",
  3210. "click", "dblclick", "rightclick", "dblrightclick","resize",
  3211. "focus", "blur","touchstart", "touchmove", "touchend","keydown",
  3212. "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  3213. "MSGestureStart", "MSGestureChange", "MSGestureEnd","contextmenu"
  3214. ]
  3215. */
  3216. this.BROWSER_EVENTS = [
  3217. "mouseover", "mouseout",
  3218. "mousedown", "mouseup", "mousemove",
  3219. "click", "dblclick", "rightclick", "dblrightclick",
  3220. "resize", "focus", "blur",
  3221. "touchstart", "touchmove", "touchend",
  3222. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  3223. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  3224. "contextmenu"
  3225. ];
  3226. /**
  3227. * @member {Object} SuperMap.Events.prototype.listeners
  3228. * @description Hashtable of Array(function): events listener functions
  3229. */
  3230. this.listeners = {};
  3231. /**
  3232. * @member {Object} SuperMap.Events.prototype.object
  3233. * @description 发布应用程序事件的对象。
  3234. */
  3235. this.object = object;
  3236. /**
  3237. * @member {HTMLElement} SuperMap.Events.prototype.element
  3238. * @description 接受浏览器事件的 DOM 节点。
  3239. */
  3240. this.element = null;
  3241. /**
  3242. * @member {Array.<string>} SuperMap.Events.prototype.eventTypes
  3243. * @description 支持的事件类型列表。
  3244. */
  3245. this.eventTypes = [];
  3246. /**
  3247. * @member {function} SuperMap.Events.prototype.eventHandler
  3248. * @description 绑定在元素上的事件处理器对象。
  3249. */
  3250. this.eventHandler = null;
  3251. /**
  3252. * @member {boolean} [SuperMap.Events.prototype.fallThrough=false]
  3253. * @description 是否允许事件处理之后向上传递(冒泡),为 false 的时候阻止事件冒泡。
  3254. */
  3255. this.fallThrough = fallThrough;
  3256. /**
  3257. * @member {boolean} [SuperMap.Events.prototype.includeXY=false]
  3258. * @description 判断是否让 xy 属性自动创建到浏览器上的鼠标事件,一般设置为 false,如果设置为 true,鼠标事件将会在事件传递过程中自动产生 xy 属性。
  3259. * 可根据事件对象的 'evt.object' 属性在相关的事件句柄上调用 getMousePosition 函数。这个选项习惯默认为 false 的原因在于,当创建一个
  3260. * 事件对象,其主要目的是管理。在一个 div 的相对定位的鼠标事件,将其设为 true 也是有意义的。这个选项也可以用来控制是否抵消缓存。如果
  3261. * 设为 false 不抵消,如果设为 true,用 this.clearMouseCache() 清除缓存偏移(边界元素偏移,元素在页面的位置偏移)。
  3262. * @example
  3263. * function named(evt) {
  3264. * this.xy = this.object.events.getMousePosition(evt);
  3265. * }
  3266. */
  3267. this.includeXY = false;
  3268. /**
  3269. * @member {Object} SuperMap.Events.prototype.extensions
  3270. * @description 事件扩展。Keys 代表事件类型,values 代表事件对象。
  3271. * @example
  3272. * 以扩展 "foostart" 和 "fooend" 事件为例。展示替换 css 属性为 foo 的元素的 click 事件。
  3273. *
  3274. * SuperMap.Events.foostart = SuperMap.Class({
  3275. * initialize: function(target) {
  3276. * this.target = target;
  3277. * this.target.register("click", this, this.doStuff, {extension: true});
  3278. * // only required if extension provides more than one event type
  3279. * this.target.extensions["foostart"] = true;
  3280. * this.target.extensions["fooend"] = true;
  3281. * },
  3282. * destroy: function() {
  3283. * var target = this.target;
  3284. * target.unregister("click", this, this.doStuff);
  3285. * delete this.target;
  3286. * // only required if extension provides more than one event type
  3287. * delete target.extensions["foostart"];
  3288. * delete target.extensions["fooend"];
  3289. * },
  3290. * doStuff: function(evt) {
  3291. * var propagate = true;
  3292. * if (SuperMap.Event.element(evt).className === "foo") {
  3293. * propagate = false;
  3294. * var target = this.target;
  3295. * target.triggerEvent("foostart");
  3296. * window.setTimeout(function() {
  3297. * target.triggerEvent("fooend");
  3298. * }, 1000);
  3299. * }
  3300. * return propagate;
  3301. * }
  3302. * });
  3303. * // only required if extension provides more than one event type
  3304. * SuperMap.Events.fooend = SuperMap.Events.foostart;
  3305. */
  3306. this.extensions = {};
  3307. /**
  3308. * @member {Object} SuperMap.Events.prototype.extensionCount
  3309. */
  3310. this.extensionCount = {};
  3311. /**
  3312. * @member {Object} SuperMap.Events.prototype.clearMouseListener
  3313. */
  3314. this.clearMouseListener = null;
  3315. Util.extend(this, options);
  3316. if (eventTypes != null) {
  3317. for (var i = 0, len = eventTypes.length; i < len; i++) {
  3318. this.addEventType(eventTypes[i]);
  3319. }
  3320. }
  3321. if (element != null) {
  3322. this.attachToElement(element);
  3323. }
  3324. this.CLASS_NAME = "SuperMap.Events";
  3325. }
  3326. /**
  3327. * @function SuperMap.Events.prototype.destroy
  3328. * @description 移除当前要素 element 上的所有事件监听和处理。
  3329. */
  3330. destroy() {
  3331. for (var e in this.extensions) {
  3332. if (typeof this.extensions[e] !== "boolean") {
  3333. this.extensions[e].destroy();
  3334. }
  3335. }
  3336. this.extensions = null;
  3337. if (this.element) {
  3338. Event.stopObservingElement(this.element);
  3339. if (this.element.hasScrollEvent) {
  3340. Event.stopObserving(
  3341. window, "scroll", this.clearMouseListener
  3342. );
  3343. }
  3344. }
  3345. this.element = null;
  3346. this.listeners = null;
  3347. this.object = null;
  3348. this.eventTypes = null;
  3349. this.fallThrough = null;
  3350. this.eventHandler = null;
  3351. }
  3352. /**
  3353. * @function SuperMap.Events.prototype.addEventType
  3354. * @description 在此事件对象中添加新的事件类型,如果这个事件类型已经添加过了,则不做任何事情。
  3355. * @param {string} eventName - 事件名。
  3356. */
  3357. addEventType(eventName) {
  3358. if (!this.listeners[eventName]) {
  3359. this.eventTypes.push(eventName);
  3360. this.listeners[eventName] = [];
  3361. }
  3362. }
  3363. /**
  3364. * @function SuperMap.Events.prototype.attachToElement
  3365. * @description 给 DOM 元素绑定浏览器事件。
  3366. * @param {HTMLDOMElement} element - 绑定浏览器事件的 DOM 元素。
  3367. */
  3368. attachToElement(element) {
  3369. if (this.element) {
  3370. Event.stopObservingElement(this.element);
  3371. } else {
  3372. // keep a bound copy of handleBrowserEvent() so that we can
  3373. // pass the same function to both Event.observe() and .stopObserving()
  3374. this.eventHandler = FunctionExt.bindAsEventListener(
  3375. this.handleBrowserEvent, this
  3376. );
  3377. // to be used with observe and stopObserving
  3378. this.clearMouseListener = FunctionExt.bind(
  3379. this.clearMouseCache, this
  3380. );
  3381. }
  3382. this.element = element;
  3383. for (var i = 0, len = this.BROWSER_EVENTS.length; i < len; i++) {
  3384. var eventType = this.BROWSER_EVENTS[i];
  3385. // every browser event has a corresponding application event
  3386. // (whether it's listened for or not).
  3387. this.addEventType(eventType);
  3388. // use Prototype to register the event cross-browser
  3389. Event.observe(element, eventType, this.eventHandler);
  3390. }
  3391. // disable dragstart in IE so that mousedown/move/up works normally
  3392. Event.observe(element, "dragstart", Event.stop);
  3393. }
  3394. /**
  3395. * @function SuperMap.Events.prototype.on
  3396. * @description 在一个相同的范围内注册监听器的方法,此方法调用 register 函数。
  3397. * @example
  3398. * // 注册一个 "loadstart" 监听事件
  3399. * events.on({"loadstart": loadStartListener});
  3400. *
  3401. * // 同样注册一个 "loadstart" 监听事件
  3402. * events.register("loadstart", undefined, loadStartListener);
  3403. *
  3404. * // 同时为对象注册多个监听事件
  3405. * events.on({
  3406. * "loadstart": loadStartListener,
  3407. * "loadend": loadEndListener,
  3408. * scope: object
  3409. * });
  3410. *
  3411. * // 同时为对象注册多个监听事件,多次调用 register 方法
  3412. * events.register("loadstart", object, loadStartListener);
  3413. * events.register("loadend", object, loadEndListener);
  3414. *
  3415. *
  3416. * @param {Object} object - 添加监听的对象。
  3417. */
  3418. on(object) {
  3419. for (var type in object) {
  3420. if (type !== "scope" && object.hasOwnProperty(type)) {
  3421. this.register(type, object.scope, object[type]);
  3422. }
  3423. }
  3424. }
  3425. /**
  3426. * @function SuperMap.Events.prototype.register
  3427. * @description 在事件对象上注册一个事件。当事件被触发时,'func' 函数被调用,假设我们触发一个事件,
  3428. * 指定 SuperMap.Bounds 作为 "obj",当事件被触发时,回调函数的上下文作为 Bounds 对象。
  3429. * @param {string} type - 事件注册者的名字。
  3430. * @param {Object} [obj=this.object] - 对象绑定的回调。
  3431. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  3432. * @param {(boolean|Object)} [priority] - 当为 true 时将新的监听加在事件队列的前面。
  3433. */
  3434. register(type, obj, func, priority) {
  3435. if (type in Events_Events && !this.extensions[type]) {
  3436. this.extensions[type] = new Events_Events[type](this);
  3437. }
  3438. if ((func != null) &&
  3439. (Util.indexOf(this.eventTypes, type) !== -1)) {
  3440. if (obj == null) {
  3441. obj = this.object;
  3442. }
  3443. var listeners = this.listeners[type];
  3444. if (!listeners) {
  3445. listeners = [];
  3446. this.listeners[type] = listeners;
  3447. this.extensionCount[type] = 0;
  3448. }
  3449. var listener = {obj: obj, func: func};
  3450. if (priority) {
  3451. listeners.splice(this.extensionCount[type], 0, listener);
  3452. if (typeof priority === "object" && priority.extension) {
  3453. this.extensionCount[type]++;
  3454. }
  3455. } else {
  3456. listeners.push(listener);
  3457. }
  3458. }
  3459. }
  3460. /**
  3461. * @function SuperMap.Events.prototype.registerPriority
  3462. * @description 相同的注册方法,但是在前面增加新的监听者事件查询而代替到方法的结束。
  3463. * @param {string} type - 事件注册者的名字。
  3464. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  3465. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  3466. */
  3467. registerPriority(type, obj, func) {
  3468. this.register(type, obj, func, true);
  3469. }
  3470. /**
  3471. * @function SuperMap.Events.prototype.un
  3472. * @description 在一个相同的范围内取消注册监听器的方法,此方法调用 unregister 函数。
  3473. * @example
  3474. * // 移除 "loadstart" 事件监听
  3475. * events.un({"loadstart": loadStartListener});
  3476. *
  3477. * // 使用 "unregister" 方法移除 "loadstart" 事件监听
  3478. * events.unregister("loadstart", undefined, loadStartListener);
  3479. *
  3480. * // 取消对象多个事件监听
  3481. * events.un({
  3482. * "loadstart": loadStartListener,
  3483. * "loadend": loadEndListener,
  3484. * scope: object
  3485. * });
  3486. *
  3487. * // 取消对象多个事件监听,多次调用unregister方法。
  3488. * events.unregister("loadstart", object, loadStartListener);
  3489. * events.unregister("loadend", object, loadEndListener);
  3490. *
  3491. * @param {Object} object - 移除监听的对象。
  3492. */
  3493. un(object) {
  3494. for (var type in object) {
  3495. if (type !== "scope" && object.hasOwnProperty(type)) {
  3496. this.unregister(type, object.scope, object[type]);
  3497. }
  3498. }
  3499. }
  3500. /**
  3501. * @function SuperMap.Events.prototype.unregister
  3502. * @description 取消注册。
  3503. * @param {string} type - 事件类型。
  3504. * @param {Object} [obj=this.object] - 对象绑定方面的回调。
  3505. * @param {function} [func] - 回调函数,如果没有特定的回调,则这个函数不做任何事情。
  3506. */
  3507. unregister(type, obj, func) {
  3508. if (obj == null) {
  3509. obj = this.object;
  3510. }
  3511. var listeners = this.listeners[type];
  3512. if (listeners != null) {
  3513. for (var i = 0, len = listeners.length; i < len; i++) {
  3514. if (listeners[i].obj === obj && listeners[i].func === func) {
  3515. listeners.splice(i, 1);
  3516. break;
  3517. }
  3518. }
  3519. }
  3520. }
  3521. /**
  3522. * @function SuperMap.Events.prototype.remove
  3523. * @description 删除某个事件类型的所有监听,如果该事件类型没有注册,则不做任何操作。
  3524. * @param {string} type - 事件类型。
  3525. */
  3526. remove(type) {
  3527. if (this.listeners[type] != null) {
  3528. this.listeners[type] = [];
  3529. }
  3530. }
  3531. /**
  3532. * @function SuperMap.Events.prototype.triggerEvent
  3533. * @description 触发一个特定的注册事件。
  3534. * @param {string} type - 触发事件类型。
  3535. * @param {Event} evt - 事件对象。
  3536. * @returns {boolean} 返回监听对象,如果返回是 false,则停止监听。
  3537. */
  3538. triggerEvent(type, evt) {
  3539. var listeners = this.listeners[type];
  3540. // fast path
  3541. if (!listeners || listeners.length == 0) {
  3542. return undefined;
  3543. }
  3544. // prep evt object with object & div references
  3545. if (evt == null) {
  3546. evt = {};
  3547. }
  3548. evt.object = this.object;
  3549. evt.element = this.element;
  3550. if (!evt.type) {
  3551. evt.type = type;
  3552. }
  3553. // execute all callbacks registered for specified type
  3554. // get a clone of the listeners array to
  3555. // allow for splicing during callbacks
  3556. listeners = listeners.slice();
  3557. var continueChain;
  3558. for (var i = 0, len = listeners.length; i < len; i++) {
  3559. var callback = listeners[i];
  3560. // bind the context to callback.obj
  3561. continueChain = callback.func.apply(callback.obj, [evt]);
  3562. if ((continueChain != undefined) && (continueChain === false)) {
  3563. // if callback returns false, execute no more callbacks.
  3564. break;
  3565. }
  3566. }
  3567. // don't fall through to other DOM elements
  3568. if (!this.fallThrough) {
  3569. Event.stop(evt, true);
  3570. }
  3571. return continueChain;
  3572. }
  3573. /**
  3574. * @function SuperMap.Events.prototype.handleBrowserEvent
  3575. * @description 对 triggerEvent 函数的包装,给事件对象设置了 xy 属性(即当前鼠标点的 xy 坐标)。
  3576. * @param {Event} evt - 事件对象。
  3577. */
  3578. handleBrowserEvent(evt) {
  3579. var type = evt.type, listeners = this.listeners[type];
  3580. if (!listeners || listeners.length == 0) {
  3581. // noone's listening, bail out
  3582. return;
  3583. }
  3584. // add clientX & clientY to all events - corresponds to average x, y
  3585. var touches = evt.touches;
  3586. if (touches && touches[0]) {
  3587. var x = 0;
  3588. var y = 0;
  3589. var num = touches.length;
  3590. var touch;
  3591. for (var i = 0; i < num; ++i) {
  3592. touch = touches[i];
  3593. x += touch.clientX;
  3594. y += touch.clientY;
  3595. }
  3596. evt.clientX = x / num;
  3597. evt.clientY = y / num;
  3598. }
  3599. if (this.includeXY) {
  3600. evt.xy = this.getMousePosition(evt);
  3601. }
  3602. this.triggerEvent(type, evt);
  3603. }
  3604. /**
  3605. * @function SuperMap.Events.prototype.clearMouseCache
  3606. * @description 清除鼠标缓存。
  3607. */
  3608. clearMouseCache() {
  3609. this.element.scrolls = null;
  3610. this.element.lefttop = null;
  3611. var body = document.body;
  3612. if (body && !((body.scrollTop != 0 || body.scrollLeft != 0) &&
  3613. navigator.userAgent.match(/iPhone/i))) {
  3614. this.element.offsets = null;
  3615. }
  3616. }
  3617. /**
  3618. * @function SuperMap.Events.prototype.getMousePosition
  3619. * @param {Event} evt - 事件对象。
  3620. * @returns {SuperMap.Pixel} 当前的鼠标的 xy 坐标点。
  3621. */
  3622. getMousePosition(evt) {
  3623. if (!this.includeXY) {
  3624. this.clearMouseCache();
  3625. } else if (!this.element.hasScrollEvent) {
  3626. Event.observe(window, "scroll", this.clearMouseListener);
  3627. this.element.hasScrollEvent = true;
  3628. }
  3629. if (!this.element.scrolls) {
  3630. var viewportElement = Util.getViewportElement();
  3631. this.element.scrolls = [
  3632. viewportElement.scrollLeft,
  3633. viewportElement.scrollTop
  3634. ];
  3635. }
  3636. if (!this.element.lefttop) {
  3637. this.element.lefttop = [
  3638. (document.documentElement.clientLeft || 0),
  3639. (document.documentElement.clientTop || 0)
  3640. ];
  3641. }
  3642. if (!this.element.offsets) {
  3643. this.element.offsets = Util.pagePosition(this.element);
  3644. }
  3645. return new Pixel_Pixel(
  3646. (evt.clientX + this.element.scrolls[0]) - this.element.offsets[0]
  3647. - this.element.lefttop[0],
  3648. (evt.clientY + this.element.scrolls[1]) - this.element.offsets[1]
  3649. - this.element.lefttop[1]
  3650. );
  3651. }
  3652. }
  3653. SuperMap.Events = Events_Events;
  3654. SuperMap.Events.prototype.BROWSER_EVENTS = [
  3655. "mouseover", "mouseout",
  3656. "mousedown", "mouseup", "mousemove",
  3657. "click", "dblclick", "rightclick", "dblrightclick",
  3658. "resize", "focus", "blur",
  3659. "touchstart", "touchmove", "touchend",
  3660. "keydown", "MSPointerDown", "MSPointerUp", "pointerdown", "pointerup",
  3661. "MSGestureStart", "MSGestureChange", "MSGestureEnd",
  3662. "contextmenu"
  3663. ];
  3664. // EXTERNAL MODULE: external "function(){try{return elasticsearch}catch(e){return {}}}()"
  3665. var external_function_try_return_elasticsearch_catch_e_return_ = __webpack_require__(3);
  3666. var external_function_try_return_elasticsearch_catch_e_return_default = /*#__PURE__*/__webpack_require__.n(external_function_try_return_elasticsearch_catch_e_return_);
  3667. // CONCATENATED MODULE: ./src/common/thirdparty/elasticsearch/ElasticSearch.js
  3668. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  3669. * This program are made available under the terms of the Apache License, Version 2.0
  3670. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  3671. /**
  3672. * @class SuperMap.ElasticSearch
  3673. * @classdesc ElasticSearch服务类。
  3674. * @category ElasticSearch
  3675. * @param {string} url - ElasticSearch服务地址。
  3676. * @param {Object} options - 参数。
  3677. * @param {function} [options.change] - 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  3678. * @param {boolean} [options.openGeoFence=false] - 是否开启地理围栏验证,默认为不开启。
  3679. * @param {function} [options.outOfGeoFence] - 数据超出地理围栏后执行的函数。
  3680. * @param {Object} [options.geoFence] - 地理围栏。
  3681. */
  3682. class ElasticSearch_ElasticSearch {
  3683. constructor(url, options) {
  3684. options = options || {};
  3685. /**
  3686. * @member {string} SuperMap.ElasticSearch.prototype.url
  3687. * @description ElasticSearch服务地址
  3688. */
  3689. this.url = url;
  3690. /**
  3691. * @member {Object} SuperMap.ElasticSearch.prototype.client
  3692. * @description client ES客户端
  3693. */
  3694. this.client = new external_function_try_return_elasticsearch_catch_e_return_default.a.Client({
  3695. host: this.url
  3696. });
  3697. /**
  3698. * @deprecated
  3699. * @member {function} [SuperMap.ElasticSearch.prototype.change]
  3700. * @description 服务器返回数据后执行的函数。废弃,不建议使用。使用search或msearch方法。
  3701. */
  3702. this.change = null;
  3703. /**
  3704. * @member {boolean} [SuperMap.ElasticSearch.prototype.openGeoFence=false]
  3705. * @description 是否开启地理围栏验证,默认为不开启。
  3706. */
  3707. this.openGeoFence = false;
  3708. /**
  3709. * @member {function} [SuperMap.ElasticSearch.prototype.outOfGeoFence]
  3710. * @description 数据超出地理围栏后执行的函数
  3711. */
  3712. this.outOfGeoFence = null;
  3713. /**
  3714. * @member {Object} [SuperMap.ElasticSearch.prototype.geoFence]
  3715. * @description 地理围栏
  3716. * @example {
  3717. * radius: 1000,//单位是m
  3718. * center: [104.40, 30.43],
  3719. * unit: 'meter|degree'
  3720. * }
  3721. */
  3722. this.geoFence = null;
  3723. /*
  3724. * Constant: EVENT_TYPES
  3725. * {Array.<String>}
  3726. * 此类支持的事件类型。
  3727. *
  3728. */
  3729. this.EVENT_TYPES = ['change', 'error', 'outOfGeoFence'];
  3730. /**
  3731. * @member {SuperMap.Events} SuperMap.ElasticSearch.prototype.events
  3732. * @description 事件
  3733. */
  3734. this.events = new Events_Events(this, null, this.EVENT_TYPES);
  3735. /**
  3736. * @member {Object} SuperMap.ElasticSearch.prototype.eventListeners
  3737. * @description 听器对象,在构造函数中设置此参数(可选),对 MapService 支持的两个事件 processCompleted 、processFailed 进行监听,
  3738. * 相当于调用 SuperMap.Events.on(eventListeners)。
  3739. */
  3740. this.eventListeners = null;
  3741. Util.extend(this, options);
  3742. if (this.eventListeners instanceof Object) {
  3743. this.events.on(this.eventListeners);
  3744. }
  3745. }
  3746. /**
  3747. * @function SuperMap.ElasticSearch.prototype.setGeoFence
  3748. * @description 设置地理围栏,openGeoFence参数为true的时候,设置的地理围栏才生效。
  3749. * @param {SuperMap.Geometry} geoFence - 地理围栏。
  3750. */
  3751. setGeoFence(geoFence) {
  3752. this.geoFence = geoFence;
  3753. }
  3754. /**
  3755. * @function SuperMap.ElasticSearch.prototype.bulk
  3756. * @description 批量操作API,允许执行多个索引/删除操作。
  3757. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-bulk}</br>
  3758. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-bulk.html}</br>
  3759. * @param {Object} params - 参数。
  3760. * @param {function} callback - 回调函数。
  3761. */
  3762. bulk(params, callback) {
  3763. return this.client.bulk(params, callback);
  3764. }
  3765. /**
  3766. * @function SuperMap.ElasticSearch.prototype.clearScroll
  3767. * @description 通过指定scroll参数进行查询来清除已经创建的scroll请求。
  3768. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-clearscroll}</br>
  3769. *更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  3770. * @param {Object} params - 参数。
  3771. * @param {function} callback - 回调函数。
  3772. */
  3773. clearScroll(params, callback) {
  3774. return this.client.clearScroll(params, callback);
  3775. }
  3776. /**
  3777. * @function SuperMap.ElasticSearch.prototype.count
  3778. * @description 获取集群、索引、类型或查询的文档个数。
  3779. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-count}</br>
  3780. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-count.html}</br>
  3781. * @param {Object} params - 参数。
  3782. * @param {function} callback - 回调函数。
  3783. */
  3784. count(params, callback) {
  3785. return this.client.count(params, callback);
  3786. }
  3787. /**
  3788. * @function SuperMap.ElasticSearch.prototype.count
  3789. * @description 在特定索引中添加一个类型化的JSON文档,使其可搜索。如果具有相同index,type且id已经存在的文档将发生错误。</br>
  3790. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-create}
  3791. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}
  3792. * @param {Object} params - 参数。
  3793. * @param {function} callback - 回调函数。
  3794. */
  3795. create(params, callback) {
  3796. return this.client.create(params, callback);
  3797. }
  3798. /**
  3799. * @function SuperMap.ElasticSearch.prototype.delete
  3800. * @description 根据其ID从特定索引中删除键入的JSON文档。
  3801. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-delete}</br>
  3802. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete.html}</br>
  3803. * @param {Object} params - 参数。
  3804. * @param {function} callback - 回调函数。
  3805. */
  3806. delete(params, callback) {
  3807. return this.client.delete(params, callback);
  3808. }
  3809. /**
  3810. * @function SuperMap.ElasticSearch.prototype.delete
  3811. * @description 根据其ID从特定索引中删除键入的JSON文档。
  3812. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletebyquery}</br>
  3813. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-delete-by-query.html}</br>
  3814. * @param {Object} params - 参数。
  3815. * @param {function} callback - 回调函数。
  3816. */
  3817. deleteByQuery(params, callback) {
  3818. return this.client.deleteByQuery(params, callback);
  3819. }
  3820. /**
  3821. * @function SuperMap.ElasticSearch.prototype.delete
  3822. * @description 根据其ID删除脚本。</br>
  3823. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletescript}</br>
  3824. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  3825. * @param {Object} params - 参数。
  3826. * @param {function} callback - 回调函数。
  3827. */
  3828. deleteScript(params, callback) {
  3829. return this.client.deleteScript(params, callback);
  3830. }
  3831. /**
  3832. * @function SuperMap.ElasticSearch.prototype.deleteTemplate
  3833. * @description 根据其ID删除模板。</br>
  3834. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-deletetemplate}</br>
  3835. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3836. * @param {Object} params - 参数。
  3837. * @param {function} callback - 回调函数。
  3838. */
  3839. deleteTemplate(params, callback) {
  3840. return this.client.deleteTemplate(params, callback);
  3841. }
  3842. /**
  3843. * @function SuperMap.ElasticSearch.prototype.exists
  3844. * @description 检查给定文档是否存在。</br>
  3845. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-exists}</br>
  3846. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3847. * @param {Object} params - 参数。
  3848. * @param {function} callback - 回调函数。
  3849. */
  3850. exists(params, callback) {
  3851. return this.client.exists(params, callback);
  3852. }
  3853. /**
  3854. * @function SuperMap.ElasticSearch.prototype.existsSource
  3855. * @description 检查资源是否存在。</br>
  3856. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-existssource}</br>
  3857. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3858. * @param {Object} params - 参数。
  3859. * @param {function} callback - 回调函数。
  3860. */
  3861. existsSource(params, callback) {
  3862. return this.client.existsSource(params, callback);
  3863. }
  3864. /**
  3865. * @function SuperMap.ElasticSearch.prototype.explain
  3866. * @description 提供与特定查询相关的特定文档分数的详细信息。它还会告诉您文档是否与指定的查询匹配。</br>
  3867. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-explain}</br>
  3868. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-explain.html}</br>
  3869. * @param {Object} params - 参数。
  3870. * @param {function} callback - 回调函数。
  3871. */
  3872. explain(params, callback) {
  3873. return this.client.explain(params, callback);
  3874. }
  3875. /**
  3876. * @function SuperMap.ElasticSearch.prototype.fieldCaps
  3877. * @description 允许检索多个索引之间的字段的功能。(实验性API,可能会在未来版本中删除)</br>
  3878. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-fieldcaps}</br>
  3879. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-field-caps.html}</br>
  3880. * @param {Object} params - 参数。
  3881. * @param {function} callback - 回调函数。
  3882. */
  3883. fieldCaps(params, callback) {
  3884. return this.client.fieldCaps(params, callback);
  3885. }
  3886. /**
  3887. * @function SuperMap.ElasticSearch.prototype.get
  3888. * @description 从索引获取一个基于其id的类型的JSON文档。</br>
  3889. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-get}</br>
  3890. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3891. * @param {Object} params - 参数。
  3892. * @param {function} callback - 回调函数。
  3893. */
  3894. get(params, callback) {
  3895. return this.client.get(params, callback);
  3896. }
  3897. /**
  3898. * @function SuperMap.ElasticSearch.prototype.getScript
  3899. * @description 获取脚本。</br>
  3900. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getscript}</br>
  3901. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  3902. * @param {Object} params - 参数。
  3903. * @param {function} callback - 回调函数。
  3904. */
  3905. getScript(params, callback) {
  3906. return this.client.getScript(params, callback);
  3907. }
  3908. /**
  3909. * @function SuperMap.ElasticSearch.prototype.getSource
  3910. * @description 通过索引,类型和ID获取文档的源。</br>
  3911. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-getsource}</br>
  3912. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-get.html}</br>
  3913. * @param {Object} params - 参数。
  3914. * @param {function} callback - 回调函数。
  3915. */
  3916. getSource(params, callback) {
  3917. return this.client.getSource(params, callback);
  3918. }
  3919. /**
  3920. * @function SuperMap.ElasticSearch.prototype.getTemplate
  3921. * @description 获取模板。</br>
  3922. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-gettemplate}</br>
  3923. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3924. * @param {Object} params - 参数。
  3925. * @param {function} callback - 回调函数。
  3926. */
  3927. getTemplate(params, callback) {
  3928. return this.client.getTemplate(params, callback);
  3929. }
  3930. /**
  3931. * @function SuperMap.ElasticSearch.prototype.index
  3932. * @description 在索引中存储一个键入的JSON文档,使其可搜索。</br>
  3933. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-index}</br>
  3934. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-index_.html}</br>
  3935. * @param {Object} params - 参数。
  3936. * @param {function} callback - 回调函数。
  3937. */
  3938. index(params, callback) {
  3939. return this.client.index(params, callback);
  3940. }
  3941. /**
  3942. * @function SuperMap.ElasticSearch.prototype.info
  3943. * @description 从当前集群获取基本信息。</br>
  3944. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-info}</br>
  3945. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  3946. * @param {Object} params - 参数。
  3947. * @param {function} callback - 回调函数。
  3948. */
  3949. info(params, callback) {
  3950. return this.client.info(params, callback);
  3951. }
  3952. /**
  3953. * @function SuperMap.ElasticSearch.prototype.mget
  3954. * @description 根据索引,类型(可选)和ids来获取多个文档。mget所需的主体可以采用两种形式:文档位置数组或文档ID数组。</br>
  3955. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mget}</br>
  3956. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-get.html}</br>
  3957. * @param {Object} params - 参数。
  3958. * @param {function} callback - 回调函数。
  3959. */
  3960. mget(params, callback) {
  3961. return this.client.mget(params, callback);
  3962. }
  3963. /**
  3964. * @function SuperMap.ElasticSearch.prototype.msearch
  3965. * @description 在同一请求中执行多个搜索请求。</br>
  3966. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearch}</br>
  3967. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-multi-search.html}</br>
  3968. * @param {Object} params - 参数。
  3969. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  3970. * 回调参数:error,response。结果存储在response.responses中
  3971. */
  3972. msearch(params, callback) {
  3973. let me = this;
  3974. return me.client.msearch(params)
  3975. .then(function (resp) {
  3976. me._update(resp.responses, callback);
  3977. return resp;
  3978. }, function (err) {
  3979. callback(err);
  3980. me.events.triggerEvent('error', {error: err});
  3981. return err;
  3982. });
  3983. }
  3984. /**
  3985. * @function SuperMap.ElasticSearch.prototype.msearchTemplate
  3986. * @description 在同一请求中执行多个搜索模板请求。</br>
  3987. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-msearchtemplate}</br>
  3988. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  3989. * @param {Object} params - 参数。
  3990. * @param {function} callback - 回调函数。
  3991. */
  3992. msearchTemplate(params, callback) {
  3993. return this.client.msearchTemplate(params, callback);
  3994. }
  3995. /**
  3996. * @function SuperMap.ElasticSearch.prototype.mtermvectors
  3997. * @description 多termvectors API允许一次获得多个termvectors。</br>
  3998. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-mtermvectors}</br>
  3999. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-multi-termvectors.html}</br>
  4000. * @param {Object} params - 参数。
  4001. * @param {function} callback - 回调函数。
  4002. */
  4003. mtermvectors(params, callback) {
  4004. return this.client.mtermvectors(params, callback);
  4005. }
  4006. /**
  4007. * @function SuperMap.ElasticSearch.prototype.ping
  4008. * @description 测试连接。</br>
  4009. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-ping}</br>
  4010. * 更多信息参考 {@link https://www.elastic.co/guide/index.html}</br>
  4011. * @param {Object} params - 参数。
  4012. * @param {function} callback - 回调函数。
  4013. */
  4014. ping(params, callback) {
  4015. return this.client.ping(params, callback);
  4016. }
  4017. /**
  4018. * @function SuperMap.ElasticSearch.prototype.putScript
  4019. * @description 添加脚本。</br>
  4020. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-putscript}</br>
  4021. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-scripting.html}</br>
  4022. * @param {Object} params - 参数。
  4023. * @param {function} callback - 回调函数。
  4024. */
  4025. putScript(params, callback) {
  4026. return this.client.putScript(params, callback);
  4027. }
  4028. /**
  4029. * @function SuperMap.ElasticSearch.prototype.putTemplate
  4030. * @description 添加模板。</br>
  4031. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-puttemplate}</br>
  4032. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  4033. * @param {Object} params - 参数。
  4034. * @param {function} callback - 回调函数。
  4035. */
  4036. putTemplate(params, callback) {
  4037. return this.client.putTemplate(params, callback);
  4038. }
  4039. /**
  4040. * @function SuperMap.ElasticSearch.prototype.reindex
  4041. * @description 重新索引。</br>
  4042. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindex}</br>
  4043. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  4044. * @param {Object} params - 参数。
  4045. * @param {function} callback - 回调函数。
  4046. */
  4047. reindex(params, callback) {
  4048. return this.client.reindex(params, callback);
  4049. }
  4050. /**
  4051. * @function SuperMap.ElasticSearch.prototype.reindexRessrottle
  4052. * @description 重新索引。</br>
  4053. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-reindexrethrottle}</br>
  4054. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-reindex.html}</br>
  4055. * @param {Object} params - 参数。
  4056. * @param {function} callback - 回调函数。
  4057. */
  4058. reindexRessrottle(params, callback) {
  4059. return this.client.reindexRessrottle(params, callback);
  4060. }
  4061. /**
  4062. * @function SuperMap.ElasticSearch.prototype.renderSearchTemplate
  4063. * @description 搜索模板。</br>
  4064. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-rendersearchtemplate}</br>
  4065. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-template.html}</br>
  4066. * @param {Object} params - 参数。
  4067. * @param {function} callback - 回调函数。
  4068. */
  4069. renderSearchTemplate(params, callback) {
  4070. return this.client.renderSearchTemplate(params, callback);
  4071. }
  4072. /**
  4073. * @function SuperMap.ElasticSearch.prototype.scroll
  4074. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。</br>
  4075. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-scroll}</br>
  4076. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-scroll.html}</br>
  4077. * @param {Object} params - 参数。
  4078. * @param {function} callback - 回调函数。
  4079. */
  4080. scroll(params, callback) {
  4081. return this.client.scroll(params, callback);
  4082. }
  4083. /**
  4084. * @function SuperMap.ElasticSearch.prototype.search
  4085. * @description 在search()调用中指定滚动参数之后,滚动搜索请求(检索下一组结果)。
  4086. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-search}</br>
  4087. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-search.html}</br>
  4088. * @param {Object} params - 参数。
  4089. * @param {function} callback - 请求返回的回调函数。也可以使用then表达式获取返回结果。
  4090. * 回调参数:error,response,结果存储在response.responses中
  4091. */
  4092. search(params, callback) {
  4093. let me = this;
  4094. return me.client.search(params)
  4095. .then(function (resp) {
  4096. me._update(resp.responses, callback);
  4097. return resp;
  4098. }, function (err) {
  4099. callback(err);
  4100. me.events.triggerEvent('error', {error: err});
  4101. return err;
  4102. });
  4103. }
  4104. /**
  4105. * @function SuperMap.ElasticSearch.prototype.searchShards
  4106. * @description 返回要执行搜索请求的索引和分片。
  4107. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchshards}</br>
  4108. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-shards.html}</br>
  4109. * @param {Object} params - 参数。
  4110. * @param {function} callback - 回调函数。
  4111. */
  4112. searchShards(params, callback) {
  4113. return this.client.searchShards(params, callback);
  4114. }
  4115. /**
  4116. * @function SuperMap.ElasticSearch.prototype.searchTemplate
  4117. * @description 搜索模板。
  4118. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-searchtemplate}</br>
  4119. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  4120. * @param {Object} params - 参数。
  4121. * @param {function} callback - 回调函数。
  4122. */
  4123. searchTemplate(params, callback) {
  4124. return this.client.searchTemplate(params, callback);
  4125. }
  4126. /**
  4127. * @function SuperMap.ElasticSearch.prototype.suggest
  4128. * @description 该建议功能通过使用特定的建议者,基于所提供的文本来建议类似的术语。
  4129. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-suggest}</br>
  4130. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/search-suggesters.html}</br>
  4131. * @param {Object} params - 参数。
  4132. * @param {function} callback - 回调函数。
  4133. */
  4134. suggest(params, callback) {
  4135. return this.client.suggest(params, callback);
  4136. }
  4137. /**
  4138. * @function SuperMap.ElasticSearch.prototype.termvectors
  4139. * @description 返回有关特定文档字段中的术语的信息和统计信息。
  4140. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-termvectors}</br>
  4141. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-termvectors.html}</br>
  4142. * @param {Object} params - 参数。
  4143. * @param {function} callback - 回调函数。
  4144. */
  4145. termvectors(params, callback) {
  4146. return this.client.termvectors(params, callback);
  4147. }
  4148. /**
  4149. * @function SuperMap.ElasticSearch.prototype.update
  4150. * @description 更新文档的部分。
  4151. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-update}</br>
  4152. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update.html}</br>
  4153. * @param {Object} params - 参数。
  4154. * @param {function} callback - 回调函数。
  4155. */
  4156. update(params, callback) {
  4157. return this.client.update(params, callback);
  4158. }
  4159. /**
  4160. * @function SuperMap.ElasticSearch.prototype.update
  4161. * @description 通过查询API来更新文档。
  4162. * 参数设置参考 {@link https://www.elastic.co/guide/en/elasticsearch/client/javascript-api/current/api-reference.html#api-updatebyquery}</br>
  4163. * 更多信息参考 {@link https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html}</br>
  4164. * @param {Object} params - 参数。
  4165. * @param {function} callback - 回调函数。
  4166. */
  4167. updateByQuery(params, callback) {
  4168. return this.client.updateByQuery(params, callback);
  4169. }
  4170. _update(data, callback) {
  4171. let me = this;
  4172. if (!data) {
  4173. return;
  4174. }
  4175. me.data = data;
  4176. if (me.openGeoFence && me.geoFence) {
  4177. me._validateDatas(data);
  4178. }
  4179. me.events.triggerEvent('change', {data: me.data});
  4180. //change方法已废弃,不建议使用。建议使用search方法的第二个参数传入请求成功的回调
  4181. if (me.change) {
  4182. me.change && me.change(data);
  4183. } else {
  4184. //加responses是为了保持跟原来es自身的数据结构一致
  4185. callback && callback(undefined, {responses: data});
  4186. }
  4187. }
  4188. _validateDatas(datas) {
  4189. if (!datas) {
  4190. return;
  4191. }
  4192. if (!(datas instanceof Array)) {
  4193. datas = [datas];
  4194. }
  4195. var i, len = datas.length;
  4196. for (i = 0; i < len; i++) {
  4197. this._validateData(datas[i]);
  4198. }
  4199. }
  4200. _validateData(data) {
  4201. let me = this;
  4202. data.hits.hits.map(function (source) {
  4203. let content = source._source;
  4204. let meterUnit = me._getMeterPerMapUnit(me.geoFence.unit);
  4205. let geoFenceCX = me.geoFence.center[0] * meterUnit;
  4206. let geoFenceCY = me.geoFence.center[1] * meterUnit;
  4207. let contentX = content.x * meterUnit;
  4208. let contentY = content.y * meterUnit;
  4209. let distance = me._distance(contentX, contentY, geoFenceCX, geoFenceCY);
  4210. let radius = me.geoFence.radius;
  4211. if (distance > radius) {
  4212. me.outOfGeoFence && me.outOfGeoFence(data);
  4213. me.events.triggerEvent('outOfGeoFence', {data: data});
  4214. }
  4215. return source;
  4216. });
  4217. }
  4218. _distance(x1, y1, x2, y2) {
  4219. return Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
  4220. }
  4221. _getMeterPerMapUnit(mapUnit) {
  4222. let earchRadiusInMeters = 6378137;
  4223. let meterPerMapUnit;
  4224. if (mapUnit === 'meter') {
  4225. meterPerMapUnit = 1;
  4226. } else if (mapUnit === 'degree') {
  4227. // 每度表示多少米。
  4228. meterPerMapUnit = Math.PI * 2 * earchRadiusInMeters / 360;
  4229. }
  4230. return meterPerMapUnit;
  4231. }
  4232. }
  4233. SuperMap.ElasticSearch = ElasticSearch_ElasticSearch;
  4234. // EXTERNAL MODULE: ./node_modules/promise-polyfill/dist/polyfill.js
  4235. var polyfill = __webpack_require__(4);
  4236. // EXTERNAL MODULE: ./node_modules/fetch-ie8/fetch.js
  4237. var fetch = __webpack_require__(8);
  4238. // EXTERNAL MODULE: ./node_modules/fetch-jsonp/build/fetch-jsonp.js
  4239. var fetch_jsonp = __webpack_require__(2);
  4240. var fetch_jsonp_default = /*#__PURE__*/__webpack_require__.n(fetch_jsonp);
  4241. // CONCATENATED MODULE: ./src/common/util/FetchRequest.js
  4242. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  4243. * This program are made available under the terms of the Apache License, Version 2.0
  4244. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4245. let FetchRequest_fetch = window.fetch;
  4246. var setFetch = function (newFetch) {
  4247. FetchRequest_fetch = newFetch;
  4248. }
  4249. /**
  4250. * @function SuperMap.setCORS
  4251. * @description 设置是否允许跨域请求,全局配置,优先级低于 service 下的 crossOring 参数。
  4252. * @param {boolean} cors - 是否允许跨域请求。
  4253. */
  4254. var setCORS = SuperMap.setCORS = function (cors) {
  4255. SuperMap.CORS = cors;
  4256. }
  4257. /**
  4258. * @function SuperMap.isCORS
  4259. * @description 是是否允许跨域请求。
  4260. * @returns {boolean} 是否允许跨域请求。
  4261. */
  4262. var isCORS = SuperMap.isCORS = function () {
  4263. if (SuperMap.CORS != undefined) {
  4264. return SuperMap.CORS;
  4265. }
  4266. return window.XMLHttpRequest && 'withCredentials' in new window.XMLHttpRequest();
  4267. }
  4268. /**
  4269. * @function SuperMap.setRequestTimeout
  4270. * @description 设置请求超时时间。
  4271. * @param {number} [timeout=45] - 请求超时时间,单位秒。
  4272. */
  4273. var setRequestTimeout = SuperMap.setRequestTimeout = function (timeout) {
  4274. return SuperMap.RequestTimeout = timeout;
  4275. }
  4276. /**
  4277. * @function SuperMap.getRequestTimeout
  4278. * @description 获取请求超时时间。
  4279. * @returns {number} 请求超时时间。
  4280. */
  4281. var getRequestTimeout = SuperMap.getRequestTimeout = function () {
  4282. return SuperMap.RequestTimeout || 45000;
  4283. }
  4284. var FetchRequest = SuperMap.FetchRequest = {
  4285. commit: function (method, url, params, options) {
  4286. method = method ? method.toUpperCase() : method;
  4287. switch (method) {
  4288. case 'GET':
  4289. return this.get(url, params, options);
  4290. case 'POST':
  4291. return this.post(url, params, options);
  4292. case 'PUT':
  4293. return this.put(url, params, options);
  4294. case 'DELETE':
  4295. return this.delete(url, params, options);
  4296. default:
  4297. return this.get(url, params, options);
  4298. }
  4299. },
  4300. supportDirectRequest: function (url, options) {
  4301. if (Util.isInTheSameDomain(url)) {
  4302. return true;
  4303. }
  4304. if (options.crossOrigin != undefined) {
  4305. return options.crossOrigin;
  4306. } else {
  4307. return isCORS() || options.proxy;
  4308. }
  4309. },
  4310. get: function (url, params, options) {
  4311. options = options || {};
  4312. var type = 'GET';
  4313. url = Util.urlAppend(url, this._getParameterString(params || {}));
  4314. url = this._processUrl(url, options);
  4315. if (!this.supportDirectRequest(url, options)) {
  4316. url = url.replace('.json', '.jsonp');
  4317. var config = {
  4318. url: url,
  4319. data: params
  4320. };
  4321. return SuperMap.Util.RequestJSONPPromise.GET(config);
  4322. }
  4323. if (!this.urlIsLong(url)) {
  4324. return this._fetch(url, params, options, type);
  4325. } else {
  4326. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  4327. }
  4328. },
  4329. delete: function (url, params, options) {
  4330. options = options || {};
  4331. var type = 'DELETE';
  4332. url = Util.urlAppend(url, this._getParameterString(params || {}));
  4333. url = this._processUrl(url, options);
  4334. if (!this.supportDirectRequest(url, options)) {
  4335. url = url.replace('.json', '.jsonp');
  4336. var config = {
  4337. url: url += "&_method=DELETE",
  4338. data: params
  4339. };
  4340. return SuperMap.Util.RequestJSONPPromise.DELETE(config);
  4341. }
  4342. if (this.urlIsLong(url)) {
  4343. return this._postSimulatie(type, url.substring(0, url.indexOf('?') - 1), params, options);
  4344. }
  4345. return this._fetch(url, params, options, type);
  4346. },
  4347. post: function (url, params, options) {
  4348. options = options || {};
  4349. if (!this.supportDirectRequest(url, options)) {
  4350. url = url.replace('.json', '.jsonp');
  4351. var config = {
  4352. url: url += "&_method=POST",
  4353. data: params
  4354. };
  4355. return SuperMap.Util.RequestJSONPPromise.POST(config);
  4356. }
  4357. return this._fetch(this._processUrl(url, options), params, options, 'POST');
  4358. },
  4359. put: function (url, params, options) {
  4360. options = options || {};
  4361. url = this._processUrl(url, options);
  4362. if (!this.supportDirectRequest(url, options)) {
  4363. url = url.replace('.json', '.jsonp');
  4364. var config = {
  4365. url: url += "&_method=PUT",
  4366. data: params
  4367. };
  4368. return SuperMap.Util.RequestJSONPPromise.PUT(config);
  4369. }
  4370. return this._fetch(url, params, options, 'PUT');
  4371. },
  4372. urlIsLong: function (url) {
  4373. //当前url的字节长度。
  4374. var totalLength = 0,
  4375. charCode = null;
  4376. for (var i = 0, len = url.length; i < len; i++) {
  4377. //转化为Unicode编码
  4378. charCode = url.charCodeAt(i);
  4379. if (charCode < 0x007f) {
  4380. totalLength++;
  4381. } else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) {
  4382. totalLength += 2;
  4383. } else if ((0x0800 <= charCode) && (charCode <= 0xffff)) {
  4384. totalLength += 3;
  4385. }
  4386. }
  4387. return totalLength < 2000 ? false : true;
  4388. },
  4389. _postSimulatie: function (type, url, params, options) {
  4390. var separator = url.indexOf('?') > -1 ? '&' : '?';
  4391. url += separator + '_method=' + type;
  4392. if (typeof params !== 'string') {
  4393. params = JSON.stringify(params);
  4394. }
  4395. return this.post(url, params, options);
  4396. },
  4397. _processUrl: function (url, options) {
  4398. if (this._isMVTRequest(url)) {
  4399. return url;
  4400. }
  4401. if (url.indexOf('.json') === -1 && !options.withoutFormatSuffix) {
  4402. if (url.indexOf('?') < 0) {
  4403. url += '.json';
  4404. } else {
  4405. var urlArrays = url.split('?');
  4406. if (urlArrays.length === 2) {
  4407. url = urlArrays[0] + '.json?' + urlArrays[1];
  4408. }
  4409. }
  4410. }
  4411. if (options && options.proxy) {
  4412. if (typeof options.proxy === 'function') {
  4413. url = options.proxy(url);
  4414. } else {
  4415. url = decodeURIComponent(url);
  4416. url = options.proxy + encodeURIComponent(url);
  4417. }
  4418. }
  4419. return url;
  4420. },
  4421. _fetch: function (url, params, options, type) {
  4422. options = options || {};
  4423. options.headers = options.headers || {};
  4424. if (!options.headers['Content-Type']) {
  4425. options.headers['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8';
  4426. }
  4427. if (options.timeout) {
  4428. return this._timeout(
  4429. options.timeout,
  4430. FetchRequest_fetch(url, {
  4431. method: type,
  4432. headers: options.headers,
  4433. body: type === 'PUT' || type === 'POST' ? params : undefined,
  4434. credentials: this._getWithCredentials(options),
  4435. mode: 'cors',
  4436. timeout: getRequestTimeout()
  4437. }).then(function (response) {
  4438. return response;
  4439. })
  4440. );
  4441. }
  4442. return FetchRequest_fetch(url, {
  4443. method: type,
  4444. body: type === 'PUT' || type === 'POST' ? params : undefined,
  4445. headers: options.headers,
  4446. credentials: this._getWithCredentials(options),
  4447. mode: 'cors',
  4448. timeout: getRequestTimeout()
  4449. }).then(function (response) {
  4450. return response;
  4451. });
  4452. },
  4453. _getWithCredentials: function (options) {
  4454. if (options.withCredentials === true) {
  4455. return 'include';
  4456. }
  4457. if (options.withCredentials === false) {
  4458. return 'omit';
  4459. }
  4460. return 'same-origin';
  4461. },
  4462. _fetchJsonp: function (url, options) {
  4463. options = options || {};
  4464. return fetch_jsonp_default()(url, {
  4465. method: 'GET',
  4466. timeout: options.timeout
  4467. }).then(function (response) {
  4468. return response;
  4469. });
  4470. },
  4471. _timeout: function (seconds, promise) {
  4472. return new Promise(function (resolve, reject) {
  4473. setTimeout(function () {
  4474. reject(new Error('timeout'));
  4475. }, seconds);
  4476. promise.then(resolve, reject);
  4477. });
  4478. },
  4479. _getParameterString: function (params) {
  4480. var paramsArray = [];
  4481. for (var key in params) {
  4482. var value = params[key];
  4483. if (value != null && typeof value !== 'function') {
  4484. var encodedValue;
  4485. if (Array.isArray(value) || value.toString() === '[object Object]') {
  4486. encodedValue = encodeURIComponent(JSON.stringify(value));
  4487. } else {
  4488. encodedValue = encodeURIComponent(value);
  4489. }
  4490. paramsArray.push(encodeURIComponent(key) + '=' + encodedValue);
  4491. }
  4492. }
  4493. return paramsArray.join('&');
  4494. },
  4495. _isMVTRequest: function (url) {
  4496. return url.indexOf('.mvt') > -1 || url.indexOf('.pbf') > -1;
  4497. }
  4498. }
  4499. SuperMap.Util.RequestJSONPPromise = {
  4500. limitLength: 1500,
  4501. queryKeys: [],
  4502. queryValues: [],
  4503. supermap_callbacks: {},
  4504. addQueryStrings: function (values) {
  4505. var me = this;
  4506. for (var key in values) {
  4507. me.queryKeys.push(key);
  4508. if (typeof values[key] !== 'string') {
  4509. values[key] = SuperMap.Util.toJSON(values[key]);
  4510. }
  4511. var tempValue = encodeURIComponent(values[key]);
  4512. me.queryValues.push(tempValue);
  4513. }
  4514. },
  4515. issue: function (config) {
  4516. var me = this,
  4517. uid = me.getUid(),
  4518. url = config.url,
  4519. splitQuestUrl = [];
  4520. var p = new Promise(function (resolve) {
  4521. me.supermap_callbacks[uid] = function (response) {
  4522. delete me.supermap_callbacks[uid];
  4523. resolve(response);
  4524. };
  4525. });
  4526. // me.addQueryStrings({
  4527. // callback: "SuperMap.Util.RequestJSONPPromise.supermap_callbacks[" + uid + "]"
  4528. // });
  4529. var sectionURL = url,
  4530. keysCount = 0; //此次sectionURL中有多少个key
  4531. var length = me.queryKeys ? me.queryKeys.length : 0;
  4532. for (var i = 0; i < length; i++) {
  4533. if (sectionURL.length + me.queryKeys[i].length + 2 >= me.limitLength) {
  4534. //+2 for ("&"or"?")and"="
  4535. if (keysCount == 0) {
  4536. return false;
  4537. }
  4538. splitQuestUrl.push(sectionURL);
  4539. sectionURL = url;
  4540. keysCount = 0;
  4541. i--;
  4542. } else {
  4543. if (sectionURL.length + me.queryKeys[i].length + 2 + me.queryValues[i].length > me.limitLength) {
  4544. var leftValue = me.queryValues[i];
  4545. while (leftValue.length > 0) {
  4546. var leftLength = me.limitLength - sectionURL.length - me.queryKeys[i].length - 2; //+2 for ("&"or"?")and"="
  4547. if (sectionURL.indexOf('?') > -1) {
  4548. sectionURL += '&';
  4549. } else {
  4550. sectionURL += '?';
  4551. }
  4552. var tempLeftValue = leftValue.substring(0, leftLength);
  4553. //避免 截断sectionURL时,将类似于%22这样的符号截成两半,从而导致服务端组装sectionURL时发生错误
  4554. if (tempLeftValue.substring(leftLength - 1, leftLength) === '%') {
  4555. leftLength -= 1;
  4556. tempLeftValue = leftValue.substring(0, leftLength);
  4557. } else if (tempLeftValue.substring(leftLength - 2, leftLength - 1) === '%') {
  4558. leftLength -= 2;
  4559. tempLeftValue = leftValue.substring(0, leftLength);
  4560. }
  4561. sectionURL += me.queryKeys[i] + '=' + tempLeftValue;
  4562. leftValue = leftValue.substring(leftLength);
  4563. if (tempLeftValue.length > 0) {
  4564. splitQuestUrl.push(sectionURL);
  4565. sectionURL = url;
  4566. keysCount = 0;
  4567. }
  4568. }
  4569. } else {
  4570. keysCount++;
  4571. if (sectionURL.indexOf('?') > -1) {
  4572. sectionURL += '&';
  4573. } else {
  4574. sectionURL += '?';
  4575. }
  4576. sectionURL += me.queryKeys[i] + '=' + me.queryValues[i];
  4577. }
  4578. }
  4579. }
  4580. splitQuestUrl.push(sectionURL);
  4581. me.send(
  4582. splitQuestUrl,
  4583. 'SuperMap.Util.RequestJSONPPromise.supermap_callbacks[' + uid + ']',
  4584. config && config.proxy
  4585. );
  4586. return p;
  4587. },
  4588. getUid: function () {
  4589. var uid = new Date().getTime(),
  4590. random = Math.floor(Math.random() * 1e17);
  4591. return uid * 1000 + random;
  4592. },
  4593. send: function (splitQuestUrl, callback, proxy) {
  4594. var len = splitQuestUrl.length;
  4595. if (len > 0) {
  4596. var jsonpUserID = new Date().getTime();
  4597. for (var i = 0; i < len; i++) {
  4598. var url = splitQuestUrl[i];
  4599. if (url.indexOf('?') > -1) {
  4600. url += '&';
  4601. } else {
  4602. url += '?';
  4603. }
  4604. url += 'sectionCount=' + len;
  4605. url += '&sectionIndex=' + i;
  4606. url += '&jsonpUserID=' + jsonpUserID;
  4607. if (proxy) {
  4608. url = decodeURIComponent(url);
  4609. url = proxy + encodeURIComponent(url);
  4610. }
  4611. fetch_jsonp_default()(url, {
  4612. jsonpCallbackFunction: callback,
  4613. timeout: 30000
  4614. });
  4615. }
  4616. }
  4617. },
  4618. GET: function (config) {
  4619. var me = this;
  4620. me.queryKeys.length = 0;
  4621. me.queryValues.length = 0;
  4622. me.addQueryStrings(config.params);
  4623. return me.issue(config);
  4624. },
  4625. POST: function (config) {
  4626. var me = this;
  4627. me.queryKeys.length = 0;
  4628. me.queryValues.length = 0;
  4629. me.addQueryStrings({
  4630. requestEntity: config.data
  4631. });
  4632. return me.issue(config);
  4633. },
  4634. PUT: function (config) {
  4635. var me = this;
  4636. me.queryKeys.length = 0;
  4637. me.queryValues.length = 0;
  4638. me.addQueryStrings({
  4639. requestEntity: config.data
  4640. });
  4641. return me.issue(config);
  4642. },
  4643. DELETE: function (config) {
  4644. var me = this;
  4645. me.queryKeys.length = 0;
  4646. me.queryValues.length = 0;
  4647. me.addQueryStrings({
  4648. requestEntity: config.data
  4649. });
  4650. return me.issue(config);
  4651. }
  4652. };
  4653. // CONCATENATED MODULE: ./src/common/security/SecurityManager.js
  4654. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  4655. * This program are made available under the terms of the Apache License, Version 2.0
  4656. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4657. /**
  4658. * @name SecurityManager
  4659. * @memberOf SuperMap
  4660. * @namespace
  4661. * @category Security
  4662. * @description 安全管理中心,提供 iServer,iPortal,Online 统一权限认证管理。
  4663. * > 使用说明:
  4664. * > 创建任何一个服务之前调用 {@link SuperMap.SecurityManager.registerToken}或
  4665. * > {@link SuperMap.SecurityManager.registerKey}注册凭据。
  4666. * > 发送请求时根据 url 或者服务 id 获取相应的 key 或者 token 并自动添加到服务地址中。
  4667. */
  4668. class SecurityManager_SecurityManager {
  4669. /**
  4670. * @description 从服务器获取一个token,在此之前要注册服务器信息。
  4671. * @function SuperMap.SecurityManager.generateToken
  4672. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4673. * @param {SuperMap.TokenServiceParameter} tokenParam - token 申请参数。
  4674. * @returns {Promise} 返回包含 token 信息的 Promise 对象。
  4675. */
  4676. static generateToken(url, tokenParam) {
  4677. var serverInfo = this.servers[url];
  4678. if (!serverInfo) {
  4679. return;
  4680. }
  4681. return FetchRequest.post(serverInfo.tokenServiceUrl, JSON.stringify(tokenParam.toJSON())).then(function (response) {
  4682. return response.text();
  4683. });
  4684. }
  4685. /**
  4686. * @description 注册安全服务器相关信息。
  4687. * @function SuperMap.SecurityManager.registerServers
  4688. * @param {SuperMap.ServerInfo} serverInfos - 服务器信息。
  4689. */
  4690. static registerServers(serverInfos) {
  4691. this.servers = this.servers || {};
  4692. if (!Util.isArray(serverInfos)) {
  4693. serverInfos = [serverInfos];
  4694. }
  4695. for (var i = 0; i < serverInfos.length; i++) {
  4696. var serverInfo = serverInfos[i];
  4697. this.servers[serverInfo.server] = serverInfo;
  4698. }
  4699. }
  4700. /**
  4701. * @description 服务请求都会自动带上这个 token。
  4702. * @function SuperMap.SecurityManager.registerToken
  4703. * @param {string} url -服务器域名+端口:如http://localhost:8090。
  4704. * @param {string} token - token
  4705. */
  4706. static registerToken(url, token) {
  4707. this.tokens = this.tokens || {};
  4708. if (!url || !token) {
  4709. return;
  4710. }
  4711. var domain = this._getTokenStorageKey(url);
  4712. this.tokens[domain] = token;
  4713. }
  4714. /**
  4715. * @description 注册 key,ids 为数组(存在一个 key 对应多个服务)。
  4716. * @function SuperMap.SecurityManager.registerKey
  4717. * @param {Array} ids - 可以是服务 id 数组或者 url 地址数组或者 webAPI 类型数组。
  4718. * @param {string} key - key
  4719. */
  4720. static registerKey(ids, key) {
  4721. this.keys = this.keys || {};
  4722. if (!ids || ids.length < 1 || !key) {
  4723. return;
  4724. }
  4725. ids = (Util.isArray(ids)) ? ids : [ids];
  4726. for (var i = 0; i < ids.length; i++) {
  4727. var id = this._getUrlRestString(ids[0]) || ids[0];
  4728. this.keys[id] = key;
  4729. }
  4730. }
  4731. /**
  4732. * @description 获取服务器信息。
  4733. * @function SuperMap.SecurityManager.getServerInfo
  4734. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4735. * @returns {SuperMap.ServerInfo} 服务器信息。
  4736. */
  4737. static getServerInfo(url) {
  4738. this.servers = this.servers || {};
  4739. return this.servers[url];
  4740. }
  4741. /**
  4742. * @description 根据 Url 获取token。
  4743. * @function SuperMap.SecurityManager.getToken
  4744. * @param {string} url - 服务器域名+端口,如:http://localhost:8092。
  4745. * @returns {string} token
  4746. */
  4747. static getToken(url) {
  4748. if (!url) {
  4749. return;
  4750. }
  4751. this.tokens = this.tokens || {};
  4752. var domain = this._getTokenStorageKey(url);
  4753. return this.tokens[domain];
  4754. }
  4755. /**
  4756. * @description 根据 Url 获取 key。
  4757. * @function SuperMap.SecurityManager.getKey
  4758. * @param {string} id - id
  4759. * @returns {string} key
  4760. */
  4761. static getKey(id) {
  4762. this.keys = this.keys || {};
  4763. var key = this._getUrlRestString(id) || id;
  4764. return this.keys[key];
  4765. }
  4766. /**
  4767. * @description iServer 登录验证。
  4768. * @function SuperMap.SecurityManager.loginiServer
  4769. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4770. * @param {string} username - 用户名。
  4771. * @param {string} password - 密码。
  4772. * @param {boolean} [rememberme=false] - 是否记住。
  4773. * @returns {Promise} 返回包含 iServer 登录请求结果的 Promise 对象。
  4774. */
  4775. static loginiServer(url, username, password, rememberme) {
  4776. url = Util.urlPathAppend(url, 'services/security/login');
  4777. var loginInfo = {
  4778. username: username && username.toString(),
  4779. password: password && password.toString(),
  4780. rememberme: rememberme
  4781. };
  4782. loginInfo = JSON.stringify(loginInfo);
  4783. var requestOptions = {
  4784. headers: {
  4785. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4786. }
  4787. };
  4788. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  4789. return response.json();
  4790. });
  4791. }
  4792. /**
  4793. * @description iServer登出。
  4794. * @function SuperMap.SecurityManager.logoutiServer
  4795. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4796. * @returns {Promise} 是否登出成功。
  4797. */
  4798. static logoutiServer(url) {
  4799. url = Util.urlPathAppend(url, 'services/security/logout');
  4800. var requestOptions = {
  4801. headers: {
  4802. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4803. },
  4804. withoutFormatSuffix: true
  4805. };
  4806. return FetchRequest.get(url, "", requestOptions).then(function () {
  4807. return true;
  4808. }).catch(function () {
  4809. return false;
  4810. });
  4811. }
  4812. /**
  4813. * @description Online 登录验证。
  4814. * @function SuperMap.SecurityManager.loginOnline
  4815. * @param {string} callbackLocation - 跳转位置。
  4816. * @param {boolean} [newTab=true] - 是否新窗口打开。
  4817. */
  4818. static loginOnline(callbackLocation, newTab) {
  4819. var loginUrl = SecurityManager_SecurityManager.SSO + "/login?service=" + callbackLocation;
  4820. this._open(loginUrl, newTab);
  4821. }
  4822. /**
  4823. * @description iPortal登录验证。
  4824. * @function SuperMap.SecurityManager.loginiPortal
  4825. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4826. * @param {string} username - 用户名。
  4827. * @param {string} password - 密码。
  4828. * @returns {Promise} 返回包含 iPortal 登录请求结果的 Promise 对象。
  4829. */
  4830. static loginiPortal(url, username, password) {
  4831. url = Util.urlPathAppend(url, 'web/login');
  4832. var loginInfo = {
  4833. username: username && username.toString(),
  4834. password: password && password.toString()
  4835. };
  4836. loginInfo = JSON.stringify(loginInfo);
  4837. var requestOptions = {
  4838. headers: {
  4839. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4840. },
  4841. withCredentials: true
  4842. };
  4843. return FetchRequest.post(url, loginInfo, requestOptions).then(function (response) {
  4844. return response.json();
  4845. });
  4846. }
  4847. /**
  4848. * @description iPortal 登出。
  4849. * @function SuperMap.SecurityManager.logoutiPortal
  4850. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4851. * @returns {Promise} 如果登出成功,返回 true;否则返回 false。
  4852. */
  4853. static logoutiPortal(url) {
  4854. url = Util.urlPathAppend(url, 'services/security/logout');
  4855. var requestOptions = {
  4856. headers: {
  4857. 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  4858. },
  4859. withCredentials: true,
  4860. withoutFormatSuffix: true
  4861. };
  4862. return FetchRequest.get(url, "", requestOptions).then(function () {
  4863. return true;
  4864. }).catch(function () {
  4865. return false;
  4866. });
  4867. }
  4868. /**
  4869. * @description iManager 登录验证。
  4870. * @function SuperMap.SecurityManager.loginManager
  4871. * @param {string} url - iManager 地址。地址参数为 iManager 首页地址,如: http://localhost:8390/imanager。
  4872. * @param {Object} [loginInfoParams] - iManager 登录参数。
  4873. * @param {string} loginInfoParams.userName - 用户名。
  4874. * @param {string} loginInfoParams.password - 密码。
  4875. * @param {Object} options
  4876. * @param {boolean} [options.isNewTab=true] - 不同域时是否在新窗口打开登录页面。
  4877. * @returns {Promise} 返回包含 iManager 登录请求结果的 Promise 对象。
  4878. */
  4879. static loginManager(url, loginInfoParams, options) {
  4880. if (!Util.isInTheSameDomain(url)) {
  4881. var isNewTab = options ? options.isNewTab : true;
  4882. this._open(url, isNewTab);
  4883. return;
  4884. }
  4885. var requestUrl = Util.urlPathAppend(url, 'icloud/security/tokens');
  4886. var params = loginInfoParams || {};
  4887. var loginInfo = {
  4888. username: params.userName && params.userName.toString(),
  4889. password: params.password && params.password.toString()
  4890. };
  4891. loginInfo = JSON.stringify(loginInfo);
  4892. var requestOptions = {
  4893. headers: {
  4894. 'Accept': '*/*',
  4895. 'Content-Type': 'application/json'
  4896. }
  4897. };
  4898. var me = this;
  4899. return FetchRequest.post(requestUrl, loginInfo, requestOptions).then(function (response) {
  4900. response.text().then(function (result) {
  4901. me.imanagerToken = result;
  4902. return result;
  4903. });
  4904. });
  4905. }
  4906. /**
  4907. * @description 清空全部验证信息。
  4908. * @function SuperMap.SecurityManager.destroyAllCredentials
  4909. */
  4910. static destroyAllCredentials() {
  4911. this.keys = null;
  4912. this.tokens = null;
  4913. this.servers = null;
  4914. }
  4915. /**
  4916. * @description 清空令牌信息。
  4917. * @function SuperMap.SecurityManager.destroyToken
  4918. * @param {string} url - iportal 首页地址,如:http://localhost:8092/iportal.
  4919. */
  4920. static destroyToken(url) {
  4921. if (!url) {
  4922. return;
  4923. }
  4924. var domain = this._getTokenStorageKey(url);
  4925. this.tokens = this.tokens || {};
  4926. if (this.tokens[domain]) {
  4927. delete this.tokens[domain];
  4928. }
  4929. }
  4930. /**
  4931. * @description 清空服务授权码。
  4932. * @function SuperMap.SecurityManager.destroyKey
  4933. * @param {string} url - iServer 首页地址,如:http://localhost:8090/iserver。
  4934. */
  4935. static destroyKey(url) {
  4936. if (!url) {
  4937. return;
  4938. }
  4939. this.keys = this.keys || {};
  4940. var key = this._getUrlRestString(url) || url;
  4941. if (this.keys[key]) {
  4942. delete this.keys[key];
  4943. }
  4944. }
  4945. static _open(url, newTab) {
  4946. newTab = (newTab != null) ? newTab : true;
  4947. var offsetX = window.screen.availWidth / 2 - this.INNER_WINDOW_WIDTH / 2;
  4948. var offsetY = window.screen.availHeight / 2 - this.INNER_WINDOW_HEIGHT / 2;
  4949. var options =
  4950. "height=" + this.INNER_WINDOW_HEIGHT + ", width=" + this.INNER_WINDOW_WIDTH +
  4951. ",top=" + offsetY + ", left=" + offsetX +
  4952. ",toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
  4953. if (newTab) {
  4954. window.open(url, 'login');
  4955. } else {
  4956. window.open(url, 'login', options);
  4957. }
  4958. }
  4959. static _getTokenStorageKey(url) {
  4960. var patten = /(.*?):\/\/([^\/]+)/i;
  4961. var result = url.match(patten);
  4962. if (!result) {
  4963. return url;
  4964. }
  4965. return result[0];
  4966. }
  4967. static _getUrlRestString(url) {
  4968. if (!url) {
  4969. return url;
  4970. }
  4971. // var patten = /http:\/\/(.*\/rest)/i;
  4972. var patten = /(http|https):\/\/(.*\/rest)/i;
  4973. var result = url.match(patten);
  4974. if (!result) {
  4975. return url;
  4976. }
  4977. return result[0];
  4978. }
  4979. }
  4980. SecurityManager_SecurityManager.INNER_WINDOW_WIDTH = 600;
  4981. SecurityManager_SecurityManager.INNER_WINDOW_HEIGHT = 600;
  4982. SecurityManager_SecurityManager.SSO = "https://sso.supermap.com";
  4983. SecurityManager_SecurityManager.ONLINE = "https://www.supermapol.com";
  4984. SuperMap.SecurityManager = SecurityManager_SecurityManager;
  4985. // CONCATENATED MODULE: ./src/common/REST.js
  4986. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  4987. * This program are made available under the terms of the Apache License, Version 2.0
  4988. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  4989. /**
  4990. * @enum DataFormat
  4991. * @memberOf SuperMap
  4992. * @description 服务请求返回结果数据类型
  4993. * @type {string}
  4994. */
  4995. var DataFormat = SuperMap.DataFormat = {
  4996. /** GEOJSON */
  4997. GEOJSON: "GEOJSON",
  4998. /** ISERVER */
  4999. ISERVER: "ISERVER"
  5000. };
  5001. /**
  5002. * @enum ServerType
  5003. * @memberOf SuperMap
  5004. * @description 服务器类型
  5005. * @type {string}
  5006. */
  5007. var ServerType = SuperMap.ServerType = {
  5008. /** ISERVER */
  5009. ISERVER: "ISERVER",
  5010. /** IPORTAL */
  5011. IPORTAL: "IPORTAL",
  5012. /** ONLINE */
  5013. ONLINE: "ONLINE"
  5014. };
  5015. /**
  5016. * @enum GeometryType
  5017. * @memberOf SuperMap
  5018. * @description 几何对象枚举,定义了一系列几何对象类型。
  5019. * @type {string}
  5020. */
  5021. var GeometryType = SuperMap.GeometryType = {
  5022. /** LINE */
  5023. LINE: "LINE",
  5024. /** LINEM */
  5025. LINEM: "LINEM",
  5026. /** POINT */
  5027. POINT: "POINT",
  5028. /** REGION */
  5029. REGION: "REGION",
  5030. /** POINTEPS */
  5031. POINTEPS: "POINTEPS",
  5032. /** LINEEPS */
  5033. LINEEPS: "LINEEPS",
  5034. /** REGIONEPS */
  5035. REGIONEPS: "REGIONEPS",
  5036. /** ELLIPSE */
  5037. ELLIPSE: "ELLIPSE",
  5038. /** CIRCLE */
  5039. CIRCLE: "CIRCLE",
  5040. /** TEXT */
  5041. TEXT: "TEXT",
  5042. /** RECTANGLE */
  5043. RECTANGLE: "RECTANGLE",
  5044. /** UNKNOWN */
  5045. UNKNOWN: "UNKNOWN",
  5046. /** GEOCOMPOUND */
  5047. GEOCOMPOUND:"GEOCOMPOUND"
  5048. };
  5049. /**
  5050. * @enum QueryOption
  5051. * @memberOf SuperMap
  5052. * @description 查询结果类型枚举,描述查询结果返回类型,包括只返回属性、只返回几何实体以及返回属性和几何实体。
  5053. * @type {string}
  5054. */
  5055. var QueryOption = SuperMap.QueryOption = {
  5056. /** 属性 */
  5057. ATTRIBUTE: "ATTRIBUTE",
  5058. /** 属性和几何对象 */
  5059. ATTRIBUTEANDGEOMETRY: "ATTRIBUTEANDGEOMETRY",
  5060. /** 几何对象 */
  5061. GEOMETRY: "GEOMETRY"
  5062. };
  5063. /**
  5064. * @enum JoinType
  5065. * @memberOf SuperMap
  5066. * @description 关联查询时的关联类型常量。
  5067. * 该类定义了两个表之间的连接类型常量,决定了对两个表之间进行连接查询时,查询结果中得到的记录的情况。
  5068. * @type {string}
  5069. */
  5070. var JoinType = SuperMap.JoinType = {
  5071. /** INNERJOIN */
  5072. INNERJOIN: "INNERJOIN",
  5073. /** LEFTJOIN */
  5074. LEFTJOIN: "LEFTJOIN"
  5075. };
  5076. /**
  5077. * @enum SpatialQueryMode
  5078. * @memberOf SuperMap
  5079. * @description 空间查询模式枚举。该类定义了空间查询操作模式常量。
  5080. * @type {string}
  5081. */
  5082. var SpatialQueryMode = SuperMap.SpatialQueryMode = {
  5083. /** 包含空间查询模式 */
  5084. CONTAIN: "CONTAIN",
  5085. /** 交叉空间查询模式 */
  5086. CROSS: "CROSS",
  5087. /** 分离空间查询模式 */
  5088. DISJOINT: "DISJOINT",
  5089. /** 重合空间查询模式 */
  5090. IDENTITY: "IDENTITY",
  5091. /** 相交空间查询模式 */
  5092. INTERSECT: "INTERSECT",
  5093. /** 无空间查询 */
  5094. NONE: "NONE",
  5095. /** 叠加空间查询模式 */
  5096. OVERLAP: "OVERLAP",
  5097. /** 邻接空间查询模式 */
  5098. TOUCH: "TOUCH",
  5099. /** 被包含空间查询模式 */
  5100. WITHIN: "WITHIN"
  5101. };
  5102. /**
  5103. * @enum SpatialRelationType
  5104. * @memberOf SuperMap
  5105. * @description 数据集对象间的空间关系枚举。
  5106. * 该类定义了数据集对象间的空间关系类型常量。
  5107. * @type {string}
  5108. */
  5109. var SpatialRelationType = SuperMap.SpatialRelationType = {
  5110. /** 包含关系 */
  5111. CONTAIN: "CONTAIN",
  5112. /** 相交关系 */
  5113. INTERSECT: "INTERSECT",
  5114. /** 被包含关系 */
  5115. WITHIN: "WITHIN"
  5116. };
  5117. /**
  5118. * @enum MeasureMode
  5119. * @memberOf SuperMap
  5120. * @type {string}
  5121. * @description 量算模式枚举。
  5122. * 该类定义了两种测量模式:距离测量和面积测量。
  5123. */
  5124. var MeasureMode = SuperMap.MeasureMode = {
  5125. /** 距离测量 */
  5126. DISTANCE: "DISTANCE",
  5127. /** 面积测量 */
  5128. AREA: "AREA"
  5129. };
  5130. /**
  5131. * @enum Unit
  5132. * @memberOf SuperMap
  5133. * @description 距离单位枚举。
  5134. * 该类定义了一系列距离单位类型。
  5135. * @type {string}
  5136. */
  5137. var Unit = SuperMap.Unit = {
  5138. /** 米 */
  5139. METER: "METER",
  5140. /** 千米 */
  5141. KILOMETER: "KILOMETER",
  5142. /** 英里 */
  5143. MILE: "MILE",
  5144. /** 码 */
  5145. YARD: "YARD",
  5146. /** 度 */
  5147. DEGREE: "DEGREE",
  5148. /** 毫米 */
  5149. MILLIMETER: "MILLIMETER",
  5150. /** 厘米 */
  5151. CENTIMETER: "CENTIMETER",
  5152. /** 英寸 */
  5153. INCH: "INCH",
  5154. /** 分米 */
  5155. DECIMETER: "DECIMETER",
  5156. /** 英尺 */
  5157. FOOT: "FOOT",
  5158. /** 秒 */
  5159. SECOND: "SECOND",
  5160. /** 分 */
  5161. MINUTE: "MINUTE",
  5162. /** 弧度 */
  5163. RADIAN: "RADIAN"
  5164. };
  5165. /**
  5166. * @enum BufferRadiusUnit
  5167. * @memberOf SuperMap
  5168. * @description 缓冲区距离单位枚举。
  5169. * 该类定义了一系列缓冲距离单位类型。
  5170. * @type {string}
  5171. */
  5172. var BufferRadiusUnit = SuperMap.BufferRadiusUnit = {
  5173. /** 厘米 */
  5174. CENTIMETER: "CENTIMETER",
  5175. /** 分米 */
  5176. DECIMETER: "DECIMETER",
  5177. /** 英尺 */
  5178. FOOT: "FOOT",
  5179. /** 英寸 */
  5180. INCH: "INCH",
  5181. /** 千米 */
  5182. KILOMETER: "KILOMETER",
  5183. /** 米 */
  5184. METER: "METER",
  5185. /** 英里 */
  5186. MILE: "MILE",
  5187. /** 毫米 */
  5188. MILLIMETER: "MILLIMETER",
  5189. /** 码 */
  5190. YARD: "YARD"
  5191. }
  5192. /**
  5193. * @enum EngineType
  5194. * @memberOf SuperMap
  5195. * @description 数据源引擎类型枚举。
  5196. * @type {string}
  5197. */
  5198. var EngineType = SuperMap.EngineType = {
  5199. /** 影像只读引擎类型,文件引擎,针对通用影像格式如 BMP,JPG,TIFF 以及超图自定义影像格式 SIT 等。 */
  5200. IMAGEPLUGINS: "IMAGEPLUGINS",
  5201. /** OGC 引擎类型,针对于 Web 数据源,Web 引擎,目前支持的类型有 WMS,WFS,WCS。 */
  5202. OGC: "OGC",
  5203. /** Oracle 引擎类型,针对 Oracle 数据源,数据库引擎。 */
  5204. ORACLEPLUS: "ORACLEPLUS",
  5205. /** SDB 引擎类型,文件引擎,即 SDB 数据源。 */
  5206. SDBPLUS: "SDBPLUS",
  5207. /** SQL Server 引擎类型,针对 SQL Server 数据源,数据库引擎 */
  5208. SQLPLUS: "SQLPLUS",
  5209. /** UDB 引擎类型,文件引擎。 */
  5210. UDB: "UDB"
  5211. };
  5212. /**
  5213. * @enum ThemeGraphTextFormat
  5214. * @memberOf SuperMap
  5215. * @description 统计专题图文本显示格式枚举。
  5216. * @type {string}
  5217. */
  5218. var ThemeGraphTextFormat = SuperMap.ThemeGraphTextFormat = {
  5219. /** 标题。以各子项的标题来进行标注。 */
  5220. CAPTION: "CAPTION",
  5221. /** 标题 + 百分数。以各子项的标题和所占的百分比来进行标注。 */
  5222. CAPTION_PERCENT: "CAPTION_PERCENT",
  5223. /** 标题 + 实际数值。以各子项的标题和真实数值来进行标注。 */
  5224. CAPTION_VALUE: "CAPTION_VALUE",
  5225. /** 百分数。以各子项所占的百分比来进行标注。 */
  5226. PERCENT: "PERCENT",
  5227. /** 实际数值。以各子项的真实数值来进行标注。 */
  5228. VALUE: "VALUE"
  5229. };
  5230. /**
  5231. * @enum ThemeGraphType
  5232. * @memberOf SuperMap
  5233. * @description 统计专题图类型枚举。
  5234. * @type {string}
  5235. */
  5236. var ThemeGraphType = SuperMap.ThemeGraphType = {
  5237. /** 面积图。 */
  5238. AREA: "AREA",
  5239. /** 柱状图。 */
  5240. BAR: "BAR",
  5241. /** 三维柱状图。 */
  5242. BAR3D: "BAR3D",
  5243. /** 折线图。 */
  5244. LINE: "LINE",
  5245. /** 饼图。 */
  5246. PIE: "PIE",
  5247. /** 三维饼图。 */
  5248. PIE3D: "PIE3D",
  5249. /** 点状图。 */
  5250. POINT: "POINT",
  5251. /** 环状图。 */
  5252. RING: "RING",
  5253. /** 玫瑰图。 */
  5254. ROSE: "ROSE",
  5255. /** 三维玫瑰图。 */
  5256. ROSE3D: "ROSE3D",
  5257. /** 堆叠柱状图。 */
  5258. STACK_BAR: "STACK_BAR",
  5259. /** 三维堆叠柱状图。 */
  5260. STACK_BAR3D: "STACK_BAR3D",
  5261. /** 阶梯图。 */
  5262. STEP: "STEP"
  5263. };
  5264. /**
  5265. * @enum GraphAxesTextDisplayMode
  5266. * @memberOf SuperMap
  5267. * @description 统计专题图坐标轴文本显示模式。
  5268. * @type {string}
  5269. */
  5270. var GraphAxesTextDisplayMode = SuperMap.GraphAxesTextDisplayMode = {
  5271. /** 显示全部文本。 */
  5272. ALL: "ALL",
  5273. /** 不显示。 */
  5274. NONE: "NONE",
  5275. /** 显示Y轴的文本。 */
  5276. YAXES: "YAXES"
  5277. };
  5278. /**
  5279. * @enum GraduatedMode
  5280. * @memberOf SuperMap
  5281. * @description 专题图分级模式枚举。
  5282. *
  5283. * @type {string}
  5284. */
  5285. var GraduatedMode = SuperMap.GraduatedMode = {
  5286. /** 常量分级模式。 */
  5287. CONSTANT: "CONSTANT",
  5288. /** 对数分级模式。 */
  5289. LOGARITHM: "LOGARITHM",
  5290. /** 平方根分级模式。 */
  5291. SQUAREROOT: "SQUAREROOT"
  5292. };
  5293. /**
  5294. * @enum RangeMode
  5295. * @memberOf SuperMap
  5296. * @description 范围分段专题图分段方式枚举。
  5297. * @type {string}
  5298. */
  5299. var RangeMode = SuperMap.RangeMode = {
  5300. /** 自定义分段法。 */
  5301. CUSTOMINTERVAL: "CUSTOMINTERVAL",
  5302. /** 等距离分段法。 */
  5303. EQUALINTERVAL: "EQUALINTERVAL",
  5304. /** 对数分段法。 */
  5305. LOGARITHM: "LOGARITHM",
  5306. /** 等计数分段法。 */
  5307. QUANTILE: "QUANTILE",
  5308. /** 平方根分段法。 */
  5309. SQUAREROOT: "SQUAREROOT",
  5310. /** 标准差分段法。 */
  5311. STDDEVIATION: "STDDEVIATION"
  5312. };
  5313. /**
  5314. * @enum ThemeType
  5315. * @memberOf SuperMap
  5316. * @description 专题图类型枚举。
  5317. * @type {string}
  5318. */
  5319. var ThemeType = SuperMap.ThemeType = {
  5320. /** 点密度专题图。 */
  5321. DOTDENSITY: "DOTDENSITY",
  5322. /** 等级符号专题图。 */
  5323. GRADUATEDSYMBOL: "GRADUATEDSYMBOL",
  5324. /** 统计专题图。 */
  5325. GRAPH: "GRAPH",
  5326. /** 标签专题图。 */
  5327. LABEL: "LABEL",
  5328. /** 分段专题图。 */
  5329. RANGE: "RANGE",
  5330. /** 単值专题图。 */
  5331. UNIQUE: "UNIQUE"
  5332. };
  5333. /**
  5334. * @enum ColorGradientType
  5335. * @memberOf SuperMap
  5336. * @description 渐变颜色枚举。
  5337. * @type {string}
  5338. */
  5339. var ColorGradientType = SuperMap.ColorGradientType = {
  5340. /** 黑白渐变色。 */
  5341. BLACK_WHITE: "BLACKWHITE",
  5342. /** 蓝黑渐变色。 */
  5343. BLUE_BLACK: "BLUEBLACK",
  5344. /** 蓝红渐变色。 */
  5345. BLUE_RED: "BLUERED",
  5346. /** 蓝白渐变色。 */
  5347. BLUE_WHITE: "BLUEWHITE",
  5348. /** 青黑渐变色。 */
  5349. CYAN_BLACK: "CYANBLACK",
  5350. /** 青蓝渐变色。 */
  5351. CYAN_BLUE: "CYANBLUE",
  5352. /** 青绿渐变色。 */
  5353. CYAN_GREEN: "CYANGREEN",
  5354. /** 青白渐变色。 */
  5355. CYAN_WHITE: "CYANWHITE",
  5356. /** 绿黑渐变色。 */
  5357. GREEN_BLACK: "GREENBLACK",
  5358. /** 绿蓝渐变色。 */
  5359. GREEN_BLUE: "GREENBLUE",
  5360. /** 绿橙紫渐变色。 */
  5361. GREEN_ORANGE_VIOLET: "GREENORANGEVIOLET",
  5362. /** 绿红渐变色。 */
  5363. GREEN_RED: "GREENRED",
  5364. /** 蓝红渐变色。 */
  5365. GREEN_WHITE: "GREENWHITE",
  5366. /** 粉黑渐变色。 */
  5367. PINK_BLACK: "PINKBLACK",
  5368. /** 粉蓝渐变色。 */
  5369. PINK_BLUE: "PINKBLUE",
  5370. /** 粉红渐变色。 */
  5371. PINK_RED: "PINKRED",
  5372. /** 粉白渐变色。 */
  5373. PINK_WHITE: "PINKWHITE",
  5374. /** 彩虹色。 */
  5375. RAIN_BOW: "RAINBOW",
  5376. /** 红黑渐变色。 */
  5377. RED_BLACK: "REDBLACK",
  5378. /** 红白渐变色。 */
  5379. RED_WHITE: "REDWHITE",
  5380. /** 光谱渐变。 */
  5381. SPECTRUM: "SPECTRUM",
  5382. /** 地形渐变,用于三维显示效果较好。 */
  5383. TERRAIN: "TERRAIN",
  5384. /** 黄黑渐变色。 */
  5385. YELLOW_BLACK: "YELLOWBLACK",
  5386. /** 黄蓝渐变色。 */
  5387. YELLOW_BLUE: "YELLOWBLUE",
  5388. /** 黄绿渐变色。 */
  5389. YELLOW_GREEN: "YELLOWGREEN",
  5390. /** 黄红渐变色。 */
  5391. YELLOW_RED: "YELLOWRED",
  5392. /** 黄白渐变色。 */
  5393. YELLOW_WHITE: "YELLOWWHITE"
  5394. };
  5395. /**
  5396. * @enum TextAlignment
  5397. * @memberOf SuperMap
  5398. * @description 文本对齐枚举。
  5399. * @type {string}
  5400. */
  5401. var TextAlignment = SuperMap.TextAlignment = {
  5402. /** 左上角对齐。 */
  5403. TOPLEFT: "TOPLEFT",
  5404. /** 顶部居中对齐。 */
  5405. TOPCENTER: "TOPCENTER",
  5406. /** 右上角对齐。 */
  5407. TOPRIGHT: "TOPRIGHT",
  5408. /** 基准线左对齐。 */
  5409. BASELINELEFT: "BASELINELEFT",
  5410. /** 基准线居中对齐。 */
  5411. BASELINECENTER: "BASELINECENTER",
  5412. /** 基准线右对齐。 */
  5413. BASELINERIGHT: "BASELINERIGHT",
  5414. /** 左下角对齐。 */
  5415. BOTTOMLEFT: "BOTTOMLEFT",
  5416. /** 底部居中对齐。 */
  5417. BOTTOMCENTER: "BOTTOMCENTER",
  5418. /** 右下角对齐。 */
  5419. BOTTOMRIGHT: "BOTTOMRIGHT",
  5420. /** 左中对齐。 */
  5421. MIDDLELEFT: "MIDDLELEFT",
  5422. /** 中心对齐。 */
  5423. MIDDLECENTER: "MIDDLECENTER",
  5424. /** 右中对齐。 */
  5425. MIDDLERIGHT: "MIDDLERIGHT"
  5426. };
  5427. /**
  5428. * @enum FillGradientMode
  5429. * @memberOf SuperMap
  5430. * @description 渐变填充风格的渐变类型枚举。
  5431. * @type {string}
  5432. */
  5433. var FillGradientMode = SuperMap.FillGradientMode = {
  5434. /** 无渐变。 */
  5435. NONE: "NONE",
  5436. /** 线性渐变填充。 */
  5437. LINEAR: "LINEAR",
  5438. /** 辐射渐变填充。 */
  5439. RADIAL: "RADIAL",
  5440. /** 圆锥渐变填充。 */
  5441. CONICAL: "CONICAL",
  5442. /** 四角渐变填充。 */
  5443. SQUARE: "SQUARE"
  5444. };
  5445. /**
  5446. * @enum AlongLineDirection
  5447. * @memberOf SuperMap
  5448. * @description 标签沿线标注方向枚举。
  5449. * @type {string}
  5450. */
  5451. var AlongLineDirection = SuperMap.AlongLineDirection = {
  5452. /** 沿线的法线方向放置标签。 */
  5453. NORMAL: "ALONG_LINE_NORMAL",
  5454. /** 从下到上,从左到右放置。 */
  5455. LB_TO_RT: "LEFT_BOTTOM_TO_RIGHT_TOP",
  5456. /** 从上到下,从左到右放置。 */
  5457. LT_TO_RB: "LEFT_TOP_TO_RIGHT_BOTTOM",
  5458. /** 从下到上,从右到左放置。 */
  5459. RB_TO_LT: "RIGHT_BOTTOM_TO_LEFT_TOP",
  5460. /** 从上到下,从右到左放置。 */
  5461. RT_TO_LB: "RIGHT_TOP_TO_LEFT_BOTTOM"
  5462. };
  5463. /**
  5464. * @enum LabelBackShape
  5465. * @memberOf SuperMap
  5466. * @description 标签专题图中标签背景的形状枚举。
  5467. * @type {string}
  5468. */
  5469. var LabelBackShape = SuperMap.LabelBackShape = {
  5470. /** 菱形背景,即标签背景的形状为菱形。 */
  5471. DIAMOND: "DIAMOND",
  5472. /** 椭圆形背景,即标签背景的行状为椭圆形。 */
  5473. ELLIPSE: "ELLIPSE",
  5474. /** 符号背景,即标签背景的形状为设定的符号。 */
  5475. MARKER: "MARKER",
  5476. /** 空背景,即不使用任何形状作为标签的背景。 */
  5477. NONE: "NONE",
  5478. /** 矩形背景,即标签背景的形状为矩形。 */
  5479. RECT: "RECT",
  5480. /** 圆角矩形背景,即标签背景的形状为圆角矩形。 */
  5481. ROUNDRECT: "ROUNDRECT",
  5482. /** 三角形背景,即标签背景的形状为三角形。 */
  5483. TRIANGLE: "TRIANGLE"
  5484. };
  5485. /**
  5486. * @enum LabelOverLengthMode
  5487. * @memberOf SuperMap
  5488. * @description 标签专题图中超长标签的处理模式枚举。
  5489. * @type {string}
  5490. */
  5491. var LabelOverLengthMode = SuperMap.LabelOverLengthMode = {
  5492. /** 换行显示。 */
  5493. NEWLINE: "NEWLINE",
  5494. /** 对超长标签不进行处理。 */
  5495. NONE: "NONE",
  5496. /** 省略超出部分。 */
  5497. OMIT: "OMIT"
  5498. };
  5499. /**
  5500. * @enum DirectionType
  5501. * @memberOf SuperMap
  5502. * @description 网络分析中方向枚举。
  5503. * 在行驶引导子项中使用。
  5504. * @type {string}
  5505. */
  5506. var DirectionType = SuperMap.DirectionType = {
  5507. /** 东。 */
  5508. EAST: "EAST",
  5509. /** 无方向。 */
  5510. NONE: "NONE",
  5511. /** 北。 */
  5512. NORTH: "NORTH",
  5513. /** 南。 */
  5514. SOURTH: "SOURTH",
  5515. /** 西。 */
  5516. WEST: "WEST"
  5517. };
  5518. /**
  5519. * @enum SideType
  5520. * @memberOf SuperMap
  5521. * @description 行驶位置枚举。
  5522. * 表示在行驶在路的左边、右边或者路上的枚举,该类用在行驶导引子项类中。
  5523. * @type {string}
  5524. */
  5525. var SideType = SuperMap.SideType = {
  5526. /** 路的左侧。 */
  5527. LEFT: "LEFT",
  5528. /** 在路上(即路的中间)。 */
  5529. MIDDLE: "MIDDLE",
  5530. /** 无效值。 */
  5531. NONE: "NONE",
  5532. /** 路的右侧。 */
  5533. RIGHT: "RIGHT"
  5534. };
  5535. /**
  5536. * @enum SupplyCenterType
  5537. * @memberOf SuperMap
  5538. * @description 资源供给中心类型枚举。
  5539. * 该枚举定义了网络分析中资源中心点的类型,主要用于资源分配和选址分区。
  5540. * 资源供给中心点的类型包括非中心,固定中心和可选中心。固定中心用于资源分配分析; 固定中心和可选中心用于选址分析;非中心在两种网络分析时都不予考虑。
  5541. * @type {string}
  5542. */
  5543. var SupplyCenterType = SuperMap.SupplyCenterType = {
  5544. /** 固定中心点。 */
  5545. FIXEDCENTER: "FIXEDCENTER",
  5546. /** 非中心点。 */
  5547. NULL: "NULL",
  5548. /** 可选中心点。 */
  5549. OPTIONALCENTER: "OPTIONALCENTER"
  5550. };
  5551. /**
  5552. * @enum TurnType
  5553. * @memberOf SuperMap
  5554. * @description 转弯方向枚举。
  5555. * 用在行驶引导子项类中,表示转弯的方向。
  5556. * @type {string}
  5557. */
  5558. var TurnType = SuperMap.TurnType = {
  5559. /** 向前直行。 */
  5560. AHEAD: "AHEAD",
  5561. /** 掉头。 */
  5562. BACK: "BACK",
  5563. /** 终点,不拐弯。 */
  5564. END: "END",
  5565. /** 左转弯。 */
  5566. LEFT: "LEFT",
  5567. /** 无效值。 */
  5568. NONE: "NONE",
  5569. /** 右转弯。 */
  5570. RIGHT: "RIGHT"
  5571. };
  5572. /**
  5573. * @enum BufferEndType
  5574. * @memberOf SuperMap
  5575. * @description 缓冲区分析BufferEnd类型。
  5576. * @type {string}
  5577. */
  5578. var BufferEndType = SuperMap.BufferEndType = {
  5579. /** FLAT */
  5580. FLAT: "FLAT",
  5581. /** ROUND */
  5582. ROUND: "ROUND"
  5583. };
  5584. /**
  5585. * @enum OverlayOperationType
  5586. * @memberOf SuperMap
  5587. * @description 叠加分析类型枚举。
  5588. * @type {string}
  5589. */
  5590. var OverlayOperationType = SuperMap.OverlayOperationType = {
  5591. /** 操作数据集(几何对象)裁剪被操作数据集(几何对象)。 */
  5592. CLIP: "CLIP",
  5593. /** 在被操作数据集(几何对象)上擦除掉与操作数据集(几何对象)相重合的部分。 */
  5594. ERASE: "ERASE",
  5595. /**对被操作数据集(几何对象)进行同一操作,即操作执行后,被操作数据集(几何对象)包含来自操作数据集(几何对象)的几何形状。 */
  5596. IDENTITY: "IDENTITY",
  5597. /** 对两个数据集(几何对象)求交,返回两个数据集(几何对象)的交集。 */
  5598. INTERSECT: "INTERSECT",
  5599. /** 对两个面数据集(几何对象)进行合并操作。 */
  5600. UNION: "UNION",
  5601. /** 对两个面数据集(几何对象)进行更新操作。 */
  5602. UPDATE: "UPDATE",
  5603. /** 对两个面数据集(几何对象)进行对称差操作。 */
  5604. XOR: "XOR"
  5605. };
  5606. /**
  5607. * @enum OutputType
  5608. * @memberOf SuperMap
  5609. * @description 分布式分析输出类型枚举。
  5610. * @type {string}
  5611. */
  5612. var OutputType = SuperMap.OutputType = {
  5613. /** INDEXEDHDFS */
  5614. INDEXEDHDFS: "INDEXEDHDFS",
  5615. /** UDB */
  5616. UDB: "UDB",
  5617. /** MONGODB */
  5618. MONGODB: "MONGODB",
  5619. /** PG */
  5620. PG: "PG"
  5621. };
  5622. /**
  5623. * @enum SmoothMethod
  5624. * @memberOf SuperMap
  5625. * @description 光滑方法枚举。
  5626. * 用于从Grid 或DEM数据生成等值线或等值面时对等值线或者等值面的边界线进行平滑处理的方法。
  5627. * @type {string}
  5628. */
  5629. var SmoothMethod = SuperMap.SmoothMethod = {
  5630. /** B 样条法。 */
  5631. BSPLINE: "BSPLINE",
  5632. /** 磨角法。 */
  5633. POLISH: "POLISH"
  5634. };
  5635. /**
  5636. * @enum SurfaceAnalystMethod
  5637. * @memberOf SuperMap
  5638. * @description 表面分析方法枚举。
  5639. * 通过对数据进行表面分析,能够挖掘原始数据所包含的信息,使某些细节明显化,易于分析。
  5640. * @type {string}
  5641. */
  5642. var SurfaceAnalystMethod = SuperMap.SurfaceAnalystMethod = {
  5643. /** 等值线提取。 */
  5644. ISOLINE: "ISOLINE",
  5645. /** 等值面提取。 */
  5646. ISOREGION: "ISOREGION"
  5647. };
  5648. /**
  5649. * @enum DataReturnMode
  5650. * @memberOf SuperMap
  5651. * @description 数据返回模式枚举。
  5652. * 该枚举用于指定空间分析返回结果模式,包含返回数据集标识和记录集、只返回数据集标识(数据集名称@数据源名称)及只返回记录集三种模式。
  5653. * @type {string}
  5654. */
  5655. var DataReturnMode = SuperMap.DataReturnMode = {
  5656. /** 返回结果数据集标识(数据集名称@数据源名称)和记录集(RecordSet)。 */
  5657. DATASET_AND_RECORDSET: "DATASET_AND_RECORDSET",
  5658. /** 只返回数据集标识(数据集名称@数据源名称)。 */
  5659. DATASET_ONLY: "DATASET_ONLY",
  5660. /** 只返回记录集(RecordSet)。 */
  5661. RECORDSET_ONLY: "RECORDSET_ONLY"
  5662. };
  5663. /**
  5664. * @enum EditType
  5665. * @memberOf SuperMap
  5666. * @description 要素集更新模式枚举。
  5667. * 该枚举用于指定数据服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  5668. * @type {string}
  5669. */
  5670. var EditType = SuperMap.EditType = {
  5671. /** 增加操作。 */
  5672. ADD: "add",
  5673. /** 修改操作。 */
  5674. UPDATE: "update",
  5675. /** 删除操作。 */
  5676. DELETE: "delete"
  5677. };
  5678. /**
  5679. * @enum TransferTactic
  5680. * @memberOf SuperMap
  5681. * @description 公交换乘策略枚举。
  5682. * 该枚举用于指定公交服务中要素集更新模式,包含添加要素集、更新要素集和删除要素集。
  5683. * @type {string}
  5684. */
  5685. var TransferTactic = SuperMap.TransferTactic = {
  5686. /** 时间短。 */
  5687. LESS_TIME: "LESS_TIME",
  5688. /** 少换乘。 */
  5689. LESS_TRANSFER: "LESS_TRANSFER",
  5690. /** 少步行。 */
  5691. LESS_WALK: "LESS_WALK",
  5692. /** 距离最短。 */
  5693. MIN_DISTANCE: "MIN_DISTANCE"
  5694. };
  5695. /**
  5696. * @enum TransferPreference
  5697. * @memberOf SuperMap
  5698. * @description 公交换乘策略枚举。
  5699. * 该枚举用于指定交通换乘服务中设置地铁优先、公交优先、不乘地铁、无偏好等偏好设置。
  5700. * @type {string}
  5701. */
  5702. var TransferPreference = SuperMap.TransferPreference = {
  5703. /** 公交汽车优先。 */
  5704. BUS: "BUS",
  5705. /** 地铁优先。 */
  5706. SUBWAY: "SUBWAY",
  5707. /** 不乘坐地铁。 */
  5708. NO_SUBWAY: "NO_SUBWAY",
  5709. /** 无乘车偏好。 */
  5710. NONE: "NONE"
  5711. };
  5712. /**
  5713. * @enum GridType
  5714. * @memberOf SuperMap
  5715. * @description 地图背景格网类型枚举。
  5716. * @type {string}
  5717. */
  5718. var GridType = SuperMap.GridType = {
  5719. /** 十字叉丝。 */
  5720. CROSS: "CROSS",
  5721. /** 网格线。 */
  5722. GRID: "GRID",
  5723. /** 点。 */
  5724. POINT: "POINT"
  5725. };
  5726. /**
  5727. * @enum ColorSpaceType
  5728. * @memberOf SuperMap
  5729. * @description 色彩空间枚举。
  5730. * 由于成色原理的不同,决定了显示器、投影仪这类靠色光直接合成颜色的颜色设备和打印机、
  5731. * 印刷机这类靠使用颜料的印刷设备在生成颜色方式上的区别。
  5732. * 针对上述不同成色方式,SuperMap 提供两种色彩空间,
  5733. * 分别为 RGB 和 CMYK。RGB 主要用于显示系统中,CMYK 主要用于印刷系统中。
  5734. * @type {string}
  5735. */
  5736. var ColorSpaceType = SuperMap.ColorSpaceType = {
  5737. /** 该类型主要在印刷系统使用。 */
  5738. CMYK: "CMYK",
  5739. /** 该类型主要在显示系统中使用。 */
  5740. RGB: "RGB"
  5741. };
  5742. /**
  5743. * @enum LayerType
  5744. * @memberOf SuperMap
  5745. * @description 图层类型。
  5746. * @type {string}
  5747. */
  5748. var LayerType = SuperMap.LayerType = {
  5749. /** SuperMap UGC 类型图层。如矢量图层、栅格(Grid)图层、影像图层。 */
  5750. UGC: "UGC",
  5751. /** WMS 图层。 */
  5752. WMS: "WMS",
  5753. /** WFS 图层。 */
  5754. WFS: "WFS",
  5755. /** 自定义图层。 */
  5756. CUSTOM: "CUSTOM"
  5757. };
  5758. /**
  5759. * @enum UGCLayerType
  5760. * @memberOf SuperMap
  5761. * @description UGC图层类型。
  5762. * @type {string}
  5763. */
  5764. var UGCLayerType = SuperMap.UGCLayerType = {
  5765. /** 专题图层。 */
  5766. THEME: "THEME",
  5767. /** 矢量图层。 */
  5768. VECTOR: "VECTOR",
  5769. /** 栅格图层。。 */
  5770. GRID: "GRID",
  5771. /** 影像图层。 */
  5772. IMAGE: "IMAGE"
  5773. };
  5774. /**
  5775. * @enum StatisticMode
  5776. * @memberOf SuperMap
  5777. * @description 字段统计方法类型。
  5778. * @type {string}
  5779. */
  5780. var StatisticMode = SuperMap.StatisticMode = {
  5781. /** 统计所选字段的平均值。 */
  5782. AVERAGE: "AVERAGE",
  5783. /** 统计所选字段的最大值。 */
  5784. MAX: "MAX",
  5785. /** 统计所选字段的最小值。 */
  5786. MIN: "MIN",
  5787. /** 统计所选字段的标准差 */
  5788. STDDEVIATION: "STDDEVIATION",
  5789. /** 统计所选字段的总和。 */
  5790. SUM: "SUM",
  5791. /** 统计所选字段的方差。 */
  5792. VARIANCE: "VARIANCE"
  5793. };
  5794. /**
  5795. * @enum PixelFormat
  5796. * @memberOf SuperMap
  5797. * @description 栅格与影像数据存储的像素格式枚举。
  5798. * @type {string}
  5799. */
  5800. var PixelFormat = SuperMap.PixelFormat = {
  5801. /** 每个像元用16个比特(即2个字节)表示。 */
  5802. BIT16: "BIT16",
  5803. /** 每个像元用32个比特(即4个字节)表示。 */
  5804. BIT32: "BIT32",
  5805. /** 每个像元用64个比特(即8个字节)表示,只提供给栅格数据集使用。 */
  5806. BIT64: "BIT64",
  5807. /** 每个像元用4个字节来表示,只提供给栅格数据集使用。 */
  5808. SINGLE: "SINGLE",
  5809. /** 每个像元用8个字节来表示,只提供给栅格数据集使用。 */
  5810. DOUBLE: "DOUBLE",
  5811. /** 每个像元用1个比特表示。 */
  5812. UBIT1: "UBIT1",
  5813. /** 每个像元用4个比特来表示。 */
  5814. UBIT4: "UBIT4",
  5815. /** 每个像元用8个比特(即1个字节)来表示。 */
  5816. UBIT8: "UBIT8",
  5817. /** 每个像元用24个比特(即3个字节)来表示。 */
  5818. UBIT24: "UBIT24",
  5819. /** 每个像元用32个比特(即4个字节)来表示。 */
  5820. UBIT32: "UBIT32"
  5821. };
  5822. /**
  5823. * @enum SearchMode
  5824. * @memberOf SuperMap
  5825. * @description 内插时使用的样本点的查找方式枚举
  5826. * @type {string}
  5827. */
  5828. var SearchMode = SuperMap.SearchMode = {
  5829. /** 使用 KDTREE 的固定点数方式查找参与内插分析的点。 */
  5830. KDTREE_FIXED_COUNT: "KDTREE_FIXED_COUNT",
  5831. /** 使用 KDTREE 的定长方式查找参与内插分析的点。 */
  5832. KDTREE_FIXED_RADIUS: "KDTREE_FIXED_RADIUS",
  5833. /** 不进行查找,使用所有的输入点进行内插分析。 */
  5834. NONE: "NONE",
  5835. /** 使用 QUADTREE 方式查找参与内插分析的点,仅对样条(RBF)插值和普通克吕金(Kriging)有用。 */
  5836. QUADTREE: "QUADTREE"
  5837. };
  5838. /**
  5839. * @enum InterpolationAlgorithmType
  5840. * @memberOf SuperMap
  5841. * @description 插值分析的算法的类型
  5842. * @type {string}
  5843. */
  5844. var InterpolationAlgorithmType = SuperMap.InterpolationAlgorithmType = {
  5845. /** 普通克吕金插值法。 */
  5846. KRIGING: "KRIGING",
  5847. /** 简单克吕金插值法。 */
  5848. SimpleKriging: "SimpleKriging",
  5849. /** 泛克吕金插值法。 */
  5850. UniversalKriging: "UniversalKriging"
  5851. };
  5852. /**
  5853. * @enum VariogramMode
  5854. * @memberOf SuperMap
  5855. * @description 克吕金(Kriging)插值时的半变函数类型枚举
  5856. * @type {string}
  5857. */
  5858. var VariogramMode = SuperMap.VariogramMode = {
  5859. /** 指数函数。 */
  5860. EXPONENTIAL: "EXPONENTIAL",
  5861. /** 高斯函数。 */
  5862. GAUSSIAN: "GAUSSIAN",
  5863. /** 球型函数。 */
  5864. SPHERICAL: "SPHERICAL"
  5865. };
  5866. /**
  5867. * @enum Exponent
  5868. * @memberOf SuperMap
  5869. * @description 定义了泛克吕金(UniversalKriging)插值时样点数据中趋势面方程的阶数
  5870. * @type {string}
  5871. */
  5872. var Exponent = SuperMap.Exponent = {
  5873. /** 阶数为1。 */
  5874. EXP1: "EXP1",
  5875. /** 阶数为2。 */
  5876. EXP2: "EXP2"
  5877. };
  5878. /**
  5879. * @enum ClientType
  5880. * @memberOf SuperMap
  5881. * @description token申请的客户端标识类型
  5882. * @type {string}
  5883. */
  5884. var ClientType = SuperMap.ClientType = {
  5885. /** 指定的 IP 地址。 */
  5886. IP: "IP",
  5887. /** 指定的 URL。 */
  5888. REFERER: "Referer",
  5889. /** 发送申请令牌请求的客户端 IP。 */
  5890. REQUESTIP: "RequestIP",
  5891. /** 不做任何验证。 */
  5892. NONE: "NONE",
  5893. /** SERVER。 */
  5894. SERVER: "SERVER",
  5895. /** WEB。 */
  5896. WEB: "WEB"
  5897. };
  5898. /**
  5899. * @enum ChartType
  5900. * @memberOf SuperMap
  5901. * @description 客户端专题图图表类型
  5902. * @type {string}
  5903. */
  5904. var ChartType = SuperMap.ChartType = {
  5905. /** 柱状图。 */
  5906. BAR: "Bar",
  5907. /** 三维柱状图。 */
  5908. BAR3D: "Bar3D",
  5909. /** 圆形图。 */
  5910. CIRCLE: "Circle",
  5911. /** 饼图。 */
  5912. PIE: "Pie",
  5913. /** 散点图。 */
  5914. POINT: "Point",
  5915. /** 折线图。 */
  5916. LINE: "Line",
  5917. /** 环状图。 */
  5918. RING: "Ring"
  5919. };
  5920. /**
  5921. * @enum ClipAnalystMode
  5922. * @memberOf SuperMap
  5923. * @description 裁剪分析模式
  5924. * @type {string}
  5925. */
  5926. var ClipAnalystMode = SuperMap.ClipAnalystMode = {
  5927. /** CLIP。 */
  5928. CLIP: "clip",
  5929. /** INTERSECT。 */
  5930. INTERSECT: "intersect"
  5931. };
  5932. /**
  5933. * @enum AnalystAreaUnit
  5934. * @memberOf SuperMap
  5935. * @description 分布式分析面积单位
  5936. * @type {string}
  5937. */
  5938. var AnalystAreaUnit = SuperMap.AnalystAreaUnit = {
  5939. /** 平方米。 */
  5940. "SQUAREMETER": "SquareMeter",
  5941. /** 平方千米。 */
  5942. "SQUAREKILOMETER": "SquareKiloMeter",
  5943. /** 公顷。 */
  5944. "HECTARE": "Hectare",
  5945. /** 公亩。 */
  5946. "ARE": "Are",
  5947. /** 英亩。 */
  5948. "ACRE": "Acre",
  5949. /** 平方英尺。 */
  5950. "SQUAREFOOT": "SquareFoot",
  5951. /** 平方码。 */
  5952. "SQUAREYARD": "SquareYard",
  5953. /** 平方英里。 */
  5954. "SQUAREMILE": "SquareMile"
  5955. };
  5956. /**
  5957. * @enum AnalystSizeUnit
  5958. * @memberOf SuperMap
  5959. * @description 分布式分析单位
  5960. * @type {string}
  5961. */
  5962. var AnalystSizeUnit = SuperMap.AnalystSizeUnit = {
  5963. /** 米。 */
  5964. "METER": "Meter",
  5965. /** 千米。 */
  5966. "KILOMETER": "Kilometer",
  5967. /** 码。 */
  5968. "YARD": "Yard",
  5969. /** 英尺。 */
  5970. "FOOT": "Foot",
  5971. /** 英里。 */
  5972. "MILE": "Mile"
  5973. };
  5974. /**
  5975. * @enum StatisticAnalystMode
  5976. * @memberOf SuperMap
  5977. * @description 分布式分析统计模式
  5978. * @type {string}
  5979. */
  5980. var StatisticAnalystMode = SuperMap.StatisticAnalystMode = {
  5981. /** 统计所选字段的最大值。 */
  5982. "MAX": "max",
  5983. /** 统计所选字段的最小值。 */
  5984. "MIN": "min",
  5985. /** 统计所选字段的平均值。 */
  5986. "AVERAGE": "average",
  5987. /** 统计所选字段的总和。 */
  5988. "SUM": "sum",
  5989. /** 统计所选字段的方差。 */
  5990. "VARIANCE": "variance",
  5991. /** 统计所选字段的标准差 */
  5992. "STDDEVIATION": "stdDeviation"
  5993. };
  5994. /**
  5995. * @enum SummaryType
  5996. * @memberOf SuperMap
  5997. * @description 分布式分析聚合类型
  5998. * @type {string}
  5999. */
  6000. var SummaryType = SuperMap.SummaryType = {
  6001. /** 格网聚合。 */
  6002. "SUMMARYMESH": "SUMMARYMESH",
  6003. /** 多边形聚合。 */
  6004. "SUMMARYREGION": "SUMMARYREGION"
  6005. };
  6006. /**
  6007. * @enum TopologyValidatorRule
  6008. * @memberOf SuperMap
  6009. * @description 拓扑检查模式枚举。该类定义了拓扑检查操作模式常量。
  6010. * @type {string}
  6011. */
  6012. var TopologyValidatorRule = SuperMap.TopologyValidatorRule = {
  6013. /** 面内无重叠,用于对面数据进行拓扑检查。 */
  6014. REGIONNOOVERLAP: "REGIONNOOVERLAP",
  6015. /** 面与面无重叠,用于对面数据进行拓扑检查。 */
  6016. REGIONNOOVERLAPWITH: "REGIONNOOVERLAPWITH",
  6017. /** 面被面包含,用于对面数据进行拓扑检查。 */
  6018. REGIONCONTAINEDBYREGION: "REGIONCONTAINEDBYREGION",
  6019. /** 面被面覆盖,用于对面数据进行拓扑检查。 */
  6020. REGIONCOVEREDBYREGION: "REGIONCOVEREDBYREGION",
  6021. /** 线与线无重叠,用于对线数据进行拓扑检查。 */
  6022. LINENOOVERLAP: "LINENOOVERLAP",
  6023. /** 线内无重叠,用于对线数据进行拓扑检查。 */
  6024. LINENOOVERLAPWITH: "LINENOOVERLAPWITH",
  6025. /** 点不相同,用于对点数据进行拓扑检查。 */
  6026. POINTNOIDENTICAL: "POINTNOIDENTICAL"
  6027. };
  6028. /**
  6029. * @enum AggregationType
  6030. * @memberOf SuperMap
  6031. * @description 聚合查询枚举类,该类定义了Es数据服务中聚合查询模式常量
  6032. * @type {string}
  6033. */
  6034. var AggregationType = SuperMap.AggregationType = {
  6035. /** 格网聚合类型。 */
  6036. GEOHASH_GRID: "geohash_grid",
  6037. /** 过滤聚合类型。 */
  6038. FILTER: "filter"
  6039. };
  6040. /**
  6041. * @enum AggregationType
  6042. * @memberOf SuperMap
  6043. * @description 聚合查询中filter查询枚举类
  6044. * @type {string}
  6045. */
  6046. var AggregationQueryBuilderType = SuperMap.AggregationQueryBuilderType = {
  6047. /** 范围查询。 */
  6048. GEO_BOUNDING_BOX: "geo_bounding_box"
  6049. }
  6050. /**
  6051. * @enum GetFeatureMode
  6052. * @memberOf SuperMap
  6053. * @description feature 查询方式。
  6054. * @type {string}
  6055. */
  6056. var GetFeatureMode = SuperMap.GetFeatureMode = {
  6057. /** 通过范围查询来获取要素。 */
  6058. BOUNDS: "BOUNDS",
  6059. /** 通过几何对象的缓冲区来获取要素。 */
  6060. BUFFER: "BUFFER",
  6061. /** 通过 ID 来获取要素。 */
  6062. ID: "ID",
  6063. /** 通过空间查询模式来获取要素。 */
  6064. SPATIAL: "SPATIAL",
  6065. /** 通过 SQL 查询来获取要素。 */
  6066. SQL: 'SQL'
  6067. }
  6068. /**
  6069. * @enum RasterFunctionType
  6070. * @memberOf SuperMap
  6071. * @description 栅格分析方法。
  6072. * @type {string}
  6073. */
  6074. var RasterFunctionType = SuperMap.RasterFunctionType = {
  6075. /** 归一化植被指数。 */
  6076. NDVI: "NDVI",
  6077. /** 阴影面分析。 */
  6078. HILLSHADE: "HILLSHADE"
  6079. }
  6080. /**
  6081. * @enum ResourceType
  6082. * @memberOf SuperMap
  6083. * @description iportal资源类型。
  6084. * @version 10.0.1
  6085. * @type {string}
  6086. */
  6087. var ResourceType = SuperMap.ResourceType = {
  6088. /** 地图。 */
  6089. MAP: "MAP",
  6090. /** 服务。 */
  6091. SERVICE: "SERVICE",
  6092. /** 场景。 */
  6093. SCENE: "SCENE",
  6094. /** 数据。 */
  6095. DATA: "DATA",
  6096. /** 洞察。 */
  6097. INSIGHTS_WORKSPACE: "INSIGHTS_WORKSPACE",
  6098. /** 大屏。 */
  6099. MAP_DASHBOARD: "MAP_DASHBOARD"
  6100. }
  6101. /**
  6102. * @enum OrderBy
  6103. * @memberOf SuperMap
  6104. * @description iportal资源排序字段。
  6105. * @version 10.0.1
  6106. * @type {string}
  6107. */
  6108. var OrderBy = SuperMap.OrderBy = {
  6109. /** 按更新时间排序 */
  6110. UPDATETIME: "UPDATETIME",
  6111. /** 按热度(可能是访问量、下载量)排序 */
  6112. HEATLEVEL: "HEATLEVEL",
  6113. /** 按相关性排序 */
  6114. RELEVANCE: "RELEVANCE"
  6115. }
  6116. /**
  6117. * @enum OrderType
  6118. * @memberOf SuperMap
  6119. * @description iportal资源升序还是降序过滤
  6120. * @version 10.0.1
  6121. * @type {string}
  6122. */
  6123. var OrderType = SuperMap.OrderType = {
  6124. /** 升序 */
  6125. ASC: "ASC",
  6126. /** 降序 */
  6127. DESC: "DESC"
  6128. }
  6129. /**
  6130. * @enum SearchType
  6131. * @memberOf SuperMap
  6132. * @description iportal资源查询的范围进行过滤
  6133. * @version 10.0.1
  6134. * @type {string}
  6135. */
  6136. var SearchType = SuperMap.SearchType = {
  6137. /** 公开资源。 */
  6138. PUBLIC: "PUBLIC",
  6139. /** 我的资源。 */
  6140. MY_RES: "MY_RES",
  6141. /** 我的群组资源。 */
  6142. MYGROUP_RES: "MYGROUP_RES",
  6143. /** 我的部门资源。 */
  6144. MYDEPARTMENT_RES: "MYDEPARTMENT_RES",
  6145. /** 分享给我的资源。 */
  6146. SHARETOME_RES: "SHARETOME_RES"
  6147. }
  6148. /**
  6149. * @enum AggregationTypes
  6150. * @memberOf SuperMap
  6151. * @description iportal资源聚合查询的类型
  6152. * @version 10.0.1
  6153. * @type {string}
  6154. */
  6155. var AggregationTypes = SuperMap.AggregationTypes = {
  6156. /** 标签 */
  6157. TAG: "TAG",
  6158. /** 资源类型 */
  6159. TYPE: "TYPE"
  6160. }
  6161. /**
  6162. * @enum PermissionType
  6163. * @memberOf SuperMap
  6164. * @description iportal资源权限类型。
  6165. * @version 10.0.1
  6166. * @type {string}
  6167. */
  6168. var PermissionType = SuperMap.PermissionType = {
  6169. /** 可检索 */
  6170. SEARCH:"SEARCH",
  6171. /** 可查看 */
  6172. READ: "READ",
  6173. /** 可编辑 */
  6174. READWRITE: "READWRITE",
  6175. /** 可删除 */
  6176. DELETE: "DELETE",
  6177. /** 可下载,包括可读、可检索 */
  6178. DOWNLOAD:"DOWNLOAD"
  6179. }
  6180. /**
  6181. * @enum EntityType
  6182. * @memberOf SuperMap
  6183. * @description iportal资源实体类型。
  6184. * @version 10.0.1
  6185. * @type {string}
  6186. */
  6187. var EntityType = SuperMap.EntityType = {
  6188. /** 部门 */
  6189. DEPARTMENT: "DEPARTMENT",
  6190. /** 用户组 */
  6191. GROUP: "GROUP",
  6192. /** 群组 */
  6193. IPORTALGROUP: "IPORTALGROUP",
  6194. /** 角色 */
  6195. ROLE: "ROLE",
  6196. /** 用户 */
  6197. USER: "USER"
  6198. }
  6199. /**
  6200. * @enum DataItemType
  6201. * @memberOf SuperMap
  6202. * @description iportal数据类型。
  6203. * @version 10.0.1
  6204. * @type {string}
  6205. */
  6206. var DataItemType = SuperMap.DataItemType = {
  6207. /** 工作空间 sxwu, smwu, sxw, smw */
  6208. WORKSPACE: "WORKSPACE",
  6209. /** udb 数据源 */
  6210. UDB: "UDB",
  6211. /** shp空间数据 */
  6212. SHP: "SHP",
  6213. /** excel数据 */
  6214. EXCEL: "EXCEL",
  6215. /** csv数据 */
  6216. CSV: "CSV",
  6217. /** geojson数据。 */
  6218. GEOJSON: "GEOJSON",
  6219. /** smtiles */
  6220. SMTILES: "SMTILES",
  6221. /** svtiles */
  6222. SVTILES: "SVTILES",
  6223. /** mbtiles */
  6224. MBTILES: "MBTILES",
  6225. /** tpk */
  6226. TPK: "TPK",
  6227. /** ugc v5 */
  6228. UGCV5: "UGCV5",
  6229. /** UGCV5_MVT */
  6230. UGCV5_MVT: "UGCV5_MVT",
  6231. /** json数据 */
  6232. JSON: "JSON"
  6233. }
  6234. /**
  6235. * @enum WebExportFormatType
  6236. * @memberOf SuperMap
  6237. * @description Web 打印输出的格式。
  6238. * @version 10.0.1
  6239. * @type {string}
  6240. */
  6241. var WebExportFormatType = SuperMap.WebExportFormatType = {
  6242. /** png */
  6243. PNG: "PNG",
  6244. /** pdf */
  6245. PDF: "PDF"
  6246. }
  6247. /**
  6248. * @enum WebScaleOrientationType
  6249. * @memberOf SuperMap
  6250. * @description Web 比例尺的方位样式。
  6251. * @version 10.0.1
  6252. * @type {string}
  6253. */
  6254. var WebScaleOrientationType = SuperMap.WebScaleOrientationType = {
  6255. /** horizontal labels below */
  6256. HORIZONTALLABELSBELOW: "HORIZONTALLABELSBELOW",
  6257. /** horizontal labels above */
  6258. HORIZONTALLABELSABOVE: "HORIZONTALLABELSABOVE",
  6259. /** vertical labels left */
  6260. VERTICALLABELSLEFT: "VERTICALLABELSLEFT",
  6261. /** vertical labels right */
  6262. VERTICALLABELSRIGHT: "VERTICALLABELSRIGHT"
  6263. }
  6264. /**
  6265. * @enum WebScaleType
  6266. * @memberOf SuperMap
  6267. * @description Web 比例尺的样式。
  6268. * @version 10.0.1
  6269. * @type {string}
  6270. */
  6271. var WebScaleType = SuperMap.WebScaleType = {
  6272. /** line */
  6273. LINE: "LINE",
  6274. /** bar */
  6275. BAR: "BAR",
  6276. /** bar sub */
  6277. BAR_SUB: "BAR_SUB"
  6278. }
  6279. /**
  6280. * @enum WebScaleUnit
  6281. * @memberOf SuperMap
  6282. * @description Web 比例尺的单位制。
  6283. * @version 10.0.1
  6284. * @type {string}
  6285. */
  6286. var WebScaleUnit = SuperMap.WebScaleUnit = {
  6287. /** meter */
  6288. METER: "METER",
  6289. /** foot */
  6290. FOOT: "FOOT",
  6291. /** degrees */
  6292. DEGREES: "DEGREES"
  6293. }
  6294. // CONCATENATED MODULE: ./src/common/iServer/DatasourceConnectionInfo.js
  6295. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6296. * This program are made available under the terms of the Apache License, Version 2.0
  6297. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6298. // eslint-disable-line no-unused-vars
  6299. /**
  6300. * @class SuperMap.DatasourceConnectionInfo
  6301. * @category iServer Data
  6302. * @classdesc 数据源连接信息类。该类包括了进行数据源连接的所有信息,如所要连接的服务器名称、数据库名称、用户名以及密码等。
  6303. * 当保存为工作空间时, 工作空间中的数据源的连接信息都将存储到工作空间文件中。对于不同类型的数据源,其连接信息有所区别。
  6304. * 所以在使 用该类所包含的成员时,请注意该成员所适用的数据源类型。对于从数据源对象中返回的数据连接信息对象,只有 connect 方法可以被修改,
  6305. * 其他内容是不可以被修改的。对于用户创建的数据源连接信息对象,其内容都可以修改。
  6306. * @category iServer Data
  6307. * @param {Object} options - 参数。
  6308. * @param {string} options.alias - 数据源别名。
  6309. * @param {string} options.dataBase - 数据源连接的数据库名。
  6310. * @param {boolean} [options.connect] - 数据源是否自动连接数据。
  6311. * @param {string} [options.driver] - 使用 ODBC(Open Database Connectivity,开放数据库互连)的数据库的驱动程序名。
  6312. * @param {SuperMap.EngineType} [options.engineType] - 数据源连接的引擎类型。
  6313. * @param {boolean} [options.exclusive] - 是否以独占方式打开数据源。
  6314. * @param {boolean} [options.OpenLinkTable] - 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  6315. * @param {string} [options.password] - 登录数据源连接的数据库或文件的密码。
  6316. * @param {boolean} [options.readOnly] - 是否以只读方式打开数据源。
  6317. * @param {string} [options.server] - 数据库服务器名或 SDB 文件名。
  6318. * @param {string} [options.user] - 登录数据库的用户名。
  6319. */
  6320. class DatasourceConnectionInfo_DatasourceConnectionInfo {
  6321. constructor(options) {
  6322. /**
  6323. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.alias
  6324. * @description 数据源别名。
  6325. */
  6326. this.alias = null;
  6327. /**
  6328. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.connect]
  6329. * @description 数据源是否自动连接数据。
  6330. */
  6331. this.connect = null;
  6332. /**
  6333. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.dataBase
  6334. * @description 数据源连接的数据库名。
  6335. */
  6336. this.dataBase = null;
  6337. /**
  6338. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.driver]
  6339. * @description 使用 ODBC(Open Database Connectivity,开放数据库互连) 的数据库的驱动程序名。
  6340. * 其中,对于 SQL Server 数据库与 iServer 发布的 WMTS 服务,此为必设参数。
  6341. * 对于 SQL Server 数据库,它使用 ODBC 连接,所设置的驱动程序名为 "SQL Server" 或 "SQL Native Client";
  6342. * 对于 iServer 发布的 WMTS 服务,设置的驱动名称为 "WMTS"。
  6343. */
  6344. this.driver = null;
  6345. /**
  6346. * @member {SuperMap.EngineType} [SuperMap.DatasourceConnectionInfo.prototype.engineType]
  6347. * @description 数据源连接的引擎类型。
  6348. */
  6349. this.engineType = null;
  6350. /**
  6351. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.exclusive]
  6352. * @description 是否以独占方式打开数据源。
  6353. */
  6354. this.exclusive = null;
  6355. /**
  6356. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.OpenLinkTable]
  6357. * @description 是否把数据库中的其他非 SuperMap 数据表作为 LinkTable 打开。
  6358. */
  6359. this.OpenLinkTable = null;
  6360. /**
  6361. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.password]
  6362. * @description 登录数据源连接的数据库或文件的密码。
  6363. */
  6364. this.password = null;
  6365. /**
  6366. * @member {boolean} [SuperMap.DatasourceConnectionInfo.prototype.readOnly]
  6367. * @description 是否以只读方式打开数据源。
  6368. */
  6369. this.readOnly = null;
  6370. /**
  6371. * @member {string} [SuperMap.DatasourceConnectionInfo.prototype.server]
  6372. * @description 数据库服务器名、文件名或服务地址。
  6373. * 1.对于 SDB 和 UDB 文件,为其文件的绝对路径。注意:当绝对路径的长度超过 UTF-8 编码格式的 260 字节长度,该数据源无法打开。
  6374. * 2.对于 Oracle 数据库,其服务器名为其 TNS 服务名称。
  6375. * 3.对于 SQL Server 数据库,其服务器名为其系统的 DSN(Database Source Name) 名称。
  6376. * 4.对于 PostgreSQL 数据库,其服务器名为 “IP:端口号”,默认的端口号是 5432。
  6377. * 5.对于 DB2 数据库,已经进行了编目,所以不需要进行服务器的设置。
  6378. * 6.对于 Kingbase 数据库,其服务器名为其 IP 地址。
  6379. * 7.对于 GoogleMaps 数据源,其服务器地址,默认设置为 “{@link http://maps.google.com}”,且不可更改。
  6380. * 8.对于 SuperMapCould 数据源,为其服务地址。
  6381. * 9.对于 MAPWORLD 数据源,为其服务地址,默认设置为 “{@link http://www.tianditu.cn}”,且不可更改。
  6382. * 10.对于 OGC 和 REST 数据源,为其服务地址。
  6383. */
  6384. this.server = null;
  6385. /**
  6386. * @member {string} SuperMap.DatasourceConnectionInfo.prototype.user
  6387. * @description 登录数据库的用户名。
  6388. */
  6389. this.user = null;
  6390. if (options) {
  6391. Util.extend(this, options);
  6392. }
  6393. this.CLASS_NAME = "SuperMap.DatasourceConnectionInfo";
  6394. }
  6395. /**
  6396. * @function SuperMap.DatasourceConnectionInfo.prototype.destroy
  6397. * @description 释放资源,将引用资源的属性置空。
  6398. */
  6399. destroy() {
  6400. var me = this;
  6401. me.alias = null;
  6402. me.connect = null;
  6403. me.dataBase = null;
  6404. me.driver = null;
  6405. me.engineType = null;
  6406. me.exclusive = null;
  6407. me.OpenLinkTable = null;
  6408. me.password = null;
  6409. me.readOnly = null;
  6410. me.server = null;
  6411. me.user = null;
  6412. }
  6413. }
  6414. SuperMap.DatasourceConnectionInfo = DatasourceConnectionInfo_DatasourceConnectionInfo;
  6415. // CONCATENATED MODULE: ./src/common/iServer/OutputSetting.js
  6416. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6417. * This program are made available under the terms of the Apache License, Version 2.0
  6418. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6419. /**
  6420. * @class SuperMap.OutputSetting
  6421. * @category iServer ProcessingService
  6422. * @classdesc 分布式分析输出类型设置类。
  6423. * @param {Object} options - 参数。
  6424. * @param {SuperMap.DatasourceConnectionInfo} options.datasourceInfo - 数据源连接信息。
  6425. * @param {string} [options.datasetName='analystResult'] - 结果数据集名称。
  6426. * @param {SuperMap.OutputType} [options.type=SuperMap.OutputType.UDB] - 输出类型。
  6427. * @param {string} [options.outputPath] - 分析结果输出路径。
  6428. */
  6429. class OutputSetting_OutputSetting {
  6430. constructor(options) {
  6431. /**
  6432. * @member {SuperMap.OutputType} SuperMap.OutputSetting.prototype.type
  6433. * @description 分布式分析的输出类型。
  6434. */
  6435. this.type = OutputType.UDB;
  6436. /**
  6437. * @member {string} [SuperMap.OutputSetting.prototype.datasetName='analystResult']
  6438. * @description 分布式分析的输出结果数据集名称。
  6439. */
  6440. this.datasetName = "analystResult";
  6441. /**
  6442. * @member {SuperMap.DatasourceConnectionInfo} SuperMap.OutputSetting.prototype.datasourceInfo
  6443. * @description 分布式分析的输出结果数据源连接信息。
  6444. */
  6445. this.datasourceInfo = null;
  6446. /**
  6447. * @member {string} [SuperMap.OutputSetting.prototype.outputPath]
  6448. * @description 分布式分析的分析结果输出路径。
  6449. */
  6450. this.outputPath = "";
  6451. Util.extend(this, options);
  6452. this.CLASS_NAME = "SuperMap.OutputSetting";
  6453. }
  6454. /**
  6455. * @function SuperMap.OutputSetting.prototype.destroy
  6456. * @description 释放资源,将引用资源的属性置空。
  6457. */
  6458. destroy() {
  6459. var me = this;
  6460. me.type = null;
  6461. me.datasetName = null;
  6462. me.outputPath = null;
  6463. if (me.datasourceInfo instanceof DatasourceConnectionInfo_DatasourceConnectionInfo) {
  6464. me.datasourceInfo.destroy();
  6465. me.datasourceInfo = null;
  6466. }
  6467. }
  6468. }
  6469. SuperMap.OutputSetting = OutputSetting_OutputSetting;
  6470. // CONCATENATED MODULE: ./src/common/iServer/MappingParameters.js
  6471. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6472. * This program are made available under the terms of the Apache License, Version 2.0
  6473. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6474. /**
  6475. * @class SuperMap.MappingParameters
  6476. * @category iServer ProcessingService
  6477. * @classdesc 分析后结果可视化的参数类。
  6478. * @param {Object} options - 参数。
  6479. * @param {Array.<SuperMap.ThemeGridRangeItem>} [options.items] - 栅格分段专题图子项数组。
  6480. * @param {number} [options.numericPrecision=1] - 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  6481. * @param {SuperMap.RangeMode} [options.rangeMode=SuperMap.RangeMode.EQUALINTERVAL] - 专题图分段模式。
  6482. * @param {number} [options.rangeCount] - 专题图分段个数。
  6483. * @param {SuperMap.ColorGradientType} [options.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED] - 专题图颜色渐变模式。
  6484. */
  6485. class MappingParameters_MappingParameters {
  6486. constructor(options) {
  6487. /**
  6488. * @member {Array.<SuperMap.ThemeGridRangeItem>} [SuperMap.MappingParameters.prototype.items]
  6489. * @description 栅格分段专题图子项数组。
  6490. */
  6491. this.items = null;
  6492. /**
  6493. * @member {number} [SuperMap.MappingParameters.prototype.numericPrecision=1]
  6494. * @description 精度,此字段用于设置分析结果标签专题图中标签数值的精度,如“1”表示精确到小数点的后一位。
  6495. */
  6496. this.numericPrecision = 1;
  6497. /**
  6498. * @member {SuperMap.RangeMode} [SuperMap.MappingParameters.prototype.RangeMode=SuperMap.RangeMode.EQUALINTERVAL]
  6499. * @description 专题图分段模式。
  6500. */
  6501. this.rangeMode = RangeMode.EQUALINTERVAL;
  6502. /**
  6503. * @member {number} [SuperMap.MappingParameters.prototype.rangeCount]
  6504. * @description 专题图分段个数。
  6505. */
  6506. this.rangeCount = "";
  6507. /**
  6508. * @member {SuperMap.ColorGradientType} [SuperMap.MappingParameters.prototype.colorGradientType=SuperMap.ColorGradientType.YELLOW_RED]
  6509. * @description 专题图颜色渐变模式。
  6510. */
  6511. this.colorGradientType = ColorGradientType.YELLOW_RED;
  6512. Util.extend(this, options);
  6513. this.CLASS_NAME = "SuperMap.MappingParameters";
  6514. }
  6515. /**
  6516. * @function SuperMap.MappingParameters.prototype.destroy
  6517. * @description 释放资源,将引用资源的属性置空。
  6518. */
  6519. destroy() {
  6520. var me = this;
  6521. if (me.items) {
  6522. if (me.items.length > 0) {
  6523. for (var item in me.items) {
  6524. me.items[item].destroy();
  6525. me.items[item] = null;
  6526. }
  6527. }
  6528. me.items = null;
  6529. }
  6530. me.numericPrecision = null;
  6531. me.rangeMode = null;
  6532. me.rangeCount = null;
  6533. me.colorGradientType = null;
  6534. }
  6535. }
  6536. SuperMap.MappingParameters = MappingParameters_MappingParameters;
  6537. // CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobParameter.js
  6538. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6539. * This program are made available under the terms of the Apache License, Version 2.0
  6540. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6541. /**
  6542. * @class SuperMap.KernelDensityJobParameter
  6543. * @category iServer ProcessingService DensityAnalyst
  6544. * @classdesc 密度分析任务参数类。
  6545. * @param {Object} options - 参数。
  6546. * @param {string} options.datasetName - 数据集名。
  6547. * @param {string} options.fields - 权重索引。
  6548. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  6549. * @param {number} [options.resolution=80] - 分辨率。
  6550. * @param {number} [options.method=0] - 分析方法。
  6551. * @param {number} [options.meshType=0] - 分析类型。
  6552. * @param {number} [options.radius=300] - 分析的影响半径。
  6553. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6554. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6555. */
  6556. class KernelDensityJobParameter_KernelDensityJobParameter {
  6557. constructor(options) {
  6558. if (!options) {
  6559. return;
  6560. }
  6561. /**
  6562. * @member {string} SuperMap.KernelDensityJobParameter.prototype.datasetName
  6563. * @description 数据集名。
  6564. */
  6565. this.datasetName = "";
  6566. /**
  6567. * @member {SuperMap.Bounds|L.Bounds|ol.extent} [SuperMap.KernelDensityJobParameter.prototype.query]
  6568. * @description 分析范围。
  6569. */
  6570. this.query = "";
  6571. /**
  6572. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.resolution=80]
  6573. * @description 网格大小。
  6574. */
  6575. this.resolution = 80;
  6576. /**
  6577. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.method=0]
  6578. * @description 分析方法。
  6579. */
  6580. this.method = 0;
  6581. /**
  6582. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.meshType=0]
  6583. * @description 分析类型。
  6584. */
  6585. this.meshType = 0;
  6586. /**
  6587. * @member {string} SuperMap.KernelDensityJobParameter.prototype.fields
  6588. * @description 权重索引。
  6589. */
  6590. this.fields = "";
  6591. /**
  6592. * @member {number} [SuperMap.KernelDensityJobParameter.prototype.radius=300]
  6593. * @description 分析的影响半径。
  6594. */
  6595. this.radius = 300;
  6596. /**
  6597. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  6598. * @description 网格大小单位。
  6599. */
  6600. this.meshSizeUnit = AnalystSizeUnit.METER;
  6601. /**
  6602. * @member {SuperMap.AnalystSizeUnit} [SuperMap.KernelDensityJobParameter.prototype.radiusUnit=SuperMap.AnalystSizeUnit.METER]
  6603. * @description 搜索半径单位。
  6604. */
  6605. this.radiusUnit = AnalystSizeUnit.METER;
  6606. /**
  6607. * @member {SuperMap.AnalystAreaUnit} [SuperMap.KernelDensityJobParameter.prototype.areaUnit=SuperMap.AnalystAreaUnit.SQUAREMILE]
  6608. * @description 面积单位。
  6609. */
  6610. this.areaUnit = AnalystAreaUnit.SQUAREMILE;
  6611. /**
  6612. * @member {SuperMap.OutputSetting} SuperMap.KernelDensityJobParameter.prototype.output
  6613. * @description 输出参数设置类
  6614. */
  6615. this.output = null;
  6616. /**
  6617. * @member {SuperMap.MappingParameters} [SuperMap.KernelDensityJobParameter.prototype.mappingParameters]
  6618. * @description 分析后结果可视化的参数类。
  6619. */
  6620. this.mappingParameters = null;
  6621. Util.extend(this, options);
  6622. this.CLASS_NAME = "SuperMap.KernelDensityJobParameter";
  6623. }
  6624. /**
  6625. * @function SuperMap.KernelDensityJobParameter.prototype.destroy
  6626. * @description 释放资源,将引用资源的属性置空。
  6627. */
  6628. destroy() {
  6629. this.datasetName = null;
  6630. this.query = null;
  6631. this.resolution = null;
  6632. this.method = null;
  6633. this.radius = null;
  6634. this.meshType = null;
  6635. this.fields = null;
  6636. this.meshSizeUnit = null;
  6637. this.radiusUnit = null;
  6638. this.areaUnit = null;
  6639. if (this.output instanceof OutputSetting_OutputSetting) {
  6640. this.output.destroy();
  6641. this.output = null;
  6642. }
  6643. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  6644. this.mappingParameters.destroy();
  6645. this.mappingParameters = null;
  6646. }
  6647. }
  6648. /**
  6649. * @function SuperMap.KernelDensityJobParameter.toObject
  6650. * @param {SuperMap.KernelDensityJobParameter} kernelDensityJobParameter - 密度分析任务参数类。
  6651. * @param {SuperMap.KernelDensityJobParameter} tempObj - 密度分析任务参数对象。
  6652. * @description 将密度分析任务参数对象转换为 JSON 对象。
  6653. * @returns JSON 对象。
  6654. */
  6655. static toObject(kernelDensityJobParameter, tempObj) {
  6656. for (var name in kernelDensityJobParameter) {
  6657. if (name === "datasetName") {
  6658. tempObj['input'] = tempObj['input'] || {};
  6659. tempObj['input'][name] = kernelDensityJobParameter[name];
  6660. continue;
  6661. }
  6662. if (name === "output") {
  6663. tempObj['output'] = tempObj['output'] || {};
  6664. tempObj['output'] = kernelDensityJobParameter[name];
  6665. continue;
  6666. }
  6667. tempObj['analyst'] = tempObj['analyst'] || {};
  6668. if (name === 'query' && kernelDensityJobParameter[name]) {
  6669. tempObj['analyst'][name] = kernelDensityJobParameter[name].toBBOX();
  6670. } else {
  6671. tempObj['analyst'][name] = kernelDensityJobParameter[name];
  6672. }
  6673. if (name === 'mappingParameters') {
  6674. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6675. tempObj['analyst']['mappingParameters'] = kernelDensityJobParameter[name];
  6676. }
  6677. }
  6678. }
  6679. }
  6680. SuperMap.KernelDensityJobParameter = KernelDensityJobParameter_KernelDensityJobParameter;
  6681. // CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsParameter.js
  6682. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6683. * This program are made available under the terms of the Apache License, Version 2.0
  6684. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6685. /**
  6686. * @class SuperMap.SingleObjectQueryJobsParameter
  6687. * @category iServer ProcessingService Query
  6688. * @classdesc 单对象空间查询分析任务参数类。
  6689. * @param {Object} options - 参数。
  6690. * @param {string} options.datasetName - 数据集名。
  6691. * @param {string} options.datasetQuery - 查询对象所在的数据集名称。
  6692. * @param {SuperMap.SpatialQueryMode} [options.mode=SuperMap.SpatialQueryMode.CONTAIN] - 空间查询模式。
  6693. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6694. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6695. */
  6696. class SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter {
  6697. constructor(options) {
  6698. if (!options) {
  6699. return;
  6700. }
  6701. /**
  6702. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetName
  6703. * @description 数据集名。
  6704. */
  6705. this.datasetName = "";
  6706. /**
  6707. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.datasetQuery
  6708. * @description 查询对象所在的数据集名称。
  6709. */
  6710. this.datasetQuery = "";
  6711. /**
  6712. * @member {string} SuperMap.SingleObjectQueryJobsParameter.prototype.geometryQuery
  6713. * @description 查询对象所在的几何对象。
  6714. */
  6715. this.geometryQuery = "";
  6716. /**
  6717. * @member {SuperMap.SpatialQueryMode} [SuperMap.SingleObjectQueryJobsParameter.prototype.mode=SuperMap.SpatialQueryMode.CONTAIN]
  6718. * @description 空间查询模式 。
  6719. */
  6720. this.mode = SpatialQueryMode.CONTAIN;
  6721. /**
  6722. * @member {SuperMap.OutputSetting} [SuperMap.SingleObjectQueryJobsParameter.prototype.output]
  6723. * @description 输出参数设置类。
  6724. */
  6725. this.output = null;
  6726. /**
  6727. * @member {SuperMap.MappingParameters} [SuperMap.SingleObjectQueryJobsParameter.prototype.mappingParameters]
  6728. * @description 分析后结果可视化的参数类。
  6729. */
  6730. this.mappingParameters = null;
  6731. Util.extend(this, options);
  6732. this.CLASS_NAME = "SuperMap.SingleObjectQueryJobsParameter";
  6733. }
  6734. /**
  6735. * @function SuperMap.SingleObjectQueryJobsParameter.prototype.destroy
  6736. * @description 释放资源,将引用资源的属性置空。
  6737. */
  6738. destroy() {
  6739. this.datasetName = null;
  6740. this.datasetQuery = null;
  6741. this.geometryQuery = null;
  6742. this.mode = null;
  6743. if (this.output instanceof OutputSetting_OutputSetting) {
  6744. this.output.destroy();
  6745. this.output = null;
  6746. }
  6747. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  6748. this.mappingParameters.destroy();
  6749. this.mappingParameters = null;
  6750. }
  6751. }
  6752. /**
  6753. * @function SuperMap.SingleObjectQueryJobsParameter.toObject
  6754. * @param {Object} singleObjectQueryJobsParameter - 单对象空间查询分析任务参数。
  6755. * @param {Object} tempObj - 目标对象。
  6756. * @description 生成单对象空间查询分析任务对象。
  6757. */
  6758. static toObject(singleObjectQueryJobsParameter, tempObj) {
  6759. for (var name in singleObjectQueryJobsParameter) {
  6760. if (name === "datasetName") {
  6761. tempObj['input'] = tempObj['input'] || {};
  6762. tempObj['input'][name] = singleObjectQueryJobsParameter[name];
  6763. continue;
  6764. }
  6765. if (name === "output"){
  6766. tempObj['output'] = tempObj['output'] || {};
  6767. tempObj['output'] = singleObjectQueryJobsParameter[name];
  6768. continue;
  6769. }
  6770. tempObj['analyst'] = tempObj['analyst'] || {};
  6771. tempObj['analyst'][name] = singleObjectQueryJobsParameter[name];
  6772. if(name === 'mappingParameters'){
  6773. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6774. tempObj['analyst']['mappingParameters'] = singleObjectQueryJobsParameter[name];
  6775. }
  6776. }
  6777. }
  6778. }
  6779. SuperMap.SingleObjectQueryJobsParameter = SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter;
  6780. // CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsParameter.js
  6781. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6782. * This program are made available under the terms of the Apache License, Version 2.0
  6783. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6784. /**
  6785. * @class SuperMap.SummaryAttributesJobsParameter
  6786. * @category iServer ProcessingService SummaryAttributes
  6787. * @classdesc 属性汇总分析任务参数类
  6788. * @param {Object} options - 参数。
  6789. * @param {string} options.datasetName - 数据集名。
  6790. * @param {string} options.groupField - 分组字段。
  6791. * @param {string} options.attributeField - 属性字段。
  6792. * @param {string} options.statisticModes - 统计模式。
  6793. * @param {SuperMap.OutputSetting} [options.output] -输出参数设置。
  6794. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6795. */
  6796. class SummaryAttributesJobsParameter_SummaryAttributesJobsParameter {
  6797. constructor(options) {
  6798. if (!options) {
  6799. return;
  6800. }
  6801. /**
  6802. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.datasetName
  6803. * @description 汇总数据集名称。
  6804. */
  6805. this.datasetName = "";
  6806. /**
  6807. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.groupField
  6808. * @description 分组字段。
  6809. */
  6810. this.groupField = "";
  6811. /**
  6812. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.attributeField
  6813. * @description 属性字段。
  6814. */
  6815. this.attributeField = "";
  6816. /**
  6817. * @member {string} SuperMap.SummaryAttributesJobsParameter.prototype.statisticModes
  6818. * @description 属性汇总统计模式。
  6819. */
  6820. this.statisticModes = "";
  6821. /**
  6822. * @member {SuperMap.OutputSetting} SuperMap.SummaryAttributesJobsParameter.prototype.output
  6823. * @description 输出参数设置类。
  6824. */
  6825. this.output = null;
  6826. /**
  6827. * @member {SuperMap.MappingParameters} [SuperMap.SummaryAttributesJobsParameter.prototype.mappingParameters]
  6828. * @description 分析后结果可视化的参数类。
  6829. */
  6830. this.mappingParameters = null;
  6831. Util.extend(this, options);
  6832. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsParameter";
  6833. }
  6834. /**
  6835. * @function SuperMap.SummaryAttributesJobsParameter.destroy
  6836. * @override
  6837. */
  6838. destroy() {
  6839. this.datasetName = null;
  6840. this.groupField = null;
  6841. this.attributeField = null;
  6842. this.statisticModes = null;
  6843. if (this.output instanceof OutputSetting_OutputSetting) {
  6844. this.output.destroy();
  6845. this.output = null;
  6846. }
  6847. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  6848. this.mappingParameters.destroy();
  6849. this.mappingParameters = null;
  6850. }
  6851. }
  6852. /**
  6853. * @function SuperMap.SummaryAttributesJobsParameter.toObject
  6854. * @param {Object} SummaryAttributesJobsParameter - 属性汇总任务参数。
  6855. * @param {Object} tempObj - 目标对象。
  6856. * @description 生成属性汇总分析任务对象。
  6857. */
  6858. static toObject(SummaryAttributesJobsParameter, tempObj) {
  6859. for (var name in SummaryAttributesJobsParameter) {
  6860. if (name === "datasetName") {
  6861. tempObj['input'] = tempObj['input'] || {};
  6862. tempObj['input'][name] = SummaryAttributesJobsParameter[name];
  6863. continue;
  6864. }
  6865. if (name === "output") {
  6866. tempObj['output'] = tempObj['output'] || {};
  6867. tempObj['output'] = SummaryAttributesJobsParameter[name];
  6868. continue;
  6869. }
  6870. tempObj['analyst'] = tempObj['analyst'] || {};
  6871. tempObj['analyst'][name] = SummaryAttributesJobsParameter[name];
  6872. if(name === 'mappingParameters'){
  6873. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  6874. tempObj['analyst']['mappingParameters'] = SummaryAttributesJobsParameter[name];
  6875. }
  6876. }
  6877. }
  6878. }
  6879. SuperMap.SummaryAttributesJobsParameter = SummaryAttributesJobsParameter_SummaryAttributesJobsParameter;
  6880. // CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobParameter.js
  6881. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  6882. * This program are made available under the terms of the Apache License, Version 2.0
  6883. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  6884. /**
  6885. * @class SuperMap.SummaryMeshJobParameter
  6886. * @category iServer ProcessingService AggregatePoints
  6887. * @classdesc 点聚合分析任务参数类。
  6888. * @param {Object} options - 参数。
  6889. * @param {string} options.datasetName - 数据集名。
  6890. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  6891. * @param {number} options.fields - 权重索引。
  6892. * @param {number} [options.resolution=100] - 分辨率。
  6893. * @param {SuperMap.StatisticAnalystMode} [options.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE] - 分析模式。
  6894. * @param {number} [options.meshType=0] - 分析类型。
  6895. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 聚合类型。
  6896. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  6897. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  6898. */
  6899. class SummaryMeshJobParameter_SummaryMeshJobParameter {
  6900. constructor(options) {
  6901. if (!options) {
  6902. return;
  6903. }
  6904. /**
  6905. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.datasetName
  6906. * @description 数据集名。
  6907. */
  6908. this.datasetName = "";
  6909. /**
  6910. * @member {string} SuperMap.SummaryMeshJobParameter.prototype.regionDataset
  6911. * @description 聚合面数据集(聚合类型为多边形聚合时使用的参数)。
  6912. */
  6913. this.regionDataset = "";
  6914. /**
  6915. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryMeshJobParameter.prototype.query
  6916. * @description 分析范围(聚合类型为网格面聚合时使用的参数)。
  6917. */
  6918. this.query = "";
  6919. /**
  6920. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.resolution=100]
  6921. * @description 分辨率(聚合类型为网格面聚合时使用的参数)。
  6922. */
  6923. this.resolution = 100;
  6924. /**
  6925. * @member {number} [SuperMap.SummaryMeshJobParameter.prototype.meshType=0]
  6926. * @description 网格面类型(聚合类型为网格面聚合时使用的参数),取值:0 或 1。
  6927. */
  6928. this.meshType = 0;
  6929. /**
  6930. * @member {SuperMap.StatisticAnalystMode} [SuperMap.SummaryMeshJobParameter.prototype.statisticModes=SuperMap.StatisticAnalystMode.AVERAGE]
  6931. * @description 统计模式。
  6932. */
  6933. this.statisticModes = StatisticAnalystMode.AVERAGE;
  6934. /**
  6935. * @member {number} SuperMap.SummaryMeshJobParameter.prototype.fields
  6936. * @description 权重字段。
  6937. */
  6938. this.fields = "";
  6939. /**
  6940. * @member {SuperMap.SummaryType} [SuperMap.SummaryMeshJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  6941. * @description 聚合类型。
  6942. */
  6943. this.type = SummaryType.SUMMARYMESH;
  6944. /**
  6945. * @member {SuperMap.OutputSetting} [SuperMap.SummaryMeshJobParameter.prototype.output]
  6946. * @description 输出参数设置类。
  6947. */
  6948. this.output = null;
  6949. /**
  6950. * @member {SuperMap.MappingParameters} [SuperMap.SummaryMeshJobParameter.prototype.mappingParameters]
  6951. * @description 分析后结果可视化的参数类。
  6952. */
  6953. this.mappingParameters = null;
  6954. Util.extend(this, options);
  6955. this.CLASS_NAME = "SuperMap.SummaryMeshJobParameter";
  6956. }
  6957. /**
  6958. * @function SuperMap.SummaryMeshJobParameter.destroy
  6959. * @override
  6960. */
  6961. destroy() {
  6962. this.datasetName = null;
  6963. this.query = null;
  6964. this.resolution = null;
  6965. this.statisticModes = null;
  6966. this.meshType = null;
  6967. this.fields = null;
  6968. this.regionDataset = null;
  6969. this.type = null;
  6970. if (this.output instanceof OutputSetting_OutputSetting) {
  6971. this.output.destroy();
  6972. this.output = null;
  6973. }
  6974. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  6975. this.mappingParameters.destroy();
  6976. this.mappingParameters = null;
  6977. }
  6978. }
  6979. /**
  6980. * @function SuperMap.SummaryMeshJobParameter.toObject
  6981. * @param {Object} summaryMeshJobParameter - 点聚合分析任务参数。
  6982. * @param {Object} tempObj - 目标对象。
  6983. * @description 生成点聚合分析任务对象。
  6984. */
  6985. static toObject(summaryMeshJobParameter, tempObj) {
  6986. for (var name in summaryMeshJobParameter) {
  6987. if (name === "datasetName") {
  6988. tempObj['input'] = tempObj['input'] || {};
  6989. tempObj['input'][name] = summaryMeshJobParameter[name];
  6990. continue;
  6991. }
  6992. if (name === "type") {
  6993. tempObj['type'] = summaryMeshJobParameter[name];
  6994. continue;
  6995. }
  6996. if (name === "output") {
  6997. tempObj['output'] = tempObj['output'] || {};
  6998. tempObj['output'] = summaryMeshJobParameter[name];
  6999. continue;
  7000. }
  7001. if (summaryMeshJobParameter.type === 'SUMMARYMESH' && name !== 'regionDataset' || summaryMeshJobParameter.type === 'SUMMARYREGION' && !contains(['meshType', 'resolution', 'query'], name)) {
  7002. tempObj['analyst'] = tempObj['analyst'] || {};
  7003. if (name === 'query' && summaryMeshJobParameter[name]) {
  7004. tempObj['analyst'][name] = summaryMeshJobParameter[name].toBBOX();
  7005. } else {
  7006. tempObj['analyst'][name] = summaryMeshJobParameter[name];
  7007. }
  7008. if(name === 'mappingParameters'){
  7009. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7010. tempObj['analyst']['mappingParameters'] = summaryMeshJobParameter[name];
  7011. }
  7012. }
  7013. }
  7014. function contains(arr, obj) {
  7015. var i = arr.length;
  7016. while (i--) {
  7017. if (arr[i] === obj) {
  7018. return true;
  7019. }
  7020. }
  7021. return false;
  7022. }
  7023. }
  7024. }
  7025. SuperMap.SummaryMeshJobParameter = SummaryMeshJobParameter_SummaryMeshJobParameter;
  7026. // CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobParameter.js
  7027. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7028. * This program are made available under the terms of the Apache License, Version 2.0
  7029. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7030. /**
  7031. * @class SuperMap.SummaryRegionJobParameter
  7032. * @category iServer ProcessingService SummaryRegion
  7033. * @classdesc 区域汇总分析任务参数类。
  7034. * @param {Object} options - 参数。
  7035. * @param {string} options.datasetName - 数据集名。
  7036. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.query] - 分析范围(默认为全图范围)。
  7037. * @param {string} [options.standardFields] - 标准属性字段名称。
  7038. * @param {string} [options.weightedFields] - 权重字段名称。
  7039. * @param {SuperMap.StatisticAnalystMode} [options.standardStatisticModes] - 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  7040. * @param {SuperMap.StatisticAnalystMode} [options.weightedStatisticModes] - 权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  7041. * @param {boolean} [options.sumShape=true] - 是否统计长度或面积。
  7042. * @param {boolean} [options.standardSummaryFields=false] - 是否以标准属字段统计。
  7043. * @param {boolean} [options.weightedSummaryFields=false] - 是否以权重字段统计。
  7044. * @param {number} [options.resolution=100] - 网格大小。
  7045. * @param {number} [options.meshType=0] - 网格面汇总类型。
  7046. * @param {SuperMap.AnalystSizeUnit} [options.meshSizeUnit=SuperMap.AnalystSizeUnit.METER] - 网格大小单位。
  7047. * @param {SuperMap.SummaryType} [options.type=SuperMap.SummaryType.SUMMARYMESH] - 汇总类型。
  7048. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  7049. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  7050. */
  7051. class SummaryRegionJobParameter_SummaryRegionJobParameter {
  7052. constructor(options) {
  7053. if (!options) {
  7054. return;
  7055. }
  7056. /**
  7057. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.datasetName
  7058. * @description 数据集名。
  7059. */
  7060. this.datasetName = "";
  7061. /**
  7062. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.regionDataset
  7063. * @description 汇总数据源(多边形汇总时用到的参数)。
  7064. */
  7065. this.regionDataset = "";
  7066. /**
  7067. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.sumShape=true]
  7068. * @description 是否统计长度或面积。
  7069. */
  7070. this.sumShape = true;
  7071. /**
  7072. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.SummaryRegionJobParameter.prototype.query
  7073. * @description 分析范围。
  7074. */
  7075. this.query = "";
  7076. /**
  7077. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.standardSummaryFields=false]
  7078. * @description 是否以标准属字段统计。
  7079. */
  7080. this.standardSummaryFields = false;
  7081. /**
  7082. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.standardFields
  7083. * @description 标准属性字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。standardSummaryFields 为 true 时必填。
  7084. */
  7085. this.standardFields = "";
  7086. /**
  7087. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.standardStatisticModes
  7088. * @description 标准属性字段的统计模式。standardSummaryFields 为 true 时必填。
  7089. */
  7090. this.standardStatisticModes = "";
  7091. /**
  7092. * @member {boolean} [SuperMap.SummaryRegionJobParameter.prototype.weightedSummaryFields=false]
  7093. * @description 是否以权重字段统计。
  7094. */
  7095. this.weightedSummaryFields = false;
  7096. /**
  7097. * @member {string} SuperMap.SummaryRegionJobParameter.prototype.weightedFields
  7098. * @description 权重字段名称。仅支持系统字段以外的整形、长整形、浮点型的字段的名称。weightedSummaryFields 为 true 时必填。
  7099. */
  7100. this.weightedFields = "";
  7101. /**
  7102. * @member {SuperMap.StatisticAnalystMode} SuperMap.SummaryRegionJobParameter.prototype.weightedStatisticModes
  7103. * @description 以权重字段统计的统计模式。权重字段的统计模式。weightedSummaryFields 为 true 时必填。
  7104. */
  7105. this.weightedStatisticModes = "";
  7106. /**
  7107. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.meshType=0]
  7108. * @description 网格面汇总类型。
  7109. */
  7110. this.meshType = 0;
  7111. /**
  7112. * @member {number} [SuperMap.SummaryRegionJobParameter.prototype.resolution=100]
  7113. * @description 网格大小。
  7114. */
  7115. this.resolution = 100;
  7116. /**
  7117. * @member {SuperMap.AnalystSizeUnit} [SuperMap.SummaryRegionJobParameter.prototype.meshSizeUnit=SuperMap.AnalystSizeUnit.METER]
  7118. * @description 网格大小单位。
  7119. */
  7120. this.meshSizeUnit = AnalystSizeUnit.METER;
  7121. /**
  7122. * @member {SuperMap.SummaryType} [SuperMap.SummaryRegionJobParameter.prototype.type=SuperMap.SummaryType.SUMMARYMESH]
  7123. * @description 汇总类型。
  7124. */
  7125. this.type = SummaryType.SUMMARYMESH;
  7126. /**
  7127. * @member {SuperMap.OutputSetting} SuperMap.SummaryRegionJobParameter.prototype.output
  7128. * @description 输出参数设置类
  7129. */
  7130. this.output = null;
  7131. /**
  7132. * @member {SuperMap.MappingParameters} [SuperMap.SummaryRegionJobParameter.prototype.mappingParameters]
  7133. * @description 分析后结果可视化的参数类。
  7134. */
  7135. this.mappingParameters = null;
  7136. Util.extend(this, options);
  7137. this.CLASS_NAME = "SuperMap.SummaryRegionJobParameter";
  7138. }
  7139. /**
  7140. * @function SuperMap.SummaryRegionJobParameter.prototype.destroy
  7141. * @description 释放资源,将引用资源的属性置空。
  7142. */
  7143. destroy() {
  7144. this.datasetName = null;
  7145. this.sumShape = null;
  7146. this.regionDataset = null;
  7147. this.query = null;
  7148. this.standardSummaryFields = null;
  7149. this.standardFields = null;
  7150. this.standardStatisticModes = null;
  7151. this.weightedSummaryFields = null;
  7152. this.weightedFields = null;
  7153. this.weightedStatisticModes = null;
  7154. this.meshType = null;
  7155. this.resolution = null;
  7156. this.meshSizeUnit = null;
  7157. this.type = null;
  7158. if (this.output instanceof OutputSetting_OutputSetting) {
  7159. this.output.destroy();
  7160. this.output = null;
  7161. }
  7162. if (this.mappingParameters instanceof MappingParameters_MappingParameters){
  7163. this.mappingParameters.destroy();
  7164. this.mappingParameters = null;
  7165. }
  7166. }
  7167. /**
  7168. * @function SuperMap.SummaryRegionJobParameter.toObject
  7169. * @param {Object} summaryRegionJobParameter - 矢量裁剪分析任务参数。
  7170. * @param {Object} tempObj - 目标对象。
  7171. * @description 生成区域汇总分析服务对象。
  7172. */
  7173. static toObject(summaryRegionJobParameter, tempObj) {
  7174. for (var name in summaryRegionJobParameter) {
  7175. if (name === "datasetName") {
  7176. tempObj['input'] = tempObj['input'] || {};
  7177. tempObj['input'][name] = summaryRegionJobParameter[name];
  7178. continue;
  7179. }
  7180. if (name === "type") {
  7181. tempObj['type'] = summaryRegionJobParameter[name];
  7182. continue;
  7183. }
  7184. if (name === "type") {
  7185. tempObj['type'] = summaryRegionJobParameter[name];
  7186. continue;
  7187. }
  7188. if (name === "output") {
  7189. tempObj['output'] = tempObj['output'] || {};
  7190. tempObj['output'] = summaryRegionJobParameter[name];
  7191. continue;
  7192. }
  7193. if (summaryRegionJobParameter.type === "SUMMARYREGION" || summaryRegionJobParameter.type === "SUMMARYMESH" && name !== "regionDataset") {
  7194. tempObj['analyst'] = tempObj['analyst'] || {};
  7195. if (name === 'query' && summaryRegionJobParameter[name]) {
  7196. tempObj['analyst'][name] = summaryRegionJobParameter[name].toBBOX();
  7197. } else {
  7198. tempObj['analyst'][name] = summaryRegionJobParameter[name];
  7199. }
  7200. if(name === 'mappingParameters'){
  7201. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7202. tempObj['analyst']['mappingParameters'] = summaryRegionJobParameter[name];
  7203. }
  7204. }
  7205. }
  7206. }
  7207. }
  7208. SuperMap.SummaryRegionJobParameter = SummaryRegionJobParameter_SummaryRegionJobParameter;
  7209. // CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobParameter.js
  7210. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7211. * This program are made available under the terms of the Apache License, Version 2.0
  7212. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7213. /**
  7214. * @class SuperMap.OverlayGeoJobParameter
  7215. * @category iServer ProcessingService OverlayAnalyst
  7216. * @classdesc 叠加分析任务参数类。
  7217. * @param {Object} options - 参数。
  7218. * @param {string} options.datasetName - 数据集名。
  7219. * @param {string} options.datasetOverlay - 叠加对象所在的数据集名称。
  7220. * @param {string} options.srcFields - 输入数据需要保留的字段。
  7221. * @param {string} [options.overlayFields] - 叠加数据需要保留的字段。对分析模式为 clip、update、erase 时,此参数无效。
  7222. * @param {string} [options.mode] - 叠加分析模式。
  7223. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  7224. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  7225. */
  7226. class OverlayGeoJobParameter_OverlayGeoJobParameter {
  7227. constructor(options) {
  7228. if (!options) {
  7229. return;
  7230. }
  7231. /**
  7232. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetName
  7233. * @description 数据集名。
  7234. */
  7235. this.datasetName = "";
  7236. /**
  7237. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.datasetOverlay
  7238. * @description 叠加对象所在的数据集名称。
  7239. */
  7240. this.datasetOverlay = "";
  7241. /**
  7242. * @member {string} [SuperMap.OverlayGeoJobParameter.prototype.mode]
  7243. * @description 叠加分析模式。
  7244. */
  7245. this.mode = "";
  7246. /**
  7247. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.srcFields
  7248. * @description 输入数据需要保留的字段。
  7249. */
  7250. this.srcFields = "";
  7251. /**
  7252. * @member {string} SuperMap.OverlayGeoJobParameter.prototype.overlayFields
  7253. * @description 叠加数据需要保留的字段,对分析模式为 clip、update、erase 时,此参数无效。
  7254. */
  7255. this.overlayFields = "";
  7256. /**
  7257. * @member {SuperMap.OutputSetting} [SuperMap.OverlayGeoJobParameter.prototype.output]
  7258. * @description 输出参数设置类。
  7259. */
  7260. this.output = null;
  7261. /**
  7262. * @member {SuperMap.MappingParameters} [SuperMap.OverlayGeoJobParameter.prototype.mappingParameters]
  7263. * @description 分析后结果可视化的参数类。
  7264. */
  7265. this.mappingParameters = null;
  7266. Util.extend(this, options);
  7267. this.CLASS_NAME = "SuperMap.OverlayGeoJobParameter";
  7268. }
  7269. /**
  7270. * @function SuperMap.OverlayGeoJobParameter.destroy
  7271. * @override
  7272. */
  7273. destroy() {
  7274. this.datasetName = null;
  7275. this.datasetOverlay = null;
  7276. this.mode = null;
  7277. this.srcFields = null;
  7278. this.overlayFields = null;
  7279. if (this.output instanceof OutputSetting_OutputSetting) {
  7280. this.output.destroy();
  7281. this.output = null;
  7282. }
  7283. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  7284. this.mappingParameters.destroy();
  7285. this.mappingParameters = null;
  7286. }
  7287. }
  7288. /**
  7289. * @function SuperMap.OverlayGeoJobParameter.toObject
  7290. * @param {Object} OverlayGeoJobParameter - 点聚合分析任务参数。
  7291. * @param {Object} tempObj - 目标对象。
  7292. * @description 生成点聚合分析任务对象。
  7293. */
  7294. static toObject(OverlayGeoJobParameter, tempObj) {
  7295. for (var name in OverlayGeoJobParameter) {
  7296. if (name == "datasetName") {
  7297. tempObj['input'] = tempObj['input'] || {};
  7298. tempObj['input'][name] = OverlayGeoJobParameter[name];
  7299. continue;
  7300. }
  7301. if (name === "output") {
  7302. tempObj['output'] = tempObj['output'] || {};
  7303. tempObj['output'] = OverlayGeoJobParameter[name];
  7304. continue;
  7305. }
  7306. tempObj['analyst'] = tempObj['analyst'] || {};
  7307. tempObj['analyst'][name] = OverlayGeoJobParameter[name];
  7308. if(name === 'mappingParameters'){
  7309. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7310. tempObj['analyst']['mappingParameters'] = OverlayGeoJobParameter[name];
  7311. }
  7312. }
  7313. }
  7314. }
  7315. SuperMap.OverlayGeoJobParameter = OverlayGeoJobParameter_OverlayGeoJobParameter;
  7316. // CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsParameter.js
  7317. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7318. * This program are made available under the terms of the Apache License, Version 2.0
  7319. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7320. /**
  7321. * @class SuperMap.BuffersAnalystJobsParameter
  7322. * @category iServer ProcessingService BufferAnalyst
  7323. * @classdesc 缓冲区分析任务参数类。
  7324. * @param {Object} options - 参数。
  7325. * @param {string} options.datasetName - 数据集名。
  7326. * @param {(SuperMap.Bounds|L.Bounds|ol.extent)} [options.bounds] - 分析范围(默认为全图范围)。
  7327. * @param {string} [options.distance='15'] - 缓冲距离,或缓冲区半径。
  7328. * @param {string} [options.distanceField='pickup_latitude'] - 缓冲区分析距离字段。
  7329. * @param {SuperMap.AnalystSizeUnit} [options.distanceUnit=SuperMap.AnalystSizeUnit.METER] - 缓冲距离单位单位。
  7330. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  7331. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  7332. */
  7333. class BuffersAnalystJobsParameter_BuffersAnalystJobsParameter {
  7334. constructor(options) {
  7335. /**
  7336. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.datasetName
  7337. * @description 数据集名。
  7338. */
  7339. this.datasetName = '';
  7340. /**
  7341. * @member {(SuperMap.Bounds|L.Bounds|ol.extent)} SuperMap.BuffersAnalystJobsParameter.prototype.bounds
  7342. * @description 分析范围。
  7343. */
  7344. this.bounds = '';
  7345. /**
  7346. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distance='15']
  7347. * @description 缓冲距离,或称为缓冲区半径。当缓冲距离字段位空时,此参数有效。
  7348. */
  7349. this.distance = '';
  7350. /**
  7351. * @member {string} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceField='pickup_latitude']
  7352. * @description 缓冲距离字段。
  7353. */
  7354. this.distanceField = '';
  7355. /**
  7356. * @member {SuperMap.AnalystSizeUnit} [SuperMap.BuffersAnalystJobsParameter.prototype.distanceUnit=SuperMap.AnalystSizeUnit.METER]
  7357. * @description 缓冲距离单位。
  7358. */
  7359. this.distanceUnit = AnalystSizeUnit.METER;
  7360. /**
  7361. * @member {string} SuperMap.BuffersAnalystJobsParameter.prototype.dissolveField
  7362. * @description 融合字段,根据字段值对缓冲区结果面对象进行融合。
  7363. */
  7364. this.dissolveField = '';
  7365. /**
  7366. * @member {SuperMap.OutputSetting} [SuperMap.BuffersAnalystJobsParameter.prototype.output]
  7367. * @description 输出参数设置类。
  7368. */
  7369. this.output = null;
  7370. /**
  7371. * @member {SuperMap.MappingParameters} [SuperMap.BuffersAnalystJobsParameter.prototype.mappingParameters]
  7372. * @description 分析后结果可视化的参数类。
  7373. */
  7374. this.mappingParameters = null;
  7375. if (!options) {
  7376. return this;
  7377. }
  7378. Util.extend(this, options);
  7379. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsParameter';
  7380. }
  7381. /**
  7382. * @function SuperMap.BuffersAnalystJobsParameter.prototype.destroy
  7383. * @description 释放资源,将引用资源的属性置空。
  7384. */
  7385. destroy() {
  7386. this.datasetName = null;
  7387. this.bounds = null;
  7388. this.distance = null;
  7389. this.distanceField = null;
  7390. this.distanceUnit = null;
  7391. this.dissolveField = null;
  7392. if (this.output instanceof OutputSetting_OutputSetting) {
  7393. this.output.destroy();
  7394. this.output = null;
  7395. }
  7396. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  7397. this.mappingParameters.destroy();
  7398. this.mappingParameters = null;
  7399. }
  7400. }
  7401. /**
  7402. * @function SuperMap.BuffersAnalystJobsParameter.toObject
  7403. * @param {SuperMap.BuffersAnalystJobsParameter} BuffersAnalystJobsParameter - 缓冲区分析任务参数。
  7404. * @param {Object} tempObj - 目标对象。
  7405. * @description 生成缓冲区分析任务对象。
  7406. */
  7407. static toObject(BuffersAnalystJobsParameter, tempObj) {
  7408. for (var name in BuffersAnalystJobsParameter) {
  7409. if (name === 'datasetName') {
  7410. tempObj['input'] = tempObj['input'] || {};
  7411. tempObj['input'][name] = BuffersAnalystJobsParameter[name];
  7412. continue;
  7413. }
  7414. if (name === 'output') {
  7415. tempObj['output'] = tempObj['output'] || {};
  7416. tempObj['output'] = BuffersAnalystJobsParameter[name];
  7417. continue;
  7418. }
  7419. tempObj['analyst'] = tempObj['analyst'] || {};
  7420. if (name === 'bounds' && BuffersAnalystJobsParameter[name]) {
  7421. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name].toBBOX();
  7422. } else {
  7423. tempObj['analyst'][name] = BuffersAnalystJobsParameter[name];
  7424. }
  7425. if (name === 'mappingParameters') {
  7426. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7427. tempObj['analyst']['mappingParameters'] = BuffersAnalystJobsParameter[name];
  7428. }
  7429. }
  7430. }
  7431. }
  7432. SuperMap.BuffersAnalystJobsParameter = BuffersAnalystJobsParameter_BuffersAnalystJobsParameter;
  7433. // CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsParameter.js
  7434. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7435. * This program are made available under the terms of the Apache License, Version 2.0
  7436. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7437. /**
  7438. * @class SuperMap.TopologyValidatorJobsParameter
  7439. * @category iServer ProcessingService TopologyValidator
  7440. * @classdesc 拓扑检查分析任务参数类。
  7441. * @param {Object} options - 必填参数。
  7442. * @param {string} options.datasetName - 数据集名。
  7443. * @param {string} options.datasetTopology -检查对象所在的数据集名称。
  7444. * @param {SuperMap.TopologyValidatorRule} [options.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP] - 拓扑检查规则。
  7445. * @param {string} [options.tolerance] - 容限。
  7446. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  7447. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  7448. */
  7449. class TopologyValidatorJobsParameter_TopologyValidatorJobsParameter {
  7450. constructor(options) {
  7451. if (!options) {
  7452. return;
  7453. }
  7454. /**
  7455. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetName
  7456. * @description 数据集名。
  7457. */
  7458. this.datasetName = "";
  7459. /**
  7460. * @member {string} SuperMap.TopologyValidatorJobsParameter.prototype.datasetTopology
  7461. * @description 拓扑检查对象所在的数据集名称。
  7462. */
  7463. this.datasetTopology = "";
  7464. /**
  7465. * @member {string} [SuperMap.TopologyValidatorJobsParameter.prototype.tolerance]
  7466. * @description 容限,指定的拓扑错误检查时使用的容限。
  7467. */
  7468. this.tolerance = "";
  7469. /**
  7470. * @member {SuperMap.TopologyValidatorRule} [SuperMap.TopologyValidatorJobsParameter.prototype.rule=SuperMap.TopologyValidatorRule.REGIONNOOVERLAP]
  7471. * @description 拓扑检查模式。
  7472. */
  7473. this.rule = TopologyValidatorRule.REGIONNOOVERLAP;
  7474. /**
  7475. * @member {SuperMap.OutputSetting} [SuperMap.TopologyValidatorJobsParameter.prototype.output]
  7476. * @description 输出参数设置类。
  7477. */
  7478. this.output = null;
  7479. /**
  7480. * @member {SuperMap.MappingParameters} [SuperMap.TopologyValidatorJobsParameter.prototype.mappingParameters]
  7481. * @description 分析后结果可视化的参数类。
  7482. */
  7483. this.mappingParameters = null;
  7484. Util.extend(this, options);
  7485. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsParameter";
  7486. }
  7487. /**
  7488. * @function SuperMap.TopologyValidatorJobsParameter.prototype.destroy
  7489. * @description 释放资源,将引用资源的属性置空。
  7490. */
  7491. destroy() {
  7492. this.datasetName = null;
  7493. this.datasetTopology = null;
  7494. this.tolerance = null;
  7495. this.rule = null;
  7496. if (this.output instanceof OutputSetting_OutputSetting) {
  7497. this.output.destroy();
  7498. this.output = null;
  7499. }
  7500. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  7501. this.mappingParameters.destroy();
  7502. this.mappingParameters = null;
  7503. }
  7504. }
  7505. /**
  7506. * @function SuperMap.TopologyValidatorJobsParameter.toObject
  7507. * @param {Object} TopologyValidatorJobsParameter -拓扑检查分析任务参数。
  7508. * @param {Object} tempObj - 目标对象。
  7509. * @description 生成拓扑检查分析任务对象。
  7510. */
  7511. static toObject(TopologyValidatorJobsParameter, tempObj) {
  7512. for (var name in TopologyValidatorJobsParameter) {
  7513. if (name === "datasetName") {
  7514. tempObj['input'] = tempObj['input'] || {};
  7515. tempObj['input'][name] = TopologyValidatorJobsParameter[name];
  7516. continue;
  7517. }
  7518. if (name === "output") {
  7519. tempObj['output'] = tempObj['output'] || {};
  7520. tempObj['output'] = TopologyValidatorJobsParameter[name];
  7521. continue;
  7522. }
  7523. tempObj['analyst'] = tempObj['analyst'] || {};
  7524. tempObj['analyst'][name] = TopologyValidatorJobsParameter[name];
  7525. if(name === 'mappingParameters'){
  7526. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  7527. tempObj['analyst']['mappingParameters'] = TopologyValidatorJobsParameter[name];
  7528. }
  7529. }
  7530. }
  7531. }
  7532. SuperMap.TopologyValidatorJobsParameter = TopologyValidatorJobsParameter_TopologyValidatorJobsParameter;
  7533. // CONCATENATED MODULE: ./src/common/iServer/GeoCodingParameter.js
  7534. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7535. * This program are made available under the terms of the Apache License, Version 2.0
  7536. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7537. /**
  7538. * @class SuperMap.GeoCodingParameter
  7539. * @category iServer AddressMatch
  7540. * @classdesc 地理正向匹配参数类。
  7541. * @param {Object} options - 参数。
  7542. * @param {string} options.address - 地点关键词。
  7543. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  7544. * @param {number} [options.toIndex] - 设置返回对象的结束索引值。
  7545. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  7546. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  7547. * @param {number} [options.maxReturn] - 最大返回结果数。
  7548. */
  7549. class GeoCodingParameter_GeoCodingParameter {
  7550. constructor(options) {
  7551. if (options.filters && typeof(options.filters) === 'string') {
  7552. options.filters = options.filters.split(',');
  7553. }
  7554. /**
  7555. * @member {string} SuperMap.GeoCodingParameter.prototype.address
  7556. * @description 地点关键词。
  7557. */
  7558. this.address = null;
  7559. /**
  7560. * @member {number} [SuperMap.GeoCodingParameter.prototype.fromIndex]
  7561. * @description 设置返回对象的起始索引值。
  7562. */
  7563. this.fromIndex = null;
  7564. /**
  7565. * @member {number} [SuperMap.GeoCodingParameter.prototype.toIndex]
  7566. * @description 设置返回对象的结束索引值。
  7567. */
  7568. this.toIndex = null;
  7569. /**
  7570. * @member {Array.<string>} [SuperMap.GeoCodingParameter.prototype.filters]
  7571. * @description 过滤字段,限定查询区域。
  7572. */
  7573. this.filters = null;
  7574. /**
  7575. * @member {string} [SuperMap.GeoCodingParameter.prototype.prjCoordSys]
  7576. * @description 查询结果的坐标系。
  7577. */
  7578. this.prjCoordSys = null;
  7579. /**
  7580. * @member {number} [SuperMap.GeoCodingParameter.prototype.maxReturn]
  7581. * @description 最大返回结果数。
  7582. */
  7583. this.maxReturn = null;
  7584. Util.extend(this, options);
  7585. }
  7586. /**
  7587. * @function SuperMap.GeoCodingParameter.prototype.destroy
  7588. * @description 释放资源,将引用资源的属性置空。
  7589. */
  7590. destroy() {
  7591. this.address = null;
  7592. this.fromIndex = null;
  7593. this.toIndex = null;
  7594. this.filters = null;
  7595. this.prjCoordSys = null;
  7596. this.maxReturn = null;
  7597. }
  7598. }
  7599. SuperMap.GeoCodingParameter = GeoCodingParameter_GeoCodingParameter;
  7600. // CONCATENATED MODULE: ./src/common/iServer/GeoDecodingParameter.js
  7601. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7602. * This program are made available under the terms of the Apache License, Version 2.0
  7603. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7604. /**
  7605. * @class SuperMap.GeoDecodingParameter
  7606. * @category iServer AddressMatch
  7607. * @classdesc 地理反向匹配参数类。
  7608. * @param {Object} options - 参数。
  7609. * @param {number} options.x - 查询位置的横坐标。
  7610. * @param {number} options.y - 查询位置的纵坐标。
  7611. * @param {number} [options.fromIndex] - 设置返回对象的起始索引值。
  7612. * @param {Array.<string>} [options.filters] - 过滤字段,限定查询区域。
  7613. * @param {string} [options.prjCoordSys] - 查询结果的坐标系。
  7614. * @param {number} [options.maxReturn] - 最大返回结果数。
  7615. * @param {number} [options.geoDecodingRadius] - 查询半径。
  7616. */
  7617. class GeoDecodingParameter_GeoDecodingParameter {
  7618. constructor(options) {
  7619. if (options.filters) {
  7620. options.filters = options.filters.split(',');
  7621. }
  7622. /**
  7623. * @member {number} SuperMap.GeoDecodingParameter.prototype.x
  7624. * @description 查询位置的横坐标。
  7625. */
  7626. this.x = null;
  7627. /**
  7628. * @member {number} SuperMap.GeoDecodingParameter.prototype.y
  7629. * @description 查询位置的纵坐标。
  7630. */
  7631. this.y = null;
  7632. /**
  7633. * @member {number} [SuperMap.GeoDecodingParameter.prototype.fromIndex]
  7634. * @description 设置返回对象的起始索引值。
  7635. */
  7636. this.fromIndex = null;
  7637. /**
  7638. * @member {number} [SuperMap.GeoDecodingParameter.prototype.toIndex]
  7639. * @description 设置返回对象的结束索引值。
  7640. */
  7641. this.toIndex = null;
  7642. /**
  7643. * @member {Array.<string>} [SuperMap.GeoDecodingParameter.prototype.filters]
  7644. * @description 过滤字段,限定查询区域。
  7645. */
  7646. this.filters = null;
  7647. /**
  7648. * @member {string} [SuperMap.GeoDecodingParameter.prototype.prjCoordSys]
  7649. * @description 查询结果的坐标系。
  7650. */
  7651. this.prjCoordSys = null;
  7652. /**
  7653. * @member {number} [SuperMap.GeoDecodingParameter.prototype.maxReturn]
  7654. * @description 最大返回结果数。
  7655. */
  7656. this.maxReturn = null;
  7657. /**
  7658. * @member {number} SuperMap.GeoDecodingParameter.prototype.geoDecodingRadius
  7659. * @description 查询半径。
  7660. */
  7661. this.geoDecodingRadius = null;
  7662. Util.extend(this, options);
  7663. }
  7664. /**
  7665. * @function SuperMap.GeoDecodingParameter.prototype.destroy
  7666. * @description 释放资源,将引用资源的属性置空。
  7667. */
  7668. destroy() {
  7669. this.x = null;
  7670. this.y = null;
  7671. this.fromIndex = null;
  7672. this.toIndex = null;
  7673. this.filters = null;
  7674. this.prjCoordSys = null;
  7675. this.maxReturn = null;
  7676. this.geoDecodingRadius = null;
  7677. }
  7678. }
  7679. SuperMap.GeoDecodingParameter = GeoDecodingParameter_GeoDecodingParameter;
  7680. // CONCATENATED MODULE: ./src/classic/SuperMap.js
  7681. var SuperMap_SuperMap = window.SuperMap = window.SuperMap || {};
  7682. SuperMap_SuperMap.REST = SuperMap_SuperMap.REST || {};
  7683. // EXTERNAL MODULE: external "function(){try{return mapv}catch(e){return {}}}()"
  7684. var external_function_try_return_mapv_catch_e_return_ = __webpack_require__(0);
  7685. // CONCATENATED MODULE: ./src/common/util/MapCalculateUtil.js
  7686. var getMeterPerMapUnit = function(mapUnit) {
  7687. var earchRadiusInMeters = 6378137;
  7688. var meterPerMapUnit;
  7689. if (mapUnit === Unit.METER) {
  7690. meterPerMapUnit = 1;
  7691. } else if (mapUnit === Unit.DEGREE) {
  7692. // 每度表示多少米。
  7693. meterPerMapUnit = (Math.PI * 2 * earchRadiusInMeters) / 360;
  7694. } else if (mapUnit === Unit.KILOMETER) {
  7695. meterPerMapUnit = 1.0e-3;
  7696. } else if (mapUnit === Unit.INCH) {
  7697. meterPerMapUnit = 1 / 2.5399999918e-2;
  7698. } else if (mapUnit === Unit.FOOT) {
  7699. meterPerMapUnit = 0.3048;
  7700. } else {
  7701. return meterPerMapUnit;
  7702. }
  7703. return meterPerMapUnit;
  7704. };
  7705. // CONCATENATED MODULE: ./src/classic/overlay/mapv/MapVRenderer.js
  7706. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  7707. * This program are made available under the terms of the Apache License, Version 2.0
  7708. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  7709. /**
  7710. * @class MapVRenderer
  7711. * @classdesc MapV渲染器。
  7712. * @private
  7713. * @extends {mapv.baiduMapLayer}
  7714. * @param {SuperMap.Map} map - 待渲染的地图。
  7715. * @param {SuperMap.Layer.MapVLayer} layer - 待渲染的图层。
  7716. * @param {Mapv.DataSet} dataSet - 待渲染的数据集,数据所属坐标系要求与 map 保持一致。
  7717. * @param {Object} options - 渲染的参数。
  7718. */
  7719. var MapVBaseLayer = external_function_try_return_mapv_catch_e_return_["baiduMapLayer"] ? external_function_try_return_mapv_catch_e_return_["baiduMapLayer"].__proto__ : Function;
  7720. class MapVRenderer_MapVRenderer extends MapVBaseLayer {
  7721. constructor(map, layer, dataSet, options) {
  7722. super(map, dataSet, options);
  7723. if (!MapVBaseLayer) {
  7724. return this;
  7725. }
  7726. var self = this;
  7727. options = options || {};
  7728. self.init(options);
  7729. self.argCheck(options);
  7730. this.canvasLayer = layer;
  7731. this.clickEvent = this.clickEvent.bind(this);
  7732. this.mousemoveEvent = this.mousemoveEvent.bind(this);
  7733. this.bindEvent();
  7734. }
  7735. /**
  7736. * @function MapvRenderer.prototype.clickEvent
  7737. * @description 点击事件。
  7738. * @param {Object} e - 触发对象。
  7739. */
  7740. clickEvent(e) {
  7741. var pixel = e.xy;
  7742. super.clickEvent(pixel, e);
  7743. }
  7744. /**
  7745. * @function MapvRenderer.prototype.mousemoveEvent
  7746. * @description 鼠标移动事件。
  7747. * @param {Object} e - 触发对象。
  7748. */
  7749. mousemoveEvent(e) {
  7750. var pixel = e.xy;
  7751. super.mousemoveEvent(pixel, e);
  7752. }
  7753. /**
  7754. * @function MapvRenderer.prototype.bindEvent
  7755. * @description 绑定鼠标移动和鼠标点击事件。
  7756. */
  7757. bindEvent() {
  7758. var map = this.map;
  7759. if (this.options.methods) {
  7760. if (this.options.methods.click) {
  7761. map.events.on({'click': this.clickEvent});
  7762. }
  7763. if (this.options.methods.mousemove) {
  7764. map.events.on({'mousemove': this.mousemoveEvent});
  7765. }
  7766. }
  7767. }
  7768. /**
  7769. * @function MapvRenderer.prototype.unbindEvent
  7770. * @description 解绑鼠标移动和鼠标滑动触发的事件。
  7771. */
  7772. unbindEvent() {
  7773. var map = this.map;
  7774. if (this.options.methods) {
  7775. if (this.options.methods.click) {
  7776. map.events.un({'click': this.clickEvent});
  7777. }
  7778. if (this.options.methods.mousemove) {
  7779. map.events.un({'mousemove': this.mousemoveEvent});
  7780. }
  7781. }
  7782. }
  7783. /**
  7784. * @function MapvRenderer.prototype.getContext
  7785. * @description 获取信息。
  7786. */
  7787. getContext() {
  7788. return this.canvasLayer && this.canvasLayer.canvasContext;
  7789. }
  7790. /**
  7791. * @function MapvRenderer.prototype.addData
  7792. * @description 追加数据
  7793. * @param {oject} data - 待添加的数据。
  7794. * @param {oject} options - 待添加的数据信息。
  7795. */
  7796. addData(data, options) {
  7797. var _data = data;
  7798. if (data && data.get) {
  7799. _data = data.get();
  7800. }
  7801. this.dataSet.add(_data);
  7802. this.update({options: options});
  7803. }
  7804. /**
  7805. * @function MapvRenderer.prototype.updateData
  7806. * @description 更新覆盖原数据。
  7807. * @param {oject} data - 待更新的数据。
  7808. * @param {oject} options - 待更新的数据信息。
  7809. */
  7810. setData(data, options) {
  7811. var _data = data;
  7812. if (data && data.get) {
  7813. _data = data.get();
  7814. }
  7815. this.dataSet = this.dataSet || new external_function_try_return_mapv_catch_e_return_["DataSet"]();
  7816. this.dataSet.set(_data);
  7817. this.update({options: options});
  7818. }
  7819. /**
  7820. * @function MapvRenderer.prototype.getData
  7821. * @description 获取数据。
  7822. */
  7823. getData() {
  7824. return this.dataSet;
  7825. }
  7826. /**
  7827. * @function MapvRenderer.prototype.removeData
  7828. * @description 删除符合过滤条件的数据。
  7829. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  7830. */
  7831. removeData(filter) {
  7832. if (!this.dataSet) {
  7833. return;
  7834. }
  7835. var newData = this.dataSet.get({
  7836. filter: function (data) {
  7837. return (filter != null && typeof filter === "function") ? !filter(data) : true;
  7838. }
  7839. });
  7840. this.dataSet.set(newData);
  7841. this.update({options: null});
  7842. }
  7843. /**
  7844. * @function MapvRenderer.prototype.clearData
  7845. * @description 清除数据。
  7846. */
  7847. clearData() {
  7848. this.dataSet && this.dataSet.clear();
  7849. this.update({options: null});
  7850. }
  7851. /**
  7852. * @function MapvRenderer.prototype.render
  7853. * @description 着色。
  7854. * @param {number} time
  7855. */
  7856. render(time) {
  7857. this._canvasUpdate(time);
  7858. }
  7859. /**
  7860. * @function MapvRenderer.prototype.transferToMercator
  7861. * @description 墨卡托坐标为经纬度。
  7862. * @deprecated
  7863. */
  7864. transferToMercator() {
  7865. if (this.options.coordType && ["bd09mc", "coordinates_mercator"].indexOf(this.options.coordType) > -1) {
  7866. var data = this.dataSet.get();
  7867. data = this.dataSet.transferCoordinate(data, function (coordinates) {
  7868. var pixel = SuperMap_SuperMap.Projection.transform({
  7869. x: coordinates[0],
  7870. y: coordinates[1]
  7871. }, "EPSG:3857", "EPSG:4326");
  7872. return [pixel.x, pixel.y];
  7873. }, 'coordinates', 'coordinates');
  7874. this.dataSet._set(data);
  7875. }
  7876. }
  7877. _canvasUpdate(time) {
  7878. if (!this.canvasLayer) {
  7879. return;
  7880. }
  7881. var self = this;
  7882. var animationOptions = self.options.animation;
  7883. var context = this.getContext();
  7884. var map = this.map;
  7885. if (self.isEnabledTime()) {
  7886. if (time === undefined) {
  7887. this.clear(context);
  7888. return;
  7889. }
  7890. if (this.context === '2d') {
  7891. context.save();
  7892. context.globalCompositeOperation = 'destination-out';
  7893. context.fillStyle = 'rgba(0, 0, 0, .1)';
  7894. context.fillRect(0, 0, context.canvas.width, context.canvas.height);
  7895. context.restore();
  7896. }
  7897. } else {
  7898. this.clear(context);
  7899. }
  7900. if (this.context === '2d') {
  7901. for (var key in self.options) {
  7902. context[key] = self.options[key];
  7903. }
  7904. } else {
  7905. context.clear(context.COLOR_BUFFER_BIT);
  7906. }
  7907. if (self.options.minZoom && map.getZoom() < self.options.minZoom || self.options.maxZoom && map.getZoom() > self.options.maxZoom) {
  7908. return;
  7909. }
  7910. var layer = self.canvasLayer;
  7911. var dataGetOptions = {
  7912. fromColumn: 'coordinates',
  7913. transferCoordinate: function (coordinate) {
  7914. // var coord = layer.transferToMapLatLng({lon: coordinate[0], lat: coordinate[1]});
  7915. var coord = {lon: coordinate[0], lat: coordinate[1]};
  7916. var worldPoint = map.getViewPortPxFromLonLat(coord);
  7917. return [worldPoint.x, worldPoint.y];
  7918. }
  7919. };
  7920. if (time !== undefined) {
  7921. dataGetOptions.filter = function (item) {
  7922. var trails = animationOptions.trails || 10;
  7923. return (time && item.time > (time - trails) && item.time < time);
  7924. }
  7925. }
  7926. var data = self.dataSet.get(dataGetOptions);
  7927. this.processData(data);
  7928. // 一个像素是多少米
  7929. var zoomUnit = map.getResolution() * getMeterPerMapUnit('DEGREE');
  7930. // // 兼容unit为'm'的情况
  7931. if (self.options.unit === 'm') {
  7932. if (self.options.size) {
  7933. self.options._size = self.options.size / zoomUnit;
  7934. }
  7935. if (self.options.width) {
  7936. self.options._width = self.options.width / zoomUnit;
  7937. }
  7938. if (self.options.height) {
  7939. self.options._height = self.options.height / zoomUnit;
  7940. }
  7941. } else {
  7942. self.options._size = self.options.size;
  7943. self.options._height = self.options.height;
  7944. self.options._width = self.options.width;
  7945. }
  7946. var worldPoint = map.getViewPortPxFromLonLat(layer.transferToMapLatLng({ lon: 0, lat: 0 }));
  7947. this.drawContext(context, data, self.options, worldPoint);
  7948. self.options.updateCallback && self.options.updateCallback(time);
  7949. }
  7950. init(options) {
  7951. var self = this;
  7952. self.options = options;
  7953. this.initDataRange(options);
  7954. this.context = self.options.context || '2d';
  7955. if (self.options.zIndex) {
  7956. this.canvasLayer && this.canvasLayer.setZIndex(self.options.zIndex);
  7957. }
  7958. this.initAnimator();
  7959. }
  7960. /**
  7961. * @function MapvRenderer.prototype.addAnimatorEvent
  7962. * @description 添加动画事件。
  7963. */
  7964. addAnimatorEvent() {
  7965. this.map.events.on({'movestart': this.animatorMovestartEvent.bind(this)});
  7966. this.map.events.on({'moveend': this.animatorMoveendEvent.bind(this)});
  7967. }
  7968. /**
  7969. * @function MapvRenderer.prototype.clear
  7970. * @description 清除环境。
  7971. * @param {Object} context - 当前环境。
  7972. */
  7973. clear(context) {
  7974. context && context.clearRect && context.clearRect(0, 0, context.canvas.width, context.canvas.height);
  7975. }
  7976. /**
  7977. * @function MapvRenderer.prototype.show
  7978. * @description 展示渲染效果。
  7979. */
  7980. show() {
  7981. this.map.addLayer(this.canvasLayer);
  7982. }
  7983. /**
  7984. * @function MapvRenderer.prototype.hide
  7985. * @description 隐藏渲染效果。
  7986. */
  7987. hide() {
  7988. this.map.removeLayer(this.canvasLayer);
  7989. }
  7990. /**
  7991. * @function MapvRenderer.prototype.draw
  7992. * @description 渲染绘制。
  7993. */
  7994. draw() {
  7995. this.canvasLayer.redraw();
  7996. }
  7997. }
  7998. // CONCATENATED MODULE: ./src/classic/overlay/MapVLayer.js
  7999. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8000. * This program are made available under the terms of the Apache License, Version 2.0
  8001. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8002. /**
  8003. * @class SuperMap.Layer.MapVLayer
  8004. * @category Visualization MapV
  8005. * @classdesc MapV 图层。
  8006. * @extends {SuperMap.Layer}
  8007. * @param {string} name - 图层名。
  8008. * @param {Object} options - 可选参数。
  8009. * @param {Mapv.DataSet} options.dataSet - mapv 的 dataSet 对象。
  8010. * @param {Object} options.options - mapv 绘图风格配置信息。
  8011. */
  8012. class MapVLayer_MapVLayer extends SuperMap_SuperMap.Layer {
  8013. constructor(name, options) {
  8014. super(name, options);
  8015. /**
  8016. * @member {mapv.DataSet} SuperMap.Layer.MapVLayer.prototype.dataSet
  8017. * @description mapv dataset 对象。
  8018. */
  8019. this.dataSet = null;
  8020. /**
  8021. * @member {Object} SuperMap.Layer.MapVLayer.prototype.options
  8022. * @description mapv 绘图风格配置信息。
  8023. */
  8024. this.options = null;
  8025. /**
  8026. * @member {boolean} [SuperMap.Layer.MapVLayer.prototype.supported=false]
  8027. * @description 当前浏览器是否支持 canvas 绘制。决定了 MapV 图是否可用,内部判断使用。
  8028. */
  8029. this.supported = false;
  8030. /**
  8031. * @member {Canvas} SuperMap.Layer.MapVLayer.prototype.canvas
  8032. * @description MapV 图主绘制面板。
  8033. */
  8034. this.canvas = null;
  8035. /**
  8036. * @private
  8037. * @member {CanvasContext} SuperMap.Layer.MapVLayer.prototype.canvasContext
  8038. * @description MapV 图主绘制对象。
  8039. */
  8040. this.canvasContext = null;
  8041. if (options) {
  8042. SuperMap_SuperMap.Util.extend(this, options);
  8043. }
  8044. //MapV图要求使用canvas绘制,判断是否支持
  8045. this.canvas = document.createElement('canvas');
  8046. if (!this.canvas.getContext) {
  8047. return;
  8048. }
  8049. this.supported = true;
  8050. //构建绘图面板
  8051. this.canvas.style.position = 'absolute';
  8052. this.canvas.style.top = 0 + 'px';
  8053. this.canvas.style.left = 0 + 'px';
  8054. this.div.appendChild(this.canvas);
  8055. var context = (this.options && this.options.context) || '2d';
  8056. this.canvasContext = this.canvas.getContext(context);
  8057. var global$2 = typeof window === 'undefined' ? {} : window;
  8058. var devicePixelRatio = this.devicePixelRatio = global$2.devicePixelRatio || 1;
  8059. if (context == '2d') {
  8060. this.canvasContext.scale(devicePixelRatio, devicePixelRatio);
  8061. }
  8062. this.attribution =
  8063. "© 2018 百度 <a href='https://mapv.baidu.com' target='_blank'>MapV</a> with <span>© <a target='_blank' href='https://iclient.supermap.io' " +
  8064. "style='color: #08c;text-decoration: none;'>SuperMap iClient</a></span>";
  8065. this.CLASS_NAME = 'SuperMap.Layer.MapVLayer';
  8066. }
  8067. /**
  8068. * @function SuperMap.Layer.MapVLayer.prototype.destroy
  8069. * @override
  8070. */
  8071. destroy() {
  8072. if (this.renderer && this.renderer.animator) {
  8073. this.renderer.animator.stop();
  8074. this.renderer.animator = null;
  8075. }
  8076. this.dataSet = null;
  8077. this.options = null;
  8078. this.renderer = null;
  8079. this.supported = null;
  8080. this.canvas = null;
  8081. this.canvasContext = null;
  8082. this.maxWidth = null;
  8083. this.maxHeight = null;
  8084. super.destroy();
  8085. }
  8086. /**
  8087. * @function SuperMap.Layer.MapVLayer.prototype.addData
  8088. * @description 追加数据。
  8089. * @param {mapv.DataSet} dataSet - mapv 数据集。
  8090. * @param {Object} options - mapv 绘图参数。
  8091. */
  8092. addData(dataSet, options) {
  8093. this.renderer && this.renderer.addData(dataSet, options);
  8094. }
  8095. /**
  8096. * @function SuperMap.Layer.MapVLayer.prototype.
  8097. * @description 设置数据。
  8098. * @param {mapv.DataSet} dataSet - mapv 数据集。
  8099. * @param {Object} options - mapv 绘图参数。
  8100. */
  8101. setData(dataSet, options) {
  8102. this.renderer && this.renderer.setData(dataSet, options);
  8103. }
  8104. /**
  8105. * @function SuperMap.Layer.MapVLayer.prototype.getData
  8106. * @description 获取数据。
  8107. * @returns {mapv.DataSet} - mapv 数据集。
  8108. */
  8109. getData() {
  8110. if (this.renderer) {
  8111. this.dataSet = this.renderer.getData();
  8112. }
  8113. return this.dataSet;
  8114. }
  8115. /**
  8116. * @function SuperMap.Layer.MapVLayer.prototype.removeData
  8117. * @description 删除符合过滤条件的数据。
  8118. * @param {function} filter - 过滤条件。条件参数为数据项,返回值为 true,表示删除该元素;否则表示不删除。
  8119. * @example
  8120. * filter=function(data){
  8121. * if(data.id=="1"){
  8122. * return true
  8123. * }
  8124. * return false;
  8125. * }
  8126. */
  8127. removeData(filter) {
  8128. this.renderer && this.renderer.removeData(filter);
  8129. }
  8130. /**
  8131. * @function SuperMap.Layer.MapVLayer.prototype.clearData
  8132. * @description 清除数据
  8133. */
  8134. clearData() {
  8135. this.renderer.clearData();
  8136. }
  8137. /**
  8138. * @function SuperMap.Layer.MapVLayer.prototype.setMap
  8139. * @description 图层已经添加到 Map 中。
  8140. * 如果当前浏览器支持 canvas,则开始渲染要素;如果不支持则移除图层。
  8141. * @param {SuperMap.Map} map - 需要绑定的 map 对象。
  8142. */
  8143. setMap(map) {
  8144. super.setMap(map);
  8145. this.renderer = new MapVRenderer_MapVRenderer(map, this, this.dataSet, this.options);
  8146. if (!this.supported) {
  8147. this.map.removeLayer(this);
  8148. } else {
  8149. this.redraw();
  8150. }
  8151. }
  8152. /**
  8153. * @function SuperMap.Layer.MapVLayer.prototype.moveTo
  8154. * @description 重置当前 MapV 图层的 div,再一次与 Map 控件保持一致。
  8155. * 修改当前显示范围,当平移或者缩放结束后开始重绘 MapV 图的渲染效果。
  8156. * @param {SuperMap.Bounds} bounds - 图层范围。
  8157. * @param {boolean} [zoomChanged] - 缩放级别是否改变。
  8158. * @param {boolean} [dragging] - 是否拖动。
  8159. */
  8160. moveTo(bounds, zoomChanged, dragging) {
  8161. super.moveTo(bounds, zoomChanged, dragging);
  8162. if (!this.supported) {
  8163. return;
  8164. }
  8165. this.zoomChanged = zoomChanged;
  8166. if (!dragging) {
  8167. this.div.style.visibility = 'hidden';
  8168. this.div.style.left = -parseInt(this.map.layerContainerDiv.style.left) + 'px';
  8169. this.div.style.top = -parseInt(this.map.layerContainerDiv.style.top) + 'px';
  8170. /*this.canvas.style.left = this.div.style.left;
  8171. this.canvas.style.top = this.div.style.top;*/
  8172. var size = this.map.getSize();
  8173. this.div.style.width = parseInt(size.w) + 'px';
  8174. this.div.style.height = parseInt(size.h) + 'px';
  8175. this.canvas.width = parseInt(size.w);
  8176. this.canvas.height = parseInt(size.h);
  8177. this.canvas.style.width = this.div.style.width;
  8178. this.canvas.style.height = this.div.style.height;
  8179. this.maxWidth = size.w;
  8180. this.maxHeight = size.h;
  8181. this.div.style.visibility = '';
  8182. if (!zoomChanged) {
  8183. this.renderer && this.renderer.render();
  8184. }
  8185. }
  8186. if (zoomChanged) {
  8187. this.renderer && this.renderer.render();
  8188. }
  8189. }
  8190. /**
  8191. * @function SuperMap.Layer.MapVLayer.prototype.transferToMapLatLng
  8192. * @description 将经纬度转成底图的投影坐标。
  8193. * @param {SuperMap.Lonlat} latLng - 经纬度坐标。
  8194. * @deprecated
  8195. */
  8196. transferToMapLatLng(latLng) {
  8197. var source = 'EPSG:4326',
  8198. dest = 'EPSG:4326';
  8199. var unit = this.map.getUnits() || 'degree';
  8200. if (['m', 'meter'].indexOf(unit.toLowerCase()) > -1) {
  8201. dest = 'EPSG:3857';
  8202. }
  8203. return new SuperMap_SuperMap.LonLat(latLng.lon, latLng.lat).transform(source, dest);
  8204. }
  8205. }
  8206. SuperMap_SuperMap.Layer.MapVLayer = MapVLayer_MapVLayer;
  8207. // CONCATENATED MODULE: ./src/classic/overlay/mapv/index.js
  8208. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8209. * This program are made available under the terms of the Apache License, Version 2.0
  8210. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8211. // CONCATENATED MODULE: ./src/classic/overlay/index.js
  8212. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8213. * This program are made available under the terms of the Apache License, Version 2.0
  8214. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8215. // CONCATENATED MODULE: ./src/common/commontypes/Credential.js
  8216. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8217. * This program are made available under the terms of the Apache License, Version 2.0
  8218. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8219. /**
  8220. * @class SuperMap.Credential
  8221. * @category Security
  8222. * @classdesc SuperMap 的安全证书类,其中包括 token 等安全验证信息。</br>
  8223. * 需要使用用户名和密码在:"http://localhost:8090/iserver/services/security/tokens" 下申请 value。</br>
  8224. * 获得形如:"2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ.." 的 value。</br>
  8225. * 目前支持的功能包括:地图服务、专题图、量算、查询、公交换乘、空间分析、网络分析,不支持轮询功能。</br>
  8226. * @param {string} value - 访问受安全限制的服务时用于通过安全认证的验证信息。
  8227. * @param {string} [name='token'] - 验证信息前缀,name=value 部分的 name 部分。
  8228. * @example
  8229. * var pixcel = new SuperMap.Credential("valueString","token");
  8230. * pixcel.destroy();
  8231. */
  8232. class Credential {
  8233. constructor(value, name) {
  8234. /**
  8235. * @member {string} SuperMap.Bounds.prototype.value
  8236. * @description 访问受安全限制的服务时用于通过安全认证的验证信息。
  8237. */
  8238. this.value = value ? value : "";
  8239. /**
  8240. * @member {string} [SuperMap.Bounds.prototype.name='token']
  8241. * @description 验证信息前缀,name=value 部分的 name 部分。
  8242. */
  8243. this.name = name ? name : "token";
  8244. this.CLASS_NAME = "SuperMap.Credential";
  8245. }
  8246. /**
  8247. * @function SuperMap.Credential.prototype.getUrlParameters
  8248. * @example
  8249. * var credential = new SuperMap.Credential("valueString","token");
  8250. * //这里 str = "token=valueString";
  8251. * var str = credential.getUrlParameters();
  8252. * @returns {string} 返回安全信息组成的 url 片段。
  8253. */
  8254. getUrlParameters() {
  8255. //当需要其他安全信息的时候,则需要return this.name + "=" + this.value + "&" + "...";的形式添加。
  8256. return this.name + "=" + this.value;
  8257. }
  8258. /**
  8259. * @function SuperMap.Bounds.prototype.getValue
  8260. * @description 获取 value。
  8261. * @example
  8262. * var credential = new SuperMap.Credential("2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..","token");
  8263. * //这里 str = "2OMwGmcNlrP2ixqv1Mk4BuQMybOGfLOrljruX6VcYMDQKc58Sl9nMHsqQaqeBx44jRvKSjkmpZKK1L596y7skQ..";
  8264. * var str = credential.getValue();
  8265. * @returns {string} 返回 value 字符串,在 iServer 服务下该 value 值即为 token 值。
  8266. */
  8267. getValue() {
  8268. return this.value;
  8269. }
  8270. /**
  8271. *
  8272. * @function SuperMap.Credential.prototype.destroy
  8273. * @description 销毁此对象。销毁后此对象的所有属性为 null,而不是初始值。
  8274. * @example
  8275. * var credential = new SuperMap.Credential("valueString","token");
  8276. * credential.destroy();
  8277. */
  8278. destroy() {
  8279. this.value = null;
  8280. this.name = null;
  8281. }
  8282. }
  8283. /**
  8284. * @member {SuperMap.Credential} SuperMap.Credential.CREDENTIAL
  8285. * @description 这个对象保存一个安全类的实例,在服务端需要安全验证的时候必须进行设置。
  8286. * @constant
  8287. * @example
  8288. * 代码实例:
  8289. * // 当iServer启用服务安全的时候,下边的代码是必须的。安全证书类能够接收一个value和一个name参数。
  8290. * var value = "(以iServer为例,这里是申请的token值)";
  8291. * var name = "token";
  8292. * // 默认name参数为token,所以当使用iServer服务的时候可以不进行设置。
  8293. * SuperMap.Credential.CREDENTIAL = new SuperMap.Credential(value, name);
  8294. *
  8295. */
  8296. Credential.CREDENTIAL = null;
  8297. SuperMap.Credential = Credential;
  8298. // CONCATENATED MODULE: ./src/common/format/Format.js
  8299. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8300. * This program are made available under the terms of the Apache License, Version 2.0
  8301. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8302. /**
  8303. * @class SuperMap.Format
  8304. * @classdesc 读写各种格式的格式类基类。其子类应该包含并实现 read 和 write 方法。
  8305. * @category BaseTypes Format
  8306. * @param {Object} options - 可选参数。
  8307. * @param {boolean} [options.keepData=false] - 如果设置为 true, data 属性会指向被解析的对象(例如 JSON 或 xml 数据对象)。
  8308. * @param {Object} [options.data] - 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8309. */
  8310. class Format_Format {
  8311. constructor(options) {
  8312. /**
  8313. * @member {Object} SuperMap.Format.prototype.data
  8314. * @description 当 keepData 属性设置为 true,这是传递给 read 操作的要被解析的字符串。
  8315. */
  8316. this.data = null;
  8317. /**
  8318. * APIProperty: keepData
  8319. * @member {Object} [SuperMap.Format.prototype.keepData=false]
  8320. * @description 保持最近读到的数据的引用(通过 <data> 属性)。
  8321. */
  8322. this.keepData = false;
  8323. Util.extend(this, options);
  8324. this.options = options;
  8325. this.CLASS_NAME = "SuperMap.Format";
  8326. }
  8327. /**
  8328. * @function SuperMap.Format.prototype.destroy
  8329. * @description 销毁该格式类,释放相关资源。
  8330. */
  8331. destroy() {
  8332. //用来销毁该格式类,释放相关资源
  8333. }
  8334. /**
  8335. * @function SuperMap.Format.prototype.read
  8336. * @description 来从字符串中读取数据。
  8337. * @param {string} data - 读取的数据。
  8338. */
  8339. read(data) { // eslint-disable-line no-unused-vars
  8340. //用来从字符串中读取数据
  8341. }
  8342. /**
  8343. * @function SuperMap.Format.prototype.write
  8344. * @description 将对象写成字符串。
  8345. * @param {Object} object - 可序列化的对象。
  8346. * @returns {string} 对象被写成字符串。
  8347. */
  8348. write(object) { // eslint-disable-line no-unused-vars
  8349. //用来写字符串
  8350. }
  8351. }
  8352. SuperMap.Format = SuperMap.Format || Format_Format;
  8353. // CONCATENATED MODULE: ./src/common/format/JSON.js
  8354. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8355. * This program are made available under the terms of the Apache License, Version 2.0
  8356. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8357. /**
  8358. * @class SuperMap.Format.JSON
  8359. * @classdesc 安全的读写 JSON 的解析类。使用 {@link SuperMap.Format.JSON} 构造函数创建新实例。
  8360. * @category BaseTypes Format
  8361. * @param {Object} [options] - 参数。
  8362. * @param {string} [options.indent=" "] - 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8363. * @param {string} [options.space=" "] - 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8364. * @param {string} [options.newline="\n"] - 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8365. * @param {number} [options.level=0] - 用于格式化输出, 表示的是缩进级别。
  8366. * @param {boolean} [options.pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8367. * @param {boolean} [options.nativeJSON] - 需要被注册的监听器对象。
  8368. * @extends {SuperMap.Format}
  8369. */
  8370. class JSON_JSONFormat extends Format_Format {
  8371. constructor(options) {
  8372. super(options);
  8373. /**
  8374. * @member {string} [SuperMap.Format.JSON.prototype.indent=" "]
  8375. * @description 用于格式化输出,indent 字符串会在每次缩进的时候使用一次。
  8376. */
  8377. this.indent = " ";
  8378. /**
  8379. * @member {string} [SuperMap.Format.JSON.prototype.space=" "]
  8380. * @description 用于格式化输出,space 字符串会在名值对的 ":" 后边添加。
  8381. */
  8382. this.space = " ";
  8383. /**
  8384. * @member {string} [SuperMap.Format.JSON.prototype.newline="\n"]
  8385. * @description 用于格式化输出, newline 字符串会用在每一个名值对或数组项末尾。
  8386. */
  8387. this.newline = "\n";
  8388. /**
  8389. * @member {integer} [SuperMap.Format.JSON.prototype.level=0]
  8390. * @description 用于格式化输出, 表示的是缩进级别。
  8391. */
  8392. this.level = 0;
  8393. /**
  8394. * @member {boolean} [SuperMap.Format.JSON.prototype.pretty=false]
  8395. * @description 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8396. */
  8397. this.pretty = false;
  8398. /**
  8399. * @member {boolean} SuperMap.Format.JSON.prototype.nativeJSON
  8400. * @description 判断浏览器是否原生支持 JSON 格式数据。
  8401. */
  8402. this.nativeJSON = (function () {
  8403. return !!(window.JSON && typeof JSON.parse === "function" && typeof JSON.stringify === "function");
  8404. })();
  8405. this.CLASS_NAME = "SuperMap.Format.JSON";
  8406. /**
  8407. * @member SuperMap.Format.JSON.prototype.serialize
  8408. * @description 提供一些类型对象转 JSON 字符串的方法。
  8409. */
  8410. this.serialize = {
  8411. /**
  8412. * @function SuperMap.Format.JSON.serialize.object
  8413. * @description 把对象转换为 JSON 字符串。
  8414. * @param {Object} object - 可序列化的对象。
  8415. * @returns {string} JSON 字符串。
  8416. */
  8417. 'object': function (object) {
  8418. // three special objects that we want to treat differently
  8419. if (object == null) {
  8420. return "null";
  8421. }
  8422. if (object.constructor === Date) {
  8423. return this.serialize.date.apply(this, [object]);
  8424. }
  8425. if (object.constructor === Array) {
  8426. return this.serialize.array.apply(this, [object]);
  8427. }
  8428. var pieces = ['{'];
  8429. this.level += 1;
  8430. var key, keyJSON, valueJSON;
  8431. var addComma = false;
  8432. for (key in object) {
  8433. if (object.hasOwnProperty(key)) {
  8434. // recursive calls need to allow for sub-classing
  8435. keyJSON = this.write.apply(this,
  8436. [key, this.pretty]);
  8437. valueJSON = this.write.apply(this,
  8438. [object[key], this.pretty]);
  8439. if (keyJSON != null && valueJSON != null) {
  8440. if (addComma) {
  8441. pieces.push(',');
  8442. }
  8443. pieces.push(this.writeNewline(), this.writeIndent(),
  8444. keyJSON, ':', this.writeSpace(), valueJSON);
  8445. addComma = true;
  8446. }
  8447. }
  8448. }
  8449. this.level -= 1;
  8450. pieces.push(this.writeNewline(), this.writeIndent(), '}');
  8451. return pieces.join('');
  8452. },
  8453. /**
  8454. * @function SuperMap.Format.JSON.serialize.array
  8455. * @description 把数组转换成 JSON 字符串。
  8456. * @param {Array} array - 可序列化的数组。
  8457. * @returns {string} JSON 字符串。
  8458. */
  8459. 'array': function (array) {
  8460. var json;
  8461. var pieces = ['['];
  8462. this.level += 1;
  8463. for (var i = 0, len = array.length; i < len; ++i) {
  8464. // recursive calls need to allow for sub-classing
  8465. json = this.write.apply(this,
  8466. [array[i], this.pretty]);
  8467. if (json != null) {
  8468. if (i > 0) {
  8469. pieces.push(',');
  8470. }
  8471. pieces.push(this.writeNewline(), this.writeIndent(), json);
  8472. }
  8473. }
  8474. this.level -= 1;
  8475. pieces.push(this.writeNewline(), this.writeIndent(), ']');
  8476. return pieces.join('');
  8477. },
  8478. /**
  8479. * @function SuperMap.Format.JSON.serialize.string
  8480. * @description 把字符串转换成 JSON 字符串。
  8481. * @param {string} string - 可序列化的字符串。
  8482. * @returns {string} JSON 字符串。
  8483. */
  8484. 'string': function (string) {
  8485. // If the string contains no control characters, no quote characters, and no
  8486. // backslash characters, then we can simply slap some quotes around it.
  8487. // Otherwise we must also replace the offending characters with safe
  8488. // sequences.
  8489. var m = {
  8490. '\b': '\\b',
  8491. '\t': '\\t',
  8492. '\n': '\\n',
  8493. '\f': '\\f',
  8494. '\r': '\\r',
  8495. '"': '\\"',
  8496. '\\': '\\\\'
  8497. };
  8498. /*eslint-disable no-control-regex*/
  8499. if (/["\\\x00-\x1f]/.test(string)) {
  8500. return '"' + string.replace(/([\x00-\x1f\\"])/g, function (a, b) {
  8501. var c = m[b];
  8502. if (c) {
  8503. return c;
  8504. }
  8505. c = b.charCodeAt();
  8506. return '\\u00' +
  8507. Math.floor(c / 16).toString(16) +
  8508. (c % 16).toString(16);
  8509. }) + '"';
  8510. }
  8511. return '"' + string + '"';
  8512. },
  8513. /**
  8514. * @function SuperMap.Format.JSON.serialize.number
  8515. * @description 把数字转换成 JSON 字符串。
  8516. * @param {number} number - 可序列化的数字。
  8517. * @returns {string} JSON 字符串。
  8518. */
  8519. 'number': function (number) {
  8520. return isFinite(number) ? String(number) : "null";
  8521. },
  8522. /**
  8523. * @function SuperMap.Format.JSON.serialize.boolean
  8524. * @description Transform a boolean into a JSON string.
  8525. * @param {boolean} bool - The boolean to be serialized.
  8526. * @returns {string} A JSON string representing the boolean.
  8527. */
  8528. 'boolean': function (bool) {
  8529. return String(bool);
  8530. },
  8531. /**
  8532. * @function SuperMap.Format.JSON.serialize.object
  8533. * @description 将日期对象转换成 JSON 字符串。
  8534. * @param {Date} date - 可序列化的日期对象。
  8535. * @returns {string} JSON 字符串。
  8536. */
  8537. 'date': function (date) {
  8538. function format(number) {
  8539. // Format integers to have at least two digits.
  8540. return (number < 10) ? '0' + number : number;
  8541. }
  8542. return '"' + date.getFullYear() + '-' +
  8543. format(date.getMonth() + 1) + '-' +
  8544. format(date.getDate()) + 'T' +
  8545. format(date.getHours()) + ':' +
  8546. format(date.getMinutes()) + ':' +
  8547. format(date.getSeconds()) + '"';
  8548. }
  8549. };
  8550. }
  8551. /**
  8552. * @function SuperMap.Format.JSON.prototype.read
  8553. * @description 将一个符合 JSON 结构的字符串进行解析。
  8554. * @param {string} json - 符合 JSON 结构的字符串。
  8555. * @param {function} filter - 过滤方法,最终结果的每一个键值对都会调用该过滤方法,并在对应的值的位置替换成该方法返回的值。
  8556. * @returns {Object} 对象,数组,字符串或数字。
  8557. */
  8558. read(json, filter) {
  8559. var object;
  8560. if (this.nativeJSON) {
  8561. try {
  8562. object = JSON.parse(json, filter);
  8563. } catch (e) {
  8564. // Fall through if the regexp test fails.
  8565. }
  8566. }
  8567. if (this.keepData) {
  8568. this.data = object;
  8569. }
  8570. return object;
  8571. }
  8572. /**
  8573. * @function SuperMap.Format.JSON.prototype.write
  8574. * @description 序列化一个对象到一个符合 JSON 格式的字符串。
  8575. * @param {(object|string|Array|number|boolean)} value - 需要被序列化的对象,数组,字符串,数字,布尔值。
  8576. * @param {boolean} [pretty=false] - 是否在序列化的时候使用额外的空格控制结构。在 write 方法中使用。
  8577. * @returns {string} 符合 JSON 格式的字符串。
  8578. *
  8579. */
  8580. write(value, pretty) {
  8581. this.pretty = !!pretty;
  8582. var json = null;
  8583. var type = typeof value;
  8584. if (this.serialize[type]) {
  8585. try {
  8586. json = (!this.pretty && this.nativeJSON) ?
  8587. JSON.stringify(value) :
  8588. this.serialize[type].apply(this, [value]);
  8589. } catch (err) {
  8590. //SuperMap.Console.error("Trouble serializing: " + err);
  8591. }
  8592. }
  8593. return json;
  8594. }
  8595. /**
  8596. * @function SuperMap.Format.JSON.prototype.writeIndent
  8597. * @description 根据缩进级别输出一个缩进字符串。
  8598. * @private
  8599. * @returns {string} 一个适当的缩进字符串。
  8600. */
  8601. writeIndent() {
  8602. var pieces = [];
  8603. if (this.pretty) {
  8604. for (var i = 0; i < this.level; ++i) {
  8605. pieces.push(this.indent);
  8606. }
  8607. }
  8608. return pieces.join('');
  8609. }
  8610. /**
  8611. * @function SuperMap.Format.JSON.prototype.writeNewline
  8612. * @description 在格式化输出模式情况下输出代表新一行的字符串。
  8613. * @private
  8614. * @returns {string} 代表新的一行的字符串。
  8615. */
  8616. writeNewline() {
  8617. return (this.pretty) ? this.newline : '';
  8618. }
  8619. /**
  8620. * @function SuperMap.Format.JSON.prototype.writeSpace
  8621. * @private
  8622. * @description 在格式化输出模式情况下输出一个代表空格的字符串。
  8623. * @returns {string} 一个空格。
  8624. */
  8625. writeSpace() {
  8626. return (this.pretty) ? this.space : '';
  8627. }
  8628. }
  8629. SuperMap.Format.JSON = JSON_JSONFormat;
  8630. // CONCATENATED MODULE: ./src/common/iServer/CommonServiceBase.js
  8631. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8632. * This program are made available under the terms of the Apache License, Version 2.0
  8633. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8634. /**
  8635. * @class SuperMap.CommonServiceBase
  8636. * @category iServer
  8637. * @classdesc 对接 iServer 各种服务的 Service 的基类。
  8638. * @param {string} url - 服务地址。
  8639. * @param {Object} options - 参数。
  8640. * @param {Object} options.eventListeners - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  8641. * @param {string} [options.proxy] - 服务代理地址。
  8642. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  8643. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  8644. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8645. * @param {Object} [options.headers] - 请求头。
  8646. */
  8647. class CommonServiceBase_CommonServiceBase {
  8648. constructor(url, options) {
  8649. let me = this;
  8650. this.EVENT_TYPES = ["processCompleted", "processFailed"];
  8651. this.events = null;
  8652. this.eventListeners = null;
  8653. this.url = null;
  8654. this.urls = null;
  8655. this.proxy = null;
  8656. this.serverType = null;
  8657. this.index = null;
  8658. this.length = null;
  8659. this.options = null;
  8660. this.totalTimes = null;
  8661. this.POLLING_TIMES = 3;
  8662. this._processSuccess = null;
  8663. this._processFailed = null;
  8664. this.isInTheSameDomain = null;
  8665. this.withCredentials = false;
  8666. if (Util.isArray(url)) {
  8667. me.urls = url;
  8668. me.length = url.length;
  8669. me.totalTimes = me.length;
  8670. if (me.length === 1) {
  8671. me.url = url[0];
  8672. } else {
  8673. me.index = parseInt(Math.random() * me.length);
  8674. me.url = url[me.index];
  8675. }
  8676. } else {
  8677. me.totalTimes = 1;
  8678. me.url = url;
  8679. }
  8680. if (Util.isArray(url) && !me.isServiceSupportPolling()) {
  8681. me.url = url[0];
  8682. me.totalTimes = 1;
  8683. }
  8684. me.serverType = me.serverType || ServerType.ISERVER;
  8685. options = options || {};
  8686. this.crossOrigin = options.crossOrigin;
  8687. this.headers = options.headers;
  8688. Util.extend(this, options);
  8689. me.isInTheSameDomain = Util.isInTheSameDomain(me.url);
  8690. me.events = new Events_Events(me, null, me.EVENT_TYPES, true);
  8691. if (me.eventListeners instanceof Object) {
  8692. me.events.on(me.eventListeners);
  8693. }
  8694. this.CLASS_NAME = "SuperMap.CommonServiceBase";
  8695. }
  8696. /**
  8697. * @function SuperMap.CommonServiceBase.prototype.destroy
  8698. * @description 释放资源,将引用的资源属性置空。
  8699. */
  8700. destroy() {
  8701. let me = this;
  8702. if (Util.isArray(me.urls)) {
  8703. me.urls = null;
  8704. me.index = null;
  8705. me.length = null;
  8706. me.totalTimes = null;
  8707. }
  8708. me.url = null;
  8709. me.options = null;
  8710. me._processSuccess = null;
  8711. me._processFailed = null;
  8712. me.isInTheSameDomain = null;
  8713. me.EVENT_TYPES = null;
  8714. if (me.events) {
  8715. me.events.destroy();
  8716. me.events = null;
  8717. }
  8718. if (me.eventListeners) {
  8719. me.eventListeners = null;
  8720. }
  8721. }
  8722. /**
  8723. * @function SuperMap.CommonServiceBase.prototype.request
  8724. * @description: 该方法用于向服务发送请求。
  8725. * @param {Object} options - 参数。
  8726. * @param {string} [options.method='GET'] - 请求方式,包括 "GET","POST","PUT","DELETE"。
  8727. * @param {string} [options.url] - 发送请求的地址。
  8728. * @param {Object} [options.params] - 作为查询字符串添加到 URL 中的一组键值对,此参数只适用于 GET 方式发送的请求。
  8729. * @param {string} [options.data] - 发送到服务器的数据。
  8730. * @param {function} options.success - 请求成功后的回调函数。
  8731. * @param {function} options.failure - 请求失败后的回调函数。
  8732. * @param {Object} [options.scope] - 如果回调函数是对象的一个公共方法,设定该对象的范围。
  8733. * @param {boolean} [options.isInTheSameDomain] - 请求是否在当前域中。
  8734. * @param {boolean} [options.withCredentials=false] - 请求是否携带 cookie。
  8735. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8736. * @param {Object} [options.headers] - 请求头。
  8737. */
  8738. request(options) {
  8739. let me = this;
  8740. options.url = options.url || me.url;
  8741. options.proxy = options.proxy || me.proxy;
  8742. options.withCredentials = options.withCredentials != undefined ? options.withCredentials : me.withCredentials;
  8743. options.crossOrigin = options.crossOrigin != undefined ? options.crossOrigin : me.crossOrigin;
  8744. options.headers = options.headers || me.headers;
  8745. options.isInTheSameDomain = me.isInTheSameDomain;
  8746. //为url添加安全认证信息片段
  8747. let credential = this.getCredential(options.url);
  8748. if (credential) {
  8749. options.url = Util.urlAppend(options.url, credential.getUrlParameters());
  8750. }
  8751. me.calculatePollingTimes();
  8752. me._processSuccess = options.success;
  8753. me._processFailed = options.failure;
  8754. options.scope = me;
  8755. options.success = me.getUrlCompleted;
  8756. options.failure = me.getUrlFailed;
  8757. me.options = options;
  8758. me._commit(me.options);
  8759. }
  8760. /**
  8761. * @function SuperMap.CommonServiceBase.prototype.getCredential
  8762. * @description 获取凭据信息
  8763. * @param {string} url - 服务地址。
  8764. * @returns {SuperMap.Credential} 凭据信息对象。
  8765. */
  8766. getCredential(url) {
  8767. let keyUrl = url,
  8768. credential, value;
  8769. switch (this.serverType) {
  8770. case ServerType.IPORTAL:
  8771. value = SecurityManager_SecurityManager.getToken(keyUrl);
  8772. credential = value ? new Credential(value, "token") : null;
  8773. if (!credential) {
  8774. value = SecurityManager_SecurityManager.getKey(keyUrl);
  8775. credential = value ? new Credential(value, "key") : null;
  8776. }
  8777. break;
  8778. case ServerType.ONLINE:
  8779. value = SecurityManager_SecurityManager.getKey(keyUrl);
  8780. credential = value ? new Credential(value, "key") : null;
  8781. break;
  8782. default:
  8783. //iServer or others
  8784. value = SecurityManager_SecurityManager.getToken(keyUrl);
  8785. credential = value ? new Credential(value, "token") : null;
  8786. break;
  8787. }
  8788. return credential;
  8789. }
  8790. /**
  8791. * @function SuperMap.CommonServiceBase.prototype.getUrlCompleted
  8792. * @description 请求成功后执行此方法。
  8793. * @param {Object} result - 服务器返回的结果对象。
  8794. */
  8795. getUrlCompleted(result) {
  8796. let me = this;
  8797. me._processSuccess(result);
  8798. }
  8799. /**
  8800. * @function SuperMap.CommonServiceBase.prototype.getUrlFailed
  8801. * @description 请求失败后执行此方法。
  8802. * @param {Object} result - 服务器返回的结果对象。
  8803. */
  8804. getUrlFailed(result) {
  8805. let me = this;
  8806. if (me.totalTimes > 0) {
  8807. me.totalTimes--;
  8808. me.ajaxPolling();
  8809. } else {
  8810. me._processFailed(result);
  8811. }
  8812. }
  8813. /**
  8814. *
  8815. * @function SuperMap.CommonServiceBase.prototype.ajaxPolling
  8816. * @description 请求失败后,如果剩余请求失败次数不为 0,重新获取 URL 发送请求
  8817. */
  8818. ajaxPolling() {
  8819. let me = this,
  8820. url = me.options.url,
  8821. re = /^http:\/\/([a-z]{9}|(\d+\.){3}\d+):\d{0,4}/;
  8822. me.index = parseInt(Math.random() * me.length);
  8823. me.url = me.urls[me.index];
  8824. url = url.replace(re, re.exec(me.url)[0]);
  8825. me.options.url = url;
  8826. me.options.isInTheSameDomain = Util.isInTheSameDomain(url);
  8827. me._commit(me.options);
  8828. }
  8829. /**
  8830. * @function SuperMap.CommonServiceBase.prototype.calculatePollingTimes
  8831. * @description 计算剩余请求失败执行次数。
  8832. */
  8833. calculatePollingTimes() {
  8834. let me = this;
  8835. if (me.times) {
  8836. if (me.totalTimes > me.POLLING_TIMES) {
  8837. if (me.times > me.POLLING_TIMES) {
  8838. me.totalTimes = me.POLLING_TIMES;
  8839. } else {
  8840. me.totalTimes = me.times;
  8841. }
  8842. } else {
  8843. if (me.times < me.totalTimes) {
  8844. me.totalTimes = me.times;
  8845. }
  8846. }
  8847. } else {
  8848. if (me.totalTimes > me.POLLING_TIMES) {
  8849. me.totalTimes = me.POLLING_TIMES;
  8850. }
  8851. }
  8852. me.totalTimes--;
  8853. }
  8854. /**
  8855. * @function SuperMap.CommonServiceBase.prototype.isServiceSupportPolling
  8856. * @description 判断服务是否支持轮询。
  8857. */
  8858. isServiceSupportPolling() {
  8859. let me = this;
  8860. return !(
  8861. me.CLASS_NAME === "SuperMap.REST.ThemeService" ||
  8862. me.CLASS_NAME === "SuperMap.REST.EditFeaturesService"
  8863. );
  8864. }
  8865. /**
  8866. * @function SuperMap.CommonServiceBase.prototype.serviceProcessCompleted
  8867. * @description 状态完成,执行此方法。
  8868. * @param {Object} result - 服务器返回的结果对象。
  8869. */
  8870. serviceProcessCompleted(result) {
  8871. result = Util.transformResult(result);
  8872. this.events.triggerEvent("processCompleted", {
  8873. result: result
  8874. });
  8875. }
  8876. /**
  8877. * @function SuperMap.CommonServiceBase.prototype.serviceProcessFailed
  8878. * @description 状态失败,执行此方法。
  8879. * @param {Object} result - 服务器返回的结果对象。
  8880. */
  8881. serviceProcessFailed(result) {
  8882. result = Util.transformResult(result);
  8883. let error = result.error || result;
  8884. this.events.triggerEvent("processFailed", {
  8885. error: error
  8886. });
  8887. }
  8888. _commit(options) {
  8889. if (options.method === "POST" || options.method === "PUT") {
  8890. if (options.params) {
  8891. options.url = Util.urlAppend(options.url,
  8892. Util.getParameterString(options.params || {}));
  8893. }
  8894. options.params = options.data;
  8895. }
  8896. FetchRequest.commit(options.method, options.url, options.params, {
  8897. headers: options.headers,
  8898. withCredentials: options.withCredentials,
  8899. crossOrigin: options.crossOrigin,
  8900. timeout: options.async ? 0 : null,
  8901. proxy: options.proxy
  8902. }).then(function (response) {
  8903. if (response.text) {
  8904. return response.text();
  8905. }
  8906. if (response.json) {
  8907. return response.json();
  8908. }
  8909. return response;
  8910. }).then(function (text) {
  8911. var result = text;
  8912. if (typeof text === "string") {
  8913. result = new JSON_JSONFormat().read(text);
  8914. }
  8915. if (!result || result.error || result.code >= 300 && result.code !== 304) {
  8916. if (result && result.error) {
  8917. result = {
  8918. error: result.error
  8919. };
  8920. } else {
  8921. result = {
  8922. error: result
  8923. };
  8924. }
  8925. }
  8926. if (result.error) {
  8927. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  8928. failure(result);
  8929. } else {
  8930. result.succeed = result.succeed == undefined ? true : result.succeed;
  8931. var success = (options.scope) ? FunctionExt.bind(options.success, options.scope) : options.success;
  8932. success(result);
  8933. }
  8934. }).catch(function (e) {
  8935. var failure = (options.scope) ? FunctionExt.bind(options.failure, options.scope) : options.failure;
  8936. failure(e);
  8937. })
  8938. }
  8939. }
  8940. SuperMap.CommonServiceBase = CommonServiceBase_CommonServiceBase;
  8941. /**
  8942. * 服务器请求回调函数
  8943. * @callback RequestCallback
  8944. * @example
  8945. * var requestCallback = function (serviceResult){
  8946. * console.log(serviceResult.result);
  8947. * }
  8948. * new QueryService(url).queryByBounds(param, requestCallback);
  8949. * @param {Object} serviceResult
  8950. * @param {Object} serviceResult.result 服务器返回结果。
  8951. * @param {Object} serviceResult.object 发布应用程序事件的对象。
  8952. * @param {Object} serviceResult.type 事件类型。
  8953. * @param {Object} serviceResult.element 接受浏览器事件的 DOM 节点。
  8954. */
  8955. // CONCATENATED MODULE: ./src/common/iServer/AddressMatchService.js
  8956. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  8957. * This program are made available under the terms of the Apache License, Version 2.0
  8958. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  8959. /**
  8960. * @class SuperMap.AddressMatchService
  8961. * @category iServer AddressMatch
  8962. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  8963. * @param {string} url - 地址匹配服务地址。
  8964. * @param {Object} options - 参数。
  8965. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  8966. * @param {Object} [options.headers] - 请求头。
  8967. */
  8968. class AddressMatchService_AddressMatchService extends CommonServiceBase_CommonServiceBase {
  8969. constructor(url, options) {
  8970. super(url, options);
  8971. this.options = options || {};
  8972. this.CLASS_NAME = 'SuperMap.AddressMatchService';
  8973. }
  8974. /**
  8975. * @function SuperMap.AddressMatchService.prototype.destroy
  8976. * @override
  8977. */
  8978. destroy() {
  8979. super.destroy();
  8980. }
  8981. /**
  8982. * @function SuperMap.AddressMatchService.prototype.code
  8983. * @param {string} url - 正向地址匹配服务地址。
  8984. * @param {SuperMap.GeoCodingParameter} params - 正向地址匹配服务参数。
  8985. */
  8986. code(url, params) {
  8987. if (!(params instanceof GeoCodingParameter_GeoCodingParameter)) {
  8988. return;
  8989. }
  8990. this.processAsync(url, params);
  8991. }
  8992. /**
  8993. * @function SuperMap.AddressMatchService.prototype.decode
  8994. * @param {string} url - 反向地址匹配服务地址。
  8995. * @param {SuperMap.GeoDecodingParameter} params - 反向地址匹配服务参数。
  8996. */
  8997. decode(url, params) {
  8998. if (!(params instanceof GeoDecodingParameter_GeoDecodingParameter)) {
  8999. return;
  9000. }
  9001. this.processAsync(url, params);
  9002. }
  9003. /**
  9004. * @function SuperMap.AddressMatchService.prototype.processAsync
  9005. * @description 负责将客户端的动态分段服务参数传递到服务端。
  9006. * @param {string} url - 服务地址。
  9007. * @param {Object} params - 参数。
  9008. */
  9009. processAsync(url, params) {
  9010. this.request({
  9011. method: 'GET',
  9012. url,
  9013. params,
  9014. scope: this,
  9015. success: this.serviceProcessCompleted,
  9016. failure: this.serviceProcessFailed
  9017. });
  9018. }
  9019. /**
  9020. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  9021. * @param {Object} result - 服务器返回的结果对象。
  9022. * @description 服务流程是否完成
  9023. */
  9024. serviceProcessCompleted(result) {
  9025. if (result.succeed) {
  9026. delete result.succeed;
  9027. }
  9028. super.serviceProcessCompleted(result);
  9029. }
  9030. /**
  9031. * @function SuperMap.AddressMatchService.prototype.serviceProcessCompleted
  9032. * @param {Object} result - 服务器返回的结果对象。
  9033. * @description 服务流程是否失败
  9034. */
  9035. serviceProcessFailed(result) {
  9036. super.serviceProcessFailed(result);
  9037. }
  9038. }
  9039. SuperMap.AddressMatchService = AddressMatchService_AddressMatchService;
  9040. // CONCATENATED MODULE: ./src/classic/services/AddressMatchService.js
  9041. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9042. * This program are made available under the terms of the Apache License, Version 2.0
  9043. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9044. /**
  9045. * @class SuperMap.REST.AddressMatchService
  9046. * @category iServer AddressMatch
  9047. * @classdesc 地址匹配服务,包括正向匹配和反向匹配。
  9048. * @extends {SuperMap.CommonServiceBase}
  9049. * @param {string} url - 服务地址。
  9050. * @param {Object} options - 参数。
  9051. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9052. * @param {Object} [options.headers] - 请求头。
  9053. */
  9054. class services_AddressMatchService_AddressMatchService extends CommonServiceBase_CommonServiceBase {
  9055. constructor(url, options) {
  9056. super(url, options);
  9057. this.CLASS_NAME = "SuperMap.REST.AddressMatchService";
  9058. }
  9059. /**
  9060. * @function SuperMap.REST.AddressMatchService.prototype.code
  9061. * @description 正向匹配。
  9062. * @param {SuperMap.GeoCodingParameter} params - 正向匹配参数。
  9063. * @param {RequestCallback} callback - 回调函数。
  9064. */
  9065. code(params, callback) {
  9066. var me = this;
  9067. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  9068. headers: me.headers,
  9069. proxy: me.proxy,
  9070. withCredentials: me.withCredentials,
  9071. crossOrigin: me.crossOrigin,
  9072. serverType: me.serverType,
  9073. eventListeners: {
  9074. scope: me,
  9075. processCompleted: callback,
  9076. processFailed: callback
  9077. }
  9078. });
  9079. addressMatchService.code(me.url + '/geocoding', params);
  9080. }
  9081. /**
  9082. * @function SuperMap.REST.AddressMatchService.prototype.decode
  9083. * @description 反向匹配。
  9084. * @param {SuperMap.GeoDecodingParameter} params - 反向匹配参数。
  9085. * @param {RequestCallback} callback - 回调函数。
  9086. */
  9087. decode(params, callback) {
  9088. var me = this;
  9089. var addressMatchService = new AddressMatchService_AddressMatchService(me.url, {
  9090. headers: me.headers,
  9091. proxy: me.proxy,
  9092. withCredentials: me.withCredentials,
  9093. crossOrigin: me.crossOrigin,
  9094. serverType: me.serverType,
  9095. eventListeners: {
  9096. scope: me,
  9097. processCompleted: callback,
  9098. processFailed: callback
  9099. }
  9100. });
  9101. addressMatchService.decode(me.url + '/geodecoding', params);
  9102. }
  9103. }
  9104. SuperMap_SuperMap.REST.AddressMatchService = services_AddressMatchService_AddressMatchService;
  9105. // CONCATENATED MODULE: ./src/common/iServer/ProcessingServiceBase.js
  9106. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9107. * This program are made available under the terms of the Apache License, Version 2.0
  9108. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9109. /**
  9110. * @class SuperMap.ProcessingServiceBase
  9111. * @category iServer ProcessingService
  9112. * @classdesc 分布式分析服务基类
  9113. * @extends {SuperMap.CommonServiceBase}
  9114. * @param {string} url - 分布式分析服务地址。
  9115. * @param {Object} options - 参数。
  9116. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  9117. * @param {number} options.index - 服务访问地址在数组中的位置。
  9118. * @param {number} options.length - 服务访问地址数组长度。
  9119. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  9120. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  9121. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9122. * @param {Object} [options.headers] - 请求头。
  9123. */
  9124. class ProcessingServiceBase_ProcessingServiceBase extends CommonServiceBase_CommonServiceBase {
  9125. constructor(url, options) {
  9126. options = options || {};
  9127. /*
  9128. * Constant: EVENT_TYPES
  9129. * {Array.<string>}
  9130. * 此类支持的事件类型
  9131. * - *processCompleted* 创建成功后触发的事件。
  9132. * - *processFailed* 创建失败后触发的事件 。
  9133. * - *processRunning* 创建过程的整个阶段都会触发的事件,用于获取创建过程的状态 。
  9134. */
  9135. options.EVENT_TYPES = ["processCompleted", "processFailed", "processRunning"];
  9136. super(url, options);
  9137. this.CLASS_NAME = "SuperMap.ProcessingServiceBase";
  9138. }
  9139. /**
  9140. * @function SuperMap.ProcessingServiceBase.prototype.destroy
  9141. * @override
  9142. */
  9143. destroy() {
  9144. super.destroy();
  9145. }
  9146. /**
  9147. * @function SuperMap.ProcessingServiceBase.prototype.getJobs
  9148. * @description 获取分布式分析任务。
  9149. * @param {string} url - 资源地址。
  9150. */
  9151. getJobs(url) {
  9152. var me = this;
  9153. FetchRequest.get(me._processUrl(url), null, {
  9154. proxy: me.proxy
  9155. }).then(function (response) {
  9156. return response.json();
  9157. }).then(function (result) {
  9158. me.events.triggerEvent("processCompleted", {
  9159. result: result
  9160. });
  9161. }).catch(function (e) {
  9162. me.eventListeners.processFailed({
  9163. error: e
  9164. });
  9165. });
  9166. }
  9167. /**
  9168. * @function SuperMap.ProcessingServiceBase.prototype.addJob
  9169. * @description 添加分布式分析任务。
  9170. * @param {string} url - 资源根地址。
  9171. * @param {Object} params - 创建一个空间分析的请求参数。
  9172. * @param {string} paramType - 请求参数类型。
  9173. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9174. */
  9175. addJob(url, params, paramType, seconds) {
  9176. var me = this,
  9177. parameterObject = null;
  9178. if (params && params instanceof paramType) {
  9179. parameterObject = new Object();
  9180. paramType.toObject(params, parameterObject);
  9181. }
  9182. let headers = Object.assign({
  9183. 'Content-Type': 'application/x-www-form-urlencoded'
  9184. }, me.headers || {})
  9185. var options = {
  9186. proxy: me.proxy,
  9187. headers,
  9188. withCredentials: me.withCredentials,
  9189. crossOrigin: me.crossOrigin,
  9190. isInTheSameDomain: me.isInTheSameDomain
  9191. };
  9192. FetchRequest.post(me._processUrl(url), JSON.stringify(parameterObject), options).then(function (response) {
  9193. return response.json();
  9194. }).then(function (result) {
  9195. if (result.succeed) {
  9196. me.serviceProcessCompleted(result, seconds);
  9197. } else {
  9198. me.serviceProcessFailed(result);
  9199. }
  9200. }).catch(function (e) {
  9201. me.serviceProcessFailed({
  9202. error: e
  9203. });
  9204. });
  9205. }
  9206. serviceProcessCompleted(result, seconds) {
  9207. result = Util.transformResult(result);
  9208. seconds = seconds || 1000;
  9209. var me = this;
  9210. if (result) {
  9211. var id = setInterval(function () {
  9212. FetchRequest.get(me._processUrl(result.newResourceLocation), {
  9213. _t: new Date().getTime()
  9214. })
  9215. .then(function (response) {
  9216. return response.json();
  9217. }).then(function (job) {
  9218. me.events.triggerEvent("processRunning", {
  9219. id: job.id,
  9220. state: job.state
  9221. });
  9222. if (job.state.runState === 'LOST' || job.state.runState === 'KILLED' || job.state.runState === 'FAILED') {
  9223. clearInterval(id);
  9224. me.events.triggerEvent("processFailed", {
  9225. error: job.state.errorMsg,
  9226. state: job.state.runState
  9227. });
  9228. }
  9229. if (job.state.runState === 'FINISHED' && job.setting.serviceInfo) {
  9230. clearInterval(id);
  9231. me.events.triggerEvent("processCompleted", {
  9232. result: job
  9233. });
  9234. }
  9235. }).catch(function (e) {
  9236. clearInterval(id);
  9237. me.events.triggerEvent("processFailed", {
  9238. error: e
  9239. });
  9240. });
  9241. }, seconds);
  9242. }
  9243. }
  9244. serviceProcessFailed(result) {
  9245. super.serviceProcessFailed(result);
  9246. }
  9247. _processUrl(url) {
  9248. if (SecurityManager_SecurityManager.getToken(url)) {
  9249. url = Util.urlAppend(url, 'token=' + SecurityManager_SecurityManager.getToken(url));
  9250. }
  9251. return url;
  9252. }
  9253. }
  9254. SuperMap.ProcessingServiceBase = ProcessingServiceBase_ProcessingServiceBase;
  9255. // CONCATENATED MODULE: ./src/common/iServer/KernelDensityJobsService.js
  9256. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9257. * This program are made available under the terms of the Apache License, Version 2.0
  9258. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9259. /**
  9260. * @class SuperMap.KernelDensityJobsService
  9261. * @category iServer ProcessingService DensityAnalyst
  9262. * @classdesc 核密度分析服务类
  9263. * @extends {SuperMap.ProcessingServiceBase}
  9264. * @param {string} url -核密度分析服务地址。
  9265. * @param {Object} options - 交互服务时所需可选参数。
  9266. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9267. * @param {Object} [options.headers] - 请求头。
  9268. */
  9269. class KernelDensityJobsService_KernelDensityJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9270. constructor(url, options) {
  9271. super(url, options);
  9272. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/density');
  9273. this.CLASS_NAME = "SuperMap.KernelDensityJobsService";
  9274. }
  9275. /**
  9276. * @function SuperMap.KernelDensityJobsService.prototype.destroy
  9277. * @override
  9278. */
  9279. destroy() {
  9280. super.destroy();
  9281. }
  9282. /**
  9283. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  9284. * @description 获取核密度分析任务
  9285. */
  9286. getKernelDensityJobs() {
  9287. super.getJobs(this.url);
  9288. }
  9289. /**
  9290. * @function SuperMap.KernelDensityJobsService.prototype.getKernelDensityJobs
  9291. * @description 获取指定id的核密度分析服务
  9292. * @param {string} id - 指定要获取数据的id
  9293. */
  9294. getKernelDensityJob(id) {
  9295. super.getJobs(Util.urlPathAppend(this.url, id));
  9296. }
  9297. /**
  9298. * @function SuperMap.KernelDensityJobsService.prototype.addKernelDensityJob
  9299. * @description 新建核密度分析服务
  9300. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  9301. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9302. */
  9303. addKernelDensityJob(params, seconds) {
  9304. super.addJob(this.url, params, KernelDensityJobParameter_KernelDensityJobParameter, seconds);
  9305. }
  9306. }
  9307. SuperMap.KernelDensityJobsService = KernelDensityJobsService_KernelDensityJobsService;
  9308. // CONCATENATED MODULE: ./src/common/iServer/SingleObjectQueryJobsService.js
  9309. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9310. * This program are made available under the terms of the Apache License, Version 2.0
  9311. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9312. /**
  9313. * @class SuperMap.SingleObjectQueryJobsService
  9314. * @category iServer ProcessingService Query
  9315. * @classdesc 单对象查询分析服务类
  9316. * @extends {SuperMap.ProcessingServiceBase}
  9317. * @param {string} url - 单对象空间查询分析服务地址。
  9318. * @param {Object} options - 参数。
  9319. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9320. * @param {Object} [options.headers] - 请求头。
  9321. */
  9322. class SingleObjectQueryJobsService_SingleObjectQueryJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9323. constructor(url, options) {
  9324. super(url, options);
  9325. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/query');
  9326. this.CLASS_NAME = 'SuperMap.SingleObjectQueryJobsService';
  9327. }
  9328. /**
  9329. *@override
  9330. */
  9331. destroy() {
  9332. super.destroy();
  9333. }
  9334. /**
  9335. * @function SuperMap.SingleObjectQueryJobsService.protitype.getQueryJobs
  9336. * @description 获取单对象空间查询分析所有任务
  9337. */
  9338. getQueryJobs() {
  9339. super.getJobs(this.url);
  9340. }
  9341. /**
  9342. * @function SuperMap.KernelDensityJobsService.protitype.getQueryJob
  9343. * @description 获取指定id的单对象空间查询分析服务
  9344. * @param {string} id - 指定要获取数据的id
  9345. */
  9346. getQueryJob(id) {
  9347. super.getJobs(Util.urlPathAppend(this.url, id));
  9348. }
  9349. /**
  9350. * @function SuperMap.SingleObjectQueryJobsService.protitype.addQueryJob
  9351. * @description 新建单对象空间查询分析服务
  9352. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  9353. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9354. */
  9355. addQueryJob(params, seconds) {
  9356. super.addJob(this.url, params, SingleObjectQueryJobsParameter_SingleObjectQueryJobsParameter, seconds);
  9357. }
  9358. }
  9359. SuperMap.SingleObjectQueryJobsService = SingleObjectQueryJobsService_SingleObjectQueryJobsService;
  9360. // CONCATENATED MODULE: ./src/common/iServer/SummaryMeshJobsService.js
  9361. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9362. * This program are made available under the terms of the Apache License, Version 2.0
  9363. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9364. /**
  9365. * @class SuperMap.SummaryMeshJobsService
  9366. * @category iServer ProcessingService AggregatePoints
  9367. * @classdesc 点聚合分析任务类。
  9368. * @param {string} url -点聚合分析任务地址。
  9369. * @param {Object} options - 参数。
  9370. * @param {SuperMap.Events} options.events - 处理所有事件的对象。<br>
  9371. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  9372. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  9373. * @param {number} options.index - 服务访问地址在数组中的位置。<br>
  9374. * @param {number} options.length - 服务访问地址数组长度。
  9375. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9376. * @param {Object} [options.headers] - 请求头。
  9377. */
  9378. class SummaryMeshJobsService_SummaryMeshJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9379. constructor(url, options) {
  9380. super(url, options);
  9381. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/aggregatepoints');
  9382. this.CLASS_NAME = 'SuperMap.SummaryMeshJobsService';
  9383. }
  9384. /**
  9385. * @override
  9386. */
  9387. destroy() {
  9388. super.destroy();
  9389. }
  9390. /**
  9391. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJobs
  9392. * @description 获取点聚合分析任务
  9393. */
  9394. getSummaryMeshJobs() {
  9395. super.getJobs(this.url);
  9396. }
  9397. /**
  9398. * @function SuperMap.SummaryMeshJobsService.prototype.getSummaryMeshJob
  9399. * @description 获取指定ip的点聚合分析任务
  9400. * @param {string} id - 指定要获取数据的id
  9401. */
  9402. getSummaryMeshJob(id) {
  9403. super.getJobs(Util.urlPathAppend(this.url, id));
  9404. }
  9405. /**
  9406. * @function SuperMap.SummaryMeshJobsService.prototype.addSummaryMeshJob
  9407. * @description 新建点聚合分析服务
  9408. * @param {SuperMap.SummaryMeshJobParameter} params - 创建一个空间分析的请求参数。
  9409. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9410. */
  9411. addSummaryMeshJob(params, seconds) {
  9412. super.addJob(this.url, params, SummaryMeshJobParameter_SummaryMeshJobParameter, seconds);
  9413. }
  9414. }
  9415. SuperMap.SummaryMeshJobsService = SummaryMeshJobsService_SummaryMeshJobsService;
  9416. // CONCATENATED MODULE: ./src/common/iServer/SummaryRegionJobsService.js
  9417. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9418. * This program are made available under the terms of the Apache License, Version 2.0
  9419. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9420. /**
  9421. * @class SuperMap.SummaryRegionJobsService
  9422. * @category iServer ProcessingService SummaryRegion
  9423. * @classdesc 区域汇总分析服务类
  9424. * @extends {SuperMap.ProcessingServiceBase}
  9425. * @param {string} url - 区域汇总分析服务地址。
  9426. * @param {Object} options - 参数。
  9427. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9428. * @param {Object} [options.headers] - 请求头。
  9429. */
  9430. class SummaryRegionJobsService_SummaryRegionJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9431. constructor(url, options) {
  9432. super(url, options);
  9433. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryregion');
  9434. this.CLASS_NAME = 'SuperMap.SummaryRegionJobsService';
  9435. }
  9436. /**
  9437. *@override
  9438. */
  9439. destroy() {
  9440. super.destroy();
  9441. }
  9442. /**
  9443. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJobs
  9444. * @description 获取区域汇总分析任务集合。
  9445. */
  9446. getSummaryRegionJobs() {
  9447. super.getJobs(this.url);
  9448. }
  9449. /**
  9450. * @function SuperMap.SummaryRegionJobsService.prototype.getSummaryRegionJob
  9451. * @description 获取指定id的区域汇总分析任务。
  9452. * @param {string} id -要获取区域汇总分析任务的id
  9453. */
  9454. getSummaryRegionJob(id) {
  9455. super.getJobs(Util.urlPathAppend(this.url, id));
  9456. }
  9457. /**
  9458. * @function SuperMap.SummaryRegionJobsService.prototype.addSummaryRegionJob
  9459. * @description 新建区域汇总任务。
  9460. * @param {SuperMap.SummaryRegionJobParameter} params - 创建一个区域汇总任务的请求参数。
  9461. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9462. */
  9463. addSummaryRegionJob(params, seconds) {
  9464. super.addJob(this.url, params, SummaryRegionJobParameter_SummaryRegionJobParameter, seconds);
  9465. }
  9466. }
  9467. SuperMap.SummaryRegionJobsService = SummaryRegionJobsService_SummaryRegionJobsService;
  9468. // CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsParameter.js
  9469. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9470. * This program are made available under the terms of the Apache License, Version 2.0
  9471. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9472. /**
  9473. * @class SuperMap.VectorClipJobsParameter
  9474. * @category iServer ProcessingService VectorClip
  9475. * @classdesc 矢量裁剪分析任务参数类。
  9476. * @param {Object} options - 参数。
  9477. * @param {string} options.datasetName - 数据集名。
  9478. * @param {string} options.datasetOverlay - 裁剪对象数据集。
  9479. * @param {SuperMap.ClipAnalystMode} [options.mode=SuperMap.ClipAnalystMode.CLIP] - 裁剪分析模式。
  9480. * @param {SuperMap.OutputSetting} [options.output] - 输出参数设置。
  9481. * @param {SuperMap.MappingParameters} [options.mappingParameters] - 分析后结果可视化的参数类。
  9482. */
  9483. class VectorClipJobsParameter_VectorClipJobsParameter {
  9484. constructor(options) {
  9485. options = options || {};
  9486. /**
  9487. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetName
  9488. * @description 数据集名。
  9489. */
  9490. this.datasetName = "";
  9491. /**
  9492. * @member {string} SuperMap.VectorClipJobsParameter.prototype.datasetOverlay
  9493. * @description 裁剪对象数据集。
  9494. */
  9495. this.datasetVectorClip = "";
  9496. /**
  9497. * @member {string} SuperMap.VectorClipJobsParameter.prototype.geometryClip
  9498. * @description 裁剪几何对象。
  9499. */
  9500. this.geometryClip = "";
  9501. /**
  9502. * @member {SuperMap.ClipAnalystMode} [SuperMap.VectorClipJobsParameter.prototype.mode=ClipAnalystMode.CLIP]
  9503. * @description 裁剪分析模式 。
  9504. */
  9505. this.mode = ClipAnalystMode.CLIP;
  9506. /**
  9507. * @member {SuperMap.OutputSetting} SuperMap.VectorClipJobsParameter.prototype.output
  9508. * @description 输出参数设置类。
  9509. */
  9510. this.output = null;
  9511. /**
  9512. * @member {SuperMap.MappingParameters} [SuperMap.VectorClipJobsParameter.prototype.mappingParameters]
  9513. * @description 分析后结果可视化的参数类。
  9514. */
  9515. this.mappingParameters = null;
  9516. Util.extend(this, options);
  9517. this.CLASS_NAME = "SuperMap.VectorClipJobsParameter";
  9518. }
  9519. /**
  9520. * @function SuperMap.VectorClipJobsParameter.prototype.destroy
  9521. * @description 释放资源,将引用资源的属性置空。
  9522. */
  9523. destroy() {
  9524. this.datasetName = null;
  9525. this.datasetVectorClip = null;
  9526. this.geometryClip = null;
  9527. this.mode = null;
  9528. if (this.output instanceof OutputSetting_OutputSetting) {
  9529. this.output.destroy();
  9530. this.output = null;
  9531. }
  9532. if (this.mappingParameters instanceof MappingParameters_MappingParameters) {
  9533. this.mappingParameters.destroy();
  9534. this.mappingParameters = null;
  9535. }
  9536. }
  9537. /**
  9538. * @function SuperMap.VectorClipJobsParameter.toObject
  9539. * @param {Object} vectorClipJobsParameter - 区域汇总分析服务参数。
  9540. * @param {Object} tempObj - 目标对象。
  9541. * @description 矢量裁剪分析任务对象。
  9542. */
  9543. static toObject(vectorClipJobsParameter, tempObj) {
  9544. for (var name in vectorClipJobsParameter) {
  9545. if (name === "datasetName") {
  9546. tempObj['input'] = tempObj['input'] || {};
  9547. tempObj['input'][name] = vectorClipJobsParameter[name];
  9548. continue;
  9549. }
  9550. if (name === "output"){
  9551. tempObj['output'] = tempObj['output'] || {};
  9552. tempObj['output'] = vectorClipJobsParameter[name];
  9553. continue;
  9554. }
  9555. tempObj['analyst'] = tempObj['analyst'] || {};
  9556. tempObj['analyst'][name] = vectorClipJobsParameter[name];
  9557. if(name === 'mappingParameters'){
  9558. tempObj['analyst'][name] = tempObj['analyst'][name] || {};
  9559. tempObj['analyst']['mappingParameters'] = vectorClipJobsParameter[name];
  9560. }
  9561. }
  9562. }
  9563. }
  9564. SuperMap.VectorClipJobsParameter = VectorClipJobsParameter_VectorClipJobsParameter;
  9565. // CONCATENATED MODULE: ./src/common/iServer/VectorClipJobsService.js
  9566. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9567. * This program are made available under the terms of the Apache License, Version 2.0
  9568. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9569. /**
  9570. * @class SuperMap.VectorClipJobsService
  9571. * @category iServer ProcessingService VectorClip
  9572. * @classdesc 矢量裁剪分析服务类
  9573. * @extends {SuperMap.ProcessingServiceBase}
  9574. * @param {string} url -矢量裁剪分析服务地址。
  9575. * @param {Object} options - 交互服务时所需可选参数。
  9576. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9577. * @param {Object} [options.headers] - 请求头。
  9578. */
  9579. class VectorClipJobsService_VectorClipJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9580. constructor(url, options) {
  9581. super(url, options);
  9582. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/vectorclip');
  9583. this.CLASS_NAME = 'SuperMap.VectorClipJobsService';
  9584. }
  9585. /**
  9586. *@override
  9587. */
  9588. destroy() {
  9589. super.destroy();
  9590. }
  9591. /**
  9592. * @function SuperMap.VectorClipJobsService.protitype.getVectorClipJobs
  9593. * @description 获取矢量裁剪分析所有任务
  9594. */
  9595. getVectorClipJobs() {
  9596. super.getJobs(this.url);
  9597. }
  9598. /**
  9599. * @function SuperMap.KernelDensityJobsService.protitype.getVectorClipJob
  9600. * @description 获取指定id的矢量裁剪分析服务
  9601. * @param {string} id - 指定要获取数据的id
  9602. */
  9603. getVectorClipJob(id) {
  9604. super.getJobs(Util.urlPathAppend(this.url, id));
  9605. }
  9606. /**
  9607. * @function SuperMap.VectorClipJobsService.protitype.addVectorClipJob
  9608. * @description 新建矢量裁剪分析服务
  9609. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  9610. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9611. */
  9612. addVectorClipJob(params, seconds) {
  9613. super.addJob(this.url, params, VectorClipJobsParameter_VectorClipJobsParameter, seconds);
  9614. }
  9615. }
  9616. SuperMap.VectorClipJobsService = VectorClipJobsService_VectorClipJobsService;
  9617. // CONCATENATED MODULE: ./src/common/iServer/OverlayGeoJobsService.js
  9618. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9619. * This program are made available under the terms of the Apache License, Version 2.0
  9620. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9621. /**
  9622. * @class SuperMap.OverlayGeoJobsService
  9623. * @category iServer ProcessingService OverlayAnalyst
  9624. * @classdesc 叠加分析任务类。
  9625. * @param {string} url - 叠加分析任务地址。
  9626. * @param {Object} options - 参数。
  9627. * @param {SuperMap.Events} options.events - 处理所有事件的对象。
  9628. * @param {SuperMap.ServerType} [options.serverType=SuperMap.ServerType.ISERVER] - 服务器类型,ISERVER|IPORTAL|ONLINE。
  9629. * @param {Object} [options.eventListeners] - 事件监听器对象。有 processCompleted 属性可传入处理完成后的回调函数。processFailed 属性传入处理失败后的回调函数。
  9630. * @param {number} options.index - 服务访问地址在数组中的位置。
  9631. * @param {number} options.length - 服务访问地址数组长度。
  9632. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9633. * @param {Object} [options.headers] - 请求头。
  9634. */
  9635. class OverlayGeoJobsService_OverlayGeoJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9636. constructor(url, options) {
  9637. super(url, options);
  9638. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/overlay');
  9639. this.CLASS_NAME = 'SuperMap.OverlayGeoJobsService';
  9640. }
  9641. /**
  9642. * @override
  9643. */
  9644. destroy() {
  9645. super.destroy();
  9646. }
  9647. /**
  9648. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJobs
  9649. * @description 获取叠加分析任务
  9650. */
  9651. getOverlayGeoJobs() {
  9652. super.getJobs(this.url);
  9653. }
  9654. /**
  9655. * @function SuperMap.OverlayGeoJobsService.prototype.getOverlayGeoJob
  9656. * @description 获取指定id的叠加分析任务
  9657. * @param {string} id - 指定要获取数据的id
  9658. */
  9659. getOverlayGeoJob(id) {
  9660. super.getJobs(Util.urlPathAppend(this.url, id));
  9661. }
  9662. /**
  9663. * @function SuperMap.OverlayGeoJobsService.prototype.addOverlayGeoJob
  9664. * @description 新建点叠加析服务
  9665. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个叠加分析的请求参数。
  9666. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9667. */
  9668. addOverlayGeoJob(params, seconds) {
  9669. super.addJob(this.url, params, OverlayGeoJobParameter_OverlayGeoJobParameter, seconds);
  9670. }
  9671. }
  9672. SuperMap.OverlayGeoJobsService = OverlayGeoJobsService_OverlayGeoJobsService;
  9673. // CONCATENATED MODULE: ./src/common/iServer/BuffersAnalystJobsService.js
  9674. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9675. * This program are made available under the terms of the Apache License, Version 2.0
  9676. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9677. /**
  9678. * @class SuperMap.BuffersAnalystJobsService
  9679. * @category iServer ProcessingService BufferAnalyst
  9680. * @classdesc 缓冲区分析服务类
  9681. * @extends {SuperMap.ProcessingServiceBase}
  9682. * @param {string} url - 服务地址。
  9683. * @param {Object} options - 参数。
  9684. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9685. * @param {Object} [options.headers] - 请求头。
  9686. */
  9687. class BuffersAnalystJobsService_BuffersAnalystJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9688. constructor(url, options) {
  9689. super(url, options);
  9690. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/buffers');
  9691. this.CLASS_NAME = 'SuperMap.BuffersAnalystJobsService';
  9692. }
  9693. /**
  9694. *@override
  9695. */
  9696. destroy() {
  9697. super.destroy();
  9698. }
  9699. /**
  9700. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJobs
  9701. * @description 获取缓冲区分析所有任务
  9702. */
  9703. getBuffersJobs() {
  9704. super.getJobs(this.url);
  9705. }
  9706. /**
  9707. * @function SuperMap.BuffersAnalystJobsService.prototype.getBufferJob
  9708. * @description 获取指定id的缓冲区分析服务
  9709. * @param {string} id - 指定要获取数据的id。
  9710. */
  9711. getBuffersJob(id) {
  9712. super.getJobs(Util.urlPathAppend(this.url, id));
  9713. }
  9714. /**
  9715. * @function SuperMap.BuffersAnalystJobsService.prototype.addBufferJob
  9716. * @description 新建缓冲区分析服务
  9717. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  9718. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9719. */
  9720. addBuffersJob(params, seconds) {
  9721. super.addJob(this.url, params, BuffersAnalystJobsParameter_BuffersAnalystJobsParameter, seconds);
  9722. }
  9723. }
  9724. SuperMap.BuffersAnalystJobsService = BuffersAnalystJobsService_BuffersAnalystJobsService;
  9725. // CONCATENATED MODULE: ./src/common/iServer/TopologyValidatorJobsService.js
  9726. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9727. * This program are made available under the terms of the Apache License, Version 2.0
  9728. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9729. /**
  9730. * @class SuperMap.TopologyValidatorJobsService
  9731. * @category iServer ProcessingService TopologyValidator
  9732. * @classdesc 拓扑检查分析服务类
  9733. * @extends {SuperMap.ProcessingServiceBase}
  9734. * @param {string} url - 拓扑检查分析服务地址。
  9735. * @param {Object} options - 参数。
  9736. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9737. * @param {Object} [options.headers] - 请求头。
  9738. */
  9739. class TopologyValidatorJobsService_TopologyValidatorJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9740. constructor(url, options) {
  9741. super(url, options);
  9742. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/topologyvalidator');
  9743. this.CLASS_NAME = "SuperMap.TopologyValidatorJobsService";
  9744. }
  9745. /**
  9746. *@override
  9747. */
  9748. destroy() {
  9749. super.destroy();
  9750. }
  9751. /**
  9752. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJobs
  9753. * @description 获取拓扑检查分析所有任务
  9754. */
  9755. getTopologyValidatorJobs() {
  9756. super.getJobs(this.url);
  9757. }
  9758. /**
  9759. * @function SuperMap.TopologyValidatorJobsService.protitype.getTopologyValidatorJob
  9760. * @description 获取指定id的拓扑检查分析服务
  9761. * @param {string} id - 指定要获取数据的id
  9762. */
  9763. getTopologyValidatorJob(id) {
  9764. super.getJobs( Util.urlPathAppend(this.url, id));
  9765. }
  9766. /**
  9767. * @function SuperMap.TopologyValidatorJobsService.protitype.addTopologyValidatorJob
  9768. * @description 新建拓扑检查分析服务
  9769. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  9770. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9771. */
  9772. addTopologyValidatorJob(params, seconds) {
  9773. super.addJob(this.url, params, TopologyValidatorJobsParameter_TopologyValidatorJobsParameter, seconds);
  9774. }
  9775. }
  9776. SuperMap.TopologyValidatorJobsService = TopologyValidatorJobsService_TopologyValidatorJobsService;
  9777. // CONCATENATED MODULE: ./src/common/iServer/SummaryAttributesJobsService.js
  9778. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9779. * This program are made available under the terms of the Apache License, Version 2.0
  9780. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9781. /**
  9782. * @class SuperMap.SummaryAttributesJobsService
  9783. * @category iServer ProcessingService SummaryAttributes
  9784. * @classdesc 属性汇总分析服务类
  9785. * @extends {SuperMap.ProcessingServiceBase}
  9786. * @param {string} url - 汇总统计分析服务地址。
  9787. * @param {Object} options - 参数。
  9788. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9789. * @param {Object} [options.headers] - 请求头。
  9790. */
  9791. class SummaryAttributesJobsService_SummaryAttributesJobsService extends ProcessingServiceBase_ProcessingServiceBase {
  9792. constructor(url, options) {
  9793. super(url, options);
  9794. this.url = Util.urlPathAppend(this.url, 'spatialanalyst/summaryattributes');
  9795. this.CLASS_NAME = "SuperMap.SummaryAttributesJobsService";
  9796. }
  9797. /**
  9798. *@override
  9799. */
  9800. destroy() {
  9801. super.destroy();
  9802. }
  9803. /**
  9804. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJobs
  9805. * @description 获取属性汇总分析所有任务
  9806. */
  9807. getSummaryAttributesJobs (){
  9808. super.getJobs(this.url);
  9809. }
  9810. /**
  9811. * @function SuperMap.SummaryAttributesJobsService.protitype.getSummaryAttributesJob
  9812. * @description 获取指定id的属性汇总分析服务
  9813. * @param {string} id - 指定要获取数据的id
  9814. */
  9815. getSummaryAttributesJob(id) {
  9816. super.getJobs(Util.urlPathAppend(this.url, id));
  9817. }
  9818. /**
  9819. * @function SuperMap.SummaryAttributesJobsService.protitype.addSummaryAttributesJob
  9820. * @description 新建属性汇总分析服务
  9821. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  9822. * @param {number} seconds - 开始创建后,获取创建成功结果的时间间隔。
  9823. */
  9824. addSummaryAttributesJob(params, seconds) {
  9825. super.addJob(this.url, params, SummaryAttributesJobsParameter_SummaryAttributesJobsParameter, seconds);
  9826. }
  9827. }
  9828. SuperMap.SummaryAttributesJobsService = SummaryAttributesJobsService_SummaryAttributesJobsService;
  9829. // CONCATENATED MODULE: ./src/classic/services/ProcessingService.js
  9830. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  9831. * This program are made available under the terms of the Apache License, Version 2.0
  9832. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  9833. /**
  9834. * @class SuperMap.REST.ProcessingService
  9835. * @category iServer ProcessingService
  9836. * @classdesc 分布式分析相关服务类。
  9837. * @augments SuperMap.CommonServiceBase
  9838. * @example
  9839. * 用法:
  9840. * new SuperMap.REST.ProcessingService(url,options)
  9841. * .getKernelDensityJobs(function(result){
  9842. * //doSomething
  9843. * })
  9844. * @param {string} url - 分布式分析服务地址。
  9845. * @param {Object} options - 可选参数。
  9846. * @param {boolean} [options.crossOrigin] - 是否允许跨域请求。
  9847. * @param {Object} [options.headers] - 请求头。
  9848. */
  9849. class ProcessingService_ProcessingService extends CommonServiceBase_CommonServiceBase {
  9850. constructor(url, options) {
  9851. super(url, options);
  9852. this.kernelDensityJobs = {};
  9853. this.summaryMeshJobs = {};
  9854. this.queryJobs = {};
  9855. this.summaryRegionJobs = {};
  9856. this.vectorClipJobs = {};
  9857. this.overlayGeoJobs = {};
  9858. this.buffersJobs = {};
  9859. this.topologyValidatorJobs = {};
  9860. this.summaryAttributesJobs = {};
  9861. }
  9862. /**
  9863. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJobs
  9864. * @description 获取密度分析的列表。
  9865. * @param {function} callback - 请求结果的回调函数。
  9866. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9867. */
  9868. getKernelDensityJobs(callback, resultFormat) {
  9869. var me = this,
  9870. format = me._processFormat(resultFormat);
  9871. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  9872. headers: me.headers,
  9873. proxy: me.proxy,
  9874. withCredentials: me.withCredentials,
  9875. crossOrigin:me.crossOrigin,
  9876. serverType: me.serverType,
  9877. eventListeners: {
  9878. scope: me,
  9879. processCompleted: callback,
  9880. processFailed: callback
  9881. },
  9882. format: format
  9883. });
  9884. kernelDensityJobsService.getKernelDensityJobs();
  9885. }
  9886. /**
  9887. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJob
  9888. * @description 获取某一个密度分析。
  9889. * @param {string} id - 空间分析的 id。
  9890. * @param {function} callback - 请求结果的回调函数。
  9891. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9892. */
  9893. getKernelDensityJob(id, callback, resultFormat) {
  9894. var me = this,
  9895. format = me._processFormat(resultFormat);
  9896. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  9897. headers: me.headers,
  9898. proxy: me.proxy,
  9899. withCredentials: me.withCredentials,
  9900. crossOrigin:me.crossOrigin,
  9901. serverType: me.serverType,
  9902. eventListeners: {
  9903. scope: me,
  9904. processCompleted: callback,
  9905. processFailed: callback
  9906. },
  9907. format: format
  9908. });
  9909. kernelDensityJobsService.getKernelDensityJob(id);
  9910. }
  9911. /**
  9912. * @function SuperMap.REST.ProcessingService.prototype.addKernelDensityJob
  9913. * @description 新建一个密度分析。
  9914. * @param {SuperMap.KernelDensityJobParameter} params - 创建一个空间分析的请求参数。
  9915. * @param {function} callback - 请求结果的回调函数。
  9916. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  9917. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9918. */
  9919. addKernelDensityJob(params, callback, seconds, resultFormat) {
  9920. var me = this, format = me._processFormat(resultFormat);
  9921. var kernelDensityJobsService = new KernelDensityJobsService_KernelDensityJobsService(me.url, {
  9922. headers: me.headers,
  9923. proxy: me.proxy,
  9924. withCredentials: me.withCredentials,
  9925. crossOrigin:me.crossOrigin,
  9926. eventListeners: {
  9927. scope: me,
  9928. processCompleted: callback,
  9929. processFailed: callback,
  9930. processRunning(job) {
  9931. me.kernelDensityJobs[job.id] = job.state;
  9932. }
  9933. },
  9934. format: format
  9935. });
  9936. kernelDensityJobsService.addKernelDensityJob(params, seconds);
  9937. }
  9938. /**
  9939. * @function SuperMap.REST.ProcessingService.prototype.getKernelDensityJobState
  9940. * @description 获取密度分析的状态。
  9941. * @param {string} id - 密度分析的 id。
  9942. * @returns {Object} - 密度分析的状态。
  9943. */
  9944. getKernelDensityJobState(id) {
  9945. return this.kernelDensityJobs[id];
  9946. }
  9947. /**
  9948. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJobs
  9949. * @description 获取点聚合分析的列表。
  9950. * @param {function} callback - 请求结果的回调函数。
  9951. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9952. */
  9953. getSummaryMeshJobs(callback, resultFormat) {
  9954. var me = this,
  9955. format = me._processFormat(resultFormat);
  9956. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  9957. headers: me.headers,
  9958. proxy: me.proxy,
  9959. withCredentials: me.withCredentials,
  9960. crossOrigin:me.crossOrigin,
  9961. serverType: me.serverType,
  9962. eventListeners: {
  9963. scope: me,
  9964. processCompleted: callback,
  9965. processFailed: callback
  9966. },
  9967. format: format
  9968. });
  9969. summaryMeshJobsService.getSummaryMeshJobs();
  9970. }
  9971. /**
  9972. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJob
  9973. * @description 获取某一个点聚合分析。
  9974. * @param {string} id - 空间分析的 id。
  9975. * @param {function} callback - 请求结果的回调函数。
  9976. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  9977. */
  9978. getSummaryMeshJob(id, callback, resultFormat) {
  9979. var me = this,
  9980. format = me._processFormat(resultFormat);
  9981. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  9982. headers: me.headers,
  9983. proxy: me.proxy,
  9984. withCredentials: me.withCredentials,
  9985. crossOrigin:me.crossOrigin,
  9986. serverType: me.serverType,
  9987. eventListeners: {
  9988. scope: me,
  9989. processCompleted: callback,
  9990. processFailed: callback
  9991. },
  9992. format: format
  9993. });
  9994. summaryMeshJobsService.getSummaryMeshJob(id);
  9995. }
  9996. /**
  9997. * @function SuperMap.REST.ProcessingService.prototype.addSummaryMeshJob
  9998. * @description 新建一个点聚合分析。
  9999. * @param {SuperMap.SummaryMeshJobParameter} params - 点聚合分析任务参数类。
  10000. * @param {function} callback - 请求结果的回调函数。
  10001. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10002. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10003. */
  10004. addSummaryMeshJob(params, callback, seconds, resultFormat) {
  10005. var me = this, format = me._processFormat(resultFormat);
  10006. var summaryMeshJobsService = new SummaryMeshJobsService_SummaryMeshJobsService(me.url, {
  10007. headers: me.headers,
  10008. proxy: me.proxy,
  10009. withCredentials: me.withCredentials,
  10010. crossOrigin:me.crossOrigin,
  10011. eventListeners: {
  10012. scope: me,
  10013. processCompleted: callback,
  10014. processFailed: callback,
  10015. processRunning(job) {
  10016. me.summaryMeshJobs[job.id] = job.state;
  10017. }
  10018. },
  10019. format: format
  10020. });
  10021. summaryMeshJobsService.addSummaryMeshJob(params, seconds);
  10022. }
  10023. /**
  10024. * @function SuperMap.REST.ProcessingService.prototype.getSummaryMeshJobState
  10025. * @description 获取点聚合分析的状态。
  10026. * @param {string} id - 点聚合分析的 id。
  10027. * @returns {Object} 点聚合分析的状态。
  10028. */
  10029. getSummaryMeshJobState(id) {
  10030. return this.summaryMeshJobs[id];
  10031. }
  10032. /**
  10033. * @function SuperMap.REST.ProcessingService.prototype.getQueryJobs
  10034. * @description 获取单对象查询分析的列表。
  10035. * @param {function} callback - 请求结果的回调函数。
  10036. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10037. */
  10038. getQueryJobs(callback, resultFormat) {
  10039. var me = this,
  10040. format = me._processFormat(resultFormat);
  10041. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  10042. headers: me.headers,
  10043. proxy: me.proxy,
  10044. withCredentials: me.withCredentials,
  10045. crossOrigin:me.crossOrigin,
  10046. serverType: me.serverType,
  10047. eventListeners: {
  10048. scope: me,
  10049. processCompleted: callback,
  10050. processFailed: callback
  10051. },
  10052. format: format
  10053. });
  10054. singleObjectQueryJobsService.getQueryJobs();
  10055. }
  10056. /**
  10057. * @function SuperMap.REST.ProcessingService.prototype.getQueryJob
  10058. * @description 获取某一个单对象查询分析。
  10059. * @param {string} id - 空间分析的 id。
  10060. * @param {function} callback - 请求结果的回调函数。
  10061. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10062. */
  10063. getQueryJob(id, callback, resultFormat) {
  10064. var me = this,
  10065. format = me._processFormat(resultFormat);
  10066. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  10067. headers: me.headers,
  10068. proxy: me.proxy,
  10069. withCredentials: me.withCredentials,
  10070. crossOrigin:me.crossOrigin,
  10071. serverType: me.serverType,
  10072. eventListeners: {
  10073. scope: me,
  10074. processCompleted: callback,
  10075. processFailed: callback
  10076. },
  10077. format: format
  10078. });
  10079. singleObjectQueryJobsService.getQueryJob(id);
  10080. }
  10081. /**
  10082. * @function SuperMap.REST.ProcessingService.prototype.addQueryJob
  10083. * @description 新建一个单对象查询分析。
  10084. * @param {SuperMap.SingleObjectQueryJobsParameter} params - 创建一个空间分析的请求参数。
  10085. * @param {function} callback - 请求结果的回调函数。
  10086. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10087. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10088. */
  10089. addQueryJob(params, callback, seconds, resultFormat) {
  10090. var me = this,
  10091. param = me._processParams(params),
  10092. format = me._processFormat(resultFormat);
  10093. var singleObjectQueryJobsService = new SingleObjectQueryJobsService_SingleObjectQueryJobsService(me.url, {
  10094. headers: me.headers,
  10095. proxy: me.proxy,
  10096. withCredentials: me.withCredentials,
  10097. crossOrigin:me.crossOrigin,
  10098. eventListeners: {
  10099. scope: me,
  10100. processCompleted: callback,
  10101. processFailed: callback,
  10102. processRunning(job) {
  10103. me.queryJobs[job.id] = job.state;
  10104. }
  10105. },
  10106. format: format
  10107. });
  10108. singleObjectQueryJobsService.addQueryJob(param, seconds);
  10109. }
  10110. /**
  10111. * @function SuperMap.REST.ProcessingService.prototype.getQueryJobState
  10112. * @description 获取单对象查询分析的状态。
  10113. * @param {string} id - 单对象查询分析的 id。
  10114. * @returns {Object} 单对象查询分析的状态
  10115. */
  10116. getQueryJobState(id) {
  10117. return this.queryJobs[id];
  10118. }
  10119. /**
  10120. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJobs
  10121. * @description 获取区域汇总分析的列表。
  10122. * @param {function} callback - 请求结果的回调函数。
  10123. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10124. */
  10125. getSummaryRegionJobs(callback, resultFormat) {
  10126. var me = this,
  10127. format = me._processFormat(resultFormat);
  10128. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  10129. proxy: me.proxy,
  10130. headers: me.headers,
  10131. withCredentials: me.withCredentials,
  10132. crossOrigin:me.crossOrigin,
  10133. serverType: me.serverType,
  10134. eventListeners: {
  10135. scope: me,
  10136. processCompleted: callback,
  10137. processFailed: callback
  10138. },
  10139. format: format
  10140. });
  10141. summaryRegionJobsService.getSummaryRegionJobs();
  10142. }
  10143. /**
  10144. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJob
  10145. * @description 获取某一个区域汇总分析。
  10146. * @param {string} id - 区域汇总分析的 id。
  10147. * @param {function} callback - 请求结果的回调函数。
  10148. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10149. */
  10150. getSummaryRegionJob(id, callback, resultFormat) {
  10151. var me = this,
  10152. format = me._processFormat(resultFormat);
  10153. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  10154. proxy: me.proxy,
  10155. withCredentials: me.withCredentials,
  10156. crossOrigin:me.crossOrigin,
  10157. headers: me.headers,
  10158. serverType: me.serverType,
  10159. eventListeners: {
  10160. scope: me,
  10161. processCompleted: callback,
  10162. processFailed: callback
  10163. },
  10164. format: format
  10165. });
  10166. summaryRegionJobsService.getSummaryRegionJob(id);
  10167. }
  10168. /**
  10169. * @function SuperMap.REST.ProcessingService.prototype.addSummaryRegionJob
  10170. * @description 新建一个区域汇总分析。
  10171. * @param {SuperMap.SummaryRegionJobParameter} params -创建一个区域汇总分析的请求参数。
  10172. * @param {function} callback - 请求结果的回调函数。
  10173. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10174. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10175. */
  10176. addSummaryRegionJob(params, callback, seconds, resultFormat) {
  10177. var me = this, format = me._processFormat(resultFormat);
  10178. var summaryRegionJobsService = new SummaryRegionJobsService_SummaryRegionJobsService(me.url, {
  10179. proxy: me.proxy,
  10180. withCredentials: me.withCredentials,
  10181. crossOrigin:me.crossOrigin,
  10182. headers: me.headers,
  10183. eventListeners: {
  10184. scope: me,
  10185. processCompleted: callback,
  10186. processFailed: callback,
  10187. processRunning(job) {
  10188. me.summaryRegionJobs[job.id] = job.state;
  10189. }
  10190. },
  10191. format: format
  10192. });
  10193. summaryRegionJobsService.addSummaryRegionJob(params, seconds);
  10194. }
  10195. /**
  10196. * @function SuperMap.REST.ProcessingService.prototype.getSummaryRegionJobState
  10197. * @description 获取区域汇总分析的状态。
  10198. * @param {string} id - 区域汇总分析的 id。
  10199. * @returns {Object} 区域汇总分析的状态。
  10200. */
  10201. getSummaryRegionJobState(id) {
  10202. return this.summaryRegionJobs[id];
  10203. }
  10204. /**
  10205. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJobs
  10206. * @description 获取矢量裁剪分析的列表。
  10207. * @param {function} callback - 请求结果的回调函数。
  10208. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10209. */
  10210. getVectorClipJobs(callback, resultFormat) {
  10211. var me = this,
  10212. format = me._processFormat(resultFormat);
  10213. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  10214. proxy: me.proxy,
  10215. withCredentials: me.withCredentials,
  10216. crossOrigin:me.crossOrigin,
  10217. headers: me.headers,
  10218. serverType: me.serverType,
  10219. eventListeners: {
  10220. scope: me,
  10221. processCompleted: callback,
  10222. processFailed: callback
  10223. },
  10224. format: format
  10225. });
  10226. vectorClipJobsService.getVectorClipJobs();
  10227. }
  10228. /**
  10229. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJob
  10230. * @description 获取某一个矢量裁剪分析。
  10231. * @param {string} id - 空间分析的 id。
  10232. * @param {function} callback - 请求结果的回调函数。
  10233. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10234. */
  10235. getVectorClipJob(id, callback, resultFormat) {
  10236. var me = this,
  10237. format = me._processFormat(resultFormat);
  10238. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  10239. proxy: me.proxy,
  10240. withCredentials: me.withCredentials,
  10241. crossOrigin:me.crossOrigin,
  10242. headers: me.headers,
  10243. serverType: me.serverType,
  10244. eventListeners: {
  10245. scope: me,
  10246. processCompleted: callback,
  10247. processFailed: callback
  10248. },
  10249. format: format
  10250. });
  10251. vectorClipJobsService.getVectorClipJob(id);
  10252. }
  10253. /**
  10254. * @function SuperMap.REST.ProcessingService.prototype.addVectorClipJob
  10255. * @description 新建一个矢量裁剪分析。
  10256. * @param {SuperMap.VectorClipJobsParameter} params - 创建一个空间分析的请求参数。
  10257. * @param {function} callback - 请求结果的回调函数。
  10258. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10259. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10260. */
  10261. addVectorClipJob(params, callback, seconds, resultFormat) {
  10262. var me = this,
  10263. param = me._processParams(params),
  10264. format = me._processFormat(resultFormat);
  10265. var vectorClipJobsService = new VectorClipJobsService_VectorClipJobsService(me.url, {
  10266. proxy: me.proxy,
  10267. withCredentials: me.withCredentials,
  10268. crossOrigin:me.crossOrigin,
  10269. headers: me.headers,
  10270. serverType: me.serverType,
  10271. eventListeners: {
  10272. scope: me,
  10273. processCompleted: callback,
  10274. processFailed: callback,
  10275. processRunning(job) {
  10276. me.vectorClipJobs[job.id] = job.state;
  10277. }
  10278. },
  10279. format: format
  10280. });
  10281. vectorClipJobsService.addVectorClipJob(param, seconds);
  10282. }
  10283. /**
  10284. * @function SuperMap.REST.ProcessingService.prototype.getVectorClipJobState
  10285. * @description 获取矢量裁剪分析的状态。
  10286. * @param {string} id - 矢量裁剪分析的 id。
  10287. * @returns {Object} 矢量裁剪分析的状态。
  10288. */
  10289. getVectorClipJobState(id) {
  10290. return this.vectorClipJobs[id];
  10291. }
  10292. /**
  10293. * @function SuperMap.REST.ProcessingService.prototype.getOverlayGeoJobs
  10294. * @description 获取叠加分析的列表。
  10295. * @param {function} callback - 请求结果的回调函数。
  10296. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10297. */
  10298. getOverlayGeoJobs(callback, resultFormat) {
  10299. var me = this,
  10300. format = me._processFormat(resultFormat);
  10301. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  10302. proxy: me.proxy,
  10303. withCredentials: me.withCredentials,
  10304. crossOrigin:me.crossOrigin,
  10305. headers: me.headers,
  10306. serverType: me.serverType,
  10307. eventListeners: {
  10308. scope: me,
  10309. processCompleted: callback,
  10310. processFailed: callback
  10311. },
  10312. format: format
  10313. });
  10314. overlayGeoJobsService.getOverlayGeoJobs();
  10315. }
  10316. /**
  10317. * @function SuperMap.REST.ProcessingService.prototype.getOverlayGeoJob
  10318. * @description 获取某一个叠加分析。
  10319. * @param {string} id - 空间分析的 id。
  10320. * @param {function} callback - 请求结果的回调函数。
  10321. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10322. */
  10323. getOverlayGeoJob(id, callback, resultFormat) {
  10324. var me = this,
  10325. format = me._processFormat(resultFormat);
  10326. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  10327. proxy: me.proxy,
  10328. withCredentials: me.withCredentials,
  10329. crossOrigin:me.crossOrigin,
  10330. headers: me.headers,
  10331. serverType: me.serverType,
  10332. eventListeners: {
  10333. scope: me,
  10334. processCompleted: callback,
  10335. processFailed: callback
  10336. },
  10337. format: format
  10338. });
  10339. overlayGeoJobsService.getOverlayGeoJob(id);
  10340. }
  10341. /**
  10342. * @function SuperMap.REST.ProcessingService.prototype.addOverlayGeoJob
  10343. * @description 新建一个叠加分析。
  10344. * @param {SuperMap.OverlayGeoJobParameter} params - 创建一个空间分析的请求参数。
  10345. * @param {function} callback - 请求结果的回调函数。
  10346. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10347. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10348. */
  10349. addOverlayGeoJob(params, callback, seconds, resultFormat) {
  10350. var me = this,
  10351. format = me._processFormat(resultFormat);
  10352. var overlayGeoJobsService = new OverlayGeoJobsService_OverlayGeoJobsService(me.url, {
  10353. proxy: me.proxy,
  10354. withCredentials: me.withCredentials,
  10355. crossOrigin:me.crossOrigin,
  10356. headers: me.headers,
  10357. serverType: me.serverType,
  10358. eventListeners: {
  10359. scope: me,
  10360. processCompleted: callback,
  10361. processFailed: callback,
  10362. processRunning: function (job) {
  10363. me.overlayGeoJobs[job.id] = job.state;
  10364. }
  10365. },
  10366. format: format
  10367. });
  10368. overlayGeoJobsService.addOverlayGeoJob(params, seconds);
  10369. }
  10370. /**
  10371. * @function SuperMap.REST.ProcessingService.prototype.getoverlayGeoJobState
  10372. * @description 获取叠加分析的状态。
  10373. * @param {string} id - 叠加分析的 id。
  10374. * @returns {Object} 叠加分析的状态。
  10375. */
  10376. getoverlayGeoJobState(id) {
  10377. return this.overlayGeoJobs[id];
  10378. }
  10379. /**
  10380. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJobs
  10381. * @description 获取缓冲区分析的列表。
  10382. * @param {function} callback - 请求结果的回调函数。
  10383. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10384. */
  10385. getBuffersJobs(callback, resultFormat) {
  10386. var me = this,
  10387. format = me._processFormat(resultFormat);
  10388. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  10389. proxy: me.proxy,
  10390. withCredentials: me.withCredentials,
  10391. crossOrigin:me.crossOrigin,
  10392. headers: me.headers,
  10393. serverType: me.serverType,
  10394. eventListeners: {
  10395. scope: me,
  10396. processCompleted: callback,
  10397. processFailed: callback
  10398. },
  10399. format: format
  10400. });
  10401. buffersAnalystJobsService.getBuffersJobs();
  10402. }
  10403. /**
  10404. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJob
  10405. * @description 获取某一个缓冲区分析。
  10406. * @param {string} id - 空间分析的 id。
  10407. * @param {function} callback - 请求结果的回调函数。
  10408. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10409. */
  10410. getBuffersJob(id, callback, resultFormat) {
  10411. var me = this,
  10412. format = me._processFormat(resultFormat);
  10413. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  10414. proxy: me.proxy,
  10415. withCredentials: me.withCredentials,
  10416. crossOrigin:me.crossOrigin,
  10417. headers: me.headers,
  10418. serverType: me.serverType,
  10419. eventListeners: {
  10420. scope: me,
  10421. processCompleted: callback,
  10422. processFailed: callback
  10423. },
  10424. format: format
  10425. });
  10426. buffersAnalystJobsService.getBuffersJob(id);
  10427. }
  10428. /**
  10429. * @function SuperMap.REST.ProcessingService.prototype.addBuffersJob
  10430. * @description 新建一个缓冲区分析。
  10431. * @param {SuperMap.BuffersAnalystJobsParameter} params - 创建一个空间分析的请求参数。
  10432. * @param {function} callback - 请求结果的回调函数。
  10433. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10434. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10435. */
  10436. addBuffersJob(params, callback, seconds, resultFormat) {
  10437. var me = this,
  10438. format = me._processFormat(resultFormat);
  10439. var buffersAnalystJobsService = new BuffersAnalystJobsService_BuffersAnalystJobsService(me.url, {
  10440. proxy: me.proxy,
  10441. withCredentials: me.withCredentials,
  10442. crossOrigin:me.crossOrigin,
  10443. headers: me.headers,
  10444. serverType: me.serverType,
  10445. eventListeners: {
  10446. scope: me,
  10447. processCompleted: callback,
  10448. processFailed: callback,
  10449. processRunning: function (job) {
  10450. me.buffersJobs[job.id] = job.state;
  10451. }
  10452. },
  10453. format: format
  10454. });
  10455. buffersAnalystJobsService.addBuffersJob(params, seconds);
  10456. }
  10457. /**
  10458. * @function SuperMap.REST.ProcessingService.prototype.getBuffersJobState
  10459. * @description 获取缓冲区分析的状态。
  10460. * @param {string} id - 缓冲区分析的 id。
  10461. * @returns {Object} 缓冲区分析的状态。
  10462. */
  10463. getBuffersJobState(id) {
  10464. return this.buffersJobs[id];
  10465. }
  10466. /**
  10467. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJobs
  10468. * @description 获取拓扑检查分析的列表。
  10469. * @param {function} callback - 请求结果的回调函数。
  10470. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10471. */
  10472. getTopologyValidatorJobs(callback, resultFormat) {
  10473. var me = this,
  10474. format = me._processFormat(resultFormat);
  10475. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  10476. proxy: me.proxy,
  10477. withCredentials: me.withCredentials,
  10478. crossOrigin:me.crossOrigin,
  10479. headers: me.headers,
  10480. serverType: me.serverType,
  10481. eventListeners: {
  10482. scope: me,
  10483. processCompleted: callback,
  10484. processFailed: callback
  10485. },
  10486. format: format
  10487. });
  10488. topologyValidatorJobsService.getTopologyValidatorJobs();
  10489. }
  10490. /**
  10491. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJob
  10492. * @description 获取某一个拓扑检查分析。
  10493. * @param {string} id - 空间分析的 id。
  10494. * @param {function} callback - 请求结果的回调函数。
  10495. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10496. */
  10497. getTopologyValidatorJob(id, callback, resultFormat) {
  10498. var me = this,
  10499. format = me._processFormat(resultFormat);
  10500. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  10501. proxy: me.proxy,
  10502. withCredentials: me.withCredentials,
  10503. crossOrigin:me.crossOrigin,
  10504. headers: me.headers,
  10505. serverType: me.serverType,
  10506. eventListeners: {
  10507. scope: me,
  10508. processCompleted: callback,
  10509. processFailed: callback
  10510. },
  10511. format: format
  10512. });
  10513. topologyValidatorJobsService.getTopologyValidatorJob(id);
  10514. }
  10515. /**
  10516. * @function SuperMap.REST.ProcessingService.prototype.addTopologyValidatorJob
  10517. * @description 新建一个拓扑检查分析。
  10518. * @param {SuperMap.TopologyValidatorJobsParameter} params - 创建一个空间分析的请求参数。
  10519. * @param {function} callback - 请求结果的回调函数。
  10520. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10521. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10522. */
  10523. addTopologyValidatorJob(params, callback, seconds, resultFormat) {
  10524. var me = this,
  10525. format = me._processFormat(resultFormat);
  10526. var topologyValidatorJobsService = new TopologyValidatorJobsService_TopologyValidatorJobsService(me.url, {
  10527. proxy: me.proxy,
  10528. withCredentials: me.withCredentials,
  10529. crossOrigin:me.crossOrigin,
  10530. headers: me.headers,
  10531. serverType: me.serverType,
  10532. eventListeners: {
  10533. scope: me,
  10534. processCompleted: callback,
  10535. processFailed: callback,
  10536. processRunning: function (job) {
  10537. me.topologyValidatorJobs[job.id] = job.state;
  10538. }
  10539. },
  10540. format: format
  10541. });
  10542. topologyValidatorJobsService.addTopologyValidatorJob(params, seconds);
  10543. }
  10544. /**
  10545. * @function SuperMap.REST.ProcessingService.prototype.getTopologyValidatorJobState
  10546. * @description 获取拓扑检查分析的状态。
  10547. * @param {string} id - 拓扑检查分析的 id。
  10548. * @returns {Object} 拓扑检查分析的状态。
  10549. */
  10550. getTopologyValidatorJobState(id) {
  10551. return this.topologyValidatorJobs[id];
  10552. }
  10553. /**
  10554. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJobs
  10555. * @description 获取属性汇总分析的列表。
  10556. * @param {function} callback - 请求结果的回调函数。
  10557. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10558. */
  10559. getSummaryAttributesJobs(callback, resultFormat) {
  10560. var me = this,
  10561. format = me._processFormat(resultFormat);
  10562. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  10563. proxy: me.proxy,
  10564. withCredentials: me.withCredentials,
  10565. crossOrigin:me.crossOrigin,
  10566. headers: me.headers,
  10567. serverType: me.serverType,
  10568. eventListeners: {
  10569. scope: me,
  10570. processCompleted: callback,
  10571. processFailed: callback
  10572. },
  10573. format: format
  10574. });
  10575. summaryAttributesJobsService.getSummaryAttributesJobs();
  10576. }
  10577. /**
  10578. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJob
  10579. * @description 获取某一个属性汇总分析。
  10580. * @param {string} id - 空间分析的 id。
  10581. * @param {function} callback - 请求结果的回调函数。
  10582. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10583. */
  10584. getSummaryAttributesJob(id, callback, resultFormat) {
  10585. var me = this,
  10586. format = me._processFormat(resultFormat);
  10587. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  10588. proxy: me.proxy,
  10589. withCredentials: me.withCredentials,
  10590. crossOrigin:me.crossOrigin,
  10591. headers: me.headers,
  10592. serverType: me.serverType,
  10593. eventListeners: {
  10594. scope: me,
  10595. processCompleted: callback,
  10596. processFailed: callback
  10597. },
  10598. format: format
  10599. });
  10600. summaryAttributesJobsService.getSummaryAttributesJob(id);
  10601. }
  10602. /**
  10603. * @function SuperMap.REST.ProcessingService.prototype.addSummaryAttributesJob
  10604. * @description 新建一个属性汇总分析。
  10605. * @param {SuperMap.SummaryAttributesJobsParameter} params - 创建一个空间分析的请求参数。
  10606. * @param {function} callback - 请求结果的回调函数。
  10607. * @param {number} [seconds=1000] - 开始创建后,获取创建成功结果的时间间隔。
  10608. * @param {SuperMap.DataFormat} [resultFormat=SuperMap.DataFormat.GEOJSON] - 返回的结果类型。
  10609. */
  10610. addSummaryAttributesJob(params, callback, seconds, resultFormat) {
  10611. var me = this,
  10612. format = me._processFormat(resultFormat);
  10613. var summaryAttributesJobsService = new SummaryAttributesJobsService_SummaryAttributesJobsService(me.url, {
  10614. proxy: me.proxy,
  10615. withCredentials: me.withCredentials,
  10616. crossOrigin:me.crossOrigin,
  10617. headers: me.headers,
  10618. serverType: me.serverType,
  10619. eventListeners: {
  10620. scope: me,
  10621. processCompleted: callback,
  10622. processFailed: callback,
  10623. processRunning: function (job) {
  10624. me.summaryAttributesJobs[job.id] = job.state;
  10625. }
  10626. },
  10627. format: format
  10628. });
  10629. summaryAttributesJobsService.addSummaryAttributesJob(params, seconds);
  10630. }
  10631. /**
  10632. * @function SuperMap.REST.ProcessingService.prototype.getSummaryAttributesJobState
  10633. * @description 获取属性汇总分析的状态。
  10634. * @param {string} id - 属性汇总分析的 id。
  10635. * @returns {Object} 属性汇总分析的状态。
  10636. */
  10637. getSummaryAttributesJobState(id) {
  10638. return this.summaryAttributesJobs[id];
  10639. }
  10640. _processFormat(resultFormat) {
  10641. return (resultFormat) ? resultFormat : DataFormat.GEOJSON;
  10642. }
  10643. _processParams(params) {
  10644. if (!params) {
  10645. return {};
  10646. }
  10647. if (params.geometryQuery) {
  10648. params.geometryQuery = this._convertPatams(params.geometryQuery);
  10649. }
  10650. if (params.geometryClip) {
  10651. params.geometryClip = this._convertPatams(params.geometryClip);
  10652. }
  10653. return params;
  10654. }
  10655. _convertPatams(points) {
  10656. var geometryParam = {};
  10657. if (points.length < 1) {
  10658. geometryParam = "";
  10659. } else {
  10660. var results = [];
  10661. for (var i = 0; i < points.length; i++) {
  10662. var point = {};
  10663. point.x = points[i].x;
  10664. point.y = points[i].y;
  10665. results.push(point);
  10666. }
  10667. geometryParam.type = "REGION";
  10668. geometryParam.points = results;
  10669. }
  10670. return geometryParam;
  10671. }
  10672. }
  10673. SuperMap_SuperMap.REST.ProcessingService = ProcessingService_ProcessingService;
  10674. // CONCATENATED MODULE: ./src/classic/services/index.js
  10675. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  10676. * This program are made available under the terms of the Apache License, Version 2.0
  10677. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10678. // CONCATENATED MODULE: ./src/classic/index.js
  10679. /* Copyright© 2000 - 2020 SuperMap Software Co.Ltd. All rights reserved.
  10680. * This program are made available under the terms of the Apache License, Version 2.0
  10681. * which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
  10682. /***/ })
  10683. /******/ ]);